@@ -386,9 +386,9 @@ DEFINE_HOOK(0x73C47A, UnitClass_DrawAsVXL_Shadow, 0x5)
386386 {
387387 const float cHeight = (float )uTypeExt->ShadowSizeCharacteristicHeight .Get (RulesClass::Instance->CruiseHeight );
388388
389- if (cHeight > 0 )
389+ if (cHeight > 0 && height > 208 )
390390 {
391- shadow_matrix.Scale ((float )std::max (Pade2_2 (baseScale_log * height / cHeight), minScale));
391+ shadow_matrix.Scale ((float )std::max (Pade2_2 (baseScale_log * ( height - 208 ) / cHeight), minScale));
392392 vxl_index_key.Invalidate ();
393393 }
394394 }
@@ -589,27 +589,29 @@ DEFINE_HOOK(0x4147F9, AircraftClass_Draw_Shadow, 0x6)
589589 if (RulesExt::Global ()->HeightShadowScaling )
590590 {
591591 const double minScale = RulesExt::Global ()->HeightShadowScaling_MinScale ;
592- const float cHeight = (float )aTypeExt->ShadowSizeCharacteristicHeight .Get (flyLoco-> FlightLevel );
592+ const float cHeight = (float )aTypeExt->ShadowSizeCharacteristicHeight .Get (pThis-> Type -> GetFlightLevel () );
593593
594594 if (cHeight > 0 )
595595 {
596596 shadow_mtx.Scale ((float )std::max (Pade2_2 (baseScale_log * height / cHeight), minScale));
597- key.Invalidate (); // I'm sorry
597+ if (flyLoco->FlightLevel > 0 || height > 0 )
598+ key.Invalidate ();
598599 }
599600 }
600601 else if (pThis->Type ->ConsideredAircraft )
601602 {
602603 shadow_mtx.Scale ((float )Pade2_2 (baseScale_log));
603604 }
604605
605- if (pThis->IsCrashing )
606- {
607- double arf = pThis->AngleRotatedForwards ;
608- if (flyLoco->CurrentSpeed > pThis->Type ->PitchSpeed )
609- arf += pThis->Type ->PitchAngle ;
610- shadow_mtx.ScaleY ((float )Math::cos (pThis->AngleRotatedSideways ));
611- shadow_mtx.ScaleX ((float )Math::cos (arf));
612- }
606+ double arf = pThis->AngleRotatedForwards ;
607+ if (flyLoco->CurrentSpeed > pThis->Type ->PitchSpeed )
608+ arf += pThis->Type ->PitchAngle ;
609+ double ars = pThis->AngleRotatedSideways ;
610+ if (key.Is_Valid_Key () && (std::abs (arf) > 0.005 || std::abs (ars) > 0.005 ))
611+ key.Invalidate ();
612+
613+ shadow_mtx.ScaleY ((float )Math::cos (ars));
614+ shadow_mtx.ScaleX ((float )Math::cos (arf));
613615 }
614616 else if (height > 0 )
615617 {
@@ -659,6 +661,12 @@ DEFINE_HOOK(0x4147F9, AircraftClass_Draw_Shadow, 0x6)
659661
660662// Shadow_Point of RocketLoco was forgotten to be set to {0,0}. It was an oversight.
661663DEFINE_JUMP (VTABLE, 0x7F0B4C , 0x4CF940 );
664+ /*
665+ //TO TEST AND EXPLAIN: why resetting height when drawing aircrafts?
666+ DEFINE_JUMP(CALL6, 0x4147D5, 0x5F4300);
667+ DEFINE_JUMP(CALL6, 0x4148AB, 0x5F4300);
668+ DEFINE_JUMP(CALL6, 0x4147F3, 0x5F4300);
669+ */
662670
663671DEFINE_HOOK (0x7072A1 , suka707280_ChooseTheGoddamnMatrix, 0x7 )
664672{
0 commit comments