Mercurial > mm7
diff mm7_2.cpp @ 872:2db21a810d48
Merge
author | Nomad |
---|---|
date | Mon, 01 Apr 2013 13:39:39 +0200 |
parents | 710cf848ad24 f4394e320312 |
children | b7246c149957 |
line wrap: on
line diff
--- a/mm7_2.cpp Mon Apr 01 13:39:19 2013 +0200 +++ b/mm7_2.cpp Mon Apr 01 13:39:39 2013 +0200 @@ -382,7 +382,7 @@ do { v2 = v1->uAIState; - if ( v1->uAIState == Dead || v2 == Removed || v2 == Disabled || (v3 = v1->uSummonerID) != 0 && (v3 & 7) == OBJECT_Player) + if ( v1->uAIState == Dead || v2 == Removed || v2 == Disabled || (v3 = v1->uSummonerID) != 0 && PID_TYPE(v3) == OBJECT_Player) ++v0; ++v1; --v7; @@ -4124,7 +4124,7 @@ { if ( v20 == uNumActors ) ++uNumActors; - v6->uSummonerID = 8 * v17 | 4; + v6->uSummonerID = PID(OBJECT_Player,v17); result = v6->pActorBuffs[2].Apply( pParty->uTimePlayed + (signed __int64)((double)(a3 << 7) * 0.033333335), v16, @@ -4982,7 +4982,7 @@ LOWORD(v7) = v5 & 0xE0; v12 = v7 + v11; LOWORD(v7) = v8 & 0xE0; - return ((v8 & 7) + (v5 & 7) + (a3a & 7) + (v6 & 7)) | (v7 + v12) | ((v8 & 0x1C00) + return (PID_TYPE(v8) + PID_TYPE(v5) + PID_TYPE(a3a) + PID_TYPE(v6)) | (v7 + v12) | ((v8 & 0x1C00) + (v5 & 0x1C00) + v9 + (__PAIR__(v10, (unsigned __int16)a4 >> 2) & 0x1C00)); @@ -10180,7 +10180,7 @@ DoInteractionWithTopmostZObject((unsigned __int16)v1, (signed int)(unsigned __int16)v1 >> 3); } v22 = 0; - v1 = (int *)((signed int)(viewparams->uScreen_BttmR_X + viewparams->uScreen_topL_X) >> 1); + v1 = (int *)((signed int)(viewparams->uScreen_BttmR_X + viewparams->uScreen_topL_X) >> 1);//wrong pointer if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) { v2 = (char *)v1 - 50; @@ -10213,11 +10213,11 @@ } while ( v6 < v22 ); } - if ( (v7 & 7) == OBJECT_Decoration) + if ( PID_TYPE(v7) == OBJECT_Decoration) { - v16 = (unsigned int)v7 >> 3; + v16 = (unsigned int)PID_ID(v7); if ( (signed int)(((unsigned int)*v21 >> 16) - - pDecorationList->pDecorations[pLevelDecorations[(unsigned int)v7 >> 3].uDecorationDescID].uRadius) <= 512 ) + - pDecorationList->pDecorations[pLevelDecorations[(unsigned int)PID_ID(v7)].uDecorationDescID].uRadius) <= 512 ) if ( v19 == v22 && v4 < 100 ) { ++v22; @@ -10311,12 +10311,12 @@ v26 = a2; v2 = a1; - switch ( a1 & 7 ) + switch ( PID_TYPE(a1) ) { case OBJECT_Item: // take the item - v17 = a1 >> 3; - v26 = a1 >> 3; - v18 = a1 >> 3; + v17 = PID_ID(a1); + v26 = PID_ID(a1); + v18 = PID_ID(a1); if ( pObjectList->pObjects[pSpriteObjects[v18].uObjectDescID].uFlags & 0x10 || v17 >= 1000 || !pSpriteObjects[v18].uObjectDescID ) @@ -10348,14 +10348,14 @@ break; case OBJECT_Actor: - v12 = a1 >> 3; - v13 = &pActors[a1 >> 3]; + v12 = PID_ID(a1); + v13 = &pActors[PID_ID(a1)]; v14 = v13->uAIState; if ( v14 == 4 || v14 == 17 ) return 1; if ( v14 == 5 ) { - stru_50C198.LootActor(&pActors[a1 >> 3]); + stru_50C198.LootActor(&pActors[PID_ID(a1)]); } else { @@ -10392,7 +10392,7 @@ break; case OBJECT_Decoration: - v8 = &pLevelDecorations[a1 >> 3]; + v8 = &pLevelDecorations[PID_ID(a1)]; v9 = v8->field_16_event_id; if ( v9 ) { @@ -10401,7 +10401,7 @@ } else { - if ( !pLevelDecorations[a1 >> 3].IsInteractive() ) + if ( !pLevelDecorations[PID_ID(a1)].IsInteractive() ) return 1; v10 = v8->_idx_in_stru123; v24 = 1; @@ -10413,7 +10413,7 @@ break; default: - if ( (a1 & 7) != OBJECT_BModel) + if ( PID_TYPE(a1) != OBJECT_BModel) { MessageBoxW(nullptr, L"Warning: Invalid ID reached!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Mouse.cpp:2020", 0); return 1; @@ -10421,13 +10421,13 @@ if ( uCurrentlyLoadedLevelType != LEVEL_Indoor ) { if ( a1 >> 9 >= pOutdoor->uNumBModels - || (v7 = &pOutdoor->pBModels[a1 >> 9].pFaces[(a1 >> 3) & 0x3F], BYTE2(v7->uAttributes) & 0x10) + || (v7 = &pOutdoor->pBModels[a1 >> 9].pFaces[(PID_ID(a1)) & 0x3F], BYTE2(v7->uAttributes) & 0x10) || (v6 = v7->sCogTriggeredID) == 0 ) return 1; EventProcessor((signed __int16)v6, v2, 1); return 0; } - v4 = &pIndoor->pFaces[a1 >> 3]; + v4 = &pIndoor->pFaces[PID_ID(a1)]; v5 = v4->uAttributes; if ( !(v5 & 0x2000000) ) { @@ -10488,11 +10488,11 @@ v6 = ((v12 - v4 - 1) >> 1) + 1; do { - if ( (*(char *)v5 & 7) == OBJECT_Actor) + if ( PID_TYPE(*(char *)v5) == OBJECT_Actor) { if ( *v5 <= a3 << 16 ) { - v7 = (signed int)(unsigned __int16)*v5 >> 3; + v7 = PID_ID((signed int)(unsigned __int16)*v5); v8 = pActors[v7].uAIState; if ( v8 != 5 ) { @@ -10559,11 +10559,11 @@ v3 = pRenderer->GetParentBillboardID(a1a); v4 = pBillboardRenderList[v3].sZValue; v5 = (unsigned __int16)pBillboardRenderList[v3].object_pid; - if ( (v5 & 7) == OBJECT_Actor) + if ( PID_TYPE(v5) == OBJECT_Actor) { if ( v4 <= (unsigned int)(a3 << 16) ) { - v6 = v5 >> 3; + v6 = PID_ID(v5); v7 = v6; v8 = pActors[v6].uAIState; if ( v8 != 5 ) @@ -10817,8 +10817,8 @@ while ( 1 ) { v19 = dword_720020_zvalues[v18] & 0xFFFF; - v20 = (dword_720020_zvalues[v18] & 0xFFFFu) >> 3; - if ( (dword_720020_zvalues[v18] & 7) == OBJECT_Item) + v20 = PID_ID(dword_720020_zvalues[v18]); + if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Item) { if ( v20 >= 0x3E8 ) return 0; @@ -10831,16 +10831,16 @@ } goto LABEL_41; } - if ( (dword_720020_zvalues[v18] & 7) == OBJECT_Actor) + if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Actor) { if ( v20 >= 0xBB8 ) return 0; v24 = (const char *)&pActors[v20]; goto LABEL_51; } - if ( (dword_720020_zvalues[v18] & 7) == OBJECT_Decoration) + if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Decoration) break; - if ( (dword_720020_zvalues[v18] & 7) == OBJECT_BModel) + if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_BModel) { if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { @@ -10853,7 +10853,7 @@ { if ( (dword_720020_zvalues[v18] & 0xFFFFu) >> 9 >= pOutdoor->uNumBModels ) goto LABEL_41; - v22 = pOutdoor->pBModels[(dword_720020_zvalues[v18] & 0xFFFFu) >> 9].pFaces[((dword_720020_zvalues[v18] & 0xFFFFu) >> 3) & 0x3F].sCogTriggeredID; + v22 = pOutdoor->pBModels[(dword_720020_zvalues[v18] & 0xFFFFu) >> 9].pFaces[v20 & 0x3F].sCogTriggeredID; } if ( v22 ) { @@ -11160,15 +11160,15 @@ v2 = &pSpriteObjects[uLayingItemID]; v3 = &pObjectList->pObjects[v2->uObjectDescID]; v145 = a2; - v151 = a2 & 7; - if ( (a2 & 7) == OBJECT_Actor) - { - if ( (v2->spell_caster_pid & 7) == OBJECT_Actor && !pActors[v2->spell_caster_pid >> 3].GetActorsRelation(&pActors[a2 >> 3]) ) + v151 = PID_TYPE(a2); + if ( PID_TYPE(a2) == OBJECT_Actor) + { + if ( PID_TYPE(v2->spell_caster_pid) == OBJECT_Actor && !pActors[PID_ID(v2->spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]) ) return 1; } else { - if ( (a2 & 7) == OBJECT_Player && (v2->spell_caster_pid & 7) == OBJECT_Player) + if ( PID_TYPE(a2) == OBJECT_Player && PID_TYPE(v2->spell_caster_pid) == OBJECT_Player) return 1; } if ( pParty->bTurnBasedModeOn == 1 ) @@ -11180,8 +11180,8 @@ v2->uAttributes = v5 & 0xFFFB; } } - if ( v151 == OBJECT_BModel && (v2->spell_caster_pid & 7) != OBJECT_Player) - BYTE2(pActors[v2->spell_caster_pid >> 3].uAttributes) |= 4u; + if ( v151 == OBJECT_BModel && PID_TYPE(v2->spell_caster_pid) != OBJECT_Player) + BYTE2(pActors[PID_ID(v2->spell_caster_pid)].uAttributes) |= 4u; v6 = v2->uType; v7 = v2->uType; if ( v7 > 3060 ) @@ -11283,7 +11283,7 @@ v115 = 8 * v153; v129 = 0; v128 = -1; - LOBYTE(v115) = 8 * v153 | 2; + LOBYTE(v115) = PID(OBJECT_Item,v153); v127 = 0; v126 = v115; v116 = v143; @@ -11295,7 +11295,7 @@ } v106 = v145; v150 = 0; - v139 = v106 >> 3; + v139 = PID_ID(v106); v137 = v2->spell_level; v152 = v2->spell_skill; v136 = v2->spell_id; @@ -11368,7 +11368,7 @@ if ( v7 == 8010 ) { if ( v151 == 3 - && MonsterStats::BelongsToSupertype(pActors[v145 >> 3].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) + && MonsterStats::BelongsToSupertype(pActors[PID_ID(v145)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) sub_43A97E(v153, v145); v93 = pObjectList->uNumObjects; ++v2->uType; @@ -11553,7 +11553,7 @@ LABEL_132: v73 = v2->vPosition.z; v74 = v2->vPosition.y; - v75 = 8 * v72 | 2; + v75 = PID(OBJECT_Item,v72); v2->vVelocity.z = v66; v2->vVelocity.y = v66; v76 = v2->vPosition.x; @@ -11872,7 +11872,7 @@ v2->vVelocity.z = 0; v38 = 8 * v153; v39 = v2->vPosition.y; - LOBYTE(v38) = 8 * v153 | 2; + LOBYTE(v38) = PID(OBJECT_Item,v153); v2->vVelocity.y = 0; v2->vVelocity.x = 0; v40 = v2->vPosition.x; @@ -11930,7 +11930,7 @@ v2->uSpriteFrameID = v32; v102 = 8 * v153; v103 = v2->vPosition.y; - LOBYTE(v102) = 8 * v153 | 2; + LOBYTE(v102) = PID(OBJECT_Item,v153); v2->vVelocity.x = v32; v2->vVelocity.y = v32; v104 = v2->vPosition.x; @@ -12024,7 +12024,7 @@ v13 = 8 * v153; v129 = v9; v128 = -1; - LOBYTE(v13) = 8 * v153 | 2; + LOBYTE(v13) = PID(OBJECT_Item,v153); v127 = v9; v126 = v13; LABEL_28: