Mercurial > mm7
changeset 423:88c30918eef7
NPC_EventProcessor
author | Gloval |
---|---|
date | Sat, 23 Feb 2013 23:09:48 +0400 |
parents | 233f9cfc32a3 |
children | afad358dc684 |
files | Events.cpp Events.h GUIWindow.cpp GameUIs.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_6.cpp mm7_data.cpp mm7_data.h |
diffstat | 10 files changed, 231 insertions(+), 412 deletions(-) [+] |
line wrap: on
line diff
--- a/Events.cpp Sat Feb 23 19:35:32 2013 +0400 +++ b/Events.cpp Sat Feb 23 23:09:48 2013 +0400 @@ -30,7 +30,7 @@ EventIndex pSomeOtherEVT_Events[4400]; -unsigned int uSomeOtherEVT_NumEvents; +signed int uSomeOtherEVT_NumEvents; char *pSomeOtherEVT; EventIndex pSomeEVT_Events[4400]; unsigned int uSomeEVT_NumEvents;
--- a/Events.h Sat Feb 23 19:35:32 2013 +0400 +++ b/Events.h Sat Feb 23 23:09:48 2013 +0400 @@ -105,14 +105,15 @@ EVENT_GiveItem = 0x29, EVENT_ChangeEvent = 0x2A, EVENT_CheckSkill = 0x2B, - EVENT_OnCanShowDialogItemCmp = 0x2C, - EVENT_EndCanShowDialogItem = 0x2D, - EVENT_SetCanShowDialogItem = 0x2E, + EVENT_OnCanShowDialogItemCmp = 44, + EVENT_EndCanShowDialogItem = 45, + EVENT_SetCanShowDialogItem = 46, EVENT_SetNPCGroupNews = 0x2F, EVENT_SetActorGroup = 0x30, EVENT_NPCSetItem = 0x31, EVENT_SetNPCGreeting = 0x32, EVENT_IsActorAlive = 0x33, + EVENT_IsActorAssasinated =52, EVENT_OnMapLeave = 0x35, EVENT_ChangeGroup = 0x36, EVENT_ChangeGroupAlly = 0x37, @@ -298,7 +299,7 @@ #define EVT_BYTE(x) (unsigned char)x extern EventIndex pSomeOtherEVT_Events[4400]; -extern unsigned int uSomeOtherEVT_NumEvents; +extern signed int uSomeOtherEVT_NumEvents; extern char *pSomeOtherEVT; extern EventIndex pSomeEVT_Events[4400]; extern unsigned int uSomeEVT_NumEvents;
--- a/GUIWindow.cpp Sat Feb 23 19:35:32 2013 +0400 +++ b/GUIWindow.cpp Sat Feb 23 23:09:48 2013 +0400 @@ -1760,26 +1760,20 @@ //GUIWindow *pWindow; // esi@4 int v10; // eax@4 unsigned int v11; // ebx@15 - NPCData *v12; // ebp@15 - void *v13; // ecx@18 - bool v14; // eax@20 - void *v15; // ecx@23 - bool v16; // eax@25 - void *v17; // ecx@28 - bool v18; // eax@30 - void *v19; // ecx@33 - bool v20; // eax@35 - void *v21; // ecx@38 - bool v22; // eax@40 - void *v23; // ecx@43 - bool v24; // eax@45 + NPCData *speakingNPC; // ebp@15 + int v14; // eax@20 + int v16; // eax@25 + int v18; // eax@30 + int v20; // eax@35 + int v22; // eax@40 + int v24; // eax@45 int v25; // eax@65 unsigned int v26; // ebx@65 char *v27; // eax@71 const char *v29; // [sp-8h] [bp-18h]@68 char *v30; // [sp-4h] [bp-14h]@68 int uWidtha; // [sp+14h] [bp+4h]@66 - int a4a; // [sp+20h] [bp+10h]@15 + int num_menu_buttons; // [sp+20h] [bp+10h]@15 for (uNextFreeWindowID = 0; uNextFreeWindowID < 20; ++uNextFreeWindowID) { @@ -1819,95 +1813,89 @@ (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); if ( pWindow->ptr_1C != (void *)1 ) { - a4a = 0; + num_menu_buttons = 0; v11 = LOBYTE(pFontArrus->uFontHeight) - 3; - v12 = GetNPCData(uDialogue_SpeakingActorNPC_ID); + speakingNPC = GetNPCData(uDialogue_SpeakingActorNPC_ID); if ( sub_445C8B(uDialogue_SpeakingActorNPC_ID) == 1 ) { - if ( v12->joins ) + if ( speakingNPC->joins ) { pWindow->CreateButton(480, 130, 140, v11, 1, 0, 0x88u, 0xDu, 0, "", 0); - a4a = 1; + num_menu_buttons = 1; } - v13 = (void *)v12->evt_A; - if ( v13 ) + if ( speakingNPC->evt_A ) { - if ( a4a < 4 ) + if ( num_menu_buttons < 4 ) { - v14 = sub_4466C4(v13); + v14 = NPC_EventProcessor(speakingNPC->evt_A); if ( v14 == 1 || v14 == 2 ) - pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x13u, 0, "", 0); + pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x13u, 0, "", 0); } } - v15 = (void *)v12->evt_B; - if ( v15 ) + if ( speakingNPC->evt_B ) { - if ( a4a < 4 ) + if ( num_menu_buttons < 4 ) { - v16 = sub_4466C4(v15); + v16 = NPC_EventProcessor(speakingNPC->evt_B); if ( v16 == 1 || v16 == 2 ) - pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x14u, 0, "", 0); + pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x14u, 0, "", 0); } } - v17 = (void *)v12->evt_C; - if ( v17 ) + if ( speakingNPC->evt_C ) { - if ( a4a < 4 ) + if ( num_menu_buttons < 4 ) { - v18 = sub_4466C4(v17); + v18 = NPC_EventProcessor(speakingNPC->evt_C); if ( v18 == 1 || v18 == 2 ) - pWindow->CreateButton( 0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x15u, 0, "", 0); + pWindow->CreateButton( 0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x15u, 0, "", 0); } } - v19 = (void *)v12->evt_D; - if ( v19 ) + if ( speakingNPC->evt_D ) { - if ( a4a < 4 ) + if ( num_menu_buttons < 4 ) { - v20 = sub_4466C4(v19); + v20 = NPC_EventProcessor(speakingNPC->evt_D); if ( v20 == 1 || v20 == 2 ) - pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x16u, 0, "", 0); + pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x16u, 0, "", 0); } } - v21 = (void *)v12->evt_E; - if ( v21 ) + if ( speakingNPC->evt_E ) { - if ( a4a < 4 ) + if ( num_menu_buttons < 4 ) { - v22 = sub_4466C4(v21); + v22 = NPC_EventProcessor(speakingNPC->evt_E); if ( v22 == 1 || v22 == 2 ) - pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x17u, 0, "", 0); + pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x17u, 0, "", 0); } } - v23 = (void *)v12->evt_F; - if ( v23 ) + if (speakingNPC->evt_F ) { - if ( a4a < 4 ) + if ( num_menu_buttons < 4 ) { - v24 = sub_4466C4(v23); + v24 = NPC_EventProcessor(speakingNPC->evt_F); if ( v24 == 1 || v24 == 2 ) - pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x18u, 0, "", 0); + pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x18u, 0, "", 0); } } } else { - if ( v12->joins ) + if ( speakingNPC->joins ) { pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, 0x88u, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее - if (v12->Hired()) + if (speakingNPC->Hired()) { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], v12->pName); //Отпустить + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], speakingNPC->pName); //Отпустить pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x4Cu, 0, pTmpBuf, 0); } else { pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять } - a4a = 2; + num_menu_buttons = 2; } } - pWindow->_41D08F(a4a, 1, 0, 1); + pWindow->_41D08F(num_menu_buttons, 1, 0, 1); } break; case WINDOW_ChangeLocation: @@ -1955,7 +1943,7 @@ if ( v26 + 1 == v25 && uHouse_ExitPic ) { v30 = pMapStats->pInfos[uHouse_ExitPic].pName; - v29 = (char*)pGlobalTXT_LocalizationStrings[411];//Войти в ^Pv[%s] + v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S];//Войти в ^Pv[%s] } else { @@ -1965,7 +1953,7 @@ //v27 = (char *)p2DEvents_minus1_::08[13 * a4]; v27 = (char *)p2DEvents[pButton - 1].pProprieterName; v30 = v27; - v29 = (char*)pGlobalTXT_LocalizationStrings[435];//Побеседовать с ^Pt[%s] + v29 = (char*)pGlobalTXT_LocalizationStrings[435];// "Converse with %s" Побеседовать с ^Pt[%s] } sprintf(&byte_591180[100 * v26], v29, v30); array_5913D8[v26 + 7] = (NPCData *)pWindow->CreateButton(*(&pNPCPortraits_x + v26 + 6 * uNumDialogueNPCPortraits - 6),
--- a/GameUIs.cpp Sat Feb 23 19:35:32 2013 +0400 +++ b/GameUIs.cpp Sat Feb 23 23:09:48 2013 +0400 @@ -35,7 +35,6 @@ uDialogueType_ = uDialogueType; dword_6BE138 = -1; ++pIcons_LOD->uTexturePacksCount; - v16 = 0; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; memset(pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots)); @@ -82,11 +81,7 @@ //v3 = 0; for (uint i = 0; i < uNumSavegameFiles; ++i) { - //Dest = pSavegameHeader; - //pTex = pSavegameThumbnails; - //Str1 = (const char *)pSavegameList->pSavesNames; - //while ( 1 ) - //{ + sprintf(pTmpBuf, "saves\\%s", pSavegameList->pFileList[i].pSaveFileName); if (_access(pTmpBuf, 6)) { @@ -112,33 +107,20 @@ pLODFile.CloseWriteFile(); pSavegameUsedSlots[i] = 1; } -//LABEL_23: - //Str1 += 280; - //++pTex; - //++Dest; - //++v3; - //if ( v3 >= (signed int)uNumSavegameFiles ) - // goto LABEL_24; - //} - //goto LABEL_22; } //LABEL_24: pLODFile.FreeSubIndexAndIO(); if ( pCurrentScreen == SCREEN_SAVEGAME ) { - v6 = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - v10 = (TEXTURE_TYPE)2; - v8 = "LS_saveD"; + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD",TEXTURE_16BIT_PALETTE); } else { - v6 = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - v10 = (TEXTURE_TYPE)2; - v8 = "LS_loadD"; + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_loadD",TEXTURE_16BIT_PALETTE); } - uTextureID_x_d = v6; - uTextureID_LS_ = pIcons_LOD->LoadTexture(v8, v10); uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, 0xA5, 0, 0, "", 0); @@ -156,8 +138,7 @@ (Texture *)(uTextureID_AR_UP_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_UP_DN] : 0), 0); pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 0x143, 0x11, 0x11, 1, 0, 0xA3, uNumSavegameFiles, 0, "", (Texture *)(uTextureID_AR_DN_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_DN_DN] : 0), 0); - v16 = -1; - //ptr_69BD58 = v7; + } //----- (0045E93E) --------------------------------------------------------
--- a/mm7_2.cpp Sat Feb 23 19:35:32 2013 +0400 +++ b/mm7_2.cpp Sat Feb 23 23:09:48 2013 +0400 @@ -3680,24 +3680,15 @@ //----- (004BCA33) -------------------------------------------------------- -GUIButton *__cdecl sub_4BCA33() +GUIButton *__cdecl UI_CreateEndConversationButton() { pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); - pBtn_ExitCancel = pDialogueWindow->CreateButton( - 0x1D7u, - 0x1BDu, - 0xA9u, - 0x23u, - 1, - 0, - 0x71u, - 0, - 0, - pGlobalTXT_LocalizationStrings[74], - (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), + pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); + pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, 0x71u, 0, 0, + pGlobalTXT_LocalizationStrings[74], //"End Conversation" + (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : NULL), 0); - return pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0); + return pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0); } //----- (004BCACC) -------------------------------------------------------- @@ -4091,12 +4082,12 @@ { case 96: pDialogueWindow->eWindowType = WINDOW_MainMenu; - sub_4BCA33(); + UI_CreateEndConversationButton(); sub_4B3703((void *)dword_F8B198); break; case 101: pDialogueWindow->eWindowType = WINDOW_MainMenu; - sub_4BCA33(); + UI_CreateEndConversationButton(); sub_4B3A72(dword_F8B198); break; case 102: @@ -4182,7 +4173,7 @@ if ( a1 == 94 ) { pDialogueWindow->eWindowType = WINDOW_MainMenu; - sub_4BCA33(); + UI_CreateEndConversationButton(); sub_4B3AD4(dword_F8B198); } } @@ -4344,7 +4335,7 @@ { if ( v0 == 3 || v0 == 5 || v0 == 4 ) { - sub_4BCA33(); + UI_CreateEndConversationButton(); dword_F8B19C = 94; sub_4B3AD4(dword_F8B198); } @@ -4359,14 +4350,14 @@ return 1; } pVideoPlayer->_4BF5B2(); - sub_4BCA33(); + UI_CreateEndConversationButton(); dword_F8B19C = 101; sub_4B3A72(dword_F8B198); } return 1; } pVideoPlayer->_4BF5B2(); - sub_4BCA33(); + UI_CreateEndConversationButton(); goto LABEL_28; } array_5913D8[6] = 0;
--- a/mm7_3.cpp Sat Feb 23 19:35:32 2013 +0400 +++ b/mm7_3.cpp Sat Feb 23 23:09:48 2013 +0400 @@ -14703,10 +14703,10 @@ pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("outside", TEXTURE_16BIT_PALETTE)]; v1 = pMapStats->GetMapInfo(pCurrentMapName); if ( v1 ) - sprintf(byte_591098, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s" - else - strcpy(byte_591098, pGlobalTXT_LocalizationStrings[79]);// "Exit" - result = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)17, 0, (int)byte_591098); + sprintf(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s" + else + strcpy(sHouseName, pGlobalTXT_LocalizationStrings[79]);// "Exit" + result = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)17, 0, (int)sHouseName); pDialogueWindow = result; return result; } @@ -15675,94 +15675,85 @@ } //----- (004466C4) -------------------------------------------------------- -bool __thiscall sub_4466C4(void *_this) -{ - signed int v1; // ebp@1 - bool result; // eax@2 - int v3; // esi@3 - signed int v4; // edx@3 - signed int v5; // eax@4 - unsigned int v6; // ebx@6 - char *v7; // eax@6 - signed int v8; // edi@18 - int v9; // eax@19 - Player *v10; // [sp+8h] [bp-10h]@18 - signed int v11; // [sp+Ch] [bp-Ch]@3 - signed int v12; // [sp+10h] [bp-8h]@3 - void *v13; // [sp+14h] [bp-4h]@1 - - v1 = 0; - v13 = _this; - if ( !_this ) +int NPC_EventProcessor( int npc_event_id ) + { + signed int event_index; // ebp@1 + int evt_seq_num; // esi@3 + bool ready_to_exit; // [sp+Ch] [bp-Ch]@3 + signed int npc_activity; // [sp+10h] [bp-8h]@3 + int result; + + event_index = 0; + if ( !npc_event_id ) return 0; - v3 = start_event_seq_number; + evt_seq_num = start_event_seq_number; pSomeOtherEVT = pGlobalEVT; uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents; - memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, 0xCE40u); - v4 = 1; - v12 = 1; - v11 = 0; - if ( (signed int)uSomeOtherEVT_NumEvents <= 0 ) - goto LABEL_16; + memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400); + npc_activity = 1; + ready_to_exit = false; + if ( uSomeOtherEVT_NumEvents <= 0 ) + return 2; do { - v5 = v1; - if ( (void *)pSomeOtherEVT_Events[v1].uEventID == v13 && pSomeOtherEVT_Events[v5].event_sequence_num == v3 ) - { - v6 = pSomeOtherEVT_Events[v5].uEventOffsetInEVT; - v7 = &pSomeOtherEVT[v6]; - if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] == 1 ) - break; - if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] == 44 ) - { - v11 = v4; - v10 = pParty->pPlayers; - v8 = (unsigned __int8)v7[7] - + (((unsigned __int8)v7[8] + (((unsigned __int8)v7[9] + ((unsigned __int8)v7[10] << 8)) << 8)) << 8); - while ( 1 ) - { - LOBYTE(v9) = v10->CompareVariable( - (enum VariableType)((unsigned __int8)pSomeOtherEVT[v6 + 5] - + ((unsigned __int8)pSomeOtherEVT[v6 + 6] << 8)), - v8); - if ( v9 ) - break; - ++v10; - if ( (signed int)v10 >= (signed int)pParty->pHirelings ) - goto LABEL_13; - } - } - else - { - if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] == 45 ) - break; - if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] == 46 ) - { - v11 = v4; - v12 = (unsigned __int8)v7[5]; - goto LABEL_13; - } - if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] != 52 - || !IsActorAlive( - (unsigned __int8)v7[5], - (unsigned __int8)v7[6] - + (((unsigned __int8)v7[7] + (((unsigned __int8)v7[8] + ((unsigned __int8)v7[9] << 8)) << 8)) << 8), - (unsigned __int8)v7[10]) ) - goto LABEL_13; - } - v1 = -1; - v3 = (unsigned __int8)pSomeOtherEVT[v6 + 11] - 1; -LABEL_13: - ++v3; - v4 = 1; - } - ++v1; - } - while ( v1 < (signed int)uSomeOtherEVT_NumEvents ); - if ( v11 ) - result = v12 != 0; - else -LABEL_16: + if ( (pSomeOtherEVT_Events[event_index].uEventID == npc_event_id) && (pSomeOtherEVT_Events[event_index].event_sequence_num == evt_seq_num) ) + { + _evt_raw *_evt = (_evt_raw *)&pSomeOtherEVT[pSomeOtherEVT_Events[event_index].uEventOffsetInEVT]; + switch(_evt->_e_type) + { + case EVENT_Exit: + //exit + if ( ready_to_exit ) + result = npc_activity != 0; + else + result = 2; + return result; + break; + case EVENT_OnCanShowDialogItemCmp: + ready_to_exit = true; + //v8 = (unsigned __int8)v7[7] + (((unsigned __int8)v7[8] + (((unsigned __int8)v7[9] + ((unsigned __int8)v7[10] << 8)) << 8)) << 8); + for(int i=0; i<4; ++i) + { + // if (pParty->pPlayers[i].CompareVariable((enum VariableType)((unsigned __int8)pSomeOtherEVT[v6 + 5] + ((unsigned __int8)pSomeOtherEVT[v6 + 6] << 8)), + // v8)) + if (pParty->pPlayers[i].CompareVariable((enum VariableType)EVT_WORD(_evt->v5), EVT_DWORD(_evt->v7))) + { + event_index = -1; + evt_seq_num = EVT_BYTE(_evt->v11)-1;//(unsigned __int8)pSomeOtherEVT[v6 + 11] - 1; + break; + } + } + break; + case EVENT_EndCanShowDialogItem : + if ( ready_to_exit ) + result = npc_activity != 0; + else + result = 2; + return result; + break; + case EVENT_SetCanShowDialogItem : + ready_to_exit = true; + npc_activity = EVT_BYTE(_evt->v5); //(unsigned __int8)v7[5]; + break; + case EVENT_IsActorAssasinated : + // if (IsActorAlive( (unsigned __int8)v7[5], + // (unsigned __int8)v7[6] + (((unsigned __int8)v7[7] + (((unsigned __int8)v7[8] + ((unsigned __int8)v7[9] << 8)) << 8)) << 8), + // (unsigned __int8)v7[10]) ) + if (IsActorAlive( EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10))) + { // drop linear sequense, going to new seq + event_index = -1; + evt_seq_num = EVT_BYTE(_evt->v11)-1;//(unsigned __int8)pSomeOtherEVT[v6 + 11] - 1; + } + break; + } + ++evt_seq_num; + } + ++event_index; + } + while ( event_index < uSomeOtherEVT_NumEvents ); + if ( ready_to_exit ) + result = npc_activity != 0; + else result = 2; return result; }
--- a/mm7_4.cpp Sat Feb 23 19:35:32 2013 +0400 +++ b/mm7_4.cpp Sat Feb 23 23:09:48 2013 +0400 @@ -11187,72 +11187,34 @@ //----- (004B4224) -------------------------------------------------------- -GUIButton *_4B4224_UpdateNPCTopics(int _this) -{ - int v1; // ebx@1 - GUIButton *result; // eax@3 +void _4B4224_UpdateNPCTopics( int _this ) + { + int num_menu_buttons; // ebx@1 int i; // ebp@5 - signed int v4; // ebp@9 - void *v5; // ecx@14 - bool v6; // eax@16 - void *v7; // ecx@19 - bool v8; // eax@21 - void *v9; // ecx@24 - bool v10; // eax@26 - void *v11; // ecx@29 - bool v12; // eax@31 - void *v13; // ecx@34 - bool v14; // eax@36 - void *v15; // ecx@39 - bool v16; // eax@41 + // signed int v4; // ebp@9 + int v6; // eax@16 + int v8; // eax@21 + int v10; // eax@26 + int v12; // eax@31 + int v14; // eax@36 + int v16; // eax@41 NPCData *v17; // [sp+10h] [bp-4h]@4 - v1 = 0; + num_menu_buttons = 0; array_5913D8[6] = (NPCData *)(_this + 1); if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) { pDialogueWindow->Release(); pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); - sprintf(byte_591098, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName); - pBtn_ExitCancel = pDialogueWindow->CreateButton( - 0x236u, - 0x1BDu, - 0x4Bu, - 0x21u, - 1, - 0, - 0x71u, - 0, - 0x4Eu, + sprintf(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); + pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, 0x71u, 0, 0x4Eu, pGlobalTXT_LocalizationStrings[34],// "Cancel" - (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), - 0); - pBtn_YES = pDialogueWindow->CreateButton( - 486u, - 445u, - 75u, - 33u, - 1, - 0, - 0xBFu, - 1u, - 0x59u, - byte_591098, - (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), - 0); - pDialogueWindow->CreateButton( - pNPCPortraits_x, - pNPCPortraits_y, - 63u, - 73u, - 1, - 0, - 0xBFu, - 1u, - 0x20u, - byte_591098, - 0); - result = pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, 0xBFu, 1u, 0x59u, byte_591098, 0); + (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0); + pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u, 75u, 33u, 1, 0, 0xBFu, 1u, 0x59u, + sHouseName, + (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); + pDialogueWindow->CreateButton(pNPCPortraits_x, pNPCPortraits_y, 63u, 73u, 1, 0, 0xBFu, 1u, 0x20u, sHouseName, 0); + pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, 0xBFu, 1u, 0x59u, sHouseName, 0); } else { @@ -11266,167 +11228,83 @@ for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) GUIButton::_41D0D8((GUIButton *)array_5913D8[i + 7]); } - v4 = 1; pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); - pBtn_ExitCancel = pDialogueWindow->CreateButton( - 471u, - 445u, - 169u, - 35u, - 1, - 0, - 0x71u, - 0, - 0, + pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" - (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), - 0); + (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0); if ( array_5913D8[6] == (NPCData *)1 && dword_591080 ) { - result = (GUIButton *)sub_4B3B42(dword_F8B198); + sub_4B3B42(dword_F8B198); } else { if ( v17->joins ) { - v1 = 1; + num_menu_buttons = 1; pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0xAFu, 0xDu, 0, "", 0); } - v5 = (void *)v17->evt_A; - if ( v5 ) - { - if ( v1 < 4 ) - { - v6 = sub_4466C4(v5); + if ( v17->evt_A) + { + if ( num_menu_buttons < 4 ) + { + v6 = NPC_EventProcessor(v17->evt_A); if ( v6 == 1 || v6 == 2 ) - pDialogueWindow->CreateButton( - 480u, - 30 * v1++ + 160, - 140u, - 30u, - 1, - 0, - 0xAFu, - 0x13u, - 0, - "", - 0); - } - } - v7 = (void *)v17->evt_B; - if ( v7 ) - { - if ( v1 < 4 ) - { - v8 = sub_4466C4(v7); + pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x13u, 0, "", 0); + } + } + if ( v17->evt_B ) + { + if ( num_menu_buttons < 4 ) + { + v8 = NPC_EventProcessor(v17->evt_B); if ( v8 == 1 || v8 == 2 ) - pDialogueWindow->CreateButton( - 480u, - 30 * v1++ + 160, - 140u, - 30u, - 1, - 0, - 0xAFu, - 0x14u, - 0, - "", - 0); - } - } - v9 = (void *)v17->evt_C; - if ( v9 ) - { - if ( v1 < 4 ) - { - v10 = sub_4466C4(v9); + pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x14u, 0, "", 0); + } + } + if ( v17->evt_C ) + { + if ( num_menu_buttons < 4 ) + { + v10 = NPC_EventProcessor(v17->evt_C); if ( v10 == 1 || v10 == 2 ) - pDialogueWindow->CreateButton( - 480u, - 30 * v1++ + 160, - 140u, - 30u, - 1, - 0, - 0xAFu, - 0x15u, - 0, - "", - 0); - } - } - v11 = (void *)v17->evt_D; - if ( v11 ) - { - if ( v1 < 4 ) - { - v12 = sub_4466C4(v11); + pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x15u, 0, "", 0); + } + } + + if ( v17->evt_D ) + { + if ( num_menu_buttons < 4 ) + { + v12 = NPC_EventProcessor(v17->evt_D); if ( v12 == 1 || v12 == 2 ) - pDialogueWindow->CreateButton( - 0x1E0u, - 30 * v1++ + 160, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0xAFu, - 0x16u, - 0, - "", - 0); - } - } - v13 = (void *)v17->evt_E; - if ( v13 ) - { - if ( v1 < 4 ) - { - v14 = sub_4466C4(v13); + pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x16u, 0, "", 0); + } + } + if ( v17->evt_E ) + { + if ( num_menu_buttons < 4 ) + { + v14 = NPC_EventProcessor(v17->evt_E); if ( v14 == 1 || v14 == 2 ) - pDialogueWindow->CreateButton( - 0x1E0u, - 30 * v1++ + 160, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0xAFu, - 0x17u, - 0, - "", - 0); - } - } - v15 = (void *)v17->evt_F; - if ( v15 ) - { - if ( v1 < 4 ) - { - v16 = sub_4466C4(v15); + pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x17u, 0, "", 0); + } + } + if ( v17->evt_F ) + { + if ( num_menu_buttons < 4 ) + { + v16 = NPC_EventProcessor(v17->evt_F); if ( v16 == 1 || v16 == 2 ) - pDialogueWindow->CreateButton( - 0x1E0u, - 30 * v1++ + 160, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0xAFu, - 0x18u, - 0, - "", - 0); - } - } - pDialogueWindow->_41D08F(v1, 1, 0, 2); - v4 = 1; - result = (GUIButton *)pDialogueWindow->pNumPresenceButton; + pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x18u, 0, "", 0); + } + } + pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; } - dword_F8B19C = v4; - } - return result; + dword_F8B19C = 1; + } + } @@ -14834,7 +14712,7 @@ v20 = pMapStats->pInfos[v14].pName; v18 = pGlobalTXT_LocalizationStrings[410]; LABEL_10: - sprintf(byte_591098, v18, v20); + sprintf(sHouseName, v18, v20); goto LABEL_20; } v21 = pGlobalTXT_LocalizationStrings[79]; @@ -14853,9 +14731,9 @@ } v21 = pGlobalTXT_LocalizationStrings[73]; LABEL_19: - strcpy(byte_591098, v21); + strcpy(sHouseName, v21); LABEL_20: - pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)26, 0, (int)byte_591098); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)26, 0, (int)sHouseName); //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) if ( BYTE1(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].field_C) ) HousePlaySomeSound(v9, 1);
--- a/mm7_6.cpp Sat Feb 23 19:35:32 2013 +0400 +++ b/mm7_6.cpp Sat Feb 23 23:09:48 2013 +0400 @@ -2431,19 +2431,8 @@ pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 1u, 0x32u, "", 0); pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 2u, 0x33u, "", 0); pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 3u, 0x34u, "", 0); - v29 = 0; - v28 = ""; - v27 = 0; - v26 = 0; - v25 = 140; - v24 = 0; - v23 = 1; - v22 = 344; - v21 = 460; - v20 = 8; - v19 = 8; - v18 = pGUIWindow_Settings; - goto LABEL_56; + pGUIWindow_Settings->CreateButton(8, 8, 460, 344, 1, 0, 140, 0, 0, "", NULL); + sub_421B2C_PlaceInInventory_or_DropPickedItem(); } if ( HIBYTE(v6) & 2 && !pGUIWindow_Settings ) {
--- a/mm7_data.cpp Sat Feb 23 19:35:32 2013 +0400 +++ b/mm7_data.cpp Sat Feb 23 23:09:48 2013 +0400 @@ -1967,7 +1967,7 @@ unsigned int uDialogueType; unsigned int uDialogue_SpeakingActorNPC_ID; struct LevelDecoration *_591094_decoration; -char byte_591098[200]; // idb +char sHouseName[200]; // idb int uCurrentHouse_Animation; // weak char *dword_591164_teleport_map_name; // idb int dword_591168_teleport_speedz; // weak
--- a/mm7_data.h Sat Feb 23 19:35:32 2013 +0400 +++ b/mm7_data.h Sat Feb 23 23:09:48 2013 +0400 @@ -1326,7 +1326,7 @@ extern unsigned int uDialogueType; extern unsigned int uDialogue_SpeakingActorNPC_ID; extern struct LevelDecoration *_591094_decoration; -extern char byte_591098[200]; // idb +extern char sHouseName[200]; // idb extern int uCurrentHouse_Animation; // weak extern char *dword_591164_teleport_map_name; // idb extern int dword_591168_teleport_speedz; // weak @@ -2032,7 +2032,7 @@ int sub_4465DF_check_season(int a1); int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb // void __cdecl crt_construct_5773C4(); -bool __thiscall sub_4466C4(void *_this); +int NPC_EventProcessor(int npc_event_id); void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3); void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename); @@ -2318,7 +2318,7 @@ void __fastcall sub_4B3EF0(int a4); void __fastcall sub_4B3FE5(int a4); void __cdecl sub_4B40E6(); -struct GUIButton *__thiscall _4B4224_UpdateNPCTopics(int _this); +void _4B4224_UpdateNPCTopics(int _this); char __fastcall sub_4B46A5(const char *Str, int a5); int __fastcall sub_4B46F8(int a1); int __cdecl TrainingDialog(); @@ -2343,7 +2343,7 @@ void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z); // idb void __cdecl ArenaFight(); struct Texture *__cdecl sub_4BC8D5(); -struct GUIButton *__cdecl sub_4BCA33(); +struct GUIButton *__cdecl UI_CreateEndConversationButton(); void __fastcall sub_4BCACC_bounties(signed int a1); signed int __cdecl sub_4BD8B5(); bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx);