Mercurial > mm7
comparison Render.cpp @ 1640:afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
author | Nomad |
---|---|
date | Tue, 17 Sep 2013 17:40:59 +0200 |
parents | ccde94f02b75 |
children | 466c5e15f524 |
comparison
equal
deleted
inserted
replaced
1639:b60ddd777d50 | 1640:afc1c3514dd5 |
---|---|
514 v4 = pSpriteFrameTable->GetFrame(object_desc->uSpriteID, object->uSpriteFrameID); | 514 v4 = pSpriteFrameTable->GetFrame(object_desc->uSpriteID, object->uSpriteFrameID); |
515 //v5 = v4; | 515 //v5 = v4; |
516 //v28 = v4; | 516 //v28 = v4; |
517 v36 = v4->uFlags; | 517 v36 = v4->uFlags; |
518 a6 = v4->uGlowRadius * object->field_22_glow_radius_multiplier; | 518 a6 = v4->uGlowRadius * object->field_22_glow_radius_multiplier; |
519 v6 = stru_5C6E00->Atan2(object->vPosition.x - pODMRenderParams->vPartyPos.x, object->vPosition.y - pODMRenderParams->vPartyPos.y); | 519 v6 = stru_5C6E00->Atan2(object->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, object->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); |
520 //LOWORD(v7) = object->uFacing; | 520 //LOWORD(v7) = object->uFacing; |
521 //v8 = v36; | 521 //v8 = v36; |
522 v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7; | 522 v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7; |
523 v10 = v4->pHwSpriteIDs[v9]; | 523 v10 = v4->pHwSpriteIDs[v9]; |
524 v3->uHwSpriteID = v10; | 524 v3->uHwSpriteID = v10; |
540 if ( a6 ) | 540 if ( a6 ) |
541 { | 541 { |
542 //LOBYTE(v11) = byte_4E94D3; | 542 //LOBYTE(v11) = byte_4E94D3; |
543 pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3); | 543 pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3); |
544 } | 544 } |
545 v12 = (x - pODMRenderParams->vPartyPos.x) << 16; | 545 v12 = (x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; |
546 if (pODMRenderParams->rotation_x) | 546 if (pGame->pIndoorCameraD3D->sRotationX) |
547 { | 547 { |
548 v13 = (y - pODMRenderParams->vPartyPos.y) << 16; | 548 v13 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; |
549 v30 = ((unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) | 549 v30 = ((unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) |
550 + ((unsigned __int64)(v13 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); | 550 + ((unsigned __int64)(v13 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); |
551 v37 = (unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; | 551 v37 = (unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; |
552 a6a = (unsigned __int64)(v13 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; | 552 a6a = (unsigned __int64)(v13 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; |
553 v33 = (z - pODMRenderParams->vPartyPos.z) << 16; | 553 v33 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; |
554 v14 = (unsigned __int64)(v30 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16; | 554 v14 = (unsigned __int64)(v30 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16; |
555 v15 = (unsigned __int64)(v33 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16; | 555 v15 = (unsigned __int64)(v33 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16; |
556 v16 = v15 + v14; | 556 v16 = v15 + v14; |
557 v42 = v15 + v14; | 557 v42 = v15 + v14; |
558 if ( v15 + v14 >= 262144 && v16 <= pODMRenderParams->shading_dist_mist << 16 ) | 558 if ( v15 + v14 >= 262144 && v16 <= pODMRenderParams->shading_dist_mist << 16 ) |
564 goto LABEL_29; | 564 goto LABEL_29; |
565 } | 565 } |
566 } | 566 } |
567 else | 567 else |
568 { | 568 { |
569 v34 = (y - pODMRenderParams->vPartyPos.y) << 16; | 569 v34 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; |
570 v19 = (unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; | 570 v19 = (unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; |
571 v20 = (unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; | 571 v20 = (unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; |
572 v16 = v20 + v19; | 572 v16 = v20 + v19; |
573 v42 = v20 + v19; | 573 v42 = v20 + v19; |
574 if ( v20 + v19 >= 262144 && v16 <= pODMRenderParams->shading_dist_mist << 16 ) | 574 if ( v20 + v19 >= 262144 && v16 <= pODMRenderParams->shading_dist_mist << 16 ) |
575 { | 575 { |
576 v21 = (unsigned __int64)(((x - pODMRenderParams->vPartyPos.x) << 16) * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; | 576 v21 = (unsigned __int64)(((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16) * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; |
577 v17 = ((unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v21; | 577 v17 = ((unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v21; |
578 v40 = ((unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v21; | 578 v40 = ((unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v21; |
579 v18 = (z - pODMRenderParams->vPartyPos.z) << 16; | 579 v18 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; |
580 LABEL_29: | 580 LABEL_29: |
581 v31 = v18; | 581 v31 = v18; |
582 v22 = abs(v17); | 582 v22 = abs(v17); |
583 if ( abs(v16) >= v22 ) | 583 if ( abs(v16) >= v22 ) |
584 { | 584 { |
994 //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | 994 //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); |
995 | 995 |
996 //v9 = v8; | 996 //v9 = v8; |
997 v42 = v8->uFlags; | 997 v42 = v8->uFlags; |
998 a5 = v8->uGlowRadius; | 998 a5 = v8->uGlowRadius; |
999 v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pODMRenderParams->vPartyPos.x, | 999 v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, |
1000 decor->vPosition.y - pODMRenderParams->vPartyPos.y); | 1000 decor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); |
1001 v11 = *((int *)v0 + 2); | 1001 v11 = *((int *)v0 + 2); |
1002 v37 = v10; | 1002 v37 = v10; |
1003 v12 = v42; | 1003 v12 = v42; |
1004 v38 = 0; | 1004 v38 = 0; |
1005 v13 = ((signed int)(stru_5C6E00->uIntegerPi | 1005 v13 = ((signed int)(stru_5C6E00->uIntegerPi |
1038 v14, | 1038 v14, |
1039 v15, | 1039 v15, |
1040 v16, | 1040 v16, |
1041 byte_4E94D0); | 1041 byte_4E94D0); |
1042 } | 1042 } |
1043 v17 = (decor->vPosition.x - pODMRenderParams->vPartyPos.x) << 16; | 1043 v17 = (decor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; |
1044 if (pODMRenderParams->rotation_x) | 1044 if (pGame->pIndoorCameraD3D->sRotationX) |
1045 { | 1045 { |
1046 v40 = (decor->vPosition.y - pODMRenderParams->vPartyPos.y) << 16; | 1046 v40 = (decor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; |
1047 v18 = ((unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) | 1047 v18 = ((unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) |
1048 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); | 1048 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); |
1049 v42 = v18; | 1049 v42 = v18; |
1050 b = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; | 1050 b = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; |
1051 a5 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; | 1051 a5 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; |
1052 v40 = (decor->vPosition.z - pODMRenderParams->vPartyPos.z) << 16; | 1052 v40 = (decor->vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; |
1053 v41 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16; | 1053 v41 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16; |
1054 v19 = (unsigned __int64)(v18 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16; | 1054 v19 = (unsigned __int64)(v18 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16; |
1055 v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); | 1055 v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); |
1056 v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); | 1056 v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); |
1057 if ( v20 >= 262144 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) | 1057 if ( v20 >= 262144 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) |
1123 goto LABEL_38; | 1123 goto LABEL_38; |
1124 } | 1124 } |
1125 } | 1125 } |
1126 else | 1126 else |
1127 { | 1127 { |
1128 v42 = (decor->vPosition.x - pODMRenderParams->vPartyPos.x) << 16; | 1128 v42 = (decor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; |
1129 v40 = (decor->vPosition.y - pODMRenderParams->vPartyPos.y) << 16; | 1129 v40 = (decor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; |
1130 b = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; | 1130 b = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; |
1131 a5 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; | 1131 a5 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; |
1132 v20 = b + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); | 1132 v20 = b + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); |
1133 v39 = b + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); | 1133 v39 = b + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); |
1134 if ( v20 >= 262144 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) | 1134 if ( v20 >= 262144 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) |
1135 { | 1135 { |
1136 a5 = (unsigned __int64)(v42 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; | 1136 a5 = (unsigned __int64)(v42 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; |
1137 b = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; | 1137 b = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; |
1138 v21 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - a5; | 1138 v21 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - a5; |
1139 v41 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - a5; | 1139 v41 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - a5; |
1140 v22 = (decor->vPosition.z - pODMRenderParams->vPartyPos.z) << 16; | 1140 v22 = (decor->vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; |
1141 goto LABEL_30; | 1141 goto LABEL_30; |
1142 } | 1142 } |
1143 } | 1143 } |
1144 } | 1144 } |
1145 } | 1145 } |
5100 { | 5100 { |
5101 v54 = (char *)&array_507D30[0].u; | 5101 v54 = (char *)&array_507D30[0].u; |
5102 LODWORD(v80) = uNumVertices; | 5102 LODWORD(v80) = uNumVertices; |
5103 do | 5103 do |
5104 { | 5104 { |
5105 v69 = (GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x; | 5105 v69 = (GetTickCount() >> 5) - pGame->pIndoorCameraD3D->vPartyPos.x; |
5106 *(float *)v54 = (double)v69 + *(float *)v54; | 5106 *(float *)v54 = (double)v69 + *(float *)v54; |
5107 *(float *)v54 = *(float *)v54 * 0.25; | 5107 *(float *)v54 = *(float *)v54 * 0.25; |
5108 v55 = GetTickCount(); | 5108 v55 = GetTickCount(); |
5109 v54 += 48; | 5109 v54 += 48; |
5110 v44 = LODWORD(v80)-- == 1; | 5110 v44 = LODWORD(v80)-- == 1; |
5111 v68 = pBLVRenderParams->vPartyPos.y + (v55 >> 5); | 5111 v68 = pGame->pIndoorCameraD3D->vPartyPos.y + (v55 >> 5); |
5112 *((float *)v54 - 11) = ((double)v68 + *((float *)v54 - 11)) * 0.25; | 5112 *((float *)v54 - 11) = ((double)v68 + *((float *)v54 - 11)) * 0.25; |
5113 } | 5113 } |
5114 while ( !v44 ); | 5114 while ( !v44 ); |
5115 uFaceID = v65; | 5115 uFaceID = v65; |
5116 } | 5116 } |
5119 v57 = v56; | 5119 v57 = v56; |
5120 v58 = pFace->GetTexture(); | 5120 v58 = pFace->GetTexture(); |
5121 pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0); | 5121 pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0); |
5122 return; | 5122 return; |
5123 } | 5123 } |
5124 HIDWORD(v69) = pBLVRenderParams->sPartyRotX; | 5124 HIDWORD(v69) = pGame->pIndoorCameraD3D->sRotationX; |
5125 HIDWORD(v68) = pBLVRenderParams->vPartyPos.z; | 5125 HIDWORD(v68) = pGame->pIndoorCameraD3D->vPartyPos.z; |
5126 *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY; | 5126 *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY; |
5127 v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pBLVRenderParams->vPartyPos.z) | 5127 v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pGame->pIndoorCameraD3D->vPartyPos.z) |
5128 / (((double)pBLVRenderParams->field_40 + 16192.0) | 5128 / (((double)pBLVRenderParams->field_40 + 16192.0) |
5129 * 65536.0) | 5129 * 65536.0) |
5130 + *(float *)&v74); | 5130 + *(float *)&v74); |
5131 v5 = (double)pBLVRenderParams->sPartyRotX * 0.0030664064; | 5131 v5 = (double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064; |
5132 *(float *)&v75 = v5; | 5132 *(float *)&v75 = v5; |
5133 v80 = cos(v5) * 16192.0; | 5133 v80 = cos(v5) * 16192.0; |
5134 v6 = (signed __int64)(*(float *)&v74 | 5134 v6 = (signed __int64)(*(float *)&v74 |
5135 - (double)pBLVRenderParams->field_40 | 5135 - (double)pBLVRenderParams->field_40 |
5136 / ((v80 + 0.0000001) | 5136 / ((v80 + 0.0000001) |
5143 v62.Create_48607B(&stru_8019C8); | 5143 v62.Create_48607B(&stru_8019C8); |
5144 v62.uTileBitmapID = pFace->uBitmapID; | 5144 v62.uTileBitmapID = pFace->uBitmapID; |
5145 v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0); | 5145 v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0); |
5146 if ( !v62.pTexture ) | 5146 if ( !v62.pTexture ) |
5147 return; | 5147 return; |
5148 v8 = pBLVRenderParams->sPartyRotX; | 5148 v8 = pGame->pIndoorCameraD3D->sRotationX; |
5149 v62.dimming_level = 0; | 5149 v62.dimming_level = 0; |
5150 v62.uNumVertices = v3; | 5150 v62.uNumVertices = v3; |
5151 v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX + 16); | 5151 v9 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16); |
5152 v62.v_18.y = 0; | 5152 v62.v_18.y = 0; |
5153 v62.v_18.x = -v9; | 5153 v62.v_18.x = -v9; |
5154 v62.v_18.z = -stru_5C6E00->Cos(v8 + 16); | 5154 v62.v_18.z = -stru_5C6E00->Cos(v8 + 16); |
5155 v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX; | 5155 v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX; |
5156 memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3])); | 5156 memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3])); |