comparison mm7_3.cpp @ 268:0b58962bf229

done with DrawDialogUI
author Nomad
date Mon, 18 Feb 2013 11:29:55 +0200
parents ac44e716d051
children 0ea5fbd16edb 640a176c030f
comparison
equal deleted inserted replaced
267:ac44e716d051 268:0b58962bf229
15013 pEventTimer->Resume(); 15013 pEventTimer->Resume();
15014 } 15014 }
15015 15015
15016 15016
15017 //----- (00445308) -------------------------------------------------------- 15017 //----- (00445308) --------------------------------------------------------
15018 const char *__fastcall sub_445308(int a1) 15018 const char *GetProfessionActionText(int a1)
15019 { 15019 {
15020 if ( a1 == 10 15020 if ( a1 == 10
15021 || a1 == 11 15021 || a1 == 11
15022 || a1 == 12 15022 || a1 == 12
15023 || a1 == 33 15023 || a1 == 33
15026 || a1 == 40 15026 || a1 == 40
15027 || a1 == 41 15027 || a1 == 41
15028 || a1 == 42 15028 || a1 == 42
15029 || a1 == 43 15029 || a1 == 43
15030 || a1 == 52 ) 15030 || a1 == 52 )
15031 return (const char *)*(&pNPCStats->field_13A60 + 5 * a1); 15031 return pNPCStats->pProfessions[a1 - 1].pActionText;
15032 else 15032 else
15033 return pNPCTopics[407].pTopic; 15033 return pNPCTopics[407].pTopic;
15034 } 15034 }
15035 15035
15036 //----- (00445350) -------------------------------------------------------- 15036 //----- (00445350) --------------------------------------------------------
15049 char *v10; // eax@29 15049 char *v10; // eax@29
15050 //int v11; // eax@30 15050 //int v11; // eax@30
15051 int v12; // esi@39 15051 int v12; // esi@39
15052 char *v13; // eax@41 15052 char *v13; // eax@41
15053 GUIButton *v14; // eax@43 15053 GUIButton *v14; // eax@43
15054 GUIButton *v15; // edi@43 15054 //GUIButton *v15; // edi@43
15055 signed int v16; // eax@44 15055 signed int v16; // eax@44
15056 unsigned int v23; // eax@53 15056 //unsigned int v23; // eax@53
15057 const char *v24; // eax@59 15057 //const char *v24; // eax@59
15058 unsigned __int16 v30; // cx@83 15058 //unsigned __int16 v30; // cx@83
15059 int v31; // ecx@86 15059 int v31; // ecx@86
15060 int v32; // ebx@93 15060 int v32; // ebx@93
15061 unsigned int v33; // eax@93 15061 unsigned int v33; // eax@93
15062 GUIWindow *v34; // ecx@93 15062 GUIWindow *v34; // ecx@93
15063 int v35; // esi@93 15063 int v35; // esi@93
15077 int v49; // [sp+Ch] [bp-108h]@39 15077 int v49; // [sp+Ch] [bp-108h]@39
15078 int v50; // [sp+14h] [bp-100h]@39 15078 int v50; // [sp+14h] [bp-100h]@39
15079 GUIWindow v51; // [sp+58h] [bp-BCh]@2 15079 GUIWindow v51; // [sp+58h] [bp-BCh]@2
15080 GUIWindow v52; // [sp+ACh] [bp-68h]@42 15080 GUIWindow v52; // [sp+ACh] [bp-68h]@42
15081 char *Str; // [sp+100h] [bp-14h]@104 15081 char *Str; // [sp+100h] [bp-14h]@104
15082 int v54; // [sp+104h] [bp-10h]@2 15082 //int v54; // [sp+104h] [bp-10h]@2
15083 unsigned __int16 *v55; // [sp+108h] [bp-Ch]@82 15083 //unsigned __int16 *v55; // [sp+108h] [bp-Ch]@82
15084 GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39 15084 GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39
15085 char *pInString=NULL; // [sp+110h] [bp-4h]@32 15085 char *pInString=NULL; // [sp+110h] [bp-4h]@32
15086 15086
15087 if ( !pDialogueWindow ) 15087 if ( !pDialogueWindow )
15088 return; 15088 return;
15089 memcpy(&v51, pDialogueWindow, sizeof(v51)); 15089 memcpy(&v51, pDialogueWindow, sizeof(v51));
15090 pNPC = GetNPCData(uDialogue_SpeakingActorNPC_ID); 15090 pNPC = GetNPCData(uDialogue_SpeakingActorNPC_ID);
15091 v1 = sub_445C8B(uDialogue_SpeakingActorNPC_ID); 15091 v1 = sub_445C8B(uDialogue_SpeakingActorNPC_ID);
15092 v51.uFrameWidth -= 10; 15092 v51.uFrameWidth -= 10;
15093 v51.uFrameZ -= 10; 15093 v51.uFrameZ -= 10;
15094 v54 = v1; 15094 //v54 = v1;
15095 GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 15095 GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
15096 GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); 15096 GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
15097 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); 15097 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u);
15098 pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background); 15098 pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background);
15099 pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_507B04 != -1 ? &pIcons_LOD->pTextures[uTextureID_507B04] : 0)); 15099 pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_507B04 != -1 ? &pIcons_LOD->pTextures[uTextureID_507B04] : 0));
15152 default: 15152 default:
15153 if (uDialogueType > DIALOGUE_18 && uDialogueType < DIALOGUE_23 && !byte_5B0938[0]) 15153 if (uDialogueType > DIALOGUE_18 && uDialogueType < DIALOGUE_23 && !byte_5B0938[0])
15154 { 15154 {
15155 pInString = (char *)ptr_F8B1E8; 15155 pInString = (char *)ptr_F8B1E8;
15156 } 15156 }
15157 else if (v54 == 1) 15157 else if (v1 == 1)
15158 { 15158 {
15159 if (pNPC->greet) 15159 if (pNPC->greet)
15160 { 15160 {
15161 if ((pNPC->uFlags & 3) == 2) 15161 if ((pNPC->uFlags & 3) == 2)
15162 pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting2; 15162 pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting2;
15163 else 15163 else
15164 pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting1; 15164 pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting1;
15165 } 15165 }
15166 } 15166 }
15167 else if (v54 == 2) 15167 else if (v1 == 2)
15168 { 15168 {
15169 auto prof = pNPCStats->pProfessions + pNPC->uProfession - 1; 15169 auto prof = pNPCStats->pProfessions + pNPC->uProfession - 1;
15170 15170
15171 if (pNPC->Hired()) 15171 if (pNPC->Hired())
15172 pInString = BuilDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); 15172 pInString = BuilDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0);
15197 15197
15198 memcpy(&v52, pDialogueWindow, sizeof(v52)); 15198 memcpy(&v52, pDialogueWindow, sizeof(v52));
15199 v52.uFrameX = 483; 15199 v52.uFrameX = 483;
15200 v52.uFrameWidth = 148; 15200 v52.uFrameWidth = 148;
15201 v52.uFrameZ = 334; 15201 v52.uFrameZ = 334;
15202 for ( pOutString = (GUIFont *)v52.pStartingPosActiveItem; 15202 for (int i = v52.pStartingPosActiveItem;
15203 (signed int)pOutString < v52.pStartingPosActiveItem + v52.pNumPresenceButton; 15203 i < v52.pStartingPosActiveItem + v52.pNumPresenceButton; ++i)
15204 pOutString = (GUIFont *)((char *)pOutString + 1) ) 15204 {
15205 { 15205 v14 = v52.GetControl(i);
15206 v14 = v52.GetControl((unsigned int)pOutString); 15206 //v15 = v14;
15207 v15 = v14;
15208 if ( !v14 ) 15207 if ( !v14 )
15209 break; 15208 break;
15210 v16 = v14->uControlParam; 15209 v16 = v14->uControlParam;
15211 15210
15212 if ( v16 > 88 ) 15211 if ( v16 > 88 )
15213 { 15212 v14->pButtonName[0] = 0;
15214 v24 = ""; 15213 else if (v16 == 88)
15215 } 15214 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[581]); // Lord
15216 else if ( v16 == 88 ) 15215 else if (v16 == 87)
15217 v24 = pGlobalTXT_LocalizationStrings[581]; // Lord 15216 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[580]); // Knight
15218 else if ( v16 == 87 ) 15217 else if (v16 == 86)
15219 v24 = pGlobalTXT_LocalizationStrings[580]; // Knight 15218 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[579]); // Squire
15220 else if ( v16 == 86 ) 15219 else if (v16 == 85)
15221 v24 = pGlobalTXT_LocalizationStrings[579]; // Squire 15220 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[578]); // Page
15222 else if ( v16 == 85 ) 15221 else if (v16 == 77)
15223 v24 = pGlobalTXT_LocalizationStrings[578]; // Page 15222 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[407]); // Details
15224 else if ( v16 == 77 ) 15223 else if (v16 == 76)
15225 v24 = pGlobalTXT_LocalizationStrings[407]; // Details 15224 {
15226 else if ( v16 == 76 ) 15225 if (pNPC->Hired())
15227 { 15226 sprintf(v14->pButtonName, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s
15228 if (pNPC->Hired()) 15227 else
15229 { 15228 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[406]); // Hire
15230 sprintf(pTmpBuf, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s 15229 }
15231 v24 = pTmpBuf; 15230 else if (v16 == 24)
15232 } 15231 {
15233 else 15232 __debugbreak(); // learn conditions of this event
15234 v24 = pGlobalTXT_LocalizationStrings[406]; // Hire 15233 auto topic = pNPCTopics[pNPC->evtf - 1].pTopic;//(&dword_721660)[8 * v23];
15235 } 15234 if (!topic)
15236 else if ( v16 == 24 ) 15235 {
15237 { 15236 v14->pButtonName[0] = 0;
15238 v23 = pNPC->evtf; 15237 v14->uControlParam = 0;
15239 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; 15238 }
15240 if ( !v24 ) 15239 else
15241 { 15240 strcpy(v14->pButtonName, topic);
15242 v24 = ""; 15241 }
15243 v15->uControlParam = 0; 15242 else if (v16 == 9)
15244 } 15243 strcpy(v14->pButtonName, GetProfessionActionText(pNPC->uProfession));
15245 } 15244 else if (v16 == 19)
15246 else if ( v16 == 9 )
15247 v24 = (const char *)sub_445308(pNPC->uProfession);
15248 else if ( v16 == 19 )
15249 { 15245 {
15250 v23 = pNPC->bDrawSomeAnim; 15246 __debugbreak(); // learn conditions of this event
15251 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; 15247 auto topic = pNPCTopics[pNPC->bDrawSomeAnim - 1].pTopic;//(&dword_721660)[8 * v23];
15252 if ( !v24 ) 15248 if (!topic)
15253 { 15249 {
15254 v24 = ""; 15250 v14->pButtonName[0] = 0;
15255 v15->uControlParam = 0; 15251 v14->uControlParam = 0;
15256 } 15252 }
15253 else strcpy(v14->pButtonName, topic);
15257 } 15254 }
15258 else if ( v16 == 20 ) 15255 else if (v16 == 20)
15259 { 15256 {
15260 v23 = pNPC->_anim_current_time; 15257 __debugbreak(); // learn conditions of this event
15261 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; 15258 auto topic = pNPCTopics[pNPC->_anim_current_time - 1].pTopic;//(&dword_721660)[8 * v23];
15262 if ( !v24 ) 15259 if (!topic)
15263 { 15260 {
15264 v24 = ""; 15261 v14->pButtonName[0] = 0;
15265 v15->uControlParam = 0; 15262 v14->uControlParam = 0;
15266 } 15263 }
15264 else strcpy(v14->pButtonName, topic);
15267 } 15265 }
15268 else if ( v16 == 21 ) 15266 else if (v16 == 21)
15269 { 15267 {
15270 v23 = pNPC->_anim_end_time; 15268 __debugbreak(); // learn conditions of this event
15271 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; 15269 auto topic = pNPCTopics[pNPC->_anim_end_time - 1].pTopic;//(&dword_721660)[8 * v23];
15272 if ( !v24 ) 15270 if (!topic)
15273 { 15271 {
15274 v24 = ""; 15272 v14->pButtonName[0] = 0;
15275 v15->uControlParam = 0; 15273 v14->uControlParam = 0;
15276 } 15274 }
15275 else strcpy(v14->pButtonName, topic);
15277 } 15276 }
15278 else if ( v16 == 22 ) 15277 else if (v16 == 22)
15279 { 15278 {
15280 v23 = pNPC->evtd; 15279 __debugbreak(); // learn conditions of this event
15281 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; 15280 auto topic = pNPCTopics[pNPC->evtd - 1].pTopic;//(&dword_721660)[8 * v23];
15282 if ( !v24 ) 15281 if (!topic)
15283 { 15282 {
15284 v24 = ""; 15283 v14->pButtonName[0] = 0;
15285 v15->uControlParam = 0; 15284 v14->uControlParam = 0;
15286 } 15285 }
15286 else strcpy(v14->pButtonName, topic);
15287 } 15287 }
15288 else if ( v16 == 23 ) 15288 else if (v16 == 23)
15289 { 15289 {
15290 v23 = pNPC->evte; 15290 __debugbreak(); // learn conditions of this event
15291 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; 15291 auto topic = pNPCTopics[pNPC->evte - 1].pTopic;//(&dword_721660)[8 * v23];
15292 if ( !v24 ) 15292 if (!topic)
15293 { 15293 {
15294 v24 = ""; 15294 v14->pButtonName[0] = 0;
15295 v15->uControlParam = 0; 15295 v14->uControlParam = 0;
15296 } 15296 }
15297 else strcpy(v14->pButtonName, topic);
15297 } 15298 }
15298 else if ( v16 == 13 ) 15299 else if (v16 == 13)
15299 { 15300 {
15300 if (pNPC->Hired()) 15301 if (pNPC->Hired())
15301 { 15302 sprintf(v14->pButtonName, pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s
15302 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s 15303 else
15303 v24 = pTmpBuf; 15304 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[122]); // Join
15304 }
15305 else
15306 v24 = pGlobalTXT_LocalizationStrings[122]; // Join
15307 } 15305 }
15308 else 15306 else
15309 v24 = ""; 15307 v14->pButtonName[0] = 0;
15310 15308
15311 15309
15312 if ( pParty->field_7B5_in_arena_quest && pParty->field_7B5_in_arena_quest != -1 ) 15310 if (pParty->field_7B5_in_arena_quest && pParty->field_7B5_in_arena_quest != -1)
15313 { 15311 {
15312 int num_dead_actors = 0;
15314 pInString = 0; 15313 pInString = 0;
15315 if ( (signed int)uNumActors > 0 ) 15314 for (uint i = 0; i < uNumActors; ++i)
15316 { 15315 {
15317 v55 = (unsigned short *)&pActors[0].uAIState; 15316 if (pActors[i].uAIState == Dead || pActors[i].uAIState == Removed ||
15318 v54 = uNumActors; 15317 pActors[i].uAIState == Disabled)
15319 do 15318 ++num_dead_actors;
15319 else
15320 { 15320 {
15321 v30 = *v55; 15321 int sumonner_type = pActors[i].uSummonerID & 7;;
15322 if ( *v55 == Dead || v30 == Removed || v30 == Disabled || (v31 = *((int *)v55 + 159)) != 0 && (v31 & 7) == OBJECT_Player) 15322 if (sumonner_type == OBJECT_Player)
15323 ++pInString; 15323 ++num_dead_actors;
15324 v55 += 418;
15325 --v54;
15326 } 15324 }
15327 while ( v54 ); 15325 }
15328 } 15326 if (num_dead_actors == uNumActors)
15329 if ( pInString == (char *)uNumActors ) 15327 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[658]); // Collect Prize
15330 v24 = pGlobalTXT_LocalizationStrings[658]; 15328 }
15331 } 15329 }
15332 strcpy(v15->pButtonName, v24); 15330
15333 } 15331
15334 v32 = 0; 15332 v32 = 0;
15335 pInString = (char *)GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 15333 //pInString = (char *)GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
15336 v33 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); 15334 v33 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
15337 v34 = pDialogueWindow; 15335 v34 = pDialogueWindow;
15338 v54 = v33; 15336 //v54 = v33;
15339 v35 = pDialogueWindow->pStartingPosActiveItem; 15337 v35 = pDialogueWindow->pStartingPosActiveItem;
15340 for ( i = v35 + pDialogueWindow->pNumPresenceButton; v35 < i; i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ) 15338 for ( i = v35 + pDialogueWindow->pNumPresenceButton; v35 < i; i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
15341 { 15339 {
15342 v37 = v34->GetControl(v35); 15340 v37 = v34->GetControl(v35);
15343 if ( !v37 ) 15341 if ( !v37 )
15354 if ( v39 ) 15352 if ( v39 )
15355 { 15353 {
15356 pOutString = (GUIFont *)((174 - v32) / v39); 15354 pOutString = (GUIFont *)((174 - v32) / v39);
15357 if ( (174 - v32) / v39 > 32 ) 15355 if ( (174 - v32) / v39 > 32 )
15358 pOutString = (GUIFont *)32; 15356 pOutString = (GUIFont *)32;
15359 v55 = (unsigned __int16 *)1; 15357 int v55 = 1;
15360 v40 = 174 - (int)pOutString * v39 - v32; 15358 v40 = 174 - (int)pOutString * v39 - v32;
15361 v41 = v34->pStartingPosActiveItem; 15359 v41 = v34->pStartingPosActiveItem;
15362 v42 = v40 / 2 - (signed int)pOutString / 2 + 138; 15360 v42 = v40 / 2 - (signed int)pOutString / 2 + 138;
15363 if ( (signed int)v41 < (signed int)(v41 + v39) ) 15361 if ( (signed int)v41 < (signed int)(v41 + v39) )
15364 { 15362 {
15369 break; 15367 break;
15370 v43->uY = (unsigned int)((char *)pOutString + v42); 15368 v43->uY = (unsigned int)((char *)pOutString + v42);
15371 Str = v43->pButtonName; 15369 Str = v43->pButtonName;
15372 v44 = pFontArrus->CalcTextHeight(v43->pButtonName, &v52, 0, 0); 15370 v44 = pFontArrus->CalcTextHeight(v43->pButtonName, &v52, 0, 0);
15373 v45 = v43->uY; 15371 v45 = v43->uY;
15374 v46 = v55; 15372 v46 = (unsigned short *)v55;
15375 v43->uHeight = v44; 15373 v43->uHeight = v44;
15376 v42 = v45 + v44 - 1; 15374 v42 = v45 + v44 - 1;
15377 v43->uW = v42; 15375 v43->uW = v42;
15378 v47 = (short)v54; 15376 v47 = v33;
15379 if ( (unsigned __int16 *)pDialogueWindow->pCurrentPosActiveItem != v46 ) 15377 if ( (unsigned __int16 *)pDialogueWindow->pCurrentPosActiveItem != v46 )
15380 v47 = (unsigned __int16)pInString; 15378 v47 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
15381 v52.DrawTitleText(pFontArrus, 0, v45, v47, Str, 3u); 15379 v52.DrawTitleText(pFontArrus, 0, v45, v47, Str, 3u);
15382 v34 = pDialogueWindow; 15380 v34 = pDialogueWindow;
15383 v55 = (unsigned __int16 *)((char *)v55 + 1); 15381 ++v55;
15384 ++v41; 15382 ++v41;
15385 } 15383 }
15386 while ( (signed int)v41 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); 15384 while ( (signed int)v41 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
15387 } 15385 }
15388 } 15386 }
15389 pRenderer->DrawTextureIndexed(471, 445, (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0)); 15387 pRenderer->DrawTextureIndexed(471, 445, (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0));
15390 } 15388 }
15391 15389
15392 //----- (004459F9) -------------------------------------------------------- 15390 //----- (004459F9) --------------------------------------------------------
15393 NPCData *__fastcall GetNPCData(unsigned int npcid) 15391 NPCData *__fastcall GetNPCData(unsigned int npcid)
15394 { 15392 {