Mercurial > mm7
comparison Engine/Graphics/Outdoor.cpp @ 2543:b6140dfeac27
GameOver h/cpp
author | a.parshin |
---|---|
date | Sun, 10 May 2015 03:21:14 +0200 |
parents | a902abdfc7f2 |
children | e06a3fe9ad6e |
comparison
equal
deleted
inserted
replaced
2542:bacf9809126a | 2543:b6140dfeac27 |
---|---|
81 | 81 |
82 //----- (0047A59E) -------------------------------------------------------- | 82 //----- (0047A59E) -------------------------------------------------------- |
83 void OutdoorLocation::ExecDraw(unsigned int bRedraw) | 83 void OutdoorLocation::ExecDraw(unsigned int bRedraw) |
84 { | 84 { |
85 | 85 |
86 pEngine->pIndoorCameraD3D->debug_flags = 0; | 86 pIndoorCameraD3D->debug_flags = 0; |
87 if (viewparams->draw_d3d_outlines) | 87 if (viewparams->draw_d3d_outlines) |
88 pEngine->pIndoorCameraD3D->debug_flags |= ODM_RENDER_DRAW_D3D_OUTLINES; | 88 pIndoorCameraD3D->debug_flags |= ODM_RENDER_DRAW_D3D_OUTLINES; |
89 | 89 |
90 if (bRedraw || true/*pRenderer->pRenderD3D*/) | 90 if (bRedraw || true/*pRenderer->pRenderD3D*/) |
91 { | 91 { |
92 //pODMRenderParams->RotationToInts(); | 92 //pODMRenderParams->RotationToInts(); |
93 sub_481ED9_MessWithODMRenderParams(); | 93 sub_481ED9_MessWithODMRenderParams(); |
102 sub_487DA9(); | 102 sub_487DA9(); |
103 } | 103 } |
104 if ( pParty->uCurrentMinute != pOutdoor->uLastSunlightUpdateMinute ) | 104 if ( pParty->uCurrentMinute != pOutdoor->uLastSunlightUpdateMinute ) |
105 pOutdoor->UpdateSunlightVectors(); | 105 pOutdoor->UpdateSunlightVectors(); |
106 pOutdoor->UpdateFog(); | 106 pOutdoor->UpdateFog(); |
107 //pEngine->pIndoorCameraD3D->sr_Reset_list_0037C(); | 107 //pIndoorCameraD3D->sr_Reset_list_0037C(); |
108 | 108 |
109 //if (pRenderer->pRenderD3D) // d3d - redraw always | 109 //if (pRenderer->pRenderD3D) // d3d - redraw always |
110 { | 110 { |
111 pRenderer->DrawOutdoorSkyD3D(); | 111 pRenderer->DrawOutdoorSkyD3D(); |
112 pRenderer->DrawBuildingsD3D(); | 112 pRenderer->DrawBuildingsD3D(); |
130 pMobileLightsStack->uNumLightsActive = 0; | 130 pMobileLightsStack->uNumLightsActive = 0; |
131 pStationaryLightsStack->uNumLightsActive = 0; | 131 pStationaryLightsStack->uNumLightsActive = 0; |
132 /*if ( !pRenderer->pRenderD3D ) | 132 /*if ( !pRenderer->pRenderD3D ) |
133 { | 133 { |
134 pRenderer->ExecOutdoorDrawSW(); | 134 pRenderer->ExecOutdoorDrawSW(); |
135 pEngine->pIndoorCameraD3D->sr_438240_draw_lits(); | 135 pIndoorCameraD3D->sr_438240_draw_lits(); |
136 }*/ | 136 }*/ |
137 pEngine->PushStationaryLights(-1); | 137 pEngine->PushStationaryLights(-1); |
138 pEngine->PrepareBloodsplats(); | 138 pEngine->PrepareBloodsplats(); |
139 if (bRedraw) | 139 if (bRedraw) |
140 pOutdoor->UpdateDiscoveredArea(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y), 1); | 140 pOutdoor->UpdateDiscoveredArea(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y), 1); |
620 if ( v24 != 0.0 || v25 != 0.0 || v26 != 0.0 ) | 620 if ( v24 != 0.0 || v25 != 0.0 || v26 != 0.0 ) |
621 break; | 621 break; |
622 currVertex--; | 622 currVertex--; |
623 } | 623 } |
624 | 624 |
625 if ( ((double)pEngine->pIndoorCameraD3D->vPartyPos.x - a2->vWorldPosition.x) * v26 | 625 if ( ((double)pIndoorCameraD3D->vPartyPos.x - a2->vWorldPosition.x) * v26 |
626 + ((double)pEngine->pIndoorCameraD3D->vPartyPos.z - a2->vWorldPosition.z) * v25 | 626 + ((double)pIndoorCameraD3D->vPartyPos.z - a2->vWorldPosition.z) * v25 |
627 + ((double)pEngine->pIndoorCameraD3D->vPartyPos.y - a2->vWorldPosition.y) * v24 > 0.0 ) | 627 + ((double)pIndoorCameraD3D->vPartyPos.y - a2->vWorldPosition.y) * v24 > 0.0 ) |
628 { | 628 { |
629 | 629 |
630 v19 = a2[1].vWorldViewPosition.x - a2->vWorldViewPosition.x; | 630 v19 = a2[1].vWorldViewPosition.x - a2->vWorldViewPosition.x; |
631 v18 = a2[1].vWorldViewPosition.y - a2->vWorldViewPosition.y; | 631 v18 = a2[1].vWorldViewPosition.y - a2->vWorldViewPosition.y; |
632 v20 = a2[1].vWorldViewPosition.z - a2->vWorldViewPosition.z; | 632 v20 = a2[1].vWorldViewPosition.z - a2->vWorldViewPosition.z; |
2443 z -= floorf(v4 + 0.5f); | 2443 z -= floorf(v4 + 0.5f); |
2444 if ( z > pActors[i].vPosition.z ) | 2444 if ( z > pActors[i].vPosition.z ) |
2445 z = pActors[i].vPosition.z; | 2445 z = pActors[i].vPosition.z; |
2446 } | 2446 } |
2447 } | 2447 } |
2448 v8 = stru_5C6E00->Atan2(pActors[i].vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x, | 2448 v8 = stru_5C6E00->Atan2(pActors[i].vPosition.x - pIndoorCameraD3D->vPartyPos.x, |
2449 pActors[i].vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y); | 2449 pActors[i].vPosition.y - pIndoorCameraD3D->vPartyPos.y); |
2450 LOWORD(v9) = pActors[i].uYawAngle; | 2450 LOWORD(v9) = pActors[i].uYawAngle; |
2451 v41 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v9 - v8) >> 8) & 7; | 2451 v41 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v9 - v8) >> 8) & 7; |
2452 if ( pParty->bTurnBasedModeOn ) | 2452 if ( pParty->bTurnBasedModeOn ) |
2453 { | 2453 { |
2454 v12 = pActors[i].uCurrentActionTime; | 2454 v12 = pActors[i].uCurrentActionTime; |
2483 if ( v15->uGlowRadius ) | 2483 if ( v15->uGlowRadius ) |
2484 { | 2484 { |
2485 //LOBYTE(v16) = _4E94D3_light_type; | 2485 //LOBYTE(v16) = _4E94D3_light_type; |
2486 pMobileLightsStack->AddLight(x, y, z, 0, v15->uGlowRadius, 0xFFu, 0xFFu, 0xFFu, _4E94D3_light_type); | 2486 pMobileLightsStack->AddLight(x, y, z, 0, v15->uGlowRadius, 0xFFu, 0xFFu, 0xFFu, _4E94D3_light_type); |
2487 } | 2487 } |
2488 v17 = (x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16; | 2488 v17 = (x - pIndoorCameraD3D->vPartyPos.x) << 16; |
2489 if (pEngine->pIndoorCameraD3D->sRotationX) | 2489 if (pIndoorCameraD3D->sRotationX) |
2490 { | 2490 { |
2491 v18 = (y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16; | 2491 v18 = (y - pIndoorCameraD3D->vPartyPos.y) << 16; |
2492 v47 = (fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v18, pEngine->pIndoorCameraD3D->int_sine_y)); | 2492 v47 = (fixpoint_mul(v17, pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v18, pIndoorCameraD3D->int_sine_y)); |
2493 v50 = fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_sine_y); | 2493 v50 = fixpoint_mul(v17, pIndoorCameraD3D->int_sine_y); |
2494 v53 = fixpoint_mul(v18, pEngine->pIndoorCameraD3D->int_cosine_y); | 2494 v53 = fixpoint_mul(v18, pIndoorCameraD3D->int_cosine_y); |
2495 v44 = (z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16; | 2495 v44 = (z - pIndoorCameraD3D->vPartyPos.z) << 16; |
2496 v19 = (fixpoint_mul(v44, pEngine->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pEngine->pIndoorCameraD3D->int_cosine_x)); | 2496 v19 = (fixpoint_mul(v44, pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pIndoorCameraD3D->int_cosine_x)); |
2497 X = fixpoint_mul(v44, pEngine->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pEngine->pIndoorCameraD3D->int_cosine_x); | 2497 X = fixpoint_mul(v44, pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pIndoorCameraD3D->int_cosine_x); |
2498 if ( v19 < 262144 || v19 > pODMRenderParams->shading_dist_mist << 16 ) | 2498 if ( v19 < 262144 || v19 > pODMRenderParams->shading_dist_mist << 16 ) |
2499 continue; | 2499 continue; |
2500 v20 = v53 - v50; | 2500 v20 = v53 - v50; |
2501 v42 = v53 - v50; | 2501 v42 = v53 - v50; |
2502 v21 = (fixpoint_mul(v44, pEngine->pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(v47, pEngine->pIndoorCameraD3D->int_sine_x)); | 2502 v21 = (fixpoint_mul(v44, pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(v47, pIndoorCameraD3D->int_sine_x)); |
2503 } | 2503 } |
2504 else | 2504 else |
2505 { | 2505 { |
2506 v48 = (y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16; | 2506 v48 = (y - pIndoorCameraD3D->vPartyPos.y) << 16; |
2507 v51 = fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_cosine_y); | 2507 v51 = fixpoint_mul(v17, pIndoorCameraD3D->int_cosine_y); |
2508 v22 = fixpoint_mul(v48, pEngine->pIndoorCameraD3D->int_sine_y); | 2508 v22 = fixpoint_mul(v48, pIndoorCameraD3D->int_sine_y); |
2509 X = v22 + v51; | 2509 X = v22 + v51; |
2510 if ( v22 + v51 < 262144 || v22 + v51 > pODMRenderParams->shading_dist_mist << 16 ) | 2510 if ( v22 + v51 < 262144 || v22 + v51 > pODMRenderParams->shading_dist_mist << 16 ) |
2511 continue; | 2511 continue; |
2512 v23 = fixpoint_mul(((x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16), pEngine->pIndoorCameraD3D->int_sine_y); | 2512 v23 = fixpoint_mul(((x - pIndoorCameraD3D->vPartyPos.x) << 16), pIndoorCameraD3D->int_sine_y); |
2513 v20 = fixpoint_mul(v48, pEngine->pIndoorCameraD3D->int_cosine_y) - v23; | 2513 v20 = fixpoint_mul(v48, pIndoorCameraD3D->int_cosine_y) - v23; |
2514 v42 = fixpoint_mul(v48, pEngine->pIndoorCameraD3D->int_cosine_y) - v23; | 2514 v42 = fixpoint_mul(v48, pIndoorCameraD3D->int_cosine_y) - v23; |
2515 v21 = (z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16; | 2515 v21 = (z - pIndoorCameraD3D->vPartyPos.z) << 16; |
2516 } | 2516 } |
2517 v45 = v21; | 2517 v45 = v21; |
2518 v24 = abs(v20); | 2518 v24 = abs(v20); |
2519 if ( abs(X) >= v24 ) | 2519 if ( abs(X) >= v24 ) |
2520 { | 2520 { |
4536 pOutdoor->MessWithLUN(); | 4536 pOutdoor->MessWithLUN(); |
4537 v7 = strlen("levels\\"); | 4537 v7 = strlen("levels\\"); |
4538 strcpy(Source, &pFilename[v7]); | 4538 strcpy(Source, &pFilename[v7]); |
4539 strcpy(pOutdoor->pLevelFilename, Source); | 4539 strcpy(pOutdoor->pLevelFilename, Source); |
4540 pWeather->Initialize(); | 4540 pWeather->Initialize(); |
4541 pEngine->pIndoorCameraD3D->sRotationY = pParty->sRotationY; | 4541 pIndoorCameraD3D->sRotationY = pParty->sRotationY; |
4542 pEngine->pIndoorCameraD3D->sRotationX = pParty->sRotationX; | 4542 pIndoorCameraD3D->sRotationX = pParty->sRotationX; |
4543 //pODMRenderParams->RotationToInts(); | 4543 //pODMRenderParams->RotationToInts(); |
4544 pOutdoor->UpdateSunlightVectors(); | 4544 pOutdoor->UpdateSunlightVectors(); |
4545 | 4545 |
4546 float fov_rad; | 4546 float fov_rad; |
4547 float fov_rad_inv; | 4547 float fov_rad_inv; |