Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const RADAR_SCALE = 10.0; // Scale of the radar
- const RADAR_MAXDIST = 750.0; // Maximum distance it can find actors at
- const RADAR_RADIUS = 50.0; // The radius of the radar's background
- protected void DrawRadar (PlayerPawn pPawn, Vector2 radarPos, double TicFrac) {
- DrawImage ("graphics/HUD/Radar/S7RDR0.png", radarPos, DI_SCREEN_RIGHT_TOP | DI_ITEM_RIGHT_TOP);
- double angleCos = Cos (-pPawn.angle), angleSin = Sin (-pPawn.angle);
- Vector3 pPawnXYPos = (pPawn.prev + (TicFrac * (pPawn.pos - pPawn.prev)));
- Vector2 radarOffs = (radarPos.x - RADAR_RADIUS, radarPos.y + RADAR_RADIUS);
- HUDFont mRadarMarkers = HUDFont.Create (fnt, fnt.GetCharWidth ("A"), true, 1, 1);
- double markerYOffs = mRadarMarkers.mFont.GetHeight () / 2.0;
- bool showKeys = CheckInventory ('S7_UpgradeRadarKeys', 1);
- let actorFinder = BlockThingsIterator.Create (pPawn, RADAR_MAXDIST);
- Actor curActor;
- while (actorFinder.Next ()) {
- curActor = actorFinder.thing;
- int colour;
- if (curActor.bIsMonster) {
- if (curActor.health > 0)
- colour = (curActor.isFriend (pPawn)) ? Font.CR_GREEN : Font.CR_RED;
- else
- colour = Font.CR_DARKGRAY;
- } else if (showKeys && curActor.bSpecial && curActor is 'Key')
- colour = Font.CR_GOLD;
- else
- continue;
- // Coords
- Vector3 actorPos = (curActor.prev + (TicFrac * (curActor.pos - curActor.prev)));
- Vector2 worldPos = pPawnXYPos.xy - actorPos.xy, screenPos;
- worldPos /= RADAR_SCALE;
- screenPos.x = (worldPos.x * angleSin + worldPos.y * angleCos);
- screenPos.y = (worldPos.x * angleCos - worldPos.y * angleSin);
- if (screenPos.Length () >= RADAR_RADIUS)
- continue;
- // Draw
- DrawString (mRadarMarkers, "B", radarOffs + screenPos - (0, markerYOffs), DI_SCREEN_RIGHT_TOP | DI_TEXT_ALIGN_CENTER | DI_NOSHADOW, colour);
- }
- DrawString (mRadarMarkers, "A", radarOffs - (0, markerYOffs), DI_SCREEN_RIGHT_TOP | DI_TEXT_ALIGN_CENTER | DI_NOSHADOW, Font.CR_BLUE);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement