comparison Actor.cpp @ 959:f8dd764fb7d7

ExitCharacterWindow and other
author Ritor1
date Fri, 03 May 2013 17:38:30 +0600
parents 5a2dbb00c399
children c8a0f6d89c70
comparison
equal deleted inserted replaced
958:9c2d08e42ed3 959:f8dd764fb7d7
165 } 165 }
166 166
167 //----- (00445D4A) -------------------------------------------------------- 167 //----- (00445D4A) --------------------------------------------------------
168 void Actor::InitializeDialogue(int bPlayerSaysHello) 168 void Actor::InitializeDialogue(int bPlayerSaysHello)
169 { 169 {
170 Actor *v2; // esi@1 170 NPCData *pNPCInfo; // ebp@1
171 signed int v3; // ecx@1
172 NPCData *v4; // eax@1
173 NPCData *v5; // ebp@1
174 unsigned int v6; // eax@1
175 //signed int v7; // eax@3
176 //unsigned int v8; // eax@8
177 int v9; // esi@8 171 int v9; // esi@8
178 int v10; // eax@11 172 int pNumberContacts; // eax@11
179 GUIWindow *v11; // ecx@19
180 signed int v12; // eax@21
181 //int v13; // [sp-8h] [bp-44h]@34
182 //const char *v14; // [sp-4h] [bp-40h]@4
183 //int v15; // [sp-4h] [bp-40h]@34
184 signed int v16; // [sp-4h] [bp-40h]@35
185 int v17; // [sp+10h] [bp-2Ch]@1
186 char pContainer[32]; // [sp+14h] [bp-28h]@3 173 char pContainer[32]; // [sp+14h] [bp-28h]@3
187 174
188 auto a1 = this;
189 v2 = a1;
190 v17 = bPlayerSaysHello;
191 dword_A74CDC = -1; 175 dword_A74CDC = -1;
192 dword_AE336C = -1; 176 dword_AE336C = -1;
193 pEventTimer->Pause(); 177 pEventTimer->Pause();
194 pMiscTimer->Pause(); 178 pMiscTimer->Pause();
195 pAudioPlayer->StopChannels(-1, -1); 179 pAudioPlayer->StopChannels(-1, -1);
196 uDialogueType = 0; 180 uDialogueType = 0;
197 v3 = v2->sNPC_ID; 181 sDialogue_SpeakingActorNPC_ID = this->sNPC_ID;
198 sDialogue_SpeakingActorNPC_ID = v2->sNPC_ID; 182 pDialogue_SpeakingActor = this;
199 pDialogue_SpeakingActor = v2; 183 pNPCInfo = GetNPCData(this->sNPC_ID);
200 v4 = GetNPCData(v3); 184 if ( (pNPCInfo->uFlags & 3) != 2 )
201 v5 = v4; 185 pNPCInfo->uFlags = pNPCInfo->uFlags + 1;
202 v6 = v4->uFlags;
203 if ( (v6 & 3) != 2 )
204 v5->uFlags = v6 + 1;
205 186
206 switch (pParty->alignment) 187 switch (pParty->alignment)
207 { 188 {
208 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; 189 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break;
209 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; 190 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break;
211 } 192 }
212 193
213 pDialogueNPCCount = 0; 194 pDialogueNPCCount = 0;
214 uNumDialogueNPCPortraits = 1; 195 uNumDialogueNPCPortraits = 1;
215 pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); 196 pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
216 sprintf(pContainer, "npc%03u", v5->uPortraitID); 197 sprintf(pContainer, "npc%03u", pNPCInfo->uPortraitID);
217 v9 = 0; 198 v9 = 0;
218 pDialogueNPCPortraits[0] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); 199 pDialogueNPCPortraits[0] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
219 dword_591084 = areWeLoadingTexture; 200 dword_591084 = areWeLoadingTexture;
220 uTextureID_right_panel_loop = uTextureID_right_panel; 201 uTextureID_right_panel_loop = uTextureID_right_panel;
221 if ( !v5->Hired() && v5->Location2D >= 0 ) 202 if ( !pNPCInfo->Hired() && pNPCInfo->Location2D >= 0 )
222 { 203 {
223 if ( (signed int)pParty->GetPartyFame() <= v5->fame 204 if ( (signed int)pParty->GetPartyFame() <= pNPCInfo->fame
224 || (v10 = v5->uFlags & 0xFFFFFF7F, (v5->uFlags & 0xFFFFFF7F & 0x80000000u) != 0) ) 205 || (pNumberContacts = pNPCInfo->uFlags & 0xFFFFFF7F, (pNumberContacts & 0x80000000u) != 0) )
225 { 206 {
226 v9 = 1; 207 v9 = 1;
227 } 208 }
228 else 209 else
229 { 210 {
230 if ( v10 > 1 ) 211 if ( pNumberContacts > 1 )
231 { 212 {
232 if ( v10 == 2 ) 213 if ( pNumberContacts == 2 )
233 { 214 {
234 v16 = 3; 215 v9 = 3;
235 v9 = v16;
236 } 216 }
237 else 217 else
238 { 218 {
239 if ( v10 != 3 ) 219 if ( pNumberContacts != 3 )
240 { 220 {
241 if ( v10 != 4 ) 221 if ( pNumberContacts != 4 )
242 v9 = 1; 222 v9 = 1;
243 } 223 }
244 else 224 else
245 { 225 {
246 v16 = 2; 226 v9 = 2;
247 v9 = v16;
248 } 227 }
249 } 228 }
250 } 229 }
251 else if ( v5->rep ) 230 else if ( pNPCInfo->rep )
252 { 231 {
253 v16 = 2; 232 v9 = 2;
254 v9 = v16;
255 } 233 }
256 } 234 }
257 } 235 }
258 if ( (sDialogue_SpeakingActorNPC_ID & 0x80000000u) != 0 ) 236 if ( (sDialogue_SpeakingActorNPC_ID & 0x80000000u) != 0 )
259 v9 = 4; 237 v9 = 4;
260 v11 = GUIWindow::Create(0, 0, 640, 480, WINDOW_Rest, v9, 0); 238 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, v9, 0);//pNumberContacts = 1, v9 = 0; pNumberContacts = 2, v9 = 3;
261 pDialogueWindow = v11; 239 if (pNPCInfo->Hired())
262 if (v5->Hired()) 240 {
263 { 241 if ( !pNPCInfo->bHasUsedTheAbility )
264 if ( !v5->bHasUsedTheAbility ) 242 {
265 { 243 if ( pNPCInfo->uProfession >= 10 )
266 v12 = v5->uProfession; 244 {
267 if ( v12 >= 10 ) 245 if ( pNPCInfo->uProfession <= 12 || pNPCInfo->uProfession > 32 && (pNPCInfo->uProfession <= 34
268 { 246 || pNPCInfo->uProfession > 38 && (pNPCInfo->uProfession <= 43 || pNPCInfo->uProfession == 52)) )
269 if ( v12 <= 12 || v12 > 32 && (v12 <= 34 || v12 > 38 && (v12 <= 43 || v12 == 52)) )
270 { 247 {
271 v11->CreateButton(480, 250, 140, LOBYTE(pFontArrus->uFontHeight) - 3, 248 pDialogueWindow->CreateButton(480, 250, 140, LOBYTE(pFontArrus->uFontHeight) - 3, 1, 0, UIMSG_SelectNPCDialogueOption, 9, 0, "", 0);
272 1,
273 0,
274 UIMSG_SelectNPCDialogueOption,
275 9,
276 0,
277 "",
278 0);
279 pDialogueWindow->_41D08F(4, 1, 0, 1); 249 pDialogueWindow->_41D08F(4, 1, 0, 1);
280 } 250 }
281 } 251 }
282 } 252 }
283 } 253 }
285 pDialogueWindow->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); 255 pDialogueWindow->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
286 pDialogueWindow->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); 256 pDialogueWindow->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
287 pDialogueWindow->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); 257 pDialogueWindow->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
288 pDialogueWindow->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); 258 pDialogueWindow->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
289 259
290 if (v17 && uActiveCharacter && !v5->Hired()) 260 if (bPlayerSaysHello && uActiveCharacter && !pNPCInfo->Hired())
291 { 261 {
292 if (pParty->uCurrentHour < 5 || pParty->uCurrentHour > 21) 262 if (pParty->uCurrentHour < 5 || pParty->uCurrentHour > 21)
293 pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodEvening, 0); 263 pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodEvening, 0);
294 else 264 else
295 pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodDay, 0); 265 pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodDay, 0);