# HG changeset patch # User Nomad # Date 1360630933 -7200 # Node ID cca78efb377ecbcbfd0bba7dd6e3818c7cb2ed28 # Parent f4d7a9a8c363f233a9b4a3a40ce06798e821ce96 Constants -> enums diff -r f4d7a9a8c363 -r cca78efb377e Actor.cpp --- a/Actor.cpp Tue Feb 12 02:02:26 2013 +0200 +++ b/Actor.cpp Tue Feb 12 03:02:13 2013 +0200 @@ -2143,7 +2143,7 @@ } else { - if ( (edx0 & 7) == 3 ) + if ( (edx0 & 7) == OBJECT_Actor) { v8 = edx0 >> 3; v6 = (AIDirection *)pActors[v8].vPosition.x; @@ -2152,7 +2152,7 @@ } else { - if ( (edx0 & 7) == 4 ) + if ( (edx0 & 7) == OBJECT_Player) { v6 = (AIDirection *)pParty->vPosition.x; v7 = (AIDirection *)pParty->vPosition.y; @@ -2176,7 +2176,7 @@ v13 = 0; if ( !arg0 ) { - v14 = Actor::GetDirectionInfo(8 * v24 | 3, a2, &a3, 0); + v14 = Actor::GetDirectionInfo(8 * v24 | OBJECT_Actor, a2, &a3, 0); v12 = &v20; memcpy(&v20, v14, sizeof(v20)); v13 = 0; @@ -2542,7 +2542,7 @@ v22 = uActorID; v3 = &pActors[uActorID]; a2 = edx0; - if ( (edx0 & 7) == 3 ) + if ( (edx0 & 7) == OBJECT_Actor) { v6 = edx0 >> 3; v4 = (AIDirection *)pActors[v6].vPosition.x; @@ -2551,7 +2551,7 @@ } else { - if ( (edx0 & 7) == 4 ) + if ( (edx0 & 7) == OBJECT_Player) { v4 = (AIDirection *)pParty->vPosition.x; v5 = (AIDirection *)pParty->vPosition.y; @@ -2573,7 +2573,7 @@ v10 = 0; if ( !pDir ) { - v11 = Actor::GetDirectionInfo(8 * v22 | 3, a2, &a3, 0); + v11 = Actor::GetDirectionInfo(8 * v22 | OBJECT_Actor, a2, &a3, 0); v9 = &v18; memcpy(&v18, v11, sizeof(v18)); v10 = 0; @@ -2654,7 +2654,7 @@ v22 = uActorID; v3 = &pActors[uActorID]; a2 = edx0; - if ( (edx0 & 7) == 3 ) + if ( (edx0 & 7) == OBJECT_Actor) { v6 = edx0 >> 3; v4 = (AIDirection *)pActors[v6].vPosition.x; @@ -2663,7 +2663,7 @@ } else { - if ( (edx0 & 7) == 4 ) + if ( (edx0 & 7) == OBJECT_Player) { v4 = (AIDirection *)pParty->vPosition.x; v5 = (AIDirection *)pParty->vPosition.y; @@ -2685,7 +2685,7 @@ v10 = 0; if ( !pDir ) { - v11 = Actor::GetDirectionInfo(8 * v22 | 3, a2, &a3, 0); + v11 = Actor::GetDirectionInfo(8 * v22 | OBJECT_Actor, a2, &a3, 0); v9 = &v18; memcpy(&v18, v11, sizeof(v18)); v10 = 0; @@ -2765,7 +2765,7 @@ v21 = uActorID; v3 = &pActors[uActorID]; a2 = edx0; - if ( (edx0 & 7) == 3 ) + if ( (edx0 & 7) == OBJECT_Actor) { v6 = edx0 >> 3; v4 = (AIDirection *)pActors[v6].vPosition.x; @@ -2774,7 +2774,7 @@ } else { - if ( (edx0 & 7) == 4 ) + if ( (edx0 & 7) == OBJECT_Player) { v4 = (AIDirection *)pParty->vPosition.x; v5 = (AIDirection *)pParty->vPosition.y; @@ -2796,7 +2796,7 @@ v10 = 0; if ( !pDir ) { - v11 = Actor::GetDirectionInfo(8 * v21 | 3, a2, &a3, 0); + v11 = Actor::GetDirectionInfo(8 * v21 | OBJECT_Actor, a2, &a3, 0); v9 = &v17; memcpy(&v17, v11, sizeof(v17)); v10 = 0; @@ -2861,7 +2861,7 @@ v21 = uActorID; v3 = &pActors[uActorID]; a2 = edx0; - if ( (edx0 & 7) == 3 ) + if ( (edx0 & 7) == OBJECT_Actor) { v6 = edx0 >> 3; v4 = pActors[v6].vPosition.x; @@ -2870,7 +2870,7 @@ } else { - if ( (edx0 & 7) == 4 ) + if ( (edx0 & 7) == OBJECT_Player) { v4 = pParty->vPosition.x; v5 = pParty->vPosition.y; @@ -2900,7 +2900,7 @@ v11 = 0; if ( !pDir ) { - v12 = Actor::GetDirectionInfo(8 * v21 | 3, a2, &a3, 0); + v12 = Actor::GetDirectionInfo(8 * v21 | OBJECT_Actor, a2, &a3, 0); v10 = &v18; memcpy(&v18, v12, sizeof(v18)); v11 = 0; @@ -3483,7 +3483,7 @@ memcpy(&a3, Actor::GetDirectionInfo(v7, 4u, &v10, 0), sizeof(a3)); memcpy(&v13, &a3, sizeof(v13)); if ( MonsterStats::BelongsToSupertype(v5->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) - || (a2 & 7) == 3 && (double)(signed int)v13.uDistance < 307.2 ) + || (a2 & 7) == OBJECT_Actor && (double)(signed int)v13.uDistance < 307.2 ) { if ( !uActionLength ) uActionLength = 256; diff -r f4d7a9a8c363 -r cca78efb377e Actor.h --- a/Actor.h Tue Feb 12 02:02:26 2013 +0200 +++ b/Actor.h Tue Feb 12 03:02:13 2013 +0200 @@ -52,7 +52,7 @@ enum ObjectType { OBJECT_unk0 = 0x0, - OBJECT_unk1 = 0x1, + OBJECT_BLVDoor = 0x1, OBJECT_Item = 0x2, OBJECT_Actor = 0x3, OBJECT_Player = 0x4, @@ -95,7 +95,7 @@ Stoned = 0xE, Paralyzed = 0xF, Resurrected = 0x10, - Summoned = 0x11, + Summoned = 17, AttackingRanged4 = 0x12, Disabled = 0x13, }; diff -r f4d7a9a8c363 -r cca78efb377e AudioPlayer.cpp --- a/AudioPlayer.cpp Tue Feb 12 02:02:26 2013 +0200 +++ b/AudioPlayer.cpp Tue Feb 12 03:02:13 2013 +0200 @@ -870,7 +870,7 @@ goto LABEL_184; } v76 = a3; - if ( (a3 & 7) == 1 ) + if ( (a3 & 7) == OBJECT_BLVDoor) { if ( uCurrentlyLoadedLevelType != LEVEL_Indoor ) goto LABEL_184; @@ -890,7 +890,7 @@ AIL_set_sample_pan(pMixerChannel5->hSample, v80); goto LABEL_184; } - if ( (a3 & 7) == 2 ) + if ( (a3 & 7) == OBJECT_Item) { pLayingItem4 = &pLayingItems[a3 >> 3]; if ( !GetSoundStrengthByDistanceFromParty(pLayingItem4->vPosition.x, pLayingItem4->vPosition.y, pLayingItem4->vPosition.z) ) @@ -898,7 +898,7 @@ } else { - if ( (a3 & 7) == 3 ) + if ( (a3 & 7) == OBJECT_Actor) { pActor3 = &pActors[a3 >> 3]; if ( !GetSoundStrengthByDistanceFromParty(pActor3->vPosition.x, pActor3->vPosition.y, pActor3->vPosition.z) ) @@ -910,7 +910,7 @@ AIL_set_sample_pan(pMixerChannel5->hSample, v80); goto LABEL_184; } - if ( (a3 & 7) != 5 ) + if ( (a3 & 7) != OBJECT_Decoration) { LABEL_184: if ( uNumRepeats ) @@ -922,7 +922,7 @@ AIL_start_sample(v85); if ( sPlaybackRate ) AIL_set_sample_playback_rate(pMixerChannel5->hSample, sPlaybackRate); - if ( (v76 & 7) == 4 ) + if ( (v76 & 7) == OBJECT_Player) AIL_sample_ms_position(pMixerChannel5->hSample, &sLastTrackLengthMS, 0); return; } @@ -978,7 +978,7 @@ _4ABE55(pMixerChannel4); goto LABEL_150; } - if ( (a3 & 7) == 2 ) + if ( (a3 & 7) == OBJECT_Item) { varC = 5; v96 = 7; @@ -986,7 +986,7 @@ } else { - if ( (a3 & 7) == 3 ) + if ( (a3 & 7) == OBJECT_Actor) { *(float *)&varC = 0.0; pActor2 = &pActors[a3 >> 3]; @@ -1000,9 +1000,9 @@ return; goto LABEL_123; } - if ( (a3 & 7) != 5 ) + if ( (a3 & 7) != OBJECT_Decoration) { - if ( (a3 & 7) == 6 ) + if ( (a3 & 7) == OBJECT_BModel) { varC = 8; v96 = 9; @@ -1048,7 +1048,7 @@ v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; goto LABEL_47; } - if ( (a3 & 7) == 2 ) + if ( (a3 & 7) == OBJECT_Item) { v22 = pAudioPlayer->uNum3DSamples; if ( v22 < 16 ) @@ -1065,7 +1065,7 @@ } else { - if ( (a3 & 7) == 3 ) + if ( (a3 & 7) == OBJECT_Actor) { v18 = pAudioPlayer->uNum3DSamples; v12 = 0; @@ -1081,10 +1081,10 @@ v21 = (double)v100; goto LABEL_47; } - if ( (a3 & 7) != 5 ) + if ( (a3 & 7) != OBJECT_Decoration) { v13 = pAudioPlayer->uNum3DSamples; - if ( (a3 & 7) == 6 ) + if ( (a3 & 7) == OBJECT_BModel) { if ( v13 >= 16 ) { @@ -1256,7 +1256,7 @@ AIL_set_3D_sample_loop_count(*(int *)v42, v86); if ( PartyX == -1 ) { - if ( (a3 & 7) == 1 ) + if ( (a3 & 7) == OBJECT_BLVDoor) { if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { @@ -1306,13 +1306,13 @@ } return; } - if ( (a3 & 7) == 2 ) + if ( (a3 & 7) == OBJECT_Item) { pLayingItem2 = &pLayingItems[a3 >> 3]; } else { - if ( (a3 & 7) == 3 ) + if ( (a3 & 7) == OBJECT_Actor) { pActor = &pActors[a3 >> 3]; v46 = pActor->vPosition.y; @@ -1322,7 +1322,7 @@ v47 = (double)uNumRepeatsb; goto LABEL_101; } - if ( (a3 & 7) != 5 ) + if ( (a3 & 7) != OBJECT_Decoration) { pRenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x; v43 = (double)pParty->vPosition.y; @@ -1603,7 +1603,7 @@ while ( 1 ) { v31 = v30->dword_000004; - if ( (v30->dword_000004 & 7) == 1 ) + if ( (v30->dword_000004 & 7) == OBJECT_BLVDoor) { if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { @@ -1633,12 +1633,12 @@ } else { - if ( (v30->dword_000004 & 7) == 2 ) + if ( (v30->dword_000004 & 7) == OBJECT_Item) { v32 = &pLayingItems[v31 >> 3]; goto LABEL_53; } - if ( (v30->dword_000004 & 7) == 3 ) + if ( (v30->dword_000004 & 7) == OBJECT_Actor) { v33 = &pActors[v31 >> 3]; v34 = GetSoundStrengthByDistanceFromParty(v33->vPosition.x, v33->vPosition.y, v33->vPosition.z); diff -r f4d7a9a8c363 -r cca78efb377e Indoor.cpp --- a/Indoor.cpp Tue Feb 12 02:02:26 2013 +0200 +++ b/Indoor.cpp Tue Feb 12 03:02:13 2013 +0200 @@ -4221,11 +4221,11 @@ v0->uSectorID = LOWORD(stru_721530.uSectorID); stru_721530.field_70 += stru_721530.field_7C; v37 = v36 >> 3; - if ( (v36 & 7) != 3 ) + if ( (v36 & 7) != OBJECT_Actor) { - if ( (v36 & 7) != 4 ) + if ( (v36 & 7) != OBJECT_Player) { - if ( (v36 & 7) == 5 ) + if ( (v36 & 7) == OBJECT_Decoration) { _this = sub_452A9E(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y); v45 = stru_5C6E00->Atan2( @@ -4242,7 +4242,7 @@ v0->vVelocity.y = WORD1(v48); goto LABEL_119; } - if ( (v36 & 7) == 6 ) + if ( (v36 & 7) == OBJECT_BModel) { stru_721530.field_84 = v36 >> 3; v38 = &pIndoor->pFaces[v37]; diff -r f4d7a9a8c363 -r cca78efb377e Outdoor.cpp --- a/Outdoor.cpp Tue Feb 12 02:02:26 2013 +0200 +++ b/Outdoor.cpp Tue Feb 12 03:02:13 2013 +0200 @@ -2979,7 +2979,7 @@ v61 = v1->vPosition.z; if ( v2 == 17 ) { - if ( (v1->uSummonerID & 7) != 3 || pActors[v1->uSummonerID >> 3].pMonsterInfo.uSpecialAbilityDamageDiceSides != 1 ) + if ( (v1->uSummonerID & 7) != OBJECT_Actor || pActors[v1->uSummonerID >> 3].pMonsterInfo.uSpecialAbilityDamageDiceSides != 1 ) { v6 = (double)v1->uActorHeight * 0.5; v7 = v6 + 6.7553994e15; diff -r f4d7a9a8c363 -r cca78efb377e Party.cpp --- a/Party.cpp Tue Feb 12 02:02:26 2013 +0200 +++ b/Party.cpp Tue Feb 12 03:02:13 2013 +0200 @@ -97,7 +97,7 @@ v12 = 0; if ( pParty->bTurnBasedModeOn == 1 ) { - if ( pTurnEngine->field_4 != 2 || (pTurnEngine->pQueue[0].uPackedID & 7) != 4 ) + if ( pTurnEngine->field_4 != 2 || (pTurnEngine->pQueue[0].uPackedID & 7) != OBJECT_Player) return 0; v2 = pTurnEngine->pQueue[0].uPackedID >> 3; return v2 + 1; diff -r f4d7a9a8c363 -r cca78efb377e Party.h --- a/Party.h Tue Feb 12 02:02:26 2013 +0200 +++ b/Party.h Tue Feb 12 03:02:13 2013 +0200 @@ -14,7 +14,11 @@ /* 355 */ -enum PARTY_FLAGS_2 : __int32 +enum PARTY_FLAGS_1: __int32 +{ + PARTY_FLAGS_1_LANDING = 0x100, +}; +enum PARTY_FLAGS_2: __int32 { PARTY_FLAGS_2_RUNNING = 0x2, }; @@ -174,6 +178,7 @@ inline bool ImmolationActive() {return pPartyBuffs[PARTY_BUFF_IMMOLATION].uExpireTime > 0;} inline bool ImmolationSkillLevel() {return pPartyBuffs[PARTY_BUFF_IMMOLATION].uSkill;} inline bool FeatherFallActive() {return pPartyBuffs[PARTY_BUFF_FEATHER_FALL].uExpireTime > 0;} + inline bool Invisible() {return pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime > 0;} int field_0; diff -r f4d7a9a8c363 -r cca78efb377e mm7_1.cpp --- a/mm7_1.cpp Tue Feb 12 02:02:26 2013 +0200 +++ b/mm7_1.cpp Tue Feb 12 03:02:13 2013 +0200 @@ -4406,7 +4406,7 @@ v5 = rand() % 4; v6 = dword_5B5920 >> 3; v35 = v5; - if ( (dword_5B5920 & 7) == 5 ) + if ( (dword_5B5920 & 7) == OBJECT_Decoration) { v16 = v6; v14 = pLevelDecorations[v6].vPosition.x; @@ -4416,7 +4416,7 @@ } else { - if ( (dword_5B5920 & 7) != 6 ) + if ( (dword_5B5920 & 7) != OBJECT_BModel) goto LABEL_12; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) { @@ -5063,7 +5063,7 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - if ( (v18 & 7) == 6 ) // bmodel + if ( (v18 & 7) == OBJECT_BModel) { if ( v18 < (signed int)0x2000000u ) { @@ -6003,7 +6003,7 @@ v1 = pMouse->GetCursorPos(&a2); v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v25)->y]]; } - if ( (v0 & 7) == 2 ) + if ( (v0 & 7) == OBJECT_Item) { a2.y = (signed int)(unsigned __int16)v0 >> 3; v21 = (signed int)(unsigned __int16)v0 >> 3; @@ -6035,9 +6035,9 @@ } goto LABEL_13; } - if ( (v0 & 7) != 3 ) - { - if ( (v0 & 7) == 5 ) + if ( (v0 & 7) != OBJECT_Actor) + { + if ( (v0 & 7) == OBJECT_Decoration) { v13 = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; if ( (signed int)(((unsigned int)v0 >> 16) - pDecorationList->pDecorations[v13->uDecorationDescID].uRadius) >= 512 ) @@ -6058,7 +6058,7 @@ } else { - if ( (v0 & 7) != 6 || (unsigned int)v0 >= 0x2000000 ) + if ( (v0 & 7) != OBJECT_BModel || (unsigned int)v0 >= 0x2000000 ) goto LABEL_13; v2 = (signed int)(unsigned __int16)v0 >> 3; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) diff -r f4d7a9a8c363 -r cca78efb377e mm7_2.cpp --- a/mm7_2.cpp Tue Feb 12 02:02:26 2013 +0200 +++ b/mm7_2.cpp Tue Feb 12 03:02:13 2013 +0200 @@ -3249,7 +3249,7 @@ do { v2 = v1->uAIState; - if ( v1->uAIState == 5 || v2 == 11 || v2 == 19 || (v3 = v1->uSummonerID) != 0 && (v3 & 7) == 4 ) + if ( v1->uAIState == Dead || v2 == Removed || v2 == Disabled || (v3 = v1->uSummonerID) != 0 && (v3 & 7) == OBJECT_Player) ++v0; ++v1; --v7; @@ -15597,7 +15597,7 @@ } while ( v6 < v22 ); } - if ( (v7 & 7) == 5 ) + if ( (v7 & 7) == OBJECT_Decoration) { v16 = (unsigned int)v7 >> 3; if ( (signed int)(((unsigned int)*v21 >> 16) @@ -15696,7 +15696,7 @@ v2 = a1; switch ( a1 & 7 ) { - case 2: + case OBJECT_Item: v17 = a1 >> 3; v26 = a1 >> 3; v18 = a1 >> 3; @@ -15729,7 +15729,8 @@ } LayingItem::_42F933(v21); break; - case 3: + + case OBJECT_Actor: v12 = a1 >> 3; v13 = &pActors[a1 >> 3]; v14 = v13->uAIState; @@ -15771,7 +15772,8 @@ } } break; - case 5: + + case OBJECT_Decoration: v8 = &pLevelDecorations[a1 >> 3]; v9 = v8->field_16_event_id; if ( v9 ) @@ -15791,10 +15793,11 @@ _5C3420_pDecoration = 0; } break; + default: - if ( (a1 & 7) != 6 ) - { - MessageBoxW(nullptr, L"Warning: Invalid ID reached!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Mouse.cpp:2020", 0); + if ( (a1 & 7) != OBJECT_BModel) + { + MessageBoxW(nullptr, L"Warning: Invalid ID reached!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Mouse.cpp:2020", 0); return 1; } if ( uCurrentlyLoadedLevelType != LEVEL_Indoor ) @@ -15865,7 +15868,7 @@ v6 = ((v12 - v4 - 1) >> 1) + 1; do { - if ( (*(char *)v5 & 7) == 3 ) + if ( (*(char *)v5 & 7) == OBJECT_Actor) { if ( *v5 <= a3 << 16 ) { @@ -15936,7 +15939,7 @@ v3 = pRenderer->GetParentBillboardID(a1a); v4 = pBillboardRenderList[v3].sZValue; v5 = (unsigned __int16)pBillboardRenderList[v3].sZValue; - if ( (v5 & 7) == 3 ) + if ( (v5 & 7) == OBJECT_Actor) { if ( v4 <= (unsigned int)(a3 << 16) ) { @@ -16195,7 +16198,7 @@ { v19 = dword_720020_zvalues[v18] & 0xFFFF; v20 = (dword_720020_zvalues[v18] & 0xFFFFu) >> 3; - if ( (dword_720020_zvalues[v18] & 7) == 2 ) + if ( (dword_720020_zvalues[v18] & 7) == OBJECT_Item) { if ( v20 >= 0x3E8 ) return 0; @@ -16208,16 +16211,16 @@ } goto LABEL_41; } - if ( (dword_720020_zvalues[v18] & 7) == 3 ) + if ( (dword_720020_zvalues[v18] & 7) == OBJECT_Actor) { if ( v20 >= 0xBB8 ) return 0; v24 = (const char *)&pActors[v20]; goto LABEL_51; } - if ( (dword_720020_zvalues[v18] & 7) == 5 ) + if ( (dword_720020_zvalues[v18] & 7) == OBJECT_Decoration) break; - if ( (dword_720020_zvalues[v18] & 7) == 6 ) + if ( (dword_720020_zvalues[v18] & 7) == OBJECT_BModel) { if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { @@ -16549,14 +16552,14 @@ v3 = &pObjectList->pObjects[v2->uObjectDescID]; v145 = a2; v151 = a2 & 7; - if ( (a2 & 7) == 3 ) - { - if ( (v2->field_58 & 7) == 3 && !pActors[v2->field_58 >> 3].GetActorsRelation(&pActors[a2 >> 3]) ) + if ( (a2 & 7) == OBJECT_Actor) + { + if ( (v2->field_58 & 7) == OBJECT_Actor && !pActors[v2->field_58 >> 3].GetActorsRelation(&pActors[a2 >> 3]) ) return 1; } else { - if ( (a2 & 7) == 4 && (v2->field_58 & 7) == 4 ) + if ( (a2 & 7) == OBJECT_Player && (v2->field_58 & 7) == OBJECT_Player) return 1; } if ( pParty->bTurnBasedModeOn == 1 ) @@ -16568,7 +16571,7 @@ v2->uAttributes = v5 & 0xFFFB; } } - if ( v151 == 6 && (v2->field_58 & 7) != 4 ) + if ( v151 == OBJECT_BModel && (v2->field_58 & 7) != OBJECT_Player) BYTE2(pActors[v2->field_58 >> 3].uAttributes) |= 4u; v6 = v2->uItemType; v7 = v2->uItemType; @@ -16625,7 +16628,7 @@ break; } v138 = 1; - if ( v151 != 3 ) + if ( v151 != OBJECT_Actor) { if ( v6 != 9030 || v2->field_50 != 4 ) goto LABEL_246; diff -r f4d7a9a8c363 -r cca78efb377e mm7_3.cpp --- a/mm7_3.cpp Tue Feb 12 02:02:26 2013 +0200 +++ b/mm7_3.cpp Tue Feb 12 03:02:13 2013 +0200 @@ -1483,11 +1483,11 @@ { _46E44E_collide_against_faces_and_portals(0); _46E0B2_collide_against_decorations(); - if ( (v1->field_58 & 7) != 4 ) + if ( (v1->field_58 & 7) != OBJECT_Player) _46EF01_collision_chech_player(1); v13 = v1->field_58; v42 = v8; - if ( (v13 & 7) == 3 ) + if ( (v13 & 7) == OBJECT_Actor) { if ( (signed int)uNumActors > v8 ) { @@ -1575,7 +1575,7 @@ if ( v2->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) ) return; v15 = (signed int)stru_721530.uFaceID >> 3; - if ( (stru_721530.uFaceID & 7) == 5 ) + if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration) { v40 = sub_452A9E(v1->vVelocity.x * v1->vVelocity.x + v1->vVelocity.y * v1->vVelocity.y); v23 = stru_5C6E00->Atan2( @@ -1593,7 +1593,7 @@ } else { - if ( (stru_721530.uFaceID & 7) != 6 ) + if ( (stru_721530.uFaceID & 7) != OBJECT_BModel) goto LABEL_64; stru_721530.field_84 = (signed int)stru_721530.uFaceID >> 3; v16 = &pIndoor->pFaces[v15]; @@ -1987,9 +1987,9 @@ v58 = v16; v18 = WorldPosToGridCellX(v17); _46E26D_collide_against_sprites(v18, v58); - if ( (v1->field_58 & 7) != 4 ) + if ( (v1->field_58 & 7) != OBJECT_Player) _46EF01_collision_chech_player(0); - if ( (v1->field_58 & 7) == 3 ) + if ( (v1->field_58 & 7) == OBJECT_Actor) { v19 = v1->field_58 >> 3; if ( v19 >= 0 ) @@ -2094,9 +2094,9 @@ return; } v30 = (signed int)stru_721530.uFaceID >> 3; - if ( (stru_721530.uFaceID & 7) == 5 ) + if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration) break; - if ( (stru_721530.uFaceID & 7) == 6 ) + if ( (stru_721530.uFaceID & 7) == OBJECT_BModel) { v31 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; v32 = &v31->pFaces[v30 & 0x3F]; @@ -2814,7 +2814,7 @@ uSectorID = stru_721530.uSectorID; stru_721530.field_70 += stru_721530.field_7C; auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + new_party_z; - if ( (stru_721530.uFaceID & 7) == 3 ) + if ( (stru_721530.uFaceID & 7) == OBJECT_Actor) { if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0 && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime)) ) @@ -2822,7 +2822,7 @@ viewparams->bRedrawGameUI = 1; goto LABEL_152; } - if ( (stru_721530.uFaceID & 7) == 5 ) + if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration) { v53 = sub_452A9E(v2 * v2 + v1 * v1); v80 = v53; @@ -2835,7 +2835,7 @@ } else { - if ( (stru_721530.uFaceID & 7) == 6 ) + if ( (stru_721530.uFaceID & 7) == OBJECT_BModel) { v44 = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3]; v45 = v44->uPolygonType; @@ -2998,8 +2998,8 @@ int v1; // edi@1 int v2; // ebx@1 int v3; // eax@14 - Player **v4; // esi@21 - int v5; // eax@24 + //Player **v4; // esi@21 + //int v5; // eax@24 int v6; // esi@45 ODMFace *v7; // ecx@45 //unsigned int v8; // eax@71 @@ -3026,16 +3026,16 @@ //signed __int64 v29; // qax@98 //unsigned int v30; // eax@103 int v31; // eax@130 - int v32; // ecx@141 + //int v32; // ecx@141 signed int v33; // eax@143 int v34; // esi@143 - unsigned int v35; // esi@147 + int v35; // esi@147 int v36; // eax@155 signed int v37; // esi@159 signed int v38; // eax@159 signed int i; // esi@159 int v40; // esi@162 - Player **v41; // esi@172 + //Player **v41; // esi@172 bool v42; // eax@180 signed int v43; // ecx@184 signed int v44; // edx@184 @@ -3183,28 +3183,24 @@ v3 = pParty->uFallStartY; if ( v3 - v123 > 512 && !bFeatherFall && v123 <= v111 + 1 ) { - if ( BYTE1(pParty->uFlags) & 1 ) - { - BYTE1(pParty->uFlags) &= 0xFEu; - } - else - { - v4 = &pPlayers[1]; // receive falling damage - do - { - if ( !(*v4)->HasEnchantedItemEquipped(72) && !(*v4)->WearsItem(529, 8) ) - { - v105 = (*v4)->GetMaxHealth(); - (*v4)->ReceiveDamage( - (signed int)((pParty->uFallStartY - v123) * (unsigned __int64)(signed __int64)((double)v105 * 0.1)) / 256, + if (pParty->uFlags & PARTY_FLAGS_1_LANDING) + { + pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; + } + else for (int _i = 0; _i < 4; ++_i) // receive falling damage + { + auto player = pParty->pPlayers + _i; + + if ( !player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) ) + { + player->ReceiveDamage( + (signed int)((pParty->uFallStartY - v123) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256, 4); - v5 = (*v4)->GetActualEndurance(); - v105 = 20 - (*v4)->_48EA1B_get_static_effect(v5); - (*v4)->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); - } - ++v4; - } - while ( (signed int)v4 <= (signed int)&pPlayers[4] ); + v105 = 20 - player->_48EA1B_get_static_effect(player->GetActualEndurance()); + player->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); + } + //} + //while ( (signed int)v4 <= (signed int)&pPlayers[4] ); } } v109 = -1; @@ -3224,7 +3220,7 @@ v101 = v123 - v111 <= 32; if ( bWalkSound && pParty->field_6F8 > 0 ) pParty->field_6F8 -= pEventTimer->uTimeElapsed; - if ( !bUnderwater + if (!bUnderwater && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) < 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0) ) pParty->bFlying = false; @@ -3537,7 +3533,7 @@ case PARTY_Land: if (pParty->bFlying) { - BYTE1(pParty->uFlags) |= 1u; + pParty->uFlags |= PARTY_FLAGS_1_LANDING; pParty->uFallSpeed = 0; } pParty->bFlying = false; @@ -3560,8 +3556,7 @@ v123 = v113 + v129; if ( v127 ) v123 = v113; - if ( SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) >= 0 - && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime)) ) + if (pParty->FlyActive()) stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] &= 0xFEu; pParty->uFallStartY = v123; goto LABEL_141; @@ -3575,27 +3570,25 @@ if ( pParty->bFlying ) goto LABEL_130; v113 = v123; - if ( SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) >= 0 - && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime)) ) + if (pParty->FlyActive()) stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u; + LABEL_141: - v32 = 0; - if ( bJumping && !pParty->bFlying ) + if (bJumping && !pParty->bFlying) { v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength()); v34 = v121 + 2 * v33; v121 += 2 * v33; - goto LABEL_149; - } - if ( !partyAtHighSlope ) + goto LABEL_164; + } + if (!partyAtHighSlope) { v34 = v121; -LABEL_149: - if ( bJumping == v32 ) + if (!bJumping) goto LABEL_150; goto LABEL_164; } - if ( !bJumping ) + if (!bJumping) { if ( v108 ) goto LABEL_150; @@ -3607,41 +3600,39 @@ ODM_GetTerrainNormalAt(v116, v117, &v98); v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength(); v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16; - v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v98.x) >> 16); - v2 += (int)v127; - v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v98.y) >> 16); - v1 += (int)v127; + v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16; + v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16; + v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16); v128 = v1; - v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16); - v34 = (int)((char *)v127 + v35); - v32 = 0; v121 = v34; - goto LABEL_149; + if (!bJumping) + goto LABEL_150; + goto LABEL_164; } v34 = v121; + LABEL_164: - if ( !bUnderwater && v34 <= v32 ) + if ( !bUnderwater && v34 <= 0) { if ( v34 < -500 && !pParty->bFlying && pParty->vPosition.z - v111 > 1000 - && SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 - && (SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) < 0 || !LODWORD(pParty->pPartyBuffs[5].uExpireTime)) ) - { - v41 = &pPlayers[1]; - do - { - if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(529, 8) && (*v41)->CanAct() ) - (*v41)->PlaySound(66, 0); - ++v41; - } - while ( (signed int)v41 <= (signed int)&pPlayers[4] ); - } - goto LABEL_151; - } + && !pParty->FeatherFallActive()) + { // falling scream + for (int i = 0; i < 4; ++i) + { + auto player = pParty->pPlayers + i; + if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) && player->CanAct()) + player->PlaySound(66, 0); + } + } + } + else + { LABEL_150: pParty->uFallStartY = v123; -LABEL_151: + } + if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope ) { *(float *)&v128 = 0.0; @@ -3754,15 +3745,15 @@ v117 = _angle_y; v45 = stru_721530.uFaceID; v123 = v40; - if ( (stru_721530.uFaceID & 7) == 3 ) - { - if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0 - && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime)) ) - pParty->pPartyBuffs[11].Reset(); + if ( (stru_721530.uFaceID & 7) == OBJECT_Actor) + { + if (pParty->Invisible()) + pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); + viewparams->bRedrawGameUI = 1; goto LABEL_234; } - if ( (stru_721530.uFaceID & 7) == 5 ) + if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration) { v56 = sub_452A9E(v2 * v2 + v128 * v128); v118 = v56; @@ -3783,7 +3774,7 @@ } else { - if ( (stru_721530.uFaceID & 7) == 6 ) + if ( (stru_721530.uFaceID & 7) == OBJECT_BModel) { pParty->bFlying = 0; v46 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; @@ -16346,7 +16337,7 @@ do { v30 = *v55; - if ( *v55 == 5 || v30 == 11 || v30 == 19 || (v31 = *((int *)v55 + 159)) != 0 && (v31 & 7) == 4 ) + if ( *v55 == Dead || v30 == Removed || v30 == Disabled || (v31 = *((int *)v55 + 159)) != 0 && (v31 & 7) == OBJECT_Player) ++pInString; v55 += 418; --*(int *)v54; @@ -20446,12 +20437,12 @@ v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; a2 = *v20; v76 = a2 & 7; - if ( (a2 & 7) == 3 ) + if ( (a2 & 7) == OBJECT_Actor) v80 = 0.5; else v80 = 1.0; v22 = v21->uAIState; - if ( v22 == 4 || v22 == 5 || v22 == 11 || v22 == 19 || v22 == 17 ) + if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) goto LABEL_254; if ( !v21->sCurrentHP ) Actor::Die(uActorID); @@ -20969,7 +20960,7 @@ v2 = this->pQueue; do { - if ( (v2->uPackedID & 7) == 3 ) + if ( (v2->uPackedID & 7) == OBJECT_Actor ) { v3 = &pActors[v2->uPackedID >> 3]; v4 = &pActors[v2->uPackedID >> 3]; @@ -20981,7 +20972,7 @@ LOBYTE(v3->uAttributes) &= 0x7Fu; } } - if ( (v2->uPackedID & 7) == 4 ) + if ( (v2->uPackedID & 7) == OBJECT_Player) { v5 = &pParty->pPlayers[v2->uPackedID >> 3]; if ( v5->pConditions[14] @@ -21017,7 +21008,7 @@ v10 = v7->field_4; if ( v9 < v10 || v9 == v10 - && ((v11 = v8->uPackedID & 7, v11 == 4) && (v7->uPackedID & 7) == 3 + && ((v11 = v8->uPackedID & 7, v11 == OBJECT_Player) && (v7->uPackedID & 7) == OBJECT_Actor || v11 == (v7->uPackedID & 7) && (v8->uPackedID & 0xFFFFFFF8) < (v7->uPackedID & 0xFFFFFFF8)) ) { v12 = v7->uPackedID; @@ -21046,7 +21037,7 @@ } v1->uActorQueueSize = v19; result = v1->pQueue[0].uPackedID; - if ( (v1->pQueue[0].uPackedID & 7) == 4 ) + if ( (v1->pQueue[0].uPackedID & 7) == OBJECT_Player) { result = (result >> 3) + 1; uActiveCharacter = result; @@ -21063,7 +21054,7 @@ v17 = v1->pQueue; do { - if ( (v17->uPackedID & 7) == 4 ) + if ( (v17->uPackedID & 7) == OBJECT_Player) pParty->pPlayers[v17->uPackedID >> 3].uTimeToRecovery = (signed __int64)((double)v17->field_4 * 0.46875); ++v22; ++v17; diff -r f4d7a9a8c363 -r cca78efb377e mm7_4.cpp --- a/mm7_4.cpp Tue Feb 12 02:02:26 2013 +0200 +++ b/mm7_4.cpp Tue Feb 12 03:02:13 2013 +0200 @@ -1265,7 +1265,7 @@ do { v4 = *v3; - if ( (v4 & 7) == 5 ) + if ( (v4 & 7) == OBJECT_Decoration) { v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; if ( !(v5->field_2 & 0x20) ) @@ -3235,7 +3235,7 @@ { if ( pTurnEngine->field_4 != 1 ) { - if ( (pTurnEngine->pQueue[0].uPackedID & 7) == 4 ) + if ( (pTurnEngine->pQueue[0].uPackedID & 7) == OBJECT_Player) { //v14 = 0; if ( pTurnEngine->uActorQueueSize > 0 ) @@ -3245,7 +3245,7 @@ { auto pElem = pTurnEngine->pQueue + i; - if ( (pElem->uPackedID & 7) != 4 ) + if ( (pElem->uPackedID & 7) != OBJECT_Player) break; v16 = dword_5079D0; if ( pParty->uFlags & 0x10 ) diff -r f4d7a9a8c363 -r cca78efb377e mm7_5.cpp --- a/mm7_5.cpp Tue Feb 12 02:02:26 2013 +0200 +++ b/mm7_5.cpp Tue Feb 12 03:02:13 2013 +0200 @@ -5221,7 +5221,7 @@ v61 = 0; v59 = 0; v62 = 0; - if ( (a1 & 7) == 2 ) + if ( (a1 & 7) == OBJECT_Item) { v4 = &pLayingItems[a1 >> 3]; uDamageAmount = (int)v4; @@ -6293,7 +6293,7 @@ a2 = uObjID; if ( !pActors[uActorID].IsAlive() ) { - if ( (a2 & 7) == 2 ) + if ( (a2 & 7) == OBJECT_Item) { v4 = &pLayingItems[(signed int)a2 >> 3]; v5 = v4->field_48; @@ -6352,7 +6352,7 @@ v4 = 0; uActorID = a2; v17 = a1; - if ( (a1 & 7) == 2 ) + if ( (a1 & 7) == OBJECT_Item) { v5 = &pLayingItems[a1 >> 3]; v4 = v5->field_60_distance_related_prolly_lod; @@ -9437,7 +9437,7 @@ while ( 1 ) { v5 = v16->uPackedID; - if ( (v16->uPackedID & 7) == 4 ) + if ( (v16->uPackedID & 7) == OBJECT_Player) break; LABEL_8: ++v17; @@ -9480,7 +9480,7 @@ v8 = v1->pQueue; do { - if ( (v8->uPackedID & 7) == 3 && ai_array_4F7DB0_actor_ids[v20] == v8->uPackedID >> 3 ) + if ( (v8->uPackedID & 7) == OBJECT_Actor && ai_array_4F7DB0_actor_ids[v20] == v8->uPackedID >> 3 ) break; ++v18; ++v8; @@ -9559,7 +9559,7 @@ _404544(); v2 = v1->pQueue; v3 = 0; - if ( (v1->pQueue[0].uPackedID & 7) == 4 ) + if ( (v1->pQueue[0].uPackedID & 7) == OBJECT_Player) uActiveCharacter = (v1->pQueue[0].uPackedID >> 3) + 1; else uActiveCharacter = 0; @@ -9578,7 +9578,7 @@ goto LABEL_27; do { - if ( (v2->uPackedID & 7) != 4 ) + if ( (v2->uPackedID & 7) != OBJECT_Player) { v5 = &pActors[v2->uPackedID >> 3]; LOWORD(v6) = v5->uAIState; @@ -9636,7 +9636,7 @@ v9 = v1->pQueue; do { - if ( (v9->uPackedID & 7) != 4 ) + if ( (v9->uPackedID & 7) != OBJECT_Player) { v10 = v9->uPackedID >> 3; v11 = pActors[v10].uAIState; @@ -9688,7 +9688,7 @@ v4 = v1->pQueue[0].field_4; if ( v4 ) { - if ( (v1->pQueue[0].uPackedID & 7) == 4 ) + if ( (v1->pQueue[0].uPackedID & 7) == OBJECT_Player) { v5 = v1->uActorQueueSize; while ( 1 ) @@ -9769,7 +9769,7 @@ v2 = this; v3 = *(&this->field_0 + 4 * (a2 + 2)); - if ( (*((char *)&this->field_0 + 16 * (a2 + 2)) & 7) == 4 ) + if ( (*((char *)&this->field_0 + 16 * (a2 + 2)) & 7) == OBJECT_Player) { v4 = v3 >> 3; v5 = (char *)&pParty->pTurnBasedPlayerRecoveryTimes[v3 >> 3]; @@ -9787,7 +9787,7 @@ } v2->pQueue[a2].field_4 = v6; v2->_404544(); - if ( (v2->pQueue[0].uPackedID & 7) == 4 ) + if ( (v2->pQueue[0].uPackedID & 7) == OBJECT_Player) uActiveCharacter = (v2->pQueue[0].uPackedID >> 3) + 1; else uActiveCharacter = 0; @@ -9835,11 +9835,11 @@ { if ( !*(int *)v1 ) { - if ( (*(v1 - 4) & 7) == 4 ) + if ( (*(v1 - 4) & 7) == OBJECT_Player) return; v2 = &pActors[*((int *)v1 - 1) >> 3]; v3 = v2->uAIState; - if ( !v3 || v3 == 9 || v3 == 7 ) + if (v3 == Standing || v3 == Fleeing || v3 == Fidgeting) { v4 = pMonsterStats->pInfos[v2->pMonsterInfo.uID].uRecoveryTime; *(int *)v1 = v4; @@ -9866,7 +9866,7 @@ v1 = this; LOWORD(v2) = _404544(); if ( v1->pQueue[0].field_4 <= 0 - || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, (v1->pQueue[0].uPackedID & 7) != 4) ? (uActiveCharacter = 0) : (v2 = (v2 >> 3) + 1, uActiveCharacter = v2), + || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, (v1->pQueue[0].uPackedID & 7) != OBJECT_Player) ? (uActiveCharacter = 0) : (v2 = (v2 >> 3) + 1, uActiveCharacter = v2), viewparams->bRedrawGameUI = 1, v1->pQueue[0].field_4 <= 0) ) { @@ -9877,7 +9877,7 @@ do { v2 = *(int *)v4; - if ( (*(char *)v4 & 7) == 4 || *(int *)(v4 + 4) > 0 ) + if ( (*(char *)v4 & 7) == OBJECT_Player || *(int *)(v4 + 4) > 0 ) break; if ( *(int *)(v4 + 8) <= 0 ) { @@ -9935,7 +9935,7 @@ v1 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); v28 = v1; v3 = v1->uPackedID; - if ( (v1->uPackedID & 7) != 4 ) + if ( (v1->uPackedID & 7) != OBJECT_Player) { v4 = v3 >> 3; // turn based only stuff a2a = dword_4F6E08[v3 >> 3]; @@ -10099,7 +10099,7 @@ v9 = 0; v20 = 0; } - if ( (v22 & 7) == 3 ) + if ( (v22 & 7) == OBJECT_Actor) v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[v22 >> 3].pMonsterInfo.uID].uID - 1) / 3] @@ -10232,7 +10232,7 @@ while ( 1 ) { v5 = v10->uPackedID; - if ( (v10->uPackedID & 7) == 3 ) + if ( (v10->uPackedID & 7) == OBJECT_Actor) { v8 = dword_4F6E08[v5 >> 3]; memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7)); @@ -10271,7 +10271,7 @@ v2 = this->pQueue; do { - if ( (v2->uPackedID & 7) == 3 ) + if ( (v2->uPackedID & 7) == OBJECT_Actor) { v3 = v2->uPackedID >> 3; v8 = v3; @@ -10326,7 +10326,7 @@ { v4 = v14->uPackedID; a1 = v14->uPackedID; - if ( (a1 & 7) != 4 ) + if ( (a1 & 7) != OBJECT_Player) { v5 = v4 >> 3; v12 = v5; @@ -10410,7 +10410,7 @@ unsigned int a2a; // [sp+5Ch] [bp+8h]@7 v2 = *(&this->field_0 + 4 * (a2 + 2)); - if ( (v2 & 7) == 4 ) + if ( (v2 & 7) == OBJECT_Player) return 0; v3 = v2 >> 3; uActorID = v3; @@ -10604,7 +10604,7 @@ v14 = this->pQueue; do { - if ( (v3->uPackedID & 7) != 4 ) + if ( (v3->uPackedID & 7) != OBJECT_Player) { v4 = v3->uPackedID >> 3; uActorID = v4; @@ -16352,9 +16352,9 @@ else v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; v6 = (unsigned __int16)v5; - if ( (v6 & 7) != 2 ) - { - if ( (v6 & 7) == 3 ) + if ( (v6 & 7) != OBJECT_Item) + { + if ( (v6 & 7) == OBJECT_Actor) { if ( pRenderer->uNumSceneBegins ) { @@ -16484,7 +16484,7 @@ } //----- (004175C0) -------------------------------------------------------- -void __thiscall UI_OnMouseLeftClick(int *pXY) +void UI_OnMouseLeftClick(int *pXY) { int *pXY_; // esi@1 signed int y; // eax@7 @@ -16591,7 +16591,7 @@ else v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; v6 = (unsigned __int16)v5; - if ( (v5 & 7) == 3 + if ( (v5 & 7) == OBJECT_Actor && uActiveCharacter && v5 < 33554432 && pPlayers[uActiveCharacter]->CanAct() diff -r f4d7a9a8c363 -r cca78efb377e mm7_6.cpp --- a/mm7_6.cpp Tue Feb 12 02:02:26 2013 +0200 +++ b/mm7_6.cpp Tue Feb 12 03:02:13 2013 +0200 @@ -3324,7 +3324,7 @@ v666 = v1; a2 = stru_50C198.FindClosesActor(5120, 1, v666); v6 = pMouse->uPointingObjectID; - if ( pMouse->uPointingObjectID != v1 && (v6 & 7) == 3 && pActors[v6 >> 3].CanAct() ) + if ( pMouse->uPointingObjectID != v1 && (v6 & 7) == OBJECT_Actor && pActors[v6 >> 3].CanAct() ) { v4 = pMouse->uPointingObjectID; LABEL_18: @@ -3333,9 +3333,9 @@ a1.uItemType = stru_4E3ACC[v3->spellnum].uItemType; if ( (short)a1.uItemType != (short)v1 ) { - if ( (a2 & 7) == 3 ) + if ( (a2 & 7) == OBJECT_Actor) { - memcpy(&v715, Actor::GetDirectionInfo((8 * v3->uPlayerID + 8) | 4, a2, &a3, 0), sizeof(v715)); + memcpy(&v715, Actor::GetDirectionInfo((8 * v3->uPlayerID + 8) | OBJECT_Player, a2, &a3, 0), sizeof(v715)); v2 = v723; v1 = 0; } @@ -3672,7 +3672,7 @@ goto LABEL_83; if ( a2 == v1 ) goto LABEL_200; - if ( (a2 & 7) != 3 ) + if ( (a2 & 7) != OBJECT_Actor) goto LABEL_1056; v699 = v1; v698 = v1; @@ -3750,7 +3750,7 @@ v47 = v38; goto LABEL_139; case 79: - if ( !pPlayer->CanCastSpell(uRequiredMana) || a2 == v1 || (a2 & 7) != 3 ) + if ( !pPlayer->CanCastSpell(uRequiredMana) || a2 == v1 || (a2 & 7) != OBJECT_Actor) goto LABEL_83; v730 = a2 >> 3; v693 = v1; @@ -3855,7 +3855,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto LABEL_83; if ( a2 == v1 - || (a2 & 7) != 3 + || (a2 & 7) != OBJECT_Actor || (v730 = a2 >> 3, v721 = (int)&pActors[a2 >> 3], !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 9u)) ) @@ -3897,7 +3897,7 @@ LODWORD(v733) = v57; if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto LABEL_83; - if ( (a2 & 7) != 3 + if ( (a2 & 7) != OBJECT_Actor || (v721 = 836 * (a2 >> 3), LODWORD(v718) = (int)&pActors[a2 >> 3], !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 3u)) ) @@ -4324,7 +4324,7 @@ while ( v730b <= &pParty->pPlayers[3] ); goto LABEL_1056; case 52: - if ( pPlayer->CanCastSpell(uRequiredMana) && a2 != v1 && (a2 & 7) == 3 ) + if ( pPlayer->CanCastSpell(uRequiredMana) && a2 != v1 && (a2 & 7) == OBJECT_Actor) { v730 = a2 >> 3; v112 = &pActors[a2 >> 3]; @@ -4511,7 +4511,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto LABEL_83; LODWORD(v725) = a2 & 7; - if ( (a2 & 7) == 3 ) + if ( (a2 & 7) == OBJECT_Actor) { v152 = a2 >> 3; uRequiredMana = pActors[v152].vPosition.x; @@ -5820,7 +5820,7 @@ v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[4]; goto LABEL_104; } - if ( (v342 & 7) == 3 ) + if ( (v342 & 7) == OBJECT_Actor) { v343 = v342 >> 3; HIDWORD(v344) = v1 + ((pParty->uTimePlayed + 1280) >> 32); @@ -6211,7 +6211,7 @@ case 59: if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto LABEL_83; - if ( a2 == v1 || (a2 & 7) != 3 ) + if ( a2 == v1 || (a2 & 7) != OBJECT_Actor) goto LABEL_1056; v417 = (int)&pActors[a2 >> 3]; v730 = v417; @@ -6303,7 +6303,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto LABEL_83; v426 = a2 >> 3; - if ( (a2 & 7) != 3 ) + if ( (a2 & 7) != OBJECT_Actor) goto LABEL_1056; v730 = 836 * v426; if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) @@ -6331,7 +6331,7 @@ goto LABEL_83; amount = 600 * v2; v427 = a2 >> 3; - if ( (a2 & 7) != 3 ) + if ( (a2 & 7) != OBJECT_Actor) goto LABEL_1056; v730 = 836 * v427; if ( MonsterStats::BelongsToSupertype(pActors[v427].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) @@ -6464,7 +6464,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto LABEL_83; v445 = a2 >> 3; - if ( (a2 & 7) == 2 ) + if ( (a2 & 7) == OBJECT_Item) { v449 = (char *)&pLayingItems[v445].stru_24; v450 = *(int *)v449; @@ -6484,15 +6484,15 @@ } else { - if ( (a2 & 7) == 3 ) + if ( (a2 & 7) == OBJECT_Actor) { stru_50C198.LootActor(&pActors[v445]); } else { - if ( (a2 & 7) != 5 ) + if ( (a2 & 7) != OBJECT_Decoration) { - if ( (a2 & 7) != 6 ) + if ( (a2 & 7) != OBJECT_BModel) goto LABEL_1056; dword_507CD8 = 1; v677 = 1; @@ -6607,7 +6607,7 @@ } else { - if ( (v460 & 7) == 3 ) + if ( (v460 & 7) == OBJECT_Actor) { v461 = &pActors[v460 >> 3]; v462 = v461->uAIState; @@ -7431,7 +7431,7 @@ LODWORD(v733) = 29030400; LABEL_1082: v599 = a2 >> 3; - if ( (a2 & 7) != 3 ) + if ( (a2 & 7) != OBJECT_Actor) goto LABEL_1056; v730 = 836 * v599; if ( !MonsterStats::BelongsToSupertype(pActors[v599].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) @@ -7916,12 +7916,12 @@ v29 = 0; v28 = 0; v7 = pMouse->uPointingObjectID; - if ( (pMouse->uPointingObjectID & 7) != 3 || (v34 = pMouse->uPointingObjectID, !pActors[v7 >> 3].CanAct()) ) + if ( (pMouse->uPointingObjectID & 7) != OBJECT_Actor || (v34 = pMouse->uPointingObjectID, !pActors[v7 >> 3].CanAct()) ) v34 = stru_50C198.FindClosesActor(5120, 0, 0); a3.z = 0; a3.y = 0; a3.x = 0; - if ( (v34 & 7) == 3 ) + if ( (v34 & 7) == OBJECT_Actor) { a2 = v34 >> 3; v8 = &pActors[v34 >> 3]; @@ -8174,7 +8174,7 @@ { v22 = *v28; v11 = *v28 & 0xFFFF; - if ( (*(char *)v28 & 7) == 3 ) + if ( (*(char *)v28 & 7) == OBJECT_Actor) { v12 = &pActors[(unsigned int)v11 >> 3]; v13 = v12->uAIState; @@ -9115,7 +9115,7 @@ { if (pParty->bTurnBasedModeOn) { - if ( pTurnEngine->field_4 == 3 || (pTurnEngine->pQueue[0].uPackedID & 7) == 4 ) + if ( pTurnEngine->field_4 == OBJECT_Actor || (pTurnEngine->pQueue[0].uPackedID & 7) == OBJECT_Player) { pParty->bTurnBasedModeOn = 0; pTurnEngine->End(true); diff -r f4d7a9a8c363 -r cca78efb377e mm7_data.h --- a/mm7_data.h Tue Feb 12 02:02:26 2013 +0200 +++ b/mm7_data.h Tue Feb 12 03:02:13 2013 +0200 @@ -1858,7 +1858,7 @@ void __cdecl identify_item(); void __thiscall sub_416B01(void *_this); void __thiscall sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(struct Vec2_int_ *_this); -void __thiscall UI_OnMouseLeftClick(int *pXY); // idb +void UI_OnMouseLeftClick(int *pXY); // idb void __thiscall sub_417871(int *pXY); void __cdecl sub_4178C4(); void __cdecl sub_4178E1();