Mercurial > mm7
changeset 2167:1497ca65a525
ODM_ProcessPartyActions continue
author | Ritor1 |
---|---|
date | Thu, 16 Jan 2014 23:49:04 +0600 |
parents | 47ac9e87690c |
children | 7cd99cb12911 |
files | Outdoor.cpp |
diffstat | 1 files changed, 108 insertions(+), 110 deletions(-) [+] |
line wrap: on
line diff
--- a/Outdoor.cpp Thu Jan 16 17:34:48 2014 +0600 +++ b/Outdoor.cpp Thu Jan 16 23:49:04 2014 +0600 @@ -3625,7 +3625,7 @@ int floor_level; // eax@14 int v6; // esi@45 ODMFace *face; // ecx@45 - signed int v33; // eax@143 + //signed int v33; // eax@143 int v34; // esi@143 int v35; // esi@147 int v36; // eax@155 @@ -3638,6 +3638,7 @@ signed int v44; // edx@184 int v45; // ecx@200 BSPModel *pModel; // eax@203 + bool pModel_; ODMFace *pODMFace; // esi@203 int v48; // eax@203 int v54; // eax@215 @@ -3710,7 +3711,7 @@ party_running_flag = false; party_walking_flag = false; v102 = 0; - pModel = 0; + pModel_ = false; bWaterWalk = false; if (!pParty->FeatherFallActive())//Проверка падение пера @@ -3839,38 +3840,38 @@ if (bUnderwater || pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 || pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 ) + { + extern int max_flight_height; + if ( pParty->vPosition.z < max_flight_height || hovering ) { - extern int max_flight_height; - if ( pParty->vPosition.z < max_flight_height || hovering ) + pZ += 30; + v113 += 30; + pParty->bFlying = true; + if ( pZ > max_flight_height ) { - pZ += 30; - v113 += 30; - pParty->bFlying = true; - if ( pZ > max_flight_height ) - { - pZ = max_flight_height; - v113 = max_flight_height; - } - v1 = 0; - v2 = 0; - fall_speed = 0; - *(float *)&v128 = 0.0; - if ( v102 && pZ < ceiling_height && (signed int)(pParty->uPartyHeight + pZ) >= ceiling_height )//столкновение с потолком - { - pParty->field_6E0 = 0; - pParty->field_6E4 = 0; - pPartyActionQueue->uNumActions = 0; - pParty->uFlags |= PARTY_FLAGS_1_LANDING; - pParty->vPosition.z = ceiling_height - pParty->uPartyHeight - 31; - pParty->field_6F0 = pZ; - pParty->bFlying = false; - pZ = ceiling_height - pParty->uPartyHeight - 31; - v113 = pParty->field_6F0; - } - pParty->uFallSpeed = 0; - pModel = (BSPModel *)1; + pZ = max_flight_height; + v113 = max_flight_height; } + v1 = 0; + v2 = 0; + fall_speed = 0; + *(float *)&v128 = 0.0; + if ( v102 && pZ < ceiling_height && (signed int)(pParty->uPartyHeight + pZ) >= ceiling_height )//столкновение с потолком + { + pParty->field_6E0 = 0; + pParty->field_6E4 = 0; + pPartyActionQueue->uNumActions = 0; + pParty->uFlags |= PARTY_FLAGS_1_LANDING; + pParty->vPosition.z = ceiling_height - pParty->uPartyHeight - 31; + pParty->field_6F0 = pZ; + pParty->bFlying = false; + pZ = ceiling_height - pParty->uPartyHeight - 31; + v113 = pParty->field_6F0; + } + pParty->uFallSpeed = 0; + pModel_ = true; } + } } break; @@ -3887,7 +3888,7 @@ pParty->uFallSpeed = 0; fall_speed = 0; pParty->bFlying = true; - pModel = (BSPModel *)1; + pModel_ = true; if ( pZ <= v111 ) { pParty->bFlying = false; @@ -4128,31 +4129,27 @@ pParty->sRotationY = _angle_y; pParty->sRotationX = _angle_x; - if ( pZ < v111 || pParty->bFlying) + //------------------------------------------- + if ( pParty->bFlying ) { - if ( pParty->bFlying ) - { - //v126 = stru_5C6E00->Cos(GetTickCount()); - v129 = fixpoint_mul(4, cosf(GetTickCount())); - v129 = (unsigned __int64)(4i64 * stru_5C6E00->Cos(GetTickCount())) >> 16; - pZ = v113 + v129; - if ( pModel ) - pZ = v113; - if (pParty->FlyActive()) - stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFE; - pParty->uFallStartY = pZ; - } - else - { - if ( is_on_water && fall_speed ) - sub_42F960_create_object(pX, pY, v111); - fall_speed = 0; - pZ = v111; - pParty->uFallStartY = v111; - v113 = pZ; - if (pParty->FlyActive()) - stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1; - } + v129 = fixpoint_mul(4, stru_5C6E00->Cos(GetTickCount())); + pZ = v113 + v129; + if ( pModel_ ) + pZ = v113; //взлетание выше + if (pParty->FlyActive()) + stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFE; + pParty->uFallStartY = pZ; + } + else if ( pZ < v111 )// подъём в горку + { + if ( is_on_water && fall_speed ) + sub_42F960_create_object(pX, pY, v111); + fall_speed = 0; + pZ = v111; + pParty->uFallStartY = v111; + v113 = pZ; + if (pParty->FlyActive()) + stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1; } else { @@ -4160,12 +4157,12 @@ if (pParty->FlyActive()) stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1; } - + //------------------------------------------ if (hovering && !pParty->bFlying)//расчёт скорости падения { - v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength()); - v34 = fall_speed + 2 * v33; - fall_speed += 2 * v33; + //v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength()); + v34 = fall_speed + 2 * -(pEventTimer->uTimeElapsed * GetGravityStrength()); + fall_speed += 2 * -(pEventTimer->uTimeElapsed * GetGravityStrength()); } else if (!partyAtHighSlope) v34 = fall_speed; @@ -4173,36 +4170,38 @@ { if ( !bmodel_standing_on_pid ) { - // rolling down the hill - // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air - // and falling to the gravity, gradually sliding downwards. nice trick - pZ = v111; - ODM_GetTerrainNormalAt(pX, pY, &v98); - v35 = fall_speed + (8 * -(pEventTimer->uTimeElapsed * GetGravityStrength())); - v129 = abs(v2 * v98.x + v1 * v98.y + v35 * v98.z) >> 16; - v2 += fixpoint_mul(v129, (int)v98.x); - v1 += fixpoint_mul(v129, (int)v98.y); - v34 = v35 + fixpoint_mul(v129, (int)v98.z); - v128 = v1; - fall_speed = v34; + // rolling down the hill + // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air + // and falling to the gravity, gradually sliding downwards. nice trick + pZ = v111; + ODM_GetTerrainNormalAt(pX, pY, &v98); + v35 = fall_speed + (8 * -(pEventTimer->uTimeElapsed * GetGravityStrength())); + v129 = abs(v2 * v98.x + v1 * v98.y + v35 * v98.z) >> 16; + v2 += fixpoint_mul(v129, v98.x); + v1 += fixpoint_mul(v129, v98.y); + v34 = v35 + fixpoint_mul(v129, v98.z); + v128 = v1; + fall_speed = v34; } } else v34 = fall_speed; - if ( hovering ) + if ( hovering )//блок для крика падения { - if ( !bUnderwater && v34 <= 0) - { - if ( v34 < -500 && !pParty->bFlying && pParty->vPosition.z - v111 > 1000 && !pParty->FeatherFallActive()) - { // falling scream - for (int i = 0; i < 4; ++i) - { - if (!pParty->pPlayers[i].HasEnchantedItemEquipped(72) && !pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) && pParty->pPlayers[i].CanAct()) - pParty->pPlayers[i].PlaySound(SPEECH_Falling_scream, 0);//крик падения - } - } - } + if ( !bUnderwater && v34 <= 0) + { + if ( v34 < -500 && !pParty->bFlying && pParty->vPosition.z - v111 > 1000 && !pParty->FeatherFallActive()) + { // falling scream + for (int i = 0; i < 4; ++i) + { + if (!pParty->pPlayers[i].HasEnchantedItemEquipped(72) + && !pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) + && pParty->pPlayers[i].CanAct()) + pParty->pPlayers[i].PlaySound(SPEECH_Falling_scream, 0);//крик падения + } + } + } } else pParty->uFallStartY = pZ; @@ -4212,7 +4211,7 @@ *(float *)&v128 = 0.0; v2 = 0; } -//--------------------------------------------------------------------- +//--(столкновения)------------------------------------------------------------------- stru_721530.field_84 = -1; stru_721530.field_70 = 0; stru_721530.prolly_normal_d = pParty->field_14_radius; @@ -4256,14 +4255,14 @@ { _angle_x = pX + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); _angle_y = pY + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); - pModel = (BSPModel *)fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); + //pModel = (BSPModel *)fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); v40 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z) + pZ; } v122 = v40; ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &is_on_water, &v97, 0); int v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &v110, 0); - pModel = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY); + bool v42_ = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY); v42 = IsTerrainSlopeTooHigh(pX, _angle_y); is_not_on_bmodel = false; //v118 = v42; @@ -4279,7 +4278,7 @@ } else { - if ( pModel && v129 > pZ ) + if ( v42_ && v129 > pZ ) v44 = 0; if ( v42 && v119 > pZ ) v43 = 0; @@ -4293,8 +4292,8 @@ pY = _angle_y; else { - pModel = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); - if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)pModel <= pZ ) + int new_ = ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); + if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && new_ <= pZ ) { v43 = 1; pX = _angle_x; @@ -4413,10 +4412,10 @@ } } } - v2 = fixpoint_mul(58500, (int)v2); - v128 = fixpoint_mul(58500, (int)v128); - v122 = fixpoint_mul(58500, (int)v122); - fall_speed = fixpoint_mul(58500, (int)fall_speed); + v2 = fixpoint_mul(58500, v2); + v128 = fixpoint_mul(58500, v128); + v122 = fixpoint_mul(58500, v122); + fall_speed = fixpoint_mul(58500, fall_speed); } //Воспроизведение звуков ходьбы/бега------------------------ @@ -4468,13 +4467,15 @@ int pMap_Y = WorldPosToGridCellZ(pParty->vPosition.y) - 1; unsigned int v114_a = WorldPosToGridCellX(pX); v66 = WorldPosToGridCellZ(pY) - 1; - pModel = (BSPModel *)((~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, pMap_Y) >> 1) & 1); - v122 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v114_a, pMap_Y) >> 1) & 1; + unsigned int v122_a = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, pMap_Y) / 2) & 1; + v122 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v114_a, pMap_Y) / 2) & 1; + v69 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, v66) / 2) & 1; + + //-(обновление координат группы)--------------------------------------- v68 = 0; - v69 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, v66) >> 1) & 1; if ( v114_a == pMap_X && v66 == pMap_Y && v122 && v69 ) v68 = 1; - if ( !is_not_on_bmodel ) + if ( !is_not_on_bmodel ) // на bmodel,и v68 = 1; if ( v68 ) { @@ -4483,12 +4484,13 @@ pParty->vPosition.z = pZ; pParty->field_6F0 = v113; pParty->uFallSpeed = fall_speed; - if ( pZ > 8160 ) + if ( pZ > 8160 ) //ограничение высоты { pZ = 8160; pParty->uFallStartY = 8160; pParty->vPosition.z = 8160; } + if ( !trigger_id //падение на землю || (EventProcessor(trigger_id, 0, 1), pParty->vPosition.x == pX) @@ -4503,14 +4505,11 @@ if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= on_ground && !bUnderwater )//Fall to the ground(падение на землю с высоты) { if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) - { pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; - } else { for ( uint i = 1; i <= 4; ++i ) { - //v110 = pPlayers[i]->GetMaxHealth(); pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(signed __int64)((double)pPlayers[i]->GetMaxHealth() * 0.1)) / 256, DMGT_PHISYCAL); v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance()); @@ -4533,19 +4532,20 @@ } return; } +//----------------------------------------------------------------- //v76 = pParty->bFlying; - if ( pParty->bFlying || !high_fall_flag || bWaterWalk || !pModel ) + if ( pParty->bFlying || !high_fall_flag || bWaterWalk || !v122_a ) v77 = 1; else v77 = v122 != 0; bool party_drowning_flag = false; - if ( !pParty->bFlying && high_fall_flag && !bWaterWalk ) + if ( !pParty->bFlying && high_fall_flag && !bWaterWalk ) //не полёт, высокое падение, не хождение по воде { - if ( pModel ) + if ( v122_a ) v78 = v69 != 0; else { - party_drowning_flag = true; + party_drowning_flag = true;//утопление v78 = true; } } @@ -4565,7 +4565,7 @@ //v79 = 20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 6180178; //*(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u; v79 = (int)&stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119]; - *(short *)v79 |= 1u; + *(short *)v79 |= 1; if ( !v122 || !v69 ) { if ( !pParty->bFlying ) @@ -4586,7 +4586,7 @@ //v81 = pZ; //v82 = pZ; pParty->vPosition.z = pZ; - if ( pZ > 8160 ) + if ( pZ > 8160 )//опять ограничение высоты { //v82 = 8160; pParty->uFallStartY = 8160; @@ -4595,7 +4595,7 @@ LOWORD(pParty->uFlags) &= 0xFDFBu; pParty->uFallSpeed = fall_speed; pParty->field_6F0 = v113; - if ( party_drowning_flag ) + if ( party_drowning_flag )//группа тонет { pTerrainHeight = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v110, 1); if ( pParty->vPosition.z <= pTerrainHeight + 1 )//положение группы всегда +1 @@ -4616,9 +4616,7 @@ if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= on_ground && !bUnderwater )//Fall to the water(падение на воду с высоты) { if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) - { pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; - } else { for ( uint i = 1; i <= 4; ++i )