Mercurial > mm7
comparison SpriteObject.cpp @ 2207:ff8920a40c21
fixpoint_mul
author | Ritor1 |
---|---|
date | Thu, 06 Feb 2014 17:20:12 +0600 |
parents | 00bd098f6435 |
children | aff7a7b072b7 |
comparison
equal
deleted
inserted
replaced
2206:15a327be07e2 | 2207:ff8920a40c21 |
---|---|
272 sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v9); | 272 sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v9); |
273 SpriteObject::OnInteraction(uLayingItemID); | 273 SpriteObject::OnInteraction(uLayingItemID); |
274 } | 274 } |
275 } | 275 } |
276 else | 276 else |
277 { | |
278 v58 = 1; | 277 v58 = 1; |
279 } | |
280 if ( !(object->uFlags & OBJECT_DESC_NO_GRAVITY) ) | 278 if ( !(object->uFlags & OBJECT_DESC_NO_GRAVITY) ) |
281 { | 279 { |
282 if ( v58 ) | 280 if ( v58 ) |
283 { | 281 { |
284 pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); | 282 pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); |
491 v56 = abs(face->pFacePlane.vNormal.x * pSpriteObjects[uLayingItemID].vVelocity.x | 489 v56 = abs(face->pFacePlane.vNormal.x * pSpriteObjects[uLayingItemID].vVelocity.x |
492 + face->pFacePlane.vNormal.y * pSpriteObjects[uLayingItemID].vVelocity.y | 490 + face->pFacePlane.vNormal.y * pSpriteObjects[uLayingItemID].vVelocity.y |
493 + face->pFacePlane.vNormal.z * pSpriteObjects[uLayingItemID].vVelocity.z) >> 16; | 491 + face->pFacePlane.vNormal.z * pSpriteObjects[uLayingItemID].vVelocity.z) >> 16; |
494 if ( (stru_721530.speed >> 3) > v56 ) | 492 if ( (stru_721530.speed >> 3) > v56 ) |
495 v56 = stru_721530.speed >> 3; | 493 v56 = stru_721530.speed >> 3; |
496 v57 = (unsigned __int64)(v56 * (signed __int64)face->pFacePlane.vNormal.x) >> 16; | 494 //v57 = fixpoint_mul(v56, face->pFacePlane.vNormal.x); |
497 v58 = (unsigned __int64)(v56 * (signed __int64)face->pFacePlane.vNormal.y) >> 16; | 495 //v58 = fixpoint_mul(v56, face->pFacePlane.vNormal.y); |
498 v60 = (unsigned __int64)(v56 * (signed __int64)face->pFacePlane.vNormal.z) >> 16; | 496 v60 = fixpoint_mul(v56, face->pFacePlane.vNormal.z); |
499 pSpriteObjects[uLayingItemID].vVelocity.x += 2 * v57; | 497 pSpriteObjects[uLayingItemID].vVelocity.x += 2 * fixpoint_mul(v56, face->pFacePlane.vNormal.x); |
500 pSpriteObjects[uLayingItemID].vVelocity.y += 2 * v58; | 498 pSpriteObjects[uLayingItemID].vVelocity.y += 2 * fixpoint_mul(v56, face->pFacePlane.vNormal.y); |
501 if ( face->pFacePlane.vNormal.z <= 32000 ) | 499 if ( face->pFacePlane.vNormal.z <= 32000 ) |
502 { | |
503 v37 = 2 * (short)v60; | 500 v37 = 2 * (short)v60; |
504 } | |
505 else | 501 else |
506 { | 502 { |
507 v36 = v60; | 503 v36 = v60; |
508 pSpriteObjects[uLayingItemID].vVelocity.z += (signed __int16)v60; | 504 pSpriteObjects[uLayingItemID].vVelocity.z += (signed __int16)v60; |
509 v58 = (unsigned __int64)(32000 * (signed __int64)(signed int)v36) >> 16; | 505 v58 = fixpoint_mul(0x7D00, v36); |
510 v37 = (unsigned int)(32000 * v36) >> 16; | 506 v37 = fixpoint_mul(32000, v36); |
511 } | 507 } |
512 pSpriteObjects[uLayingItemID].vVelocity.z += v37; | 508 pSpriteObjects[uLayingItemID].vVelocity.z += v37; |
513 if ( BYTE3(face->uAttributes) & 0x10 ) | 509 if ( BYTE3(face->uAttributes) & 0x10 ) |
514 EventProcessor(face->sCogTriggeredID, 0, 1); | 510 EventProcessor(face->sCogTriggeredID, 0, 1); |
515 goto LABEL_74; | 511 goto LABEL_74; |
516 } | 512 } |
517 pSpriteObjects[uLayingItemID].vPosition.z = bmodel->pVertices.pVertices[face->pVertexIDs[0]].z + 1; | 513 pSpriteObjects[uLayingItemID].vPosition.z = bmodel->pVertices.pVertices[face->pVertexIDs[0]].z + 1; |
518 if ( pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x | 514 if ( pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x |
519 + pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y >= 400 ) | 515 + pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y >= 400 ) |
520 { | 516 { |
521 if ( BYTE3(face->uAttributes) & 0x10 ) | 517 if ( face->uAttributes & 0x10000000 ) |
522 EventProcessor(face->sCogTriggeredID, 0, 1); | 518 EventProcessor(face->sCogTriggeredID, 0, 1); |
523 goto LABEL_74; | 519 goto LABEL_74; |
524 } | 520 } |
525 LOWORD(v35) = 0; | 521 LOWORD(v35) = 0; |
526 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | 522 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
534 } | 530 } |
535 v57 = integer_sqrt(pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x | 531 v57 = integer_sqrt(pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x |
536 + pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y); | 532 + pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y); |
537 v38 = stru_5C6E00->Atan2(pSpriteObjects[uLayingItemID].vPosition.x - pLevelDecorations[PID_ID(stru_721530.uFaceID)].vPosition.x, | 533 v38 = stru_5C6E00->Atan2(pSpriteObjects[uLayingItemID].vPosition.x - pLevelDecorations[PID_ID(stru_721530.uFaceID)].vPosition.x, |
538 pSpriteObjects[uLayingItemID].vPosition.y - pLevelDecorations[PID_ID(stru_721530.uFaceID)].vPosition.y); | 534 pSpriteObjects[uLayingItemID].vPosition.y - pLevelDecorations[PID_ID(stru_721530.uFaceID)].vPosition.y); |
539 pSpriteObjects[uLayingItemID].vVelocity.x = (unsigned __int64)(stru_5C6E00->Cos(v38) * (signed __int64)v57) >> 16; | 535 pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v38), v57); |
540 pSpriteObjects[uLayingItemID].vVelocity.y = (unsigned __int64)(stru_5C6E00->Sin(v38 - stru_5C6E00->uIntegerHalfPi) * (signed __int64)v57) >> 16; | 536 pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v38 - stru_5C6E00->uIntegerHalfPi), v57); |
541 goto LABEL_74; | 537 goto LABEL_74; |
542 } | 538 } |
543 } | 539 } |
544 | 540 |
545 //----- (0047136C) -------------------------------------------------------- | 541 //----- (0047136C) -------------------------------------------------------- |