Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions source/scripting_v3/GTA/Blip/Blip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,41 @@ public bool IsHiddenOnLegend
set => Function.Call(Hash.SET_BLIP_HIDDEN_ON_LEGEND, Handle, value);
}

/// <summary>
/// Gets whether a specific <see cref="BlipPropertyFlag"/> is set for this <see cref="Blip"/>.
/// </summary>
private bool GetPropertyFlag(BlipPropertyFlag flag)
{
const int PropertyFlagsOffset = 0x20;

IntPtr address = MemoryAddress;
if (address == IntPtr.Zero)
{
return false;
}

return SHVDN.MemDataMarshal.IsBitSet(address + PropertyFlagsOffset, (int)flag);
}

// Would be practical if this was exposed publicly,
// but when updating some flags using this method,
// the blip would not visually update until the game was paused and unpaused.
/// <summary>
/// Sets whether a specific <see cref="BlipPropertyFlag"/> is set for this <see cref="Blip"/>.
/// </summary>
private void SetPropertyFlag(BlipPropertyFlag flag, bool value)
{
const int PropertyFlagsOffset = 0x20;

IntPtr address = MemoryAddress;
if (address == IntPtr.Zero)
{
return;
}

SHVDN.MemDataMarshal.SetBit(address + PropertyFlagsOffset, (int)flag, value);
}

/// <summary>
/// Gets the appropriate name of this <see cref="Blip"/> in the same way the game does.
/// </summary>
Expand Down
140 changes: 140 additions & 0 deletions source/scripting_v3/GTA/Blip/BlipPropertyFlag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
namespace GTA
{
/// <summary>
/// Flags that define various visual and functional properties of a <see cref="Blip"/>.
/// </summary>
public enum BlipPropertyFlag
{
/// <summary>
/// Determines whether a <see cref="Blip"/>'s color is rendered with increased brightness.
/// </summary>
/// <remarks>
/// Not all <see cref="BlipColor"/> values are affected.
/// For example, <see cref="BlipColor.Blue"/> maps internally to <c>HUD_COLOUR_BLUE</c> by default
/// and switches to <c>HUD_COLOUR_BLUELIGHT</c> when this flag is enabled.
/// </remarks>
Brightness = 1,

/// <summary>
/// Determines whether a <see cref="Blip"/> will flash at intervals defined by <see cref="Blip.FlashInterval"/>.
/// </summary>
Flashing,

/// <summary>
/// Indicates whether the <see cref="Blip"/> is visible only at short range.
/// </summary>
Shortrange,

/// <summary>
/// Determines whether the <see cref="Blip"/> has a GPS route attached to it.
/// </summary>
Route,

/// <summary>
/// Shows the height indicator arrows on a <see cref="Blip"/>.
/// </summary>
ShowHeight,

/// <summary>
/// Determines whether markers are drawn at long distances (ideal for high-speed races).
/// </summary>
MarkerLongDist,

/// <summary>
/// Minimizes the <see cref="Blip"/> when it reaches the edge of the map.
/// </summary>
MinimiseOnEdge,

/// <summary>
/// Marks the <see cref="Blip"/> as "dead."
/// </summary>
Dead,

/// <summary>
/// Uses a larger vertical distance threshold before displaying the up/down arrows on the <see cref="Blip"/>.
/// </summary>
UseExtendedHeightThreshold,

/// <summary>
/// Marks a <see cref="Blip"/> as created for a ped in a relationship group.
/// </summary>
/// <remarks>
/// Used in <c>CMiniMap::GetBlipAttachedToEntity</c> to identify blips specifically created for relationship-group peds.
/// </remarks>
CreatedForRelationshipGroupPed,

/// <summary>
/// Shows a direction cone on the <see cref="Blip"/>.
/// </summary>
ShowCone,

/// <summary>
/// Indicates that the <see cref="Blip"/> is associated with a mission creator.
/// </summary>
/// <remarks>
/// Visually, this behaves similarly to <see cref="MinimiseOnEdge"/>.
/// However, the <see cref="Blip"/> will not be visible when the exterior map is hidden or when inside an interior.
/// </remarks>
MissionCreator,

/// <summary>
/// Marks the <see cref="Blip"/> as high detail for the pause map legend.
/// </summary>
HighDetail,

/// <summary>
/// Hides the <see cref="Blip"/> from the pause map legend.
/// </summary>
HiddenOnLegend,

/// <summary>
/// Shows a tick indicator on the <see cref="Blip"/>.
/// </summary>
ShowTick,

/// <summary>
/// Shows a gold tick indicator on the <see cref="Blip"/>.
/// </summary>
ShowGoldTick,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flag isn't present in b2628 or earlier game versions. I tested in both b2628 and b2699 by watching which bit SHOW_HEADING_INDICATOR_ON_BLIP changes even.


/// <summary>
/// Shows the "for sale" ($) indicator on the <see cref="Blip"/>.
/// </summary>
ShowForSale,

/// <summary>
/// Displays the heading/direction indicator on the <see cref="Blip"/>.
/// </summary>
ShowHeadingIndicator,

/// <summary>
/// Displays an outline indicator on the <see cref="Blip"/>.
/// </summary>
ShowOutlineIndicator,

/// <summary>
/// Displays the friend indicator on the <see cref="Blip"/>.
/// </summary>
ShowFriendIndicator,

/// <summary>
/// Displays the crew indicator on the <see cref="Blip"/>.
/// </summary>
ShowCrewIndicator,

/// <summary>
/// Always shows the height indicator even if the <see cref="Blip"/> is off the edge of the minimap.
/// </summary>
UseHeightOnEdge,

/// <summary>
/// Marks the <see cref="Blip"/> as being hovered on the pause map.
/// </summary>
HoveredOnPausemap,

/// <summary>
/// Uses a shorter vertical distance threshold before displaying the up/down arrows on the <see cref="Blip"/>.
/// </summary>
UseShortHeightThreshold,
};
}