Mercurial > mm7
changeset 2266:01489aec3cb0
EventProcessor cleared
author | Ritor1 |
---|---|
date | Sat, 08 Mar 2014 23:53:00 +0600 |
parents | f38f53397bc0 |
children | 6532bbac1a9e |
files | DecorationList.cpp Events.cpp |
diffstat | 2 files changed, 75 insertions(+), 140 deletions(-) [+] |
line wrap: on
line diff
--- a/DecorationList.cpp Sat Mar 08 22:23:27 2014 +0600 +++ b/DecorationList.cpp Sat Mar 08 23:53:00 2014 +0600 @@ -66,7 +66,6 @@ unsigned __int8 v25; // of@16 int j; // edi@17 const char *v27; // esi@18 - int v28; // eax@19 int v29; // eax@21 int v30; // eax@23 int v31; // eax@25 @@ -224,10 +223,7 @@ } } else - { - v28 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; - *(char *)v28 |= 1u; - } + v2->pDecorations[v2->uNumDecorations].uFlags |= 1; } } ++v2->uNumDecorations; @@ -254,7 +250,6 @@ //----- (004488B6) -------------------------------------------------------- unsigned __int16 DecorationList::GetDecorIdByName(const char *pName) { - if ( pName && (signed int)this->uNumDecorations > 1 ) { for ( uint uID = 1; uID < (signed int)this->uNumDecorations; ++uID )
--- a/Events.cpp Sat Mar 08 22:23:27 2014 +0600 +++ b/Events.cpp Sat Mar 08 23:53:00 2014 +0600 @@ -282,17 +282,9 @@ { unsigned int v3; // eax@5 signed int v4; // esi@7 - //char *v5; // eax@8 Player *v6; // ecx@8 - //char *v7; // ebp@8 - //signed int v8; // edx@10 - //int v9; // edi@12 - //ByteArray *v10; // esi@12 int v11; // eax@14 char *v12; // eax@15 - //char *v13; // edi@21 - int v14; // ebp@21 - int v15; // edi@21 const char *v16; // esi@21 bool v17; // edx@21 int v18; // ecx@22 @@ -302,11 +294,9 @@ int v22; // edx@40 int v23; // eax@40 unsigned __int16 v24; // ax@45 - int v25; // eax@54 LevelDecoration *v26; // eax@55 int v27; // eax@57 int v28; // ecx@57 - //int v29; // edx@58 int pEventID; // eax@58 int pNPC_ID; // ecx@58 int pIndex; // esi@58 @@ -362,11 +352,6 @@ Player *v82; // esi@201 int v83; // eax@212 int v84; // ebp@220 - signed int v85; // ebp@224 - char v86; // al@224 - Player *v87; // esi@227 - Player *v88; // ecx@231 - int v89; // ecx@232 int v90; // eax@243 const char *v91; // ecx@247 int v92; // eax@251 @@ -378,26 +363,17 @@ unsigned int v98; // edx@265 const char *v99; // esi@267 int v100; // edx@267 - //char *v101; // edi@281 unsigned int v102; // esi@281 int v103; // edi@284 int v104; // eax@288 int v105; // edx@294 int v106; // [sp-20h] [bp-4C8h]@278 - signed int v107; // [sp-1Ch] [bp-4C4h]@278 - unsigned int v108; // [sp-18h] [bp-4C0h]@278 signed int v109; // [sp-14h] [bp-4BCh]@278 signed int v110; // [sp-10h] [bp-4B8h]@278 - int v111; // [sp-Ch] [bp-4B4h]@278 - // Event *v112; // [sp-8h] [bp-4B0h]@5 int v113; // [sp-8h] [bp-4B0h]@106 int v114; // [sp-8h] [bp-4B0h]@117 - signed int v115; // [sp-8h] [bp-4B0h]@231 - unsigned int v116; // [sp-8h] [bp-4B0h]@278 int v117; // [sp-4h] [bp-4ACh]@106 int v118; // [sp-4h] [bp-4ACh]@117 - int v119; // [sp-4h] [bp-4ACh]@231 - int v120; // [sp-4h] [bp-4ACh]@278 int v121; // [sp-4h] [bp-4ACh]@294 int curr_seq_num; // [sp+10h] [bp-498h]@4 //char *v123; // [sp+14h] [bp-494h]@0 @@ -464,7 +440,11 @@ while ( 1 ) { if ( dword_5B65C4_cancelEventProcessing ) - goto LABEL_301; + { + if ( v133 == 1 ) + OnMapLeave(); + return; + } //v8 = v4; if ( pSomeEVT_Events[v4].uEventID == uEventID && pSomeEVT_Events[v4].event_sequence_num == curr_seq_num ) { @@ -501,18 +481,18 @@ //v13 = &pSomeEVT[v9]; //v14 = (unsigned __int8)v13[5]; //v15 = (unsigned __int8)v13[6]; - v14 = _evt->v5; - v15 = _evt->v6; + //v14 = _evt->v5; + //v15 = _evt->v6; strcpy(Str, Source); v16 = RemoveQuotes(Str); - pVideoPlayer->MovieLoop(v16, 0, v14, 1); + pVideoPlayer->MovieLoop(v16, 0, _evt->v5, 1); if ( !_stricmp(v16, "arbiter good") ) { pParty->alignment = PartyAlignment_Good; v18 = 0; LOBYTE(v17) = 1; SetUserInterface(PartyAlignment_Good, v17); - if ( !v15 || v128 == 3 ) + if ( !_evt->v6 || v128 == 3 ) { pCurrentScreen = v128; if ( v128 == 3 ) @@ -534,7 +514,7 @@ pParty->alignment = PartyAlignment_Evil; LOBYTE(v17) = 1; SetUserInterface(PartyAlignment_Evil, v17); - if ( !v15 || v128 == 3 ) + if ( !_evt->v6 || v128 == 3 ) { pCurrentScreen = v128; if ( v128 == 3 ) @@ -556,13 +536,13 @@ pParty->RestAndHeal(); pParty->days_played_without_rest = 0; } - if ( !v15 || v128 == 3 ) + if ( !_evt->v6 || v128 == 3 ) { pCurrentScreen = v128; if ( v128 == 3 ) pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; if ( v128 == 13 ) - pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); + pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1); } ++curr_seq_num; v4 = v124; @@ -577,15 +557,11 @@ if ( player_choose < 0 ) goto LABEL_47; if ( player_choose <= 3 ) - { v24 = pParty->pPlayers[0].pActiveSkills[3486 * player_choose + _evt->v5]; - } else { if ( player_choose == 4 ) - { v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5]; - } else { if ( player_choose == 5 ) @@ -612,8 +588,11 @@ break; } } - v11 = _evt->v11; - goto LABEL_130; + //v11 = _evt->v11; + curr_seq_num = _evt->v11 - 1; + ++curr_seq_num; + v4 = v124; + break; } LABEL_47: //v10 = (ByteArray *)&v5[v9]; @@ -626,8 +605,10 @@ v139 = v24 & 0x100; if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) ) { - v11 = _evt->v11; - goto LABEL_130; + curr_seq_num = _evt->v11 - 1; + ++curr_seq_num; + v4 = v124; + break; } ++curr_seq_num; v4 = v124; @@ -647,9 +628,7 @@ GameUI_InitializeDialogue(&Dst, false); } else - { bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); - } ++curr_seq_num; v4 = v124; @@ -657,11 +636,9 @@ //v7 = ""; break; case EVENT_ChangeEvent: - v25 = EVT_DWORD(_evt->v5); - if ( v25 ) - { + //v25 = EVT_DWORD(_evt->v5); + if ( EVT_DWORD(_evt->v5) ) stru_5E4C90_MapPersistVars._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124; - } else { v26 = (LevelDecoration *)activeLevelDecoration; @@ -812,7 +789,7 @@ pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_HouseInterior, 165, 0); v48 = window_SpeakInHouse->pControlsHead; - if ( v48 ) + if ( window_SpeakInHouse->pControlsHead ) { do { @@ -852,14 +829,13 @@ pParty->pPlayers[uActiveCharacter].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); else if ( _evt->v5 == 5 ) //all players { - for(int i=0; i<4; ++i) + for(int i = 0; i < 4; ++i) pParty->pPlayers[i].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); } else //random player pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); ++curr_seq_num; v4 = v124; - break; case EVENT_CharacterAnimation: if ( _evt->v5 <= 3u ) //someone @@ -916,7 +892,7 @@ } else if ( player_choose == 5 )//all { - v130=0; + v130 = 0; for(int i = 1; i < 5; ++i) { if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) @@ -1029,16 +1005,10 @@ else if ( player_choose == 5 )//all { for(int i = 1; i < 5; ++i) - { pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } } else if ( player_choose == 6 ) //random - { - player_choose = rand() % 4; - pParty->pPlayers[player_choose].SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } -//substract: + pParty->pPlayers[rand() % 4].SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); ++curr_seq_num; v4 = v124; break; @@ -1058,11 +1028,7 @@ pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); } else if ( player_choose == 6 ) //random - { - player_choose = rand() % 4; - pPlayer = &pParty->pPlayers[player_choose]; - pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } + pParty->pPlayers[rand() % 4].SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); ++curr_seq_num; v4 = v124; break; @@ -1084,10 +1050,7 @@ pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); } else if ( player_choose == 6 ) //random - { - player_choose = rand() % 4; - pParty->pPlayers[player_choose].AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } + pParty->pPlayers[rand() % 4].AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); v83 = EVT_WORD(_evt->v5); if (v83 == 21 || // gold well on emerald isle v83 == 22 || v83 == 23 || v83 == 24 ) @@ -1102,11 +1065,9 @@ if ( !entry_line ) { strcpy(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]); - v105 = curr_seq_num; - v121 = 26; -LABEL_295: - sub_4451A8_press_any_key(uEventID, v105, v121); -LABEL_301: + //v105 = curr_seq_num; + //v121 = 26; + sub_4451A8_press_any_key(uEventID, curr_seq_num, 26); if ( v133 == 1 ) OnMapLeave(); return; @@ -1116,9 +1077,9 @@ || !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[v84]]) ) { v11 = _evt->v17; -LABEL_130: +//LABEL_130: //v124 = -1; -LABEL_131: +//LABEL_131: curr_seq_num = v11 - 1; } ++curr_seq_num; @@ -1136,20 +1097,16 @@ v4 = v124; break; case EVENT_ReceiveDamage: - v85 = EVT_DWORD(_evt->v7 ); - v86 = _evt->v5; - if ( (unsigned __int8)v86 <= 3 ) + if ( (unsigned __int8)_evt->v5 <= 3 ) { - v119 = _evt->v6; - v115 = EVT_DWORD(_evt->v7 ); - v89 = (unsigned __int8)v86; - v88 = &pParty->pPlayers[v89]; - v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); + //v119 = _evt->v6; + //v115 = EVT_DWORD(_evt->v7 ); + pParty->pPlayers[(unsigned __int8)_evt->v5].ReceiveDamage(EVT_DWORD(_evt->v7 ), (DAMAGE_TYPE)_evt->v6); ++curr_seq_num; v4 = v124; break; } - if ( v86 == 4 ) + if ( _evt->v5 == 4 ) { if ( !uActiveCharacter ) { @@ -1160,21 +1117,14 @@ //v7 = ""; break; } - v119 = _evt->v6; - v88 = pPlayers[uActiveCharacter]; - v115 = EVT_DWORD(_evt->v7 ); - v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); + pPlayers[uActiveCharacter]->ReceiveDamage(EVT_DWORD(_evt->v7 ), (DAMAGE_TYPE)_evt->v6); ++curr_seq_num; v4 = v124; break; } - if ( v86 != 5 ) + if ( _evt->v5 != 5 ) { - v119 = _evt->v6; - v115 = EVT_DWORD(_evt->v7 ); - v89 = rand() % 4; - v88 = &pParty->pPlayers[v89]; - v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); + pParty->pPlayers[rand() % 4].ReceiveDamage(EVT_DWORD(_evt->v7 ), (DAMAGE_TYPE)_evt->v6); ++curr_seq_num; v4 = v124; @@ -1182,13 +1132,8 @@ //v7 = ""; break; } - v87 = pParty->pPlayers.data(); - do - { - v87->ReceiveDamage(v85, (DAMAGE_TYPE)_evt->v6); - ++v87; - } - while ( (signed int)v87 < (signed int)pParty->pHirelings.data() ); + for ( uint pl_id = 0;pl_id < 4; pl_id++ ) + pParty->pPlayers[pl_id].ReceiveDamage(EVT_DWORD(_evt->v7 ), (DAMAGE_TYPE)_evt->v6); ++curr_seq_num; v4 = v124; @@ -1249,14 +1194,12 @@ if ( activeLevelDecoration ) { if ( activeLevelDecoration == (LevelDecoration*)1 ) - { current_npc_text = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; - } if ( canShowMessages == 1 ) { v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; //LABEL_248: - ShowStatusBarString(v91, 2u); + ShowStatusBarString(v91, 2); } } else @@ -1274,17 +1217,15 @@ //v7 = ""; break; case EVENT_ShowMessage: - v92 = EVT_DWORD(_evt->v5 ); + //v92 = EVT_DWORD(_evt->v5 ); if ( activeLevelDecoration ) { - v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; + current_npc_text = pNPCTopics[EVT_DWORD(_evt->v5 )-1].pText;//(&dword_721664)[8 * v92]; byte_5B0938[0] = 0; - current_npc_text = v93; + //current_npc_text = v93; } else - { - strcpy(byte_5B0938.data(), &pLevelStr[pLevelStrOffsets[v92]]); - } + strcpy(byte_5B0938.data(), &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]); ++curr_seq_num; v4 = v124; @@ -1340,7 +1281,11 @@ break; case EVENT_OpenChest: if ( !Chest::Open(_evt->v5) ) - goto LABEL_301; + { + if ( v133 == 1 ) + OnMapLeave(); + return; + } ++curr_seq_num; v4 = v124; @@ -1363,15 +1308,15 @@ TransitionUI_Load(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); dword_5C3418 = uEventID; dword_5C341C = curr_seq_num + 1; - goto LABEL_301; + if ( v133 == 1 ) + OnMapLeave(); + return; } _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); _5B65A8_npcdata_uflags_or_other = v94; _5B65B0_npcdata_rep_or_other = v126; if ( v129 == -1 ) - { v98 = _5B65B4_npcdata_loword_house_or_other; - } else { v98 = v129 & stru_5C6E00->uDoublePiMask; @@ -1393,13 +1338,6 @@ if ( _5B65B4_npcdata_loword_house_or_other != -1 ) pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; _5B65B4_npcdata_loword_house_or_other = -1; - v120 = 0; - v116 = 0; - v111 = 0; - v110 = 0; - v109 = -1; - v108 = 0; - v107 = 0; pParty->sRotationX = v95; pParty->uFallSpeed = v134; dword_5B65C0 = 0; @@ -1409,8 +1347,7 @@ _5B65AC_npcdata_fame_or_other = 0; _5B65A8_npcdata_uflags_or_other = 0; v106 = 232; -LABEL_280: - pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120); + pAudioPlayer->PlaySound((SoundID)v106, 0, 0, -1, 0, 0, 0, 0); } } else @@ -1450,20 +1387,17 @@ //v7 = ""; break; case EVENT_PlaySound: - v120 = 0; - v116 = 0; - v111 = 0; v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - v108 = 0; - v107 = 0; v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - goto LABEL_280; + pAudioPlayer->PlaySound((SoundID)v106, 0, 0, v109, v110, 0, 0, 0); + ++curr_seq_num; + v4 = v124; + break; case EVENT_GiveItem: item.Reset(); //v101 = &pSomeEVT[v9]; - v102 = _evt->v7 - + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); + v102 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item); if ( v102 ) item.uItemID = v102; @@ -1496,9 +1430,12 @@ //v7 = ""; break; case EVENT_PressAnyKey: - v121 = 33; - v105 = curr_seq_num + 1; - goto LABEL_295; + //v121 = 33; + //v105 = curr_seq_num + 1; + sub_4451A8_press_any_key(uEventID, curr_seq_num + 1, 33); + if ( v133 == 1 ) + OnMapLeave(); + return; case EVENT_Exit: if ( v133 == 1 ) OnMapLeave(); @@ -1515,8 +1452,11 @@ ++v4; v124 = v4; if ( v4 >= uSomeEVT_NumEvents ) - goto LABEL_301; - //} + { + if ( v133 == 1 ) + OnMapLeave(); + return; + } } }