# HG changeset patch # User Ritor1 # Date 1351440821 -21600 # Node ID 517e33e08d936b6a0fa1f2e79d5a9756fd974d8e # Parent a84fb3752681ced518d55344816b199ee8711e11# Parent 8b0c4d62647759b1cbfcb4a284282055164d3605 Слияние diff -r a84fb3752681 -r 517e33e08d93 Indoor.h --- a/Indoor.h Sun Oct 28 22:13:23 2012 +0600 +++ b/Indoor.h Sun Oct 28 22:13:41 2012 +0600 @@ -284,6 +284,7 @@ inline bool Visible() const {return !Invisible();} inline bool TwoSided() const {return uAttributes & FACE_TWO_SIDED;} inline bool Animated() const {return uAttributes & FACE_TEXTURE_ANIMATED;} + inline bool Clickable() const {return uAttributes & FACE_CLICKABLE;} struct Plane_float_ pFacePlane; diff -r a84fb3752681 -r 517e33e08d93 Keyboard.cpp --- a/Keyboard.cpp Sun Oct 28 22:13:23 2012 +0600 +++ b/Keyboard.cpp Sun Oct 28 22:13:41 2012 +0600 @@ -716,9 +716,9 @@ return VK_UP; if ( !strcmp(Str, "DOWN") ) return VK_DOWN; - if ( !strcmp(Str, ascii_4E2D48) ) + if (!strcmp(Str, "") || !strcmp(Str, "LEFT")) return VK_LEFT; - if ( !strcmp(Str, ascii_4E2D40) ) + if (!strcmp(Str, "") || !strcmp(Str, "RIGHT")) return VK_RIGHT; if ( !strcmp(Str, "RETURN") ) return VK_RETURN; diff -r a84fb3752681 -r 517e33e08d93 Vis.cpp --- a/Vis.cpp Sun Oct 28 22:13:23 2012 +0600 +++ b/Vis.cpp Sun Oct 28 22:13:41 2012 +0600 @@ -1419,6 +1419,8 @@ Vis *thisa; // [sp+68h] [bp-8h]@1 RenderVertexSoft *v16; // [sp+6Ch] [bp-4h]@2 + __debugbreak(); + result = sRight; thisa = this; if ( sRight > sLeft ) diff -r a84fb3752681 -r 517e33e08d93 mm7_3.cpp --- a/mm7_3.cpp Sun Oct 28 22:13:23 2012 +0600 +++ b/mm7_3.cpp Sun Oct 28 22:13:41 2012 +0600 @@ -2429,6 +2429,7 @@ int v89; // [sp+58h] [bp-8h]@1 int angle; // [sp+5Ch] [bp-4h]@47 + uFaceEvent = 0; v89 = pParty->uFallSpeed; v1 = 0; new_party_y = pParty->vPosition.y; @@ -2463,9 +2464,8 @@ blv_prev_party_x = pParty->vPosition.x; blv_prev_party_z = pParty->vPosition.y; blv_prev_party_y = pParty->vPosition.z; - if ( pParty->bTurnBasedModeOn != 1 ) - { - __debugbreak(); + if (!pParty->bTurnBasedModeOn) + { auto v67 = GetTickCount() / 500; if (dword_720CDC != v67 ) { @@ -2575,7 +2575,6 @@ v16 = (double)v82 * fTurnSpeedMultiplier; goto LABEL_55; case PARTY_FastTurnLeft: - __debugbreak(); v12 = uTurnSpeed; if ( uTurnSpeed ) { @@ -2591,7 +2590,6 @@ angle = stru_5C6E00->uDoublePiMask & v14; goto LABEL_87; case PARTY_FastTurnRight: - __debugbreak(); LODWORD(v15) = uTurnSpeed; if ( !uTurnSpeed ) { diff -r a84fb3752681 -r 517e33e08d93 mm7_4.cpp --- a/mm7_4.cpp Sun Oct 28 22:13:23 2012 +0600 +++ b/mm7_4.cpp Sun Oct 28 22:13:41 2012 +0600 @@ -234,15 +234,15 @@ // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; //----- (0046CEC3) -------------------------------------------------------- -int __fastcall _46CEC3_get_floor_level(signed int a1, signed int a2, int a3, unsigned int uSectorID, unsigned int *pFaceID) -{ - BLVSector *v5; // edi@1 - int v6; // ecx@1 - Vec3_short_ *v7; // edx@1 - BLVFace *v8; // esi@2 - int v9; // eax@8 - int v10; // edi@8 - int v11; // eax@10 +int _46CEC3_get_floor_level(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) +{ + //BLVSector *v5; // edi@1 + //int v6; // ecx@1 + //Vec3_short_ *v7; // edx@1 + //BLVFace *v8; // esi@2 + //int v9; // eax@8 + //int v10; // edi@8 + //int v11; // eax@10 int v12; // ecx@10 int v13; // ecx@13 signed int v14; // ebx@14 @@ -254,9 +254,9 @@ PolygonType v20; // al@25 int v21; // eax@27 int v22; // ecx@29 - BLVFace *v23; // eax@33 - int v24; // esi@39 - int v25; // edi@39 + //BLVFace *v23; // eax@33 + //int v24; // esi@39 + //int v25; // edi@39 int v26; // esi@41 int v27; // ecx@43 signed int v28; // eax@45 @@ -270,80 +270,86 @@ int result; // eax@57 int v37; // edi@61 int v38; // edx@62 - int v39; // [sp+Ch] [bp-34h]@1 - int v40; // [sp+10h] [bp-30h]@2 + //int v39; // [sp+Ch] [bp-34h]@1 + //int v40; // [sp+10h] [bp-30h]@2 int v41; // [sp+14h] [bp-2Ch]@12 - unsigned __int16 *v42; // [sp+18h] [bp-28h]@1 - BLVSector *v43; // [sp+1Ch] [bp-24h]@1 + //unsigned __int16 *v42; // [sp+18h] [bp-28h]@1 + //BLVSector *v43; // [sp+1Ch] [bp-24h]@1 int v44; // [sp+20h] [bp-20h]@10 int v45; // [sp+24h] [bp-1Ch]@10 - signed int v46; // [sp+24h] [bp-1Ch]@38 + //signed int v46; // [sp+24h] [bp-1Ch]@38 bool v47; // [sp+24h] [bp-1Ch]@43 bool v48; // [sp+28h] [bp-18h]@10 bool v49; // [sp+28h] [bp-18h]@41 bool v50; // [sp+2Ch] [bp-14h]@12 int v51; // [sp+2Ch] [bp-14h]@41 - signed int v52; // [sp+30h] [bp-10h]@7 + //signed int v52; // [sp+30h] [bp-10h]@7 signed int v53; // [sp+30h] [bp-10h]@10 signed int v54; // [sp+30h] [bp-10h]@41 signed int v55; // [sp+34h] [bp-Ch]@1 - signed int v56; // [sp+38h] [bp-8h]@1 - signed int v57; // [sp+3Ch] [bp-4h]@1 - int uSectorIDa; // [sp+4Ch] [bp+Ch]@1 - signed int uSectorIDb; // [sp+4Ch] [bp+Ch]@32 - - __debugbreak(); - - v5 = &pIndoor->pSectors[uSectorID]; - v57 = a2; - v56 = a1; - v6 = 0; + //signed int v56; // [sp+38h] [bp-8h]@1 + //signed int v57; // [sp+3Ch] [bp-4h]@1 + //int uSectorIDa; // [sp+4Ch] [bp+Ch]@1 + //signed int uSectorIDb; // [sp+4Ch] [bp+Ch]@32 + + LOG_DECOMPILATION_WARNING(); + + //auto a1 = x; + //auto a2 = y; + //auto a3 = z; + + //v5 = &pIndoor->pSectors[uSectorID]; + auto pSector = &pIndoor->pSectors[uSectorID]; + //v57 = y; + //v56 = x; + //v6 = 0; v55 = 0; - v43 = v5; - v42 = v5->pFloors; - v7 = pIndoor->pVertices; - v39 = v5->uNumFloors; - for ( uSectorIDa = 0; uSectorIDa < v39; ++uSectorIDa ) - { - v40 = (int)&v42[v6]; - v8 = &pIndoor->pFaces[*(short *)v40]; - if ( !(BYTE3(v8->uAttributes) & 0x20) - && v56 <= v8->pBounding.x2 - && v56 >= v8->pBounding.x1 - && v57 <= v8->pBounding.y2 - && v57 >= v8->pBounding.y1 ) - { - v52 = 0; - if ( v8->uNumVertices ) - { - do - { - v9 = v52; - v10 = 2 * v52; - word_721460[2 * v52] = v8->pXInterceptDisplacements[v52] + v7[v8->pVertexIDs[v52]].x; - word_721390[2 * v52] = v8->pYInterceptDisplacements[v9] + v7[v8->pVertexIDs[v9]].y; - word_721460[2 * v52++ + 1] = v8->pXInterceptDisplacements[v9] + v7[v8->pVertexIDs[v9 + 1]].x; - word_721390[v10 + 1] = v8->pYInterceptDisplacements[v9] + v7[v8->pVertexIDs[v9 + 1]].y; - } - while ( v52 < v8->uNumVertices ); - v5 = v43; - } - v44 = 2 * v8->uNumVertices; - v11 = 2 * v8->uNumVertices; - word_721460[v11] = word_721460[0]; - word_721390[v11] = word_721390[0]; - v48 = word_721390[0] >= v57; + //v43 = v5; + //v42 = v5->pFloors; + //v7 = pIndoor->pVertices; + //v39 = v5->uNumFloors; + //for ( uSectorIDa = 0; uSectorIDa < v39; ++uSectorIDa ) + for (uint i = 0; i < pSector->uNumFloors; ++i) + { + //v40 = (int)&v42[v6]; + //v8 = &pIndoor->pFaces[pSector->pFloors[i]]; + auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; + if (pFloor->Clickable()) + continue; + + if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && + y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) + { + //v52 = 0; + for (uint j = 0; j < pFloor->uNumVertices; ++j) + { + //v9 = v52; + //v10 = 2 * v52; + word_721460[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; + word_721460[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; + word_721390[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; + word_721390[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; + //} + //while ( v52 < v8->uNumVertices ); + //v5 = v43; + } + v44 = 2 * pFloor->uNumVertices; + //v11 = 2 * pFloor->uNumVertices; + word_721460[2 * pFloor->uNumVertices] = word_721460[0]; + word_721390[2 * pFloor->uNumVertices] = word_721390[0]; + + v48 = word_721390[0] >= y; v12 = 0; v53 = 0; v45 = 0; - if ( v44 > 0 ) + if ( pFloor->uNumVertices > 0 ) { do { if ( v53 >= 2 ) break; v41 = word_721390[v12 + 1]; - v50 = word_721390[v12 + 1] >= v57; + v50 = word_721390[v12 + 1] >= y; if ( v48 == v50 ) { v13 = v45; @@ -351,24 +357,24 @@ else { v13 = v45; - if ( word_721460[v45 + 1] >= v56 ) + if ( word_721460[v45 + 1] >= x ) v14 = 0; else v14 = 2; - v15 = v14 | word_721460[v45] < v56; + v15 = v14 | word_721460[v45] < x; if ( v15 != 3 ) { if ( !v15 || (v16 = word_721390[v45], v17 = v41 - v16, - v18 = v57 - v16, + v18 = y - v16, LODWORD(v19) = v18 << 16, HIDWORD(v19) = v18 >> 16, - v7 = pIndoor->pVertices, + //v7 = pIndoor->pVertices, (signed int)(((unsigned __int64)(((signed int)word_721460[v45 + 1] - (signed int)word_721460[v45]) * v19 / v17) >> 16) - + word_721460[v45]) >= v56) ) + + word_721460[v45]) >= x) ) ++v53; } } @@ -377,62 +383,66 @@ v45 = v12; } while ( v12 < v44 ); + if ( v53 == 1 ) { if ( v55 >= 50 ) break; - v20 = v8->uPolygonType; + v20 = pFloor->uPolygonType; if ( v20 == 3 || v20 == 5 ) { - v21 = v7[*v8->pVertexIDs].z; + v21 = pIndoor->pVertices[*pFloor->pVertexIDs].z; } else { - v7 = pIndoor->pVertices; - v21 = ((unsigned __int64)(v8->zCalc1 * (signed __int64)v56) >> 16) - + ((unsigned __int64)(v8->zCalc2 * (signed __int64)v57) >> 16) - + HIWORD(v8->zCalc3); + //v7 = pIndoor->pVertices; + v21 = ((unsigned __int64)(pFloor->zCalc1 * (signed __int64)x) >> 16) + + ((unsigned __int64)(pFloor->zCalc2 * (signed __int64)y) >> 16) + + HIWORD(pFloor->zCalc3); } v22 = v55++; dword_7212C8[v22] = v21; - dword_721200[v22] = *(short *)v40; - } - } - } - v6 = uSectorIDa + 1; - } - if ( v5->field_0 & 8 ) - { - for ( uSectorIDb = 0; uSectorIDb < v5->uNumPortals; ++uSectorIDb ) - { - v23 = &pIndoor->pFaces[v5->pPortals[uSectorIDb]]; - if ( v23->uPolygonType == 3 - && v56 <= v23->pBounding.x2 - && v56 >= v23->pBounding.x1 - && v57 <= v23->pBounding.y2 - && v57 >= v23->pBounding.y1 ) - { - v46 = 0; - if ( v23->uNumVertices ) - { - do - { - v24 = v46; - v25 = 2 * v46; - word_721460[2 * v46] = v23->pXInterceptDisplacements[v46] + v7[v23->pVertexIDs[v46]].x; - word_721390[2 * v46] = v23->pYInterceptDisplacements[v24] + v7[v23->pVertexIDs[v24]].y; - word_721460[2 * v46++ + 1] = v23->pXInterceptDisplacements[v24 + 1] + v7[v23->pVertexIDs[v24 + 1]].x; - word_721390[v25 + 1] = v23->pYInterceptDisplacements[v24 + 1] + v7[v23->pVertexIDs[v24 + 1]].y; - } - while ( v46 < v23->uNumVertices ); - v5 = v43; - } - v26 = 2 * v23->uNumVertices; - word_721460[2 * v23->uNumVertices] = word_721460[0]; - word_721390[v26] = word_721390[0]; + dword_721200[v22] = pSector->pFloors[i]; + } + } + } + //v6 = uSectorIDa + 1; + } + + if ( pSector->field_0 & 8 ) + { + for (uint i = 0; i < pSector->uNumPortals; ++i) + { + //v23 = &pIndoor->pFaces[v5->pPortals[uSectorIDb]]; + auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; + if (portal->uPolygonType != POLYGON_Floor) + continue; + + if (x <= portal->pBounding.x2 && + x >= portal->pBounding.x1 && + y <= portal->pBounding.y2 && + y >= portal->pBounding.y1 ) + { + //v46 = 0; + for (uint j = 0; j < portal->uNumVertices; ++j) + { + //v24 = v46; + //v25 = 2 * v46; + word_721460[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; + word_721460[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; + word_721390[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; + word_721390[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; + //} + //while ( v46 < v23->uNumVertices ); + //v5 = v43; + } + + //v26 = 2 * v23->uNumVertices; + word_721460[2 * portal->uNumVertices] = word_721460[0]; + word_721390[2 * portal->uNumVertices] = word_721390[0]; v54 = 0; v51 = 0; - v49 = word_721390[0] >= v57; + v49 = word_721390[0] >= y; if ( v26 > 0 ) { do @@ -440,27 +450,27 @@ if ( v54 >= 2 ) break; v27 = v51; - v47 = word_721390[v51 + 1] >= v57; + v47 = word_721390[v51 + 1] >= y; if ( v49 != v47 ) { - if ( word_721460[v27 + 1] >= v56 ) + if ( word_721460[v27 + 1] >= x ) v28 = 0; else v28 = 2; - v29 = v28 | word_721460[v27] < v56; + v29 = v28 | word_721460[v27] < x; if ( v29 != 3 ) { if ( !v29 || (v30 = word_721390[v27], v31 = word_721390[v51 + 1] - v30, - v32 = v57 - v30, + v32 = y - v30, LODWORD(v33) = v32 << 16, HIDWORD(v33) = v32 >> 16, - v7 = pIndoor->pVertices, + //v7 = pIndoor->pVertices, (signed int)(((unsigned __int64)(((signed int)word_721460[v27 + 1] - (signed int)word_721460[v27]) * v33 / v31) >> 16) - + word_721460[v27]) >= v56) ) + + word_721460[v27]) >= x) ) ++v54; } } @@ -474,12 +484,13 @@ break; v34 = v55++; dword_7212C8[v34] = -29000; - dword_721200[v34] = v5->pPortals[uSectorIDb]; - } - } - } - } - } + dword_721200[v34] = pSector->pPortals[i]; + } + } + } + } + } + v35 = 1; if ( v55 == 1 ) { @@ -492,7 +503,7 @@ result = dword_7212C8[0]; if ( v55 > 1 ) { - v37 = a3 + 5; + v37 = z + 5; while ( 1 ) { v38 = dword_7212C8[v35]; diff -r a84fb3752681 -r 517e33e08d93 mm7_6.cpp --- a/mm7_6.cpp Sun Oct 28 22:13:23 2012 +0600 +++ b/mm7_6.cpp Sun Oct 28 22:13:41 2012 +0600 @@ -8922,6 +8922,7 @@ switch ( inputAction ) { case INPUT_MoveForward: + __debugbreak(); if ( pCurrentScreen ) break; if (!pParty->bTurnBasedModeOn) @@ -8939,6 +8940,7 @@ } break; case INPUT_MoveBackwards: + __debugbreak(); if ( pCurrentScreen ) break; if (!pParty->bTurnBasedModeOn) @@ -8956,6 +8958,7 @@ } break; case INPUT_StrafeLeft: + __debugbreak(); if ( pCurrentScreen ) break; if (!pParty->bTurnBasedModeOn) @@ -8967,6 +8970,7 @@ partyAction = PARTY_StrafeLeft; goto _add_action_and_continue_; case INPUT_StrafeRight: + __debugbreak(); if ( pCurrentScreen ) break; if (!pParty->bTurnBasedModeOn) @@ -9033,12 +9037,14 @@ } break; case INPUT_Jump: + __debugbreak(); if ( pCurrentScreen || pParty->bTurnBasedModeOn) break; partyAction = (PartyAction)12; goto _add_action_and_continue_; case INPUT_Yell: + __debugbreak(); if ( !pCurrentScreen && uActiveCharacter ) { @@ -9047,6 +9053,7 @@ } break; case INPUT_Pass: + __debugbreak(); if ( pCurrentScreen ) break; if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) @@ -9066,6 +9073,7 @@ } break; case INPUT_Combat: + __debugbreak(); if ( !pCurrentScreen ) { if (pParty->bTurnBasedModeOn) @@ -9084,6 +9092,7 @@ } break; case INPUT_CastReady: + __debugbreak(); if ( pCurrentScreen ) break; if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) @@ -9118,8 +9127,10 @@ } break; default: + __debugbreak(); break; case INPUT_Attack: + __debugbreak(); if ( pCurrentScreen ) break; if (!pParty->bTurnBasedModeOn || pTurnEngine->field_4 != 3) @@ -9160,39 +9171,46 @@ } break; case INPUT_CharCycle: + __debugbreak(); if ( pCurrentScreen == 8 || dword_50C9E8 >= 40 ) break; dword_50C9EC[3 * dword_50C9E8] = 176; goto LABEL_155; case INPUT_LookUp: + __debugbreak(); if ( pEventTimer->bPaused ) break; partyAction = (PartyAction)7; goto _add_action_and_continue_; case INPUT_CenterView: + __debugbreak(); if ( pEventTimer->bPaused ) break; partyAction = (PartyAction)9; goto _add_action_and_continue_; case INPUT_LookDown: + __debugbreak(); if ( pEventTimer->bPaused ) break; partyAction = (PartyAction)8; goto _add_action_and_continue_; case INPUT_FlyUp: + __debugbreak(); if ( pCurrentScreen || pEventTimer->bPaused ) break; partyAction = (PartyAction)13; goto _add_action_and_continue_; case INPUT_Land: + __debugbreak(); if ( pCurrentScreen || pEventTimer->bPaused ) break; partyAction = (PartyAction)15; goto _add_action_and_continue_; case INPUT_FlyDown: + __debugbreak(); if ( !pCurrentScreen && !pEventTimer->bPaused ) { @@ -9204,11 +9222,13 @@ } break; case INPUT_ZoomIn: + __debugbreak(); if ( dword_50C9E8 >= 40 ) break; dword_50C9EC[3 * dword_50C9E8] = 367; goto LABEL_155; case INPUT_ZoomOut: + __debugbreak(); if ( dword_50C9E8 < 40 ) { dword_50C9EC[3 * dword_50C9E8] = 368; diff -r a84fb3752681 -r 517e33e08d93 mm7_data.cpp --- a/mm7_data.cpp Sun Oct 28 22:13:23 2012 +0600 +++ b/mm7_data.cpp Sun Oct 28 22:13:41 2012 +0600 @@ -2402,8 +2402,8 @@ int dword_7211B0[777]; // idb int dword_721200[777]; // idb int dword_7212C8[777]; // idb -__int16 word_721390[777]; // idb -__int16 word_721460[777]; // idb +__int16 word_721390[104]; // idb +__int16 word_721460[104]; // idb int blv_prev_party_x; // weak int blv_prev_party_z; // weak int blv_prev_party_y; // weak diff -r a84fb3752681 -r 517e33e08d93 mm7_data.h --- a/mm7_data.h Sun Oct 28 22:13:23 2012 +0600 +++ b/mm7_data.h Sun Oct 28 22:13:41 2012 +0600 @@ -2939,7 +2939,7 @@ void __cdecl ODM_UpdateUserInputAndOther(); bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2); void __cdecl _46CC4B_check_event_triggers(); -int __fastcall _46CEC3_get_floor_level(signed int a1, signed int a2, int a3, unsigned int uSectorID, unsigned int *pFaceID); +int _46CEC3_get_floor_level(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID); int __fastcall sub_46D49E_prolly_get_world_y_under_party(int a1, signed int a2, int a3, int a4, int *a5, int *a6, int a7); int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4); signed __int64 __fastcall _46DCC8_get_gravity_direction_outdoor(int a1, int a2, Vec3_int_ *a3);