Mercurial > mm7
changeset 428:24936a5ff8ca
level hints
author | Gloval |
---|---|
date | Sun, 24 Feb 2013 00:48:41 +0400 |
parents | b663aca70246 |
children | f33af971bae7 |
files | Events.cpp Events.h Indoor.cpp Indoor.h Outdoor.cpp mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_data.h |
diffstat | 10 files changed, 89 insertions(+), 108 deletions(-) [+] |
line wrap: on
line diff
--- a/Events.cpp Sat Feb 23 23:23:57 2013 +0400 +++ b/Events.cpp Sun Feb 24 00:48:41 2013 +0400 @@ -33,7 +33,7 @@ signed int uSomeOtherEVT_NumEvents; char *pSomeOtherEVT; EventIndex pSomeEVT_Events[4400]; -unsigned int uSomeEVT_NumEvents; +signed int uSomeEVT_NumEvents; char *pSomeEVT; unsigned int uGlobalEVT_NumEvents; @@ -44,7 +44,7 @@ unsigned int pLevelStrOffsets[500]; unsigned int uLevelStrNumStrings; unsigned int uLevelStrFileSize; -unsigned int uLevelEVT_NumEvents; +signed int uLevelEVT_NumEvents; unsigned int uLevelEVT_Size; char pLevelStr[9216]; char pLevelEVT[9216];
--- a/Events.h Sat Feb 23 23:23:57 2013 +0400 +++ b/Events.h Sun Feb 24 00:48:41 2013 +0400 @@ -302,7 +302,7 @@ extern signed int uSomeOtherEVT_NumEvents; extern char *pSomeOtherEVT; extern EventIndex pSomeEVT_Events[4400]; -extern unsigned int uSomeEVT_NumEvents; +extern signed int uSomeEVT_NumEvents; extern char *pSomeEVT; extern unsigned int uGlobalEVT_NumEvents; @@ -313,7 +313,7 @@ extern unsigned int pLevelStrOffsets[500]; extern unsigned int uLevelStrNumStrings; extern unsigned int uLevelStrFileSize; -extern unsigned int uLevelEVT_NumEvents; +extern signed int uLevelEVT_NumEvents; extern unsigned int uLevelEVT_Size; extern char pLevelStr[9216]; extern char pLevelEVT[9216];
--- a/Indoor.cpp Sat Feb 23 23:23:57 2013 +0400 +++ b/Indoor.cpp Sun Feb 24 00:48:41 2013 +0400 @@ -3458,32 +3458,27 @@ } //----- (0044C23B) -------------------------------------------------------- -int BLVFaceExtra::HasEventint() -{ - signed int v1; // eax@1 - EventIndex *v2; // esi@2 - signed int result; // eax@5 - signed int v4; // eax@6 - - v1 = 0; - if ( (signed int)(uLevelEVT_NumEvents - 1) <= 0 ) - goto LABEL_5; - v2 = pLevelEVT_Index; - while ( v2->uEventID != this->uEventID ) +bool BLVFaceExtra::HasEventint() + { + signed int event_index; // eax@1 + _evt_raw* start_evt; + _evt_raw* end_evt; + + event_index = 0; + if ( (uLevelEVT_NumEvents - 1) <= 0 ) + return false; + while ( pLevelEVT_Index[event_index].uEventID != this->uEventID ) { - ++v1; - ++v2; - if ( v1 >= (signed int)(uLevelEVT_NumEvents - 1) ) - goto LABEL_5; + ++event_index; + if ( event_index >= (signed int)(uLevelEVT_NumEvents - 1) ) + return false; } - v4 = v1; - if ( pLevelEVT[pLevelEVT_Index[v4 + 1].uEventOffsetInEVT + 4] != 1 - || pLevelEVT[pLevelEVT_Index[v4].uEventOffsetInEVT + 4] != 4 ) -LABEL_5: - result = 0; + end_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index+1].uEventOffsetInEVT]; + start_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; + if ( (end_evt->_e_type != EVENT_Exit) || (start_evt->_e_type!= EVENT_MouseOver) ) + return false; else - result = 1; - return result; + return true; }
--- a/Indoor.h Sat Feb 23 23:23:57 2013 +0400 +++ b/Indoor.h Sun Feb 24 00:48:41 2013 +0400 @@ -316,7 +316,7 @@ #pragma pack(push, 1) struct BLVFaceExtra { - int HasEventint(); +bool HasEventint(); __int16 field_0; __int16 field_2;
--- a/Outdoor.cpp Sat Feb 23 23:23:57 2013 +0400 +++ b/Outdoor.cpp Sun Feb 24 00:48:41 2013 +0400 @@ -3143,28 +3143,23 @@ //----- (0044C1E8) -------------------------------------------------------- bool ODMFace::HasEventHint() { - signed int v1; // eax@1 - EventIndex *v2; // esi@2 - bool result; // eax@5 - signed int v4; // eax@6 + signed int event_index; // eax@1 + _evt_raw* start_evt; + _evt_raw* end_evt; - v1 = 0; - if ( (signed int)(uLevelEVT_NumEvents - 1) <= 0 ) - goto LABEL_5; - v2 = pLevelEVT_Index; - while ( v2->uEventID != this->sCogTriggeredID ) + event_index = 0; + if ( (uLevelEVT_NumEvents - 1) <= 0 ) + return false; + while ( pLevelEVT_Index[event_index].uEventID != this->sCogTriggeredID ) { - ++v1; - ++v2; - if ( v1 >= (signed int)(uLevelEVT_NumEvents - 1) ) - goto LABEL_5; + ++event_index; + if ( event_index >= (signed int)(uLevelEVT_NumEvents - 1) ) + return false; } - v4 = v1; - if ( pLevelEVT[pLevelEVT_Index[v4 + 1].uEventOffsetInEVT + 4] != 1 - || pLevelEVT[pLevelEVT_Index[v4].uEventOffsetInEVT + 4] != 4 ) -LABEL_5: - result = 0; + end_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index+1].uEventOffsetInEVT]; + start_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; + if ( (end_evt->_e_type != EVENT_Exit) || (start_evt->_e_type!= EVENT_MouseOver) ) + return false; else - result = 1; - return result; + return true; } \ No newline at end of file
--- a/mm7_1.cpp Sat Feb 23 23:23:57 2013 +0400 +++ b/mm7_1.cpp Sun Feb 24 00:48:41 2013 +0400 @@ -4253,7 +4253,7 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - v22 = _444732_GetEventHintString(v25); + v22 = GetEventHintString(v25); if ( !v22 ) //goto _return; { @@ -4291,7 +4291,7 @@ { v21 = pOutdoor->pBModels[(signed int)(unsigned __int16)v18 >> 9].pFaces[v19 & 0x3F].sCogTriggeredID; //goto LABEL_71; - if ( !v21 || (v22 = _444732_GetEventHintString(v21)) == 0 ) + if ( !v21 || (v22 = GetEventHintString(v21)) == 0 ) //goto LABEL_73; { pMouse->uPointingObjectID = 0; @@ -4328,7 +4328,7 @@ { v21 = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; //LABEL_71: - if ( !v21 || (v22 = _444732_GetEventHintString(v21)) == 0 ) + if ( !v21 || (v22 = GetEventHintString(v21)) == 0 ) //goto LABEL_73; { pMouse->uPointingObjectID = 0;
--- a/mm7_2.cpp Sat Feb 23 23:23:57 2013 +0400 +++ b/mm7_2.cpp Sun Feb 24 00:48:41 2013 +0400 @@ -15696,7 +15696,7 @@ } if ( v22 ) { - v23 = _444732_GetEventHintString(v22); + v23 = GetEventHintString(v22); if ( v23 ) goto LABEL_36; } @@ -15711,7 +15711,7 @@ v27 = v25->field_16_event_id; if ( v27 ) { - v23 = _444732_GetEventHintString(v27); + v23 = GetEventHintString(v27); if ( !v23 ) return v19; goto LABEL_36;
--- a/mm7_3.cpp Sat Feb 23 23:23:57 2013 +0400 +++ b/mm7_3.cpp Sun Feb 24 00:48:41 2013 +0400 @@ -14466,7 +14466,7 @@ { if ( !(BYTE2(v12->uAttributes) & 0x10) ) { - v14 = _444732_GetEventHintString(v13); + v14 = GetEventHintString(v13); v15 = v14; if ( v14 ) { @@ -14567,7 +14567,7 @@ { if ( !(BYTE2(v11->uAttributes) & 0x10) ) { - v13 = _444732_GetEventHintString(v12); + v13 = GetEventHintString(v12); v14 = v13; if ( v13 ) {
--- a/mm7_4.cpp Sat Feb 23 23:23:57 2013 +0400 +++ b/mm7_4.cpp Sun Feb 24 00:48:41 2013 +0400 @@ -14569,66 +14569,57 @@ //----- (00444732) -------------------------------------------------------- -char *_444732_GetEventHintString(unsigned int uEventID) -{ - signed int v1; // edx@1 - char *v2; // eax@2 - int v3; // ebx@4 - int v4; // esi@4 +char *GetEventHintString(unsigned int uEventID) +{ + signed int event_index; // edx@1 + int event_pos; // esi@4 char *result; // eax@6 - int v6; // eax@9 - char *i; // esi@11 - int v8; // edx@12 - - v1 = 0; - if ( (signed int)uLevelEVT_NumEvents <= 0 ) - { -LABEL_6: - result = 0; - } - else - { - v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; + unsigned int str_index; // eax@9 + int i; // esi@11 + _evt_raw* test_evt; + _evt_raw* last_evt; + + event_index = 0; + if ( uLevelEVT_NumEvents <= 0 ) + return NULL; + + //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; while ( 1 ) { - if ( *((int *)v2 - 2) == uEventID ) - { - v3 = *(int *)v2; - v4 = *((int *)v2 + 3); - if ( pLevelEVT[*(int *)v2 + 4] == 4 ) + if ( pLevelEVT_Index[event_index].uEventID == uEventID ) + { + test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; + last_evt=test_evt; + event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; + if ( test_evt->_e_type == EVENT_MouseOver ) break; } - ++v1; - v2 += 12; - if ( v1 >= (signed int)uLevelEVT_NumEvents ) - goto LABEL_6; - } - if ( pLevelEVT[v4 + 4] == 2 ) - { - v6 = (unsigned __int8)pLevelEVT[v4 + 5] - + (((unsigned __int8)pLevelEVT[v4 + 6] - + (((unsigned __int8)pLevelEVT[v4 + 7] + ((unsigned __int8)pLevelEVT[v4 + 8] << 8)) << 8)) << 8); -LABEL_10: - //result = (char *)p2DEvents_minus1_::04[13 * v6]; - result = (char *)p2DEvents[v6 - 1].pName; + ++event_index; + if ( event_index >= uLevelEVT_NumEvents ) + return NULL; + } + test_evt=(_evt_raw*)&pLevelEVT[event_pos]; + if ( test_evt->_e_type== EVENT_SpeakInHouse ) + { + str_index = EVT_DWORD(test_evt->v5); + result = (char *)p2DEvents[str_index - 1].pName; } else { - for ( i = (char *)pLevelEVT_Index + 4 * (3 * v1 + 3); *(int *)i == uEventID; i += 12 ) - { - v8 = *((int *)i + 2); - if ( pLevelEVT[v8 + 4] == 2 ) - { - v6 = (unsigned __int8)pLevelEVT[v8 + 5] - + (((unsigned __int8)pLevelEVT[v8 + 6] - + (((unsigned __int8)pLevelEVT[v8 + 7] + ((unsigned __int8)pLevelEVT[v8 + 8] << 8)) << 8)) << 8); - if ( (unsigned int)v6 < 0x258 ) - goto LABEL_10; - } - } - result = &pLevelStr[pLevelStrOffsets[(unsigned __int8)pLevelEVT[v3 + 5]]]; - } - } + for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) + { + event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; + test_evt=(_evt_raw*)&pLevelEVT[event_pos]; + if ( test_evt->_e_type == EVENT_SpeakInHouse ) + { + str_index = EVT_DWORD(test_evt->v5); + if ( str_index < 600 ) + return (char *)p2DEvents[str_index - 1].pName; + } + } + result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; + } + return result; }
--- a/mm7_data.h Sat Feb 23 23:23:57 2013 +0400 +++ b/mm7_data.h Sun Feb 24 00:48:41 2013 +0400 @@ -2011,7 +2011,7 @@ void __thiscall Level_LoadEvtAndStr(const char *pLevelName); char *__cdecl _4443D5_GetMinimapRightClickText(); const char *__cdecl sub_444564(); -char *__thiscall _444732_GetEventHintString(unsigned int uEventID); // idb +char *__thiscall GetEventHintString(unsigned int uEventID); // idb unsigned int __fastcall sub_444839_move_map(unsigned int a1, int a2, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName); // idb char *__cdecl TransitionUI_Draw(); struct GUIWindow *__cdecl UI_CreateTravelDialogue();