Mercurial > mm7
comparison UiGame.cpp @ 1038:39f42990698f
Cleanings
author | Nomad |
---|---|
date | Thu, 23 May 2013 03:29:29 +0200 |
parents | 3a5c8df8381d |
children | e23a79658fc5 |
comparison
equal
deleted
inserted
replaced
1035:306ec23b37df | 1038:39f42990698f |
---|---|
66 | 66 |
67 int uTextureID_GameUI_CharSelectionFrame; // 50C98C | 67 int uTextureID_GameUI_CharSelectionFrame; // 50C98C |
68 | 68 |
69 | 69 |
70 | 70 |
71 | |
72 | |
73 //----- (00421D00) -------------------------------------------------------- | |
74 void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) | |
75 { | |
76 //unsigned int v1; // esi@1 | |
77 //int v2; // eax@2 | |
78 //Player *v3; // ecx@2 | |
79 //Player *v4; // ecx@5 | |
80 unsigned int v5; // [sp-4h] [bp-10h]@21 | |
81 | |
82 //v1 = uPlayerID; | |
83 auto player = &pParty->pPlayers[uPlayerID - 1]; | |
84 if (pParty->pPickedItem.uItemID) | |
85 { | |
86 //v3 = player; | |
87 if (auto slot = player->AddItem(-1, pParty->pPickedItem.uItemID)) | |
88 { | |
89 memcpy(&player->pInventoryItems[slot-1], &pParty->pPickedItem, 0x24u); | |
90 viewparams->bRedrawGameUI = true; | |
91 pMouse->RemoveHoldingItem(); | |
92 return; | |
93 } | |
94 | |
95 if (!player->CanAct()) | |
96 { | |
97 player = pPlayers[uActiveCharacter]; | |
98 } | |
99 if(player->CanAct() || !pPlayers[uActiveCharacter]->CanAct()) | |
100 player->PlaySound(SPEECH_NoRoom, 0); | |
101 } | |
102 | |
103 //LABEL_9: | |
104 if (pCurrentScreen == SCREEN_GAME) | |
105 { | |
106 viewparams->bRedrawGameUI = true; | |
107 if ( uActiveCharacter != uPlayerID ) | |
108 //goto LABEL_27; | |
109 { | |
110 if ( pPlayers[uPlayerID]->uTimeToRecovery ) | |
111 return; | |
112 | |
113 uActiveCharacter = uPlayerID; | |
114 return; | |
115 } | |
116 v5 = 7; | |
117 //LABEL_22: | |
118 pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5); | |
119 return; | |
120 } | |
121 if ( pCurrentScreen == SCREEN_SPELL_BOOK ) | |
122 return; | |
123 if ( pCurrentScreen == SCREEN_CHEST ) | |
124 { | |
125 //LABEL_23: | |
126 viewparams->bRedrawGameUI = true; | |
127 if ( uActiveCharacter == uPlayerID ) | |
128 { | |
129 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
130 pCurrentScreen = SCREEN_CHEST_INVENTORY; | |
131 //goto LABEL_28; | |
132 uActiveCharacter = uPlayerID; | |
133 return; | |
134 } | |
135 //LABEL_27: | |
136 if ( pPlayers[uPlayerID]->uTimeToRecovery ) | |
137 return; | |
138 //goto LABEL_28; | |
139 uActiveCharacter = uPlayerID; | |
140 return; | |
141 } | |
142 if ( pCurrentScreen != SCREEN_HOUSE ) | |
143 { | |
144 if ( pCurrentScreen == SCREEN_E ) | |
145 { | |
146 //LABEL_28: | |
147 uActiveCharacter = uPlayerID; | |
148 return; | |
149 } | |
150 if ( pCurrentScreen != SCREEN_CHEST_INVENTORY ) | |
151 { | |
152 viewparams->bRedrawGameUI = true; | |
153 uActiveCharacter = uPlayerID; | |
154 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 ) | |
155 FillAwardsData(); | |
156 return; | |
157 } | |
158 //goto LABEL_23; | |
159 viewparams->bRedrawGameUI = true; | |
160 if ( uActiveCharacter == uPlayerID ) | |
161 { | |
162 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
163 pCurrentScreen = SCREEN_CHEST_INVENTORY; | |
164 //goto LABEL_28; | |
165 uActiveCharacter = uPlayerID; | |
166 return; | |
167 } | |
168 //LABEL_27: | |
169 if ( pPlayers[uPlayerID]->uTimeToRecovery ) | |
170 return; | |
171 //goto LABEL_28; | |
172 uActiveCharacter = uPlayerID; | |
173 return; | |
174 } | |
175 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
176 return; | |
177 viewparams->bRedrawGameUI = true; | |
178 if ( uActiveCharacter != uPlayerID ) | |
179 //goto LABEL_28; | |
180 uActiveCharacter = uPlayerID; | |
181 return; | |
182 if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6) | |
183 { | |
184 __debugbreak(); // fix indexing | |
185 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
186 v5 = 14; | |
187 //goto LABEL_22; | |
188 pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5); | |
189 return; | |
190 } | |
191 } | |
192 // 4E28F8: using guessed type int pCurrentScreen; | |
193 // F8B19C: using guessed type int dword_F8B19C; | |
194 | |
195 //----- (00416B01) -------------------------------------------------------- | |
196 void GameUI_DrawNPCPopup(void *_this)//PopupWindowForBenefitAndJoinText | |
197 { | |
198 int v1; // edi@2 | |
199 int v2; // ecx@2 | |
200 NPCData *v3; // eax@2 | |
201 NPCData *v4; // esi@7 | |
202 NPCData *v5; // eax@16 | |
203 NPCData *v6; // esi@16 | |
204 const CHAR *v7; // eax@18 | |
205 unsigned int v8; // eax@25 | |
206 unsigned int v9; // eax@25 | |
207 const char *v10; // ST14_4@26 | |
208 char *v11; // esi@26 | |
209 const char *v12; // ST18_4@27 | |
210 unsigned __int16 v13; // ax@28 | |
211 char *v14; // eax@28 | |
212 GUIWindow a1; // [sp+Ch] [bp-60h]@23 | |
213 int a2; // [sp+60h] [bp-Ch]@16 | |
214 void *v17; // [sp+64h] [bp-8h]@1 | |
215 LPCSTR lpsz; // [sp+68h] [bp-4h]@6 | |
216 | |
217 v17 = _this; | |
218 if ( bNoNPCHiring != 1 ) | |
219 { | |
220 v1 = 0; | |
221 v2 = 0; | |
222 v3 = pParty->pHirelings; | |
223 /*do | |
224 { | |
225 if ( v3->pName ) | |
226 pTmpBuf[v1++] = v2; | |
227 ++v3; | |
228 ++v2; | |
229 } | |
230 while ( (signed int)v3 < (signed int)&pParty->pPickedItem );*/ | |
231 for (int i = 0; i < 2; ++i) | |
232 { | |
233 if (pParty->pHirelings[i].pName) | |
234 pTmpBuf[v1++] = i; | |
235 } | |
236 lpsz = 0; | |
237 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
238 { | |
239 /*v4 = pNPCStats->pNewNPCData; | |
240 do | |
241 { | |
242 if ( v4->uFlags & 0x80 | |
243 && (!pParty->pHirelings[0].pName || strcmp(v4->pName, pParty->pHirelings[0].pName)) | |
244 && (!pParty->pHirelings[1].pName || strcmp(v4->pName, pParty->pHirelings[1].pName)) ) | |
245 pTmpBuf[v1++] = (char)lpsz + 2; | |
246 ++lpsz; | |
247 ++v4; | |
248 } | |
249 while ( (signed int)lpsz < (signed int)pNPCStats->uNumNewNPCs );*/ | |
250 for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
251 { | |
252 if (pNPCStats->pNewNPCData[i].Hired()) | |
253 { | |
254 if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName)) | |
255 { | |
256 if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName)) | |
257 pTmpBuf[v1++] = i + 2; | |
258 } | |
259 } | |
260 } | |
261 } | |
262 if ( (signed int)((char *)v17 + (unsigned __int8)pParty->field_709) < v1 ) | |
263 { | |
264 sDialogue_SpeakingActorNPC_ID = -1 - (unsigned __int8)pParty->field_709 - (int)v17; | |
265 v5 = GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&a2); | |
266 v6 = v5; | |
267 if ( v5 ) | |
268 { | |
269 if ( a2 == 57 ) | |
270 v7 = pNPCTopics[512].pText; // Baby dragon | |
271 else | |
272 v7 = (const CHAR *)pNPCStats->pProfessions[v5->uProfession].pBenefits; | |
273 lpsz = v7; | |
274 if ( !v7 ) | |
275 { | |
276 lpsz = (LPCSTR)pNPCStats->pProfessions[v5->uProfession].pJoinText; | |
277 if ( !lpsz ) | |
278 lpsz = ""; | |
279 } | |
280 a1.Hint = 0; | |
281 a1.uFrameX = 38; | |
282 a1.uFrameY = 60; | |
283 a1.uFrameWidth = 276; | |
284 a1.uFrameZ = 313; | |
285 a1.uFrameHeight = pFontArrus->CalcTextHeight(lpsz, &a1, 0, 0) | |
286 + 2 * LOBYTE(pFontArrus->uFontHeight) | |
287 + 24; | |
288 if ( (signed int)a1.uFrameHeight < 130 ) | |
289 a1.uFrameHeight = 130; | |
290 a1.uFrameWidth = 400; | |
291 a1.uFrameZ = a1.uFrameX + 399; | |
292 a1.DrawMessageBox(0); | |
293 sprintfex(pTmpBuf2, "NPC%03d", v6->uPortraitID); | |
294 v8 = pIcons_LOD->LoadTexture(pTmpBuf2, TEXTURE_16BIT_PALETTE); | |
295 pRenderer->DrawTextureIndexed( | |
296 a1.uFrameX + 22, | |
297 a1.uFrameY + 36, | |
298 (Texture *)(v8 != -1 ? &pIcons_LOD->pTextures[v8] : 0)); | |
299 v9 = v6->uProfession; | |
300 if ( v9 ) | |
301 { | |
302 v10 = v6->pName; | |
303 v11 = pTmpBuf; | |
304 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v10, aNPCProfessionNames[v9]); | |
305 } | |
306 else | |
307 { | |
308 v12 = v6->pName; | |
309 v11 = pTmpBuf; | |
310 strcpy(pTmpBuf, v12); | |
311 } | |
312 v13 = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
313 a1.DrawTitleText(pFontArrus, 0, 0xCu, v13, v11, 3u); | |
314 a1.uFrameWidth -= 24; | |
315 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
316 v14 = BuilDialogueString((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0); | |
317 a1.DrawText(pFontArrus, 100, 36, 0, v14, 0, 0, 0); | |
318 } | |
319 } | |
320 } | |
321 } | |
71 | 322 |
72 | 323 |
73 | 324 |
74 //----- (00445D4A) -------------------------------------------------------- | 325 //----- (00445D4A) -------------------------------------------------------- |
75 void GameUI_InitializeDialogue(Actor *actor, int bPlayerSaysHello) | 326 void GameUI_InitializeDialogue(Actor *actor, int bPlayerSaysHello) |
557 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v1); | 808 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v1); |
558 pRenderer->DrawTextureIndexed(8, 347 - v1, pTexture_591428); | 809 pRenderer->DrawTextureIndexed(8, 347 - v1, pTexture_591428); |
559 v2 = FitTextInAWindow(byte_5B0938, pFont, &v5, 0xCu, 0); | 810 v2 = FitTextInAWindow(byte_5B0938, pFont, &v5, 0xCu, 0); |
560 pGUIWindow2->DrawText(pFont, 12, 354 - v1, 0, v2, 0, 0, 0); | 811 pGUIWindow2->DrawText(pFont, 12, 354 - v1, 0, v2, 0, 0, 0); |
561 pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); | 812 pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); |
562 if ( pGUIWindow2->field_40 != 1 ) | 813 if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS) |
563 { | 814 { |
564 if ( pGUIWindow2->field_40 == 2 ) | 815 if ( pGUIWindow2->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) |
565 { | 816 { |
566 pGUIWindow2->field_40 = 0; | 817 pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
567 strcpy(GameUI_Footer_TimedString, (const char *)pKeyActionMap->pPressedKeysBuffer); | 818 strcpy(GameUI_Footer_TimedString, (const char *)pKeyActionMap->pPressedKeysBuffer); |
568 LABEL_16: | 819 LABEL_16: |
569 sub_4452BB(); | 820 sub_4452BB(); |
570 return; | 821 return; |
571 } | 822 } |
572 if ( pGUIWindow2->field_40 != 3 ) | 823 if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED) |
573 return; | 824 return; |
574 pGUIWindow2->field_40 = 0; | 825 pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
575 LABEL_15: | 826 LABEL_15: |
576 memset(GameUI_Footer_TimedString, 0, 0xC8u); | 827 memset(GameUI_Footer_TimedString, 0, 0xC8u); |
577 goto LABEL_16; | 828 goto LABEL_16; |
578 } | 829 } |
579 if ( pGUIWindow2->ptr_1C == (void *)26 ) | 830 if ( pGUIWindow2->ptr_1C == (void *)26 ) |
584 pGUIWindow2->DrawFlashingInputCursor(v3 + 13, 357, pFontLucida); | 835 pGUIWindow2->DrawFlashingInputCursor(v3 + 13, 357, pFontLucida); |
585 return; | 836 return; |
586 } | 837 } |
587 if ( pKeyActionMap->pPressedKeysBuffer[0] ) | 838 if ( pKeyActionMap->pPressedKeysBuffer[0] ) |
588 { | 839 { |
589 pKeyActionMap->_459ED1(0); | 840 pKeyActionMap->SetWindowInputStatus(0); |
590 goto LABEL_15; | 841 goto LABEL_15; |
591 } | 842 } |
592 } | 843 } |
593 | 844 |
594 | 845 |