comparison mm7_4.cpp @ 423:88c30918eef7

NPC_EventProcessor
author Gloval
date Sat, 23 Feb 2013 23:09:48 +0400
parents d8b3056df4e2
children afad358dc684
comparison
equal deleted inserted replaced
416:233f9cfc32a3 423:88c30918eef7
11185 dword_F8B19C = -1; 11185 dword_F8B19C = -1;
11186 } 11186 }
11187 11187
11188 11188
11189 //----- (004B4224) -------------------------------------------------------- 11189 //----- (004B4224) --------------------------------------------------------
11190 GUIButton *_4B4224_UpdateNPCTopics(int _this) 11190 void _4B4224_UpdateNPCTopics( int _this )
11191 { 11191 {
11192 int v1; // ebx@1 11192 int num_menu_buttons; // ebx@1
11193 GUIButton *result; // eax@3
11194 int i; // ebp@5 11193 int i; // ebp@5
11195 signed int v4; // ebp@9 11194 // signed int v4; // ebp@9
11196 void *v5; // ecx@14 11195 int v6; // eax@16
11197 bool v6; // eax@16 11196 int v8; // eax@21
11198 void *v7; // ecx@19 11197 int v10; // eax@26
11199 bool v8; // eax@21 11198 int v12; // eax@31
11200 void *v9; // ecx@24 11199 int v14; // eax@36
11201 bool v10; // eax@26 11200 int v16; // eax@41
11202 void *v11; // ecx@29
11203 bool v12; // eax@31
11204 void *v13; // ecx@34
11205 bool v14; // eax@36
11206 void *v15; // ecx@39
11207 bool v16; // eax@41
11208 NPCData *v17; // [sp+10h] [bp-4h]@4 11201 NPCData *v17; // [sp+10h] [bp-4h]@4
11209 11202
11210 v1 = 0; 11203 num_menu_buttons = 0;
11211 array_5913D8[6] = (NPCData *)(_this + 1); 11204 array_5913D8[6] = (NPCData *)(_this + 1);
11212 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) 11205 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
11213 { 11206 {
11214 pDialogueWindow->Release(); 11207 pDialogueWindow->Release();
11215 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); 11208 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
11216 sprintf(byte_591098, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName); 11209 sprintf(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName);
11217 pBtn_ExitCancel = pDialogueWindow->CreateButton( 11210 pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, 0x71u, 0, 0x4Eu,
11218 0x236u,
11219 0x1BDu,
11220 0x4Bu,
11221 0x21u,
11222 1,
11223 0,
11224 0x71u,
11225 0,
11226 0x4Eu,
11227 pGlobalTXT_LocalizationStrings[34],// "Cancel" 11211 pGlobalTXT_LocalizationStrings[34],// "Cancel"
11228 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 11212 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0);
11229 0); 11213 pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u, 75u, 33u, 1, 0, 0xBFu, 1u, 0x59u,
11230 pBtn_YES = pDialogueWindow->CreateButton( 11214 sHouseName,
11231 486u, 11215 (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0);
11232 445u, 11216 pDialogueWindow->CreateButton(pNPCPortraits_x, pNPCPortraits_y, 63u, 73u, 1, 0, 0xBFu, 1u, 0x20u, sHouseName, 0);
11233 75u, 11217 pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, 0xBFu, 1u, 0x59u, sHouseName, 0);
11234 33u,
11235 1,
11236 0,
11237 0xBFu,
11238 1u,
11239 0x59u,
11240 byte_591098,
11241 (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0),
11242 0);
11243 pDialogueWindow->CreateButton(
11244 pNPCPortraits_x,
11245 pNPCPortraits_y,
11246 63u,
11247 73u,
11248 1,
11249 0,
11250 0xBFu,
11251 1u,
11252 0x20u,
11253 byte_591098,
11254 0);
11255 result = pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, 0xBFu, 1u, 0x59u, byte_591098, 0);
11256 } 11218 }
11257 else 11219 else
11258 { 11220 {
11259 v17 = array_5913D8[_this + 1 - ((dword_591080 != 0) + 1)]; 11221 v17 = array_5913D8[_this + 1 - ((dword_591080 != 0) + 1)];
11260 if ( dword_F8B19C == -1 ) 11222 if ( dword_F8B19C == -1 )
11264 else 11226 else
11265 { 11227 {
11266 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) 11228 for ( i = 0; i < uNumDialogueNPCPortraits; ++i )
11267 GUIButton::_41D0D8((GUIButton *)array_5913D8[i + 7]); 11229 GUIButton::_41D0D8((GUIButton *)array_5913D8[i + 7]);
11268 } 11230 }
11269 v4 = 1;
11270 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); 11231 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
11271 pBtn_ExitCancel = pDialogueWindow->CreateButton( 11232 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0,
11272 471u,
11273 445u,
11274 169u,
11275 35u,
11276 1,
11277 0,
11278 0x71u,
11279 0,
11280 0,
11281 pGlobalTXT_LocalizationStrings[74],// "End Conversation" 11233 pGlobalTXT_LocalizationStrings[74],// "End Conversation"
11282 (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), 11234 (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), 0);
11283 0);
11284 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0); 11235 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0);
11285 if ( array_5913D8[6] == (NPCData *)1 && dword_591080 ) 11236 if ( array_5913D8[6] == (NPCData *)1 && dword_591080 )
11286 { 11237 {
11287 result = (GUIButton *)sub_4B3B42(dword_F8B198); 11238 sub_4B3B42(dword_F8B198);
11288 } 11239 }
11289 else 11240 else
11290 { 11241 {
11291 if ( v17->joins ) 11242 if ( v17->joins )
11292 { 11243 {
11293 v1 = 1; 11244 num_menu_buttons = 1;
11294 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0xAFu, 0xDu, 0, "", 0); 11245 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0xAFu, 0xDu, 0, "", 0);
11295 } 11246 }
11296 v5 = (void *)v17->evt_A; 11247 if ( v17->evt_A)
11297 if ( v5 ) 11248 {
11298 { 11249 if ( num_menu_buttons < 4 )
11299 if ( v1 < 4 ) 11250 {
11300 { 11251 v6 = NPC_EventProcessor(v17->evt_A);
11301 v6 = sub_4466C4(v5);
11302 if ( v6 == 1 || v6 == 2 ) 11252 if ( v6 == 1 || v6 == 2 )
11303 pDialogueWindow->CreateButton( 11253 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x13u, 0, "", 0);
11304 480u, 11254 }
11305 30 * v1++ + 160, 11255 }
11306 140u, 11256 if ( v17->evt_B )
11307 30u, 11257 {
11308 1, 11258 if ( num_menu_buttons < 4 )
11309 0, 11259 {
11310 0xAFu, 11260 v8 = NPC_EventProcessor(v17->evt_B);
11311 0x13u,
11312 0,
11313 "",
11314 0);
11315 }
11316 }
11317 v7 = (void *)v17->evt_B;
11318 if ( v7 )
11319 {
11320 if ( v1 < 4 )
11321 {
11322 v8 = sub_4466C4(v7);
11323 if ( v8 == 1 || v8 == 2 ) 11261 if ( v8 == 1 || v8 == 2 )
11324 pDialogueWindow->CreateButton( 11262 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x14u, 0, "", 0);
11325 480u, 11263 }
11326 30 * v1++ + 160, 11264 }
11327 140u, 11265 if ( v17->evt_C )
11328 30u, 11266 {
11329 1, 11267 if ( num_menu_buttons < 4 )
11330 0, 11268 {
11331 0xAFu, 11269 v10 = NPC_EventProcessor(v17->evt_C);
11332 0x14u,
11333 0,
11334 "",
11335 0);
11336 }
11337 }
11338 v9 = (void *)v17->evt_C;
11339 if ( v9 )
11340 {
11341 if ( v1 < 4 )
11342 {
11343 v10 = sub_4466C4(v9);
11344 if ( v10 == 1 || v10 == 2 ) 11270 if ( v10 == 1 || v10 == 2 )
11345 pDialogueWindow->CreateButton( 11271 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x15u, 0, "", 0);
11346 480u, 11272 }
11347 30 * v1++ + 160, 11273 }
11348 140u, 11274
11349 30u, 11275 if ( v17->evt_D )
11350 1, 11276 {
11351 0, 11277 if ( num_menu_buttons < 4 )
11352 0xAFu, 11278 {
11353 0x15u, 11279 v12 = NPC_EventProcessor(v17->evt_D);
11354 0,
11355 "",
11356 0);
11357 }
11358 }
11359 v11 = (void *)v17->evt_D;
11360 if ( v11 )
11361 {
11362 if ( v1 < 4 )
11363 {
11364 v12 = sub_4466C4(v11);
11365 if ( v12 == 1 || v12 == 2 ) 11280 if ( v12 == 1 || v12 == 2 )
11366 pDialogueWindow->CreateButton( 11281 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x16u, 0, "", 0);
11367 0x1E0u, 11282 }
11368 30 * v1++ + 160, 11283 }
11369 0x8Cu, 11284 if ( v17->evt_E )
11370 0x1Eu, 11285 {
11371 1, 11286 if ( num_menu_buttons < 4 )
11372 0, 11287 {
11373 0xAFu, 11288 v14 = NPC_EventProcessor(v17->evt_E);
11374 0x16u,
11375 0,
11376 "",
11377 0);
11378 }
11379 }
11380 v13 = (void *)v17->evt_E;
11381 if ( v13 )
11382 {
11383 if ( v1 < 4 )
11384 {
11385 v14 = sub_4466C4(v13);
11386 if ( v14 == 1 || v14 == 2 ) 11289 if ( v14 == 1 || v14 == 2 )
11387 pDialogueWindow->CreateButton( 11290 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x17u, 0, "", 0);
11388 0x1E0u, 11291 }
11389 30 * v1++ + 160, 11292 }
11390 0x8Cu, 11293 if ( v17->evt_F )
11391 0x1Eu, 11294 {
11392 1, 11295 if ( num_menu_buttons < 4 )
11393 0, 11296 {
11394 0xAFu, 11297 v16 = NPC_EventProcessor(v17->evt_F);
11395 0x17u,
11396 0,
11397 "",
11398 0);
11399 }
11400 }
11401 v15 = (void *)v17->evt_F;
11402 if ( v15 )
11403 {
11404 if ( v1 < 4 )
11405 {
11406 v16 = sub_4466C4(v15);
11407 if ( v16 == 1 || v16 == 2 ) 11298 if ( v16 == 1 || v16 == 2 )
11408 pDialogueWindow->CreateButton( 11299 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x18u, 0, "", 0);
11409 0x1E0u, 11300 }
11410 30 * v1++ + 160, 11301 }
11411 0x8Cu, 11302 pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2);
11412 0x1Eu,
11413 1,
11414 0,
11415 0xAFu,
11416 0x18u,
11417 0,
11418 "",
11419 0);
11420 }
11421 }
11422 pDialogueWindow->_41D08F(v1, 1, 0, 2);
11423 v4 = 1;
11424 result = (GUIButton *)pDialogueWindow->pNumPresenceButton;
11425 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; 11303 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
11426 } 11304 }
11427 dword_F8B19C = v4; 11305 dword_F8B19C = 1;
11428 } 11306 }
11429 return result; 11307
11430 } 11308 }
11431 11309
11432 11310
11433 11311
11434 //----- (004B46A5) -------------------------------------------------------- 11312 //----- (004B46A5) --------------------------------------------------------
14832 if ( v14 ) 14710 if ( v14 )
14833 { 14711 {
14834 v20 = pMapStats->pInfos[v14].pName; 14712 v20 = pMapStats->pInfos[v14].pName;
14835 v18 = pGlobalTXT_LocalizationStrings[410]; 14713 v18 = pGlobalTXT_LocalizationStrings[410];
14836 LABEL_10: 14714 LABEL_10:
14837 sprintf(byte_591098, v18, v20); 14715 sprintf(sHouseName, v18, v20);
14838 goto LABEL_20; 14716 goto LABEL_20;
14839 } 14717 }
14840 v21 = pGlobalTXT_LocalizationStrings[79]; 14718 v21 = pGlobalTXT_LocalizationStrings[79];
14841 goto LABEL_19; 14719 goto LABEL_19;
14842 } 14720 }
14851 v18 = pGlobalTXT_LocalizationStrings[411]; 14729 v18 = pGlobalTXT_LocalizationStrings[411];
14852 goto LABEL_10; 14730 goto LABEL_10;
14853 } 14731 }
14854 v21 = pGlobalTXT_LocalizationStrings[73]; 14732 v21 = pGlobalTXT_LocalizationStrings[73];
14855 LABEL_19: 14733 LABEL_19:
14856 strcpy(byte_591098, v21); 14734 strcpy(sHouseName, v21);
14857 LABEL_20: 14735 LABEL_20:
14858 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)26, 0, (int)byte_591098); 14736 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)26, 0, (int)sHouseName);
14859 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) 14737 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) )
14860 if ( BYTE1(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].field_C) ) 14738 if ( BYTE1(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].field_C) )
14861 HousePlaySomeSound(v9, 1); 14739 HousePlaySomeSound(v9, 1);
14862 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) 14740 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
14863 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); 14741 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);