Mercurial > mm7
comparison Outdoor.cpp @ 2164:f5e9ac04dd25
fixpoint_mul in ProcessPartyActions
author | Ritor1 |
---|---|
date | Thu, 16 Jan 2014 00:08:27 +0600 |
parents | 9aa0a5d90454 |
children | 47ac9e87690c |
comparison
equal
deleted
inserted
replaced
2163:9aa0a5d90454 | 2164:f5e9ac04dd25 |
---|---|
4019 v128 = v1; | 4019 v128 = v1; |
4020 party_walking_flag = true; | 4020 party_walking_flag = true; |
4021 } | 4021 } |
4022 else | 4022 else |
4023 { | 4023 { |
4024 v2 += (unsigned __int64)(stru_5C6E00->Cos(_angle_y) | 4024 /*v2 += (unsigned __int64)(stru_5C6E00->Cos(_angle_y) |
4025 * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)_walk_speed * fWalkSpeedMultiplier))) >> 16; | 4025 * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)_walk_speed * fWalkSpeedMultiplier))) >> 16; |
4026 v1 += (unsigned __int64)((signed int)stru_5C6E00->Sin(_angle_y) | 4026 v1 += (unsigned __int64)((signed int)stru_5C6E00->Sin(_angle_y) |
4027 * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)_walk_speed * fWalkSpeedMultiplier))) >> 16; | 4027 * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)_walk_speed * fWalkSpeedMultiplier))) >> 16;*/ |
4028 | 4028 |
4029 /*v2 += 2 * dx;//original -228, now -222 it's temporarily | 4029 v2 += 2 * dx; |
4030 v1 += 2 * dy;//original -2295, now -2292*/ | 4030 v1 += 2 * dy; |
4031 | 4031 |
4032 v128 = v1; | 4032 v128 = v1; |
4033 party_running_flag = true; | 4033 party_running_flag = true; |
4034 } | 4034 } |
4035 } | 4035 } |
4177 // and falling to the gravity, gradually sliding downwards. nice trick | 4177 // and falling to the gravity, gradually sliding downwards. nice trick |
4178 pZ = v111; | 4178 pZ = v111; |
4179 ODM_GetTerrainNormalAt(pX, pY, &v98); | 4179 ODM_GetTerrainNormalAt(pX, pY, &v98); |
4180 v35 = fall_speed + (8 * -(pEventTimer->uTimeElapsed * GetGravityStrength())); | 4180 v35 = fall_speed + (8 * -(pEventTimer->uTimeElapsed * GetGravityStrength())); |
4181 v129 = abs(v2 * v98.x + v1 * v98.y + v35 * v98.z) >> 16; | 4181 v129 = abs(v2 * v98.x + v1 * v98.y + v35 * v98.z) >> 16; |
4182 v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16; | 4182 v2 += fixpoint_mul(v129, (int)v98.x); |
4183 v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16; | 4183 v1 += fixpoint_mul(v129, (int)v98.y); |
4184 v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16); | 4184 v34 = v35 + fixpoint_mul(v129, (int)v98.z); |
4185 v128 = v1; | 4185 v128 = v1; |
4186 fall_speed = v34; | 4186 fall_speed = v34; |
4187 } | 4187 } |
4188 } | 4188 } |
4189 else | 4189 else |
4315 stru_721530.field_70 += stru_721530.field_7C; | 4315 stru_721530.field_70 += stru_721530.field_7C; |
4316 pX = _angle_x; | 4316 pX = _angle_x; |
4317 pY = _angle_y; | 4317 pY = _angle_y; |
4318 v45 = stru_721530.uFaceID; | 4318 v45 = stru_721530.uFaceID; |
4319 pZ = v40; | 4319 pZ = v40; |
4320 | |
4320 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor) | 4321 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor) |
4321 { | 4322 { |
4322 if (pParty->Invisible()) | 4323 if (pParty->Invisible()) |
4323 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | 4324 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); |
4324 | |
4325 viewparams->bRedrawGameUI = true; | 4325 viewparams->bRedrawGameUI = true; |
4326 unsigned __int64 ps = 58500i64 * v2; | 4326 } |
4327 float pr = (float)v2; | 4327 |
4328 v2 = ps >> 16; | |
4329 pModel = (BSPModel *)58500; | |
4330 v128 = (unsigned __int64)(58500i64 * v128) >> 16; | |
4331 v122 = (unsigned __int64)(58500i64 * fall_speed) >> 16; | |
4332 fall_speed = (unsigned __int64)(58500i64 * fall_speed) >> 16; | |
4333 continue; | |
4334 } | |
4335 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) | 4328 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) |
4336 { | 4329 { |
4337 //v118 = integer_sqrt(v2 * v2 + v128 * v128); | |
4338 v129 = stru_5C6E00->Atan2(_angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x, | 4330 v129 = stru_5C6E00->Atan2(_angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x, |
4339 _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y); | 4331 _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y); |
4340 //v59 = (signed int)stru_5C6E00->Cos(v129) * (signed __int64)integer_sqrt(v2 * v2 + v128 * v128); | 4332 v2 = fixpoint_mul(stru_5C6E00->Cos(v129), integer_sqrt(v2 * v2 + v128 * v128)); |
4341 //v122 = ((signed int)stru_5C6E00->Cos(v129) * (signed __int64)integer_sqrt(v2 * v2 + v128 * v128)) >> 16; | 4333 v122 = fixpoint_mul(stru_5C6E00->Sin(v129), integer_sqrt(v2 * v2 + v128 * v128)); |
4342 v2 = ((signed int)stru_5C6E00->Cos(v129) * (signed __int64)integer_sqrt(v2 * v2 + v128 * v128)) >> 16; | 4334 v128 = fixpoint_mul(stru_5C6E00->Sin(v129), integer_sqrt(v2 * v2 + v128 * v128)); |
4343 //v61 = (signed int)stru_5C6E00->Sin(v129) * (signed __int64)integer_sqrt(v2 * v2 + v128 * v128); | 4335 } |
4344 v122 = ((signed int)stru_5C6E00->Sin(v129) * (signed __int64)integer_sqrt(v2 * v2 + v128 * v128)) >> 16; | 4336 |
4345 v128 = ((signed int)stru_5C6E00->Sin(v129) * (signed __int64)integer_sqrt(v2 * v2 + v128 * v128)) >> 16; | 4337 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) |
4346 } | 4338 { |
4347 //else | 4339 pParty->bFlying = false; |
4348 //{ | 4340 pModel = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; |
4349 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) | 4341 pODMFace = &pModel->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; |
4350 { | 4342 v48 = pODMFace->pBoundingBox.z2 - pODMFace->pBoundingBox.z1; |
4351 pParty->bFlying = false; | 4343 v129 = v48 <= 32; |
4352 pModel = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; | 4344 v119 = pODMFace->pFacePlane.vNormal.z < 46378; |
4353 pODMFace = &pModel->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; | 4345 if ( bUnderwater == 1 ) |
4354 v48 = pODMFace->pBoundingBox.z2 - pODMFace->pBoundingBox.z1; | 4346 v119 = 0; |
4355 v129 = v48 <= 32; | 4347 if ( pODMFace->uPolygonType == POLYGON_Floor ) |
4356 v119 = pODMFace->pFacePlane.vNormal.z < 46378; | 4348 { |
4357 if ( bUnderwater == 1 ) | 4349 if ( fall_speed < 0 ) |
4358 v119 = 0; | 4350 fall_speed = 0; |
4359 if ( pODMFace->uPolygonType == POLYGON_Floor ) | 4351 pZ = pModel->pVertices.pVertices[pODMFace->pVertexIDs[0]].z + 1; |
4352 if ( v2 * v2 + v128 * v128 < 400 ) | |
4360 { | 4353 { |
4361 if ( fall_speed < 0 ) | 4354 v2 = 0; |
4362 fall_speed = 0; | 4355 *(float *)&v128 = 0.0; |
4363 pZ = pModel->pVertices.pVertices[pODMFace->pVertexIDs[0]].z + 1; | |
4364 if ( v2 * v2 + v128 * v128 < 400 ) | |
4365 { | |
4366 v2 = 0; | |
4367 *(float *)&v128 = 0.0; | |
4368 } | |
4369 if ( pParty->floor_face_pid != v45 && pODMFace->Pressure_Plate() ) | |
4370 { | |
4371 pParty->floor_face_pid = v45; | |
4372 trigger_id = pODMFace->sCogTriggeredID; // | |
4373 } | |
4374 v2 = (unsigned __int64)(58500i64 * v2) >> 16; | |
4375 pModel = (BSPModel *)58500; | |
4376 v128 = (unsigned __int64)(58500i64 * v128) >> 16; | |
4377 v122 = (unsigned __int64)(58500i64 * fall_speed) >> 16; | |
4378 fall_speed = (unsigned __int64)(58500i64 * fall_speed) >> 16; | |
4379 continue; | |
4380 } | 4356 } |
4381 if ( !v129 && (pODMFace->uPolygonType != POLYGON_InBetweenFloorAndWall || v119) )// упёрся в столб | 4357 if ( pParty->floor_face_pid != v45 && pODMFace->Pressure_Plate() ) |
4382 { | 4358 { |
4383 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + fall_speed * pODMFace->pFacePlane.vNormal.z | 4359 pParty->floor_face_pid = v45; |
4384 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16; | 4360 trigger_id = pODMFace->sCogTriggeredID; |
4385 if ((stru_721530.speed >> 3) > v118 ) | 4361 } |
4386 v118 = stru_721530.speed >> 3; | 4362 } |
4387 v2 += (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.x) >> 16; | 4363 if ( !v129 && (pODMFace->uPolygonType != POLYGON_InBetweenFloorAndWall || v119) )// упёрся в столб |
4388 v128 += (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.y) >> 16; | 4364 { |
4389 v54 = 0; | 4365 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + fall_speed * pODMFace->pFacePlane.vNormal.z |
4366 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16; | |
4367 if ((stru_721530.speed >> 3) > v118 ) | |
4368 v118 = stru_721530.speed >> 3; | |
4369 v2 += fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.x); | |
4370 v128 += fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.y); | |
4371 v54 = 0; | |
4372 if ( !v119 ) | |
4373 v54 = fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.z); | |
4374 pParty->uFallSpeed += v54; | |
4375 v55 = stru_721530.prolly_normal_d - ((signed int)(pODMFace->pFacePlane.dist + v122 * pODMFace->pFacePlane.vNormal.z | |
4376 + _angle_y * pODMFace->pFacePlane.vNormal.y + _angle_x * pODMFace->pFacePlane.vNormal.x) >> 16); | |
4377 if ( v55 > 0 ) | |
4378 { | |
4379 pX = _angle_x + fixpoint_mul(pODMFace->pFacePlane.vNormal.x, v55); | |
4380 pY = _angle_y + fixpoint_mul(pODMFace->pFacePlane.vNormal.y, v55); | |
4390 if ( !v119 ) | 4381 if ( !v119 ) |
4391 v54 = (unsigned __int64)(v118 * (signed __int64)(signed int)pODMFace->pFacePlane.vNormal.z) >> 16; | 4382 pZ = v122 + fixpoint_mul(pODMFace->pFacePlane.vNormal.z, v55); |
4392 pParty->uFallSpeed += v54; | |
4393 v55 = stru_721530.prolly_normal_d - ((signed int)(pODMFace->pFacePlane.dist + v122 * pODMFace->pFacePlane.vNormal.z | |
4394 + _angle_y * pODMFace->pFacePlane.vNormal.y | |
4395 + _angle_x * pODMFace->pFacePlane.vNormal.x) >> 16); | |
4396 if ( v55 > 0 ) | |
4397 { | |
4398 pX = _angle_x + (pODMFace->pFacePlane.vNormal.x * v55 >> 16); | |
4399 pY = _angle_y + (pODMFace->pFacePlane.vNormal.y * v55 >> 16); | |
4400 if ( !v119 ) | |
4401 pZ = v122 + (pODMFace->pFacePlane.vNormal.z * v55 >> 16); | |
4402 } | |
4403 if ( pParty->floor_face_pid != stru_721530.uFaceID && pODMFace->Pressure_Plate() ) | |
4404 { | |
4405 pParty->floor_face_pid = stru_721530.uFaceID; | |
4406 trigger_id = pODMFace->sCogTriggeredID; // | |
4407 } | |
4408 v2 = (unsigned __int64)(58500i64 * v2) >> 16; | |
4409 pModel = (BSPModel *)58500; | |
4410 v128 = (unsigned __int64)(58500i64 * v128) >> 16; | |
4411 v122 = (unsigned __int64)(58500i64 * fall_speed) >> 16; | |
4412 fall_speed = (unsigned __int64)(58500i64 * fall_speed) >> 16; | |
4413 continue; | |
4414 } | 4383 } |
4384 if ( pParty->floor_face_pid != stru_721530.uFaceID && pODMFace->Pressure_Plate() ) | |
4385 { | |
4386 pParty->floor_face_pid = stru_721530.uFaceID; | |
4387 trigger_id = pODMFace->sCogTriggeredID; // | |
4388 } | |
4389 } | |
4390 if ( pODMFace->uPolygonType == POLYGON_InBetweenFloorAndWall ) | |
4391 { | |
4415 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y | 4392 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y |
4416 + fall_speed * pODMFace->pFacePlane.vNormal.z + v2 * pODMFace->pFacePlane.vNormal.x) >> 16; | 4393 + fall_speed * pODMFace->pFacePlane.vNormal.z + v2 * pODMFace->pFacePlane.vNormal.x) >> 16; |
4417 if ((stru_721530.speed >> 3) > v118 ) | 4394 if ((stru_721530.speed >> 3) > v118 ) |
4418 v118 = stru_721530.speed >> 3; | 4395 v118 = stru_721530.speed >> 3; |
4419 v2 += (unsigned __int64)(v118 * (signed __int64)(signed int)pODMFace->pFacePlane.vNormal.x) >> 16; | 4396 v2 += fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.x); |
4420 v128 += (unsigned __int64)(v118 * (signed __int64)(signed int)pODMFace->pFacePlane.vNormal.y) >> 16; | 4397 v128 += fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.y); |
4421 fall_speed += (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.z) >> 16; | 4398 fall_speed += fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.z); |
4422 if ( v2 * v2 + v128 * v128 >= 400 ) | 4399 if ( v2 * v2 + v128 * v128 >= 400 ) |
4423 { | 4400 { |
4424 if ( pParty->floor_face_pid != stru_721530.uFaceID && pODMFace->Pressure_Plate() ) | 4401 if ( pParty->floor_face_pid != stru_721530.uFaceID && pODMFace->Pressure_Plate() ) |
4425 { | 4402 { |
4426 pParty->floor_face_pid = stru_721530.uFaceID; | 4403 pParty->floor_face_pid = stru_721530.uFaceID; |
4427 trigger_id = pODMFace->sCogTriggeredID; // | 4404 trigger_id = pODMFace->sCogTriggeredID; // |
4428 } | 4405 } |
4429 v2 = (unsigned __int64)(58500i64 * v2) >> 16; | |
4430 pModel = (BSPModel *)58500; | |
4431 v128 = (unsigned __int64)(58500i64 * v128) >> 16; | |
4432 v122 = (unsigned __int64)(58500i64 * fall_speed) >> 16; | |
4433 //++v126; | |
4434 fall_speed = (unsigned __int64)(58500i64 * fall_speed) >> 16; | |
4435 continue; | |
4436 } | 4406 } |
4437 v2 = 0; | 4407 else |
4438 fall_speed = 0; | 4408 { |
4439 *(float *)&v128 = 0.0; | 4409 v2 = 0; |
4440 } | 4410 fall_speed = 0; |
4441 //} | 4411 *(float *)&v128 = 0.0; |
4442 v2 = (unsigned __int64)(58500i64 * v2) >> 16; | 4412 } |
4443 pModel = (BSPModel *)58500; | 4413 } |
4444 v128 = (unsigned __int64)(58500i64 * v128) >> 16; | 4414 } |
4445 v122 = (unsigned __int64)(58500i64 * fall_speed) >> 16; | 4415 v2 = fixpoint_mul(58500, (int)v2); |
4446 fall_speed = (unsigned __int64)(58500i64 * fall_speed) >> 16; | 4416 v128 = fixpoint_mul(58500, (int)v128); |
4417 v122 = fixpoint_mul(58500, (int)v122); | |
4418 fall_speed = fixpoint_mul(58500, (int)fall_speed); | |
4447 } | 4419 } |
4448 | 4420 |
4449 //Воспроизведение звуков ходьбы/бега------------------------ | 4421 //Воспроизведение звуков ходьбы/бега------------------------ |
4450 v122 = abs(pParty->vPosition.x - pX); | 4422 v122 = abs(pParty->vPosition.x - pX); |
4451 uint pY_ = abs(pParty->vPosition.y - pY); | 4423 uint pY_ = abs(pParty->vPosition.y - pY); |