@@ -523,6 +523,11 @@ void HUD::DrawFrame(GuiContext& guiContext)
523523 currentPanel->DrawFrame (guiContext);
524524 }
525525 }
526+
527+ if (CheckCharacterObscure ())
528+ {
529+ DrawArrowAboveCharacter (guiContext);
530+ }
526531}
527532
528533void HUD::PushPagerMessage ()
@@ -734,4 +739,45 @@ void HUD::TickAutoHidePanels()
734739
735740 ++panels_iterator;
736741 }
737- }
742+ }
743+
744+ bool HUD::CheckCharacterObscure () const
745+ {
746+ Pedestrian* pedestrian = mHumanPlayer ->mCharacter ;
747+ debug_assert (pedestrian);
748+
749+ const glm::vec3& worldPosition = pedestrian->mTransformSmooth .mPosition ;
750+ // convert to map position
751+ glm::ivec3 mapPosition = Convert::MetersToMapUnits (worldPosition);
752+ for (int currentBlockLayer = mapPosition.y + 1 ; currentBlockLayer < MAP_LAYERS_COUNT; ++currentBlockLayer)
753+ {
754+ const MapBlockInfo* currBlock = gGameMap .GetBlockInfo (mapPosition.x , mapPosition.z , currentBlockLayer);
755+ if (currBlock->mFaces [eBlockFace_Lid] > 0 )
756+ {
757+ int bp = 0 ;
758+ return true ;
759+ }
760+ }
761+ return false ;
762+ }
763+
764+ void HUD::DrawArrowAboveCharacter (GuiContext& guiContext)
765+ {
766+ Pedestrian* pedestrian = mHumanPlayer ->mCharacter ;
767+ debug_assert (pedestrian);
768+
769+ // setup arrow sprite
770+ Sprite2D arrowSprite;
771+ gSpriteManager .GetSpriteTexture (GAMEOBJECT_ID_NULL, eSpriteID_Arrow_Pointer, 0 , arrowSprite);
772+
773+ arrowSprite.mScale = HUD_SPRITE_SCALE;
774+ arrowSprite.mDrawOrder = eSpriteDrawOrder_HUD_Arrow;
775+ // set rotation
776+ arrowSprite.mRotateAngle = pedestrian->mTransformSmooth .mOrientation + cxx::angle_t::from_degrees (SPRITE_ZERO_ANGLE);
777+
778+ // convert character position to screen position
779+ GameCamera& gameCamera = mHumanPlayer ->mPlayerView .mCamera ;
780+ gameCamera.ProjectPointToScreen (pedestrian->mTransformSmooth .mPosition , arrowSprite.mPosition );
781+
782+ guiContext.mSpriteBatch .DrawSprite (arrowSprite);
783+ }
0 commit comments