# HG changeset patch # User zipi # Date 1364726788 -3600 # Node ID 8fafe3645f362fa14ad9328e0f7b50e58a14a2a6 # Parent ceef506115676f6fab8b80e8fef40a1dc1ae959b * PID replaces * Actor::GetDirectionInfo cleaning diff -r ceef50611567 -r 8fafe3645f36 Actor.cpp --- a/Actor.cpp Sun Mar 31 10:44:43 2013 +0100 +++ b/Actor.cpp Sun Mar 31 11:46:28 2013 +0100 @@ -781,7 +781,7 @@ v24 = (double)v118; v118 = v23; v112 = v24; - v116 = 8 * LODWORD(v120) | 3; + v116 = PID(LODWORD(v120),OBJECT_Actor); do { v26 = rand(); @@ -915,7 +915,7 @@ v102 = 0; v40 = 8 * LODWORD(v120); v101 = -1; - LOBYTE(v40) = 8 * LOBYTE(v120) | 3; + LOBYTE(v40) = PID(LOBYTE(v120),OBJECT_Actor); v100 = 0; v99 = v40; v98 = (SoundID)10040; @@ -968,7 +968,7 @@ v102 = 0; v43 = 8 * LODWORD(v120); v101 = -1; - LOBYTE(v43) = 8 * LOBYTE(v120) | 3; + LOBYTE(v43) = PID(LOBYTE(v120),OBJECT_Actor); v100 = 0; v99 = v43; v98 = (SoundID)14010; @@ -1007,7 +1007,7 @@ v102 = 0; v46 = 8 * LODWORD(v120); v101 = -1; - LOBYTE(v46) = 8 * LOBYTE(v120) | 3; + LOBYTE(v46) = PID(LOBYTE(v120),OBJECT_Actor); v100 = 0; v99 = v46; v98 = (SoundID)13040; @@ -1050,7 +1050,7 @@ v50 = 8 * LODWORD(v120); v102 = v47; v101 = -1; - LOBYTE(v50) = 8 * LOBYTE(v120) | 3; + LOBYTE(v50) = PID(LOBYTE(v120),OBJECT_Actor); v100 = v47; v99 = v50; v98 = (SoundID)14020; @@ -1102,7 +1102,7 @@ v65 = 8 * LODWORD(v120); v102 = 0; v101 = -1; - LOBYTE(v65) = 8 * LOBYTE(v120) | 3; + LOBYTE(v65) = PID(LOBYTE(v120),OBJECT_Actor); v100 = 0; v99 = v65; v22 = (SoundID)word_4EE088_sound_ids[80]; @@ -1131,7 +1131,7 @@ v102 = 0; v52 = 8 * LODWORD(v120); v101 = -1; - LOBYTE(v52) = 8 * LOBYTE(v120) | 3; + LOBYTE(v52) = PID(LOBYTE(v120),OBJECT_Actor); v100 = 0; v99 = v52; v98 = (SoundID)16060; @@ -1185,7 +1185,7 @@ v102 = 0; v55 = 8 * LODWORD(v120); v101 = -1; - LOBYTE(v55) = 8 * LOBYTE(v120) | 3; + LOBYTE(v55) = PID(LOBYTE(v120),OBJECT_Actor); v100 = 0; v99 = v55; v98 = (SoundID)14060; @@ -1228,7 +1228,7 @@ v102 = 0; v97 = 8 * LODWORD(v120); v101 = -1; - LOBYTE(v97) = 8 * LOBYTE(v120) | 3; + LOBYTE(v97) = PID(LOBYTE(v120),OBJECT_Actor); v100 = 0; v99 = v97; v98 = (SoundID)17070; @@ -1272,7 +1272,7 @@ v102 = 0; v95 = 8 * LODWORD(v120); v101 = -1; - LOBYTE(v95) = 8 * LOBYTE(v120) | 3; + LOBYTE(v95) = PID(LOBYTE(v120),OBJECT_Actor); v100 = 0; v99 = v95; v98 = (SoundID)17080; @@ -1319,7 +1319,7 @@ v102 = 0; v69 = 8 * LODWORD(v120); v101 = -1; - LOBYTE(v69) = 8 * LOBYTE(v120) | 3; + LOBYTE(v69) = PID(LOBYTE(v120),OBJECT_Actor); v100 = 0; v99 = v69; v98 = (SoundID)18060; @@ -1758,173 +1758,160 @@ float a4a; // [sp+58h] [bp+Ch]@45 v4 = PID_ID(uObj1ID); - v5 = PID_TYPE(uObj1ID) - 2; + v5 = PID_TYPE(uObj1ID); v6 = uObj2ID; - if ( !v5 ) - { - v19 = v4; - outx = pSpriteObjects[v19].vPosition.x; - v13 = pSpriteObjects[v19].vPosition.y; - v14 = pSpriteObjects[v19].vPosition.z; - goto LABEL_26; - } - v7 = v5 - 1; - if ( !v7 ) - { - outx = pActors[v4].vPosition.x; - outy = pActors[v4].vPosition.y; - LODWORD(v42) = pActors[v4].uActorHeight; - v11 = pActors[v4].vPosition.z - (unsigned int)(signed __int64)((double)SLODWORD(v42) * -0.75); - goto LABEL_24; - } - v8 = v7 - 1; - if ( !v8 ) - { - if ( !v4 ) - { - outx = pParty->vPosition.x; - outy = pParty->vPosition.y; - v14 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; -LABEL_27: - outz = v14; - goto LABEL_28; - } - v15 = v4 - 1; - if ( v15 ) - { - v16 = v15 - 1; - if ( v16 ) - { - v17 = v16 - 1; - if ( v17 ) - { - if ( v17 != 1 ) - goto LABEL_28; - v40 = &outz; - v39 = &outy; - v38 = &outx; - v18 = pParty->sRotationY - stru_5C6E00->uIntegerHalfPi; - v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; - goto LABEL_20; - } - v40 = &outz; - v39 = &outy; - v38 = &outx; - v18 = pParty->sRotationY - stru_5C6E00->uIntegerHalfPi; - v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; - } - else - { - v40 = &outz; - v39 = &outy; - v38 = &outx; - v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; - v18 = stru_5C6E00->uIntegerHalfPi + pParty->sRotationY; - } - *(_QWORD *)&v37.x = *(_QWORD *)&pParty->vPosition.x; - v36 = 0; - v35 = 8; -LABEL_21: - Vec3_int_::Rotate(v35, v18, v36, v37, v38, v39, v40); - goto LABEL_28; - } - v40 = &outz; - v39 = &outy; - v38 = &outx; - v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; - v18 = stru_5C6E00->uIntegerHalfPi + pParty->sRotationY; -LABEL_20: - *(_QWORD *)&v37 = *(_QWORD *)&pParty->vPosition.x; - v36 = 0; - v35 = 24; - goto LABEL_21; - } - v9 = v8 - 1; - if ( !v9 ) - { - v12 = v4; - outx = pLevelDecorations[v12].vPosition.x; - v13 = pLevelDecorations[v12].vPosition.y; - v14 = pLevelDecorations[v12].vPosition.z; -LABEL_26: - outy = v13; - goto LABEL_27; - } - if ( v9 != 1 ) - { - outz = 0; - outy = 0; - outx = 0; - goto LABEL_28; - } - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - { - v10 = &pIndoor->pFaces[v4]; - outx = (v10->pBounding.x1 + v10->pBounding.x2) >> 1; - outy = (v10->pBounding.y1 + v10->pBounding.y2) >> 1; - v11 = (v10->pBounding.z1 + v10->pBounding.z2) >> 1; -LABEL_24: - outz = v11; - } -LABEL_28: v20 = v6; v21 = PID_TYPE(v6); v22 = PID_ID(v20); - if ( v21 == 2 ) - { - v30 = v22; - LODWORD(v45) = pSpriteObjects[v30].vPosition.x; - v27 = pSpriteObjects[v30].vPosition.y; - v28 = pSpriteObjects[v30].vPosition.z; - goto LABEL_43; - } - if ( v21 == 3 ) - { - LODWORD(v45) = pActors[v22].vPosition.x; - LODWORD(v44) = pActors[v22].vPosition.y; - v25 = pActors[v22].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v22].uActorHeight * -0.75); - goto LABEL_41; - } - if ( v21 == 4 ) - { - LODWORD(v45) = pParty->vPosition.x; - LODWORD(v44) = pParty->vPosition.y; - v29 = a4; - if ( !a4 ) - v29 = pParty->sEyelevel; - v28 = pParty->vPosition.z + v29; - goto LABEL_44; - } - if ( v21 == 5 ) + switch(v5) { - v26 = v22; - LODWORD(v45) = pLevelDecorations[v26].vPosition.x; - v27 = pLevelDecorations[v26].vPosition.y; - v28 = pLevelDecorations[v26].vPosition.z; -LABEL_43: - LODWORD(v44) = v27; -LABEL_44: - a4 = v28; - goto LABEL_45; + case OBJECT_Item: + { + v19 = v4; + outx = pSpriteObjects[v19].vPosition.x; + v13 = pSpriteObjects[v19].vPosition.y; + v14 = pSpriteObjects[v19].vPosition.z; + outy = v13; + outz = v14; + v30 = v22; + LODWORD(v45) = pSpriteObjects[v30].vPosition.x; + v27 = pSpriteObjects[v30].vPosition.y; + v28 = pSpriteObjects[v30].vPosition.z; + LODWORD(v44) = v27; + a4 = v28; + break; + } + case OBJECT_Actor: + { + outx = pActors[v4].vPosition.x; + outy = pActors[v4].vPosition.y; + LODWORD(v42) = pActors[v4].uActorHeight; + v11 = pActors[v4].vPosition.z - (unsigned int)(signed __int64)((double)SLODWORD(v42) * -0.75); + outz = v11; + LODWORD(v45) = pActors[v22].vPosition.x; + LODWORD(v44) = pActors[v22].vPosition.y; + v25 = pActors[v22].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v22].uActorHeight * -0.75); + a4 = v25; + break; + } + case OBJECT_Player: + { + if ( !v4 ) + { + outx = pParty->vPosition.x; + outy = pParty->vPosition.y; + v14 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + outz = v14; + break;; + } + if ( v4 == 4 ) + { + v40 = &outz; + v39 = &outy; + v38 = &outx; + v18 = pParty->sRotationY - stru_5C6E00->uIntegerHalfPi; + v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + *(_QWORD *)&v37 = *(_QWORD *)&pParty->vPosition.x; + v36 = 0; + v35 = 24; + Vec3_int_::Rotate(v35, v18, v36, v37, v38, v39, v40); + break; + } + if ( v4 == 3 ) + { + v40 = &outz; + v39 = &outy; + v38 = &outx; + v18 = pParty->sRotationY - stru_5C6E00->uIntegerHalfPi; + v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + *(_QWORD *)&v37.x = *(_QWORD *)&pParty->vPosition.x; + v36 = 0; + v35 = 8; + Vec3_int_::Rotate(v35, v18, v36, v37, v38, v39, v40); + break; + } + if ( v4 == 2 ) + { + v40 = &outz; + v39 = &outy; + v38 = &outx; + v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + v18 = stru_5C6E00->uIntegerHalfPi + pParty->sRotationY; + *(_QWORD *)&v37.x = *(_QWORD *)&pParty->vPosition.x; + v36 = 0; + v35 = 8; + Vec3_int_::Rotate(v35, v18, v36, v37, v38, v39, v40); + break; + } + if ( v4 == 1 ) + { + v40 = &outz; + v39 = &outy; + v38 = &outx; + v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + v18 = stru_5C6E00->uIntegerHalfPi + pParty->sRotationY; + *(_QWORD *)&v37 = *(_QWORD *)&pParty->vPosition.x; + v36 = 0; + v35 = 24; + Vec3_int_::Rotate(v35, v18, v36, v37, v38, v39, v40); + break; + } + LODWORD(v45) = pParty->vPosition.x; + LODWORD(v44) = pParty->vPosition.y; + v29 = a4; + if ( !a4 ) + v29 = pParty->sEyelevel; + v28 = pParty->vPosition.z + v29; + a4 = v28; + } + case OBJECT_Decoration: + { + v12 = v4; + outx = pLevelDecorations[v12].vPosition.x; + v13 = pLevelDecorations[v12].vPosition.y; + v14 = pLevelDecorations[v12].vPosition.z; + outy = v13; + outz = v14; + v26 = v22; + LODWORD(v45) = pLevelDecorations[v26].vPosition.x; + v27 = pLevelDecorations[v26].vPosition.y; + v28 = pLevelDecorations[v26].vPosition.z; + LODWORD(v44) = v27; + a4 = v28; + break; + } + default: + { + outz = 0; + outy = 0; + outx = 0; + a4 = 0; + v44 = 0.0; + v45 = 0.0; + break; + } + case OBJECT_BModel: + { + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + { + v10 = &pIndoor->pFaces[v4]; + outx = (v10->pBounding.x1 + v10->pBounding.x2) >> 1; + outy = (v10->pBounding.y1 + v10->pBounding.y2) >> 1; + v11 = (v10->pBounding.z1 + v10->pBounding.z2) >> 1; + outz = v11; + } + else if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + { + v23 = &pIndoor->pFaces[v22]; + v24 = v23->pBounding.y1; + LODWORD(v45) = (v23->pBounding.x1 + v23->pBounding.x2) >> 1; + LODWORD(v44) = (v24 + v23->pBounding.y2) >> 1; + v25 = (v23->pBounding.z1 + v23->pBounding.z2) >> 1; + a4 = v25; + } + break; + } } - if ( v21 != 6 ) - { - a4 = 0; - v44 = 0.0; - v45 = 0.0; - goto LABEL_45; - } - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - { - v23 = &pIndoor->pFaces[v22]; - v24 = v23->pBounding.y1; - LODWORD(v45) = (v23->pBounding.x1 + v23->pBounding.x2) >> 1; - LODWORD(v44) = (v24 + v23->pBounding.y2) >> 1; - v25 = (v23->pBounding.z1 + v23->pBounding.z2) >> 1; -LABEL_41: - a4 = v25; - } -LABEL_45: v31 = (double)SLODWORD(v45) - (double)outx; v42 = v31; v32 = (double)SLODWORD(v44) - (double)outy; @@ -2087,69 +2074,66 @@ } if ( PID_TYPE(sTargetPid) == OBJECT_Actor) - { - v8 = PID_ID(sTargetPid); - v6 = (AIDirection *)pActors[v8].vPosition.x; - v7 = (AIDirection *)pActors[v8].vPosition.y; - v23 = (signed __int64)((double)pActors[v8].uActorHeight * 0.75 + (double)pActors[v8].vPosition.z); - } - else + { + v8 = PID_ID(sTargetPid); + v6 = (AIDirection *)pActors[v8].vPosition.x; + v7 = (AIDirection *)pActors[v8].vPosition.y; + v23 = (signed __int64)((double)pActors[v8].uActorHeight * 0.75 + (double)pActors[v8].vPosition.z); + } + else if ( PID_TYPE(sTargetPid) == OBJECT_Player) + { + v6 = (AIDirection *)pParty->vPosition.x; + v7 = (AIDirection *)pParty->vPosition.y; + v23 = pParty->vPosition.z + pParty->sEyelevel; + } + else + { + v6 = arg0; + v7 = arg0; + } + v21 = v3->uActorHeight; + v9 = (double)(signed int)v21 * 0.75; + v21 = v3->vPosition.z; + v10.z = (signed __int64)(v9 + (double)(signed int)v21); + v10.y = v3->vPosition.y; + v10.x = v3->vPosition.x; + if ( sub_407A1C((int)v6, (int)v7, v23, v10) ) + { + v12 = arg0; + v13 = 0; + if ( !arg0 ) { - if ( PID_TYPE(sTargetPid) == OBJECT_Player) - { - v6 = (AIDirection *)pParty->vPosition.x; - v7 = (AIDirection *)pParty->vPosition.y; - v23 = pParty->vPosition.z + pParty->sEyelevel; - } - else - { - v6 = arg0; - v7 = arg0; - } - } - v21 = v3->uActorHeight; - v9 = (double)(signed int)v21 * 0.75; - v21 = v3->vPosition.z; - v10.z = (signed __int64)(v9 + (double)(signed int)v21); - v10.y = v3->vPosition.y; - v10.x = v3->vPosition.x; - if ( sub_407A1C((int)v6, (int)v7, v23, v10) ) - { - v12 = arg0; - v13 = 0; - if ( !arg0 ) - { - v14 = Actor::GetDirectionInfo(PID(OBJECT_Actor, v24), sTargetPid, &a3, 0); + v14 = Actor::GetDirectionInfo(PID(OBJECT_Actor, v24), sTargetPid, &a3, 0); v12 = &v20; memcpy(&v20, v14, sizeof(v20)); v13 = 0; - } - v15 = pSpriteFrameTable->pSpriteSFrames; - v3->uYawAngle = LOWORD(v12->uYawAngle); - v16 = v15[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength; - v17 = v24; - v3->uCurrentActionLength = 8 * v16; - v3->uCurrentActionTime = v13; - v3->uAIState = AttackingMelee; - Actor::PlaySound(v17, 0); - LODWORD(v18) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; - v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; - if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v13 - && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v13 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v13) ) - { - LODWORD(v18) = 2 * v18; + } + v15 = pSpriteFrameTable->pSpriteSFrames; + v3->uYawAngle = LOWORD(v12->uYawAngle); + v16 = v15[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength; + v17 = v24; + v3->uCurrentActionLength = 8 * v16; + v3->uCurrentActionTime = v13; + v3->uAIState = AttackingMelee; + Actor::PlaySound(v17, 0); + LODWORD(v18) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; + v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; + if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v13 + && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v13 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v13) ) + { + LODWORD(v18) = 2 * v18; v25 = v18; - } - if ( pParty->bTurnBasedModeOn != 1 ) + } + if ( pParty->bTurnBasedModeOn != 1 ) v18 = (signed __int64)(flt_6BE3A8_debug_recmod2 * (double)(signed int)v25 * 2.133333333333333); - v3->pMonsterInfo.uRecoveryTime = v18; - v3->vVelocity.z = v13; - v3->vVelocity.y = v13; - v3->vVelocity.x = v13; - v3->UpdateAnimation(); - } - else - Actor::_402AD7(v24, sTargetPid, rand() % 2, 64, arg0); + v3->pMonsterInfo.uRecoveryTime = v18; + v3->vVelocity.z = v13; + v3->vVelocity.y = v13; + v3->vVelocity.x = v13; + v3->UpdateAnimation(); + } + else + Actor::_402AD7(v24, sTargetPid, rand() % 2, 64, arg0); } //----- (00438CF3) -------------------------------------------------------- @@ -2231,7 +2215,7 @@ __int16 v9; // [sp-4h] [bp-8h]@3 result = a2 - 1; - v4 = 8 * uActorID | 3; + v4 = PID(uActorID,OBJECT_Actor); switch ( a2 ) { case 1: @@ -2282,42 +2266,42 @@ v9 = 4; v8 = 65536; v7 = 0; - v6 = 8 * uActorID | 3; + v6 = PID(uActorID,OBJECT_Actor); v5 = 901; goto LABEL_16; case 6: v9 = 4; v8 = 65536; v7 = 0; - v6 = 8 * uActorID | 3; + v6 = PID(uActorID,OBJECT_Actor); v5 = 902; goto LABEL_16; case 7: v9 = 4; v8 = 65536; v7 = 0; - v6 = 8 * uActorID | 3; + v6 = PID(uActorID,OBJECT_Actor); v5 = 903; goto LABEL_16; case 8: v9 = 4; v8 = 65536; v7 = 0; - v6 = 8 * uActorID | 3; + v6 = PID(uActorID,OBJECT_Actor); v5 = 900; goto LABEL_16; case 9: v9 = 4; v8 = 65536; v7 = 0; - v6 = 8 * uActorID | 3; + v6 = PID(uActorID,OBJECT_Actor); v5 = 909; goto LABEL_16; case 10: v9 = 4; v8 = 65536; v7 = 0; - v6 = 8 * uActorID | 3; + v6 = PID(uActorID,OBJECT_Actor); v5 = 908; LABEL_16: result = pOtherOverlayList->_4418B6(v5, v6, v7, v8, v9); @@ -3034,7 +3018,7 @@ && v4->uAIState != 18 && v4->uAIState != 2)) { - memcpy(&v10, Actor::GetDirectionInfo(8 * v3 | 3, a2, &a3, 0), sizeof(v10)); + memcpy(&v10, Actor::GetDirectionInfo(PID(v3,OBJECT_Actor), a2, &a3, 0), sizeof(v10)); v6 = pSpriteFrameTable->pSpriteSFrames; v4->uYawAngle = LOWORD(v10.uYawAngle); v7 = v6[v4->pSpriteIDs[ANIM_GotHit]].uAnimLength; @@ -3244,7 +3228,7 @@ v6 = 0; v7 = &pActors[uActorID]; v18 = a2; - v8 = 8 * uActorID | 3; + v8 = PID(uActorID,OBJECT_Actor); v9 = v7->pMonsterInfo.uFlying == 0; v17 = v5; if ( !v9 && !pParty->bFlying ) @@ -3327,8 +3311,8 @@ //result = pActors[uActorID].CanAct(); if ( pActors[uActorID].CanAct() ) { - v7 = 8 * v4 | 3; - a1 = 8 * v4 | 3; + v7 = PID(v4,OBJECT_Actor); + a1 = PID(v4,OBJECT_Actor); if ( !a4 ) { a4 = &v12; @@ -3387,7 +3371,7 @@ v6 = 0; v7 = &pActors[uActorID]; v19 = a2; - v8 = 8 * uActorID | 3; + v8 = PID(uActorID,OBJECT_Actor); v9 = v7->pMonsterInfo.uFlying == 0; v20 = v5; if ( !v9 && !pParty->bFlying ) @@ -3473,7 +3457,7 @@ v5 = 0; v6 = &pActors[uActorID]; v21 = a2; - v7 = 8 * uActorID | 3; + v7 = PID(uActorID,OBJECT_Actor); v8 = v6->pMonsterInfo.uFlying == 0; v22 = v4; if ( !v8 && !pParty->bFlying ) @@ -3594,7 +3578,7 @@ actor->uAIState == Removed || actor->uAIState == Summoned || actor->uAIState == Disabled || uActorID == i ) continue; - if (_this->uLastCharacterIDToHit == 0 || (v9 = 8 * v5, LOBYTE(v9) = 8 * v5 | 3, _this->uLastCharacterIDToHit != v9) ) + if (_this->uLastCharacterIDToHit == 0 || (v9 = 8 * v5, LOBYTE(v9) = PID(v5,OBJECT_Actor), _this->uLastCharacterIDToHit != v9) ) { v10 = _this->GetActorsRelation(actor); if ( v10 == 0 ) @@ -4079,7 +4063,7 @@ if ( v23->uAttributes & 0x80000 ) v8->uAttributes |= 0x80000u; result = 8 * v24; - LOBYTE(result) = 8 * v24 | 3; + LOBYTE(result) = PID(v24,OBJECT_Actor); v8->uSummonerID = result; } return result; diff -r ceef50611567 -r 8fafe3645f36 Indoor.cpp --- a/Indoor.cpp Sun Mar 31 10:44:43 2013 +0100 +++ b/Indoor.cpp Sun Mar 31 11:46:28 2013 +0100 @@ -3516,7 +3516,7 @@ //v61 = 1; //v60 = 8 * i | OBJECT_BLVDoor; //v59 = eDoorSoundID; - pAudioPlayer->PlaySound(eDoorSoundID, 8 * i | OBJECT_BLVDoor, 1, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(eDoorSoundID, PID(i,OBJECT_BLVDoor), 1, -1, 0, 0, 0, 0); //goto LABEL_18; } LABEL_18: @@ -3999,7 +3999,7 @@ { v58 = v22; v24 = 8 * v63; - LOBYTE(v24) = 8 * v63 | 3; + LOBYTE(v24) = PID(v63,OBJECT_Actor); v61 = v22; _this = v24; do diff -r ceef50611567 -r 8fafe3645f36 Player.cpp --- a/Player.cpp Sun Mar 31 10:44:43 2013 +0100 +++ b/Player.cpp Sun Mar 31 11:46:28 2013 +0100 @@ -7488,7 +7488,7 @@ } pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); v5 = 8 * a2 + 392; - LOBYTE(v5) = (8 * a2 - 120) | 4; + LOBYTE(v5) = PID(a2 - 120,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); v3->AddVariable(VAR_NumSkillPoints, 2); } @@ -8309,7 +8309,7 @@ } LABEL_172: v25 = 8 * currPlayerId + 400; - LOBYTE(v25) = (8 * currPlayerId - 112) | 4; + LOBYTE(v25) = PID(currPlayerId - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); return; } @@ -8459,7 +8459,7 @@ if ( v31 != 1 ) return; v25 = 8 * currPlayerId + 400; - LOBYTE(v25) = (8 * currPlayerId - 112) | 4; + LOBYTE(v25) = PID(currPlayerId - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); return; case VAR_PlayerItemInHands: @@ -8733,7 +8733,7 @@ return; v5 = 0; v25 = 8 * currPlayerId + 400; - LOBYTE(v25) = (8 * currPlayerId - 112) | 4; + LOBYTE(v25) = PID(currPlayerId - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); return; } @@ -9256,7 +9256,7 @@ bFlashHistoryBook = 1; _play_sound: v28 = 8 * uPlayerIdx + 400; - LOBYTE(v28) = (8 * uPlayerIdx - 112) | 4; + LOBYTE(v28) = PID(uPlayerIdx - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); return; } @@ -9466,14 +9466,14 @@ GameUI_DrawFoodAndGold(); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_CurrentHP: ReceiveDamage((signed int)pValue, 4); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_CurrentSP: @@ -9484,28 +9484,28 @@ *(int *)v9 = 0; pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_ACModifier: this->sACModifier -= (unsigned __int8)pValue; pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_BaseLevel: this->uLevel -= (unsigned __int8)pValue; pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_LevelModifier: this->sLevelModifier -= (unsigned __int8)pValue; pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_Age: @@ -9522,7 +9522,7 @@ *((int *)v12 + 1) -= v14 + HIDWORD(v13); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_QBits_QuestsDone: @@ -9543,7 +9543,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_IntellectBonus: @@ -9552,7 +9552,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_PersonalityBonus: @@ -9561,7 +9561,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_EnduranceBonus: @@ -9570,7 +9570,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_SpeedBonus: @@ -9579,7 +9579,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_AccuracyBonus: @@ -9588,7 +9588,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_LuckBonus: @@ -9597,7 +9597,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_BaseMight: @@ -9605,7 +9605,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_BaseIntellect: @@ -9613,7 +9613,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_BasePersonality: @@ -9621,7 +9621,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_BaseEndurance: @@ -9629,7 +9629,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_BaseSpeed: @@ -9637,7 +9637,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_BaseAccuracy: @@ -9645,7 +9645,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_BaseLuck: @@ -9653,7 +9653,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_FireResistance: @@ -9661,7 +9661,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_AirResistance: @@ -9669,7 +9669,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_WaterResistance: @@ -9677,7 +9677,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_EarthResistance: @@ -9685,7 +9685,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_SpiritResistance: @@ -9693,7 +9693,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_MindResistance: @@ -9701,7 +9701,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_BodyResistance: @@ -9709,7 +9709,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_LightResistance: @@ -9717,7 +9717,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_DarkResistance: @@ -9725,7 +9725,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_MagicResistance: @@ -9733,7 +9733,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_FireResistanceBonus: @@ -9741,7 +9741,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_AirResistanceBonus: @@ -9749,7 +9749,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_WaterResistanceBonus: @@ -9757,7 +9757,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_EarthResistanceBonus: @@ -9765,7 +9765,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_SpiritResistanceBonus: @@ -9773,7 +9773,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_MindResistanceBonus: @@ -9781,7 +9781,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_BodyResistanceBonus: @@ -9789,7 +9789,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_LightResistanceBonus: @@ -9797,7 +9797,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_DarkResistanceBonus: @@ -9805,7 +9805,7 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_MagicResistanceBonus: @@ -9815,14 +9815,14 @@ pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_FixedFood: Party::TakeFood((unsigned int)pValue); pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_StaffSkill: @@ -9858,7 +9858,7 @@ *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; case VAR_Cursed: @@ -9882,7 +9882,7 @@ *((int *)this + 2 * result - 209) = 0; pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); v8 = 8 * v4 + 400; - LOBYTE(v8) = (8 * v4 - 112) | 4; + LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); return result; default: diff -r ceef50611567 -r 8fafe3645f36 Vis.cpp --- a/Vis.cpp Sun Mar 31 10:44:43 2013 +0100 +++ b/Vis.cpp Sun Mar 31 11:46:28 2013 +0100 @@ -329,7 +329,7 @@ pGame->pIndoorCameraD3D->ViewTransform(&a1, 1); v9 = _48B561_mess_with_scaling_along_z(/*v8, */a1.vWorldViewPosition.x); LOWORD(v9) = 0; - v15 = (void *)((8 * pFaceID | 6) + v9); + v15 = (void *)((PID(pFaceID,OBJECT_BModel)) + v9); pNumPointers = &list->uNumPointers; //v16 = 2; //v11 = list->uNumPointers; diff -r ceef50611567 -r 8fafe3645f36 mm7_2.cpp --- a/mm7_2.cpp Sun Mar 31 10:44:43 2013 +0100 +++ b/mm7_2.cpp Sun Mar 31 11:46:28 2013 +0100 @@ -4124,7 +4124,7 @@ { if ( v20 == uNumActors ) ++uNumActors; - v6->uSummonerID = 8 * v17 | 4; + v6->uSummonerID = PID(v17,OBJECT_Player); result = v6->pActorBuffs[2].Apply( pParty->uTimePlayed + (signed __int64)((double)(a3 << 7) * 0.033333335), v16, @@ -11283,7 +11283,7 @@ v115 = 8 * v153; v129 = 0; v128 = -1; - LOBYTE(v115) = 8 * v153 | 2; + LOBYTE(v115) = PID(v153,OBJECT_Item); v127 = 0; v126 = v115; v116 = v143; @@ -11553,7 +11553,7 @@ LABEL_132: v73 = v2->vPosition.z; v74 = v2->vPosition.y; - v75 = 8 * v72 | 2; + v75 = PID(v72,OBJECT_Item); 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(v153,OBJECT_Item); 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(v153,OBJECT_Item); 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(v153,OBJECT_Item); v127 = v9; v126 = v13; LABEL_28: diff -r ceef50611567 -r 8fafe3645f36 mm7_3.cpp --- a/mm7_3.cpp Sun Mar 31 10:44:43 2013 +0100 +++ b/mm7_3.cpp Sun Mar 31 11:46:28 2013 +0100 @@ -6224,7 +6224,7 @@ uFaceID = v65; } v56 = 8 * uFaceID; - LOBYTE(v56) = 8 * uFaceID | 6; + LOBYTE(v56) = PID(uFaceID,OBJECT_BModel); v57 = v56; v58 = pFace->GetTexture(); pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0); @@ -14970,7 +14970,7 @@ { v20 = &pActors[ai_near_actors_ids[v18]]; if ( v20->uAttributes & 0x8000 - || (v21 = sub_4070EF_prolly_collide_objects(8 * ai_near_actors_ids[v18] | 3, 4u), v18 = i, v21) ) + || (v21 = sub_4070EF_prolly_collide_objects(PID(ai_near_actors_ids[v18],OBJECT_Actor), 4u), v18 = i, v21) ) { v22 = ai_near_actors_ids[v18]; v20->uAttributes |= 0x8000u; diff -r ceef50611567 -r 8fafe3645f36 mm7_4.cpp --- a/mm7_4.cpp Sun Mar 31 10:44:43 2013 +0100 +++ b/mm7_4.cpp Sun Mar 31 11:46:28 2013 +0100 @@ -133,7 +133,7 @@ v5 = v8; } if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) - EventProcessor(v1->field_16_event_id, 8 * i | 5, 1); + EventProcessor(v1->field_16_event_id, PID(i,OBJECT_Decoration), 1); } if ( v1->field_2 & 2 ) { @@ -977,7 +977,7 @@ { stru_721530.field_7C = v13; v14 = 8 * v16; - LOBYTE(v14) = 8 * v16 | 3; + LOBYTE(v14) = PID(v16,OBJECT_Actor); stru_721530.uFaceID = v14; } result = 1; @@ -2133,11 +2133,11 @@ v17 = pActors[v16].vPosition.y; a1.vPosition.z = pActors[v16].vPosition.z; v18 = 8 * v15; - LOBYTE(v18) = 8 * v15 | 3; + LOBYTE(v18) = PID(v15,OBJECT_Actor); a1.vPosition.y = v17; a1.spell_target_pid = v18; v19 = a1.Create(0, 0, 0, 0); - DamageMonsterFromParty(8 * v19 | 2, *v14, &a3); + DamageMonsterFromParty(PID(v19,OBJECT_Item), *v14, &a3); ++v9; } while ( v9 < v13 ); @@ -5521,7 +5521,7 @@ v68 = v2; v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); v6 = 8 * uFaceID; - LOBYTE(v6) = 8 * uFaceID | 6; + LOBYTE(v6) = PID(uFaceID,OBJECT_BModel); stru_F8AD28.field_0 = v6; stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; diff -r ceef50611567 -r 8fafe3645f36 mm7_5.cpp --- a/mm7_5.cpp Sun Mar 31 10:44:43 2013 +0100 +++ b/mm7_5.cpp Sun Mar 31 11:46:28 2013 +0100 @@ -5321,7 +5321,7 @@ } v17 = (SoundID)a4; LABEL_26: - pAudioPlayer->PlaySound(v17, (8 * a4 + 80) | 4, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(v17, PID(a4 + 80,OBJECT_Player), 0, -1, 0, 0, 0, 0); v18 = Actor::_43B3E0_CalcDamage(v7, v74); v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0; v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0; @@ -6779,7 +6779,7 @@ { *(int *)v4 = 100; v6 = 8 * v19; - LOBYTE(v6) = 8 * v19 | 4; + LOBYTE(v6) = PID(v19,OBJECT_Player); *((int *)v4 + 2) = v2; *((int *)v4 - 1) = v6; *((int *)v4 + 1) = v2; @@ -6815,7 +6815,7 @@ v9 = ai_near_actors_ids[v20]; *(int *)v7 = 1; *((int *)v7 + 2) = v2; - *((int *)v7 - 1) = 8 * v9 | 3; + *((int *)v7 - 1) = PID(v9,OBJECT_Actor); *((int *)v7 + 1) = v2; ++v3; v7 += 16; @@ -7409,7 +7409,7 @@ if ( v5->pMonsterInfo.uHostilityType && !*v6 ) v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; v22 = *v6; - v7 = Actor::GetDirectionInfo(8 * (int)v4 | 3, *v6, &a3, 0); + v7 = Actor::GetDirectionInfo(PID((int)v4,OBJECT_Actor), *v6, &a3, 0); v8 = v5->uActorRadius; memcpy(&a3, v7, sizeof(a3)); memcpy(&v18, &a3, sizeof(v18));