comparison mm7_3.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
14701 14701
14702 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)]; 14702 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)];
14703 pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("outside", TEXTURE_16BIT_PALETTE)]; 14703 pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("outside", TEXTURE_16BIT_PALETTE)];
14704 v1 = pMapStats->GetMapInfo(pCurrentMapName); 14704 v1 = pMapStats->GetMapInfo(pCurrentMapName);
14705 if ( v1 ) 14705 if ( v1 )
14706 sprintf(byte_591098, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s" 14706 sprintf(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s"
14707 else 14707 else
14708 strcpy(byte_591098, pGlobalTXT_LocalizationStrings[79]);// "Exit" 14708 strcpy(sHouseName, pGlobalTXT_LocalizationStrings[79]);// "Exit"
14709 result = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)17, 0, (int)byte_591098); 14709 result = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)17, 0, (int)sHouseName);
14710 pDialogueWindow = result; 14710 pDialogueWindow = result;
14711 return result; 14711 return result;
14712 } 14712 }
14713 14713
14714 //----- (00444D80) -------------------------------------------------------- 14714 //----- (00444D80) --------------------------------------------------------
15673 LOBYTE(v5) = uTotalActors == uAliveActors; 15673 LOBYTE(v5) = uTotalActors == uAliveActors;
15674 return v5; 15674 return v5;
15675 } 15675 }
15676 15676
15677 //----- (004466C4) -------------------------------------------------------- 15677 //----- (004466C4) --------------------------------------------------------
15678 bool __thiscall sub_4466C4(void *_this) 15678 int NPC_EventProcessor( int npc_event_id )
15679 { 15679 {
15680 signed int v1; // ebp@1 15680 signed int event_index; // ebp@1
15681 bool result; // eax@2 15681 int evt_seq_num; // esi@3
15682 int v3; // esi@3 15682 bool ready_to_exit; // [sp+Ch] [bp-Ch]@3
15683 signed int v4; // edx@3 15683 signed int npc_activity; // [sp+10h] [bp-8h]@3
15684 signed int v5; // eax@4 15684 int result;
15685 unsigned int v6; // ebx@6 15685
15686 char *v7; // eax@6 15686 event_index = 0;
15687 signed int v8; // edi@18 15687 if ( !npc_event_id )
15688 int v9; // eax@19
15689 Player *v10; // [sp+8h] [bp-10h]@18
15690 signed int v11; // [sp+Ch] [bp-Ch]@3
15691 signed int v12; // [sp+10h] [bp-8h]@3
15692 void *v13; // [sp+14h] [bp-4h]@1
15693
15694 v1 = 0;
15695 v13 = _this;
15696 if ( !_this )
15697 return 0; 15688 return 0;
15698 v3 = start_event_seq_number; 15689 evt_seq_num = start_event_seq_number;
15699 pSomeOtherEVT = pGlobalEVT; 15690 pSomeOtherEVT = pGlobalEVT;
15700 uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents; 15691 uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents;
15701 memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, 0xCE40u); 15692 memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400);
15702 v4 = 1; 15693 npc_activity = 1;
15703 v12 = 1; 15694 ready_to_exit = false;
15704 v11 = 0; 15695 if ( uSomeOtherEVT_NumEvents <= 0 )
15705 if ( (signed int)uSomeOtherEVT_NumEvents <= 0 ) 15696 return 2;
15706 goto LABEL_16;
15707 do 15697 do
15708 { 15698 {
15709 v5 = v1; 15699 if ( (pSomeOtherEVT_Events[event_index].uEventID == npc_event_id) && (pSomeOtherEVT_Events[event_index].event_sequence_num == evt_seq_num) )
15710 if ( (void *)pSomeOtherEVT_Events[v1].uEventID == v13 && pSomeOtherEVT_Events[v5].event_sequence_num == v3 ) 15700 {
15711 { 15701 _evt_raw *_evt = (_evt_raw *)&pSomeOtherEVT[pSomeOtherEVT_Events[event_index].uEventOffsetInEVT];
15712 v6 = pSomeOtherEVT_Events[v5].uEventOffsetInEVT; 15702 switch(_evt->_e_type)
15713 v7 = &pSomeOtherEVT[v6]; 15703 {
15714 if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] == 1 ) 15704 case EVENT_Exit:
15715 break; 15705 //exit
15716 if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] == 44 ) 15706 if ( ready_to_exit )
15717 { 15707 result = npc_activity != 0;
15718 v11 = v4; 15708 else
15719 v10 = pParty->pPlayers; 15709 result = 2;
15720 v8 = (unsigned __int8)v7[7] 15710 return result;
15721 + (((unsigned __int8)v7[8] + (((unsigned __int8)v7[9] + ((unsigned __int8)v7[10] << 8)) << 8)) << 8); 15711 break;
15722 while ( 1 ) 15712 case EVENT_OnCanShowDialogItemCmp:
15723 { 15713 ready_to_exit = true;
15724 LOBYTE(v9) = v10->CompareVariable( 15714 //v8 = (unsigned __int8)v7[7] + (((unsigned __int8)v7[8] + (((unsigned __int8)v7[9] + ((unsigned __int8)v7[10] << 8)) << 8)) << 8);
15725 (enum VariableType)((unsigned __int8)pSomeOtherEVT[v6 + 5] 15715 for(int i=0; i<4; ++i)
15726 + ((unsigned __int8)pSomeOtherEVT[v6 + 6] << 8)), 15716 {
15727 v8); 15717 // if (pParty->pPlayers[i].CompareVariable((enum VariableType)((unsigned __int8)pSomeOtherEVT[v6 + 5] + ((unsigned __int8)pSomeOtherEVT[v6 + 6] << 8)),
15728 if ( v9 ) 15718 // v8))
15729 break; 15719 if (pParty->pPlayers[i].CompareVariable((enum VariableType)EVT_WORD(_evt->v5), EVT_DWORD(_evt->v7)))
15730 ++v10; 15720 {
15731 if ( (signed int)v10 >= (signed int)pParty->pHirelings ) 15721 event_index = -1;
15732 goto LABEL_13; 15722 evt_seq_num = EVT_BYTE(_evt->v11)-1;//(unsigned __int8)pSomeOtherEVT[v6 + 11] - 1;
15733 } 15723 break;
15734 } 15724 }
15735 else 15725 }
15736 { 15726 break;
15737 if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] == 45 ) 15727 case EVENT_EndCanShowDialogItem :
15738 break; 15728 if ( ready_to_exit )
15739 if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] == 46 ) 15729 result = npc_activity != 0;
15740 { 15730 else
15741 v11 = v4; 15731 result = 2;
15742 v12 = (unsigned __int8)v7[5]; 15732 return result;
15743 goto LABEL_13; 15733 break;
15744 } 15734 case EVENT_SetCanShowDialogItem :
15745 if ( (unsigned __int8)pSomeOtherEVT[v6 + 4] != 52 15735 ready_to_exit = true;
15746 || !IsActorAlive( 15736 npc_activity = EVT_BYTE(_evt->v5); //(unsigned __int8)v7[5];
15747 (unsigned __int8)v7[5], 15737 break;
15748 (unsigned __int8)v7[6] 15738 case EVENT_IsActorAssasinated :
15749 + (((unsigned __int8)v7[7] + (((unsigned __int8)v7[8] + ((unsigned __int8)v7[9] << 8)) << 8)) << 8), 15739 // if (IsActorAlive( (unsigned __int8)v7[5],
15750 (unsigned __int8)v7[10]) ) 15740 // (unsigned __int8)v7[6] + (((unsigned __int8)v7[7] + (((unsigned __int8)v7[8] + ((unsigned __int8)v7[9] << 8)) << 8)) << 8),
15751 goto LABEL_13; 15741 // (unsigned __int8)v7[10]) )
15752 } 15742 if (IsActorAlive( EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10)))
15753 v1 = -1; 15743 { // drop linear sequense, going to new seq
15754 v3 = (unsigned __int8)pSomeOtherEVT[v6 + 11] - 1; 15744 event_index = -1;
15755 LABEL_13: 15745 evt_seq_num = EVT_BYTE(_evt->v11)-1;//(unsigned __int8)pSomeOtherEVT[v6 + 11] - 1;
15756 ++v3; 15746 }
15757 v4 = 1; 15747 break;
15758 } 15748 }
15759 ++v1; 15749 ++evt_seq_num;
15760 } 15750 }
15761 while ( v1 < (signed int)uSomeOtherEVT_NumEvents ); 15751 ++event_index;
15762 if ( v11 ) 15752 }
15763 result = v12 != 0; 15753 while ( event_index < uSomeOtherEVT_NumEvents );
15754 if ( ready_to_exit )
15755 result = npc_activity != 0;
15764 else 15756 else
15765 LABEL_16:
15766 result = 2; 15757 result = 2;
15767 return result; 15758 return result;
15768 } 15759 }
15769 15760
15770 15761