Wing Commander II
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
nav.c File Reference

Navigation map. More...

#include "game.h"

Go to the source code of this file.

Macros

#define NAV_C

Functions

short TryPlaceNavMapLabel (short x, short y, short width, short force)
void DrawNavTextLine (unsigned char alignment, unsigned short colour, const char *format,...)
void SetNavMapCoordinateScaling (short enabled)
void ScaleNavMapMarkerSize (short *size)
void ScaleNavMapCoordinates (short *x, short *y, short mapX, short mapY)
void nav_getxy (short *x, short *y, int worldX, int worldZ)
void CheckPoint (short x, short y)
void IncludeNavMapWorldPoint (int worldX, int worldZ)
void SetScale (void)
void set_sphere_point (const MissionShipRecord *record, FixedVector *position)
void Build_objective_list (void)
short NavMapPointInsideReservedArea (short area, short x, short y)
short NavMapLabelFits (short x, short y, short width, short height)
short NavMapLabelPositionAvailable (short x, short y, short width, short height)
void ResetNavMapReservedAreas (void)
void ReserveNavMapArea (short x, short y, short width, short height)
void ResetNavMapLabels (void)
void PlaceNavMapLabel (short x, short y, unsigned short colour, const char *text)
short ObjectivesShareNavLabel (short objective, short other)
short hidden_objective (short objective)
short visited (short objective)
short achieved (short objective)
void AddUniqueObjectiveNavLabel (short x, short y, unsigned short colour, const char *text, short objective, short missionShip)
short IsPointInNavMapLabel (short labelIndex, short x, short y)
void DrawViewportLine (Viewport *viewport, short x1, short y1, short x2, short y2, short colour)
void DrawViewportBorder (Viewport *viewport, short left, short top, short right, short bottom, short colour)
void DrawNavMapLabels (void)
void DrawNavRectangleMarker (short x, short y, short size, short shadow, unsigned short colour, short reserve)
short find_ships_sphere (short missionShip)
void SetTextContext (TextContext *context)
void DrawNavSquareOutline (Viewport *viewport, short x, short y, short size, signed char colour)
void DrawNavSquareMarker (short x, short y, short size, short shadow, short colour, short reserve)
void AddFixedVectors (const FixedVector *left, const FixedVector *right, FixedVector *sum)
void DrawNavTriangleOutline (Viewport *viewport, short x, short y, short size, signed char colour)
void DrawNavTriangleMarker (short x, short y, short size, short shadow, unsigned short colour, short reserve)
void DrawNavPlayerMarker (short colour, short reserve)
void DrawNavCrossMarker (short x, short y, short size, short shadow, unsigned short colour, short reserve)
short IsObjectiveInDisplayedSystem (short objective)
void SetScreenClipRect (unsigned short a, unsigned short b, unsigned short c, unsigned short d)
void DrawNavHazardMarker (FixedVector navPosition, FixedVector offset, short size, unsigned short markerColour, unsigned short textColour, const char *text)
void DrawNavMapBriefingBeacons (void)
void BuildMap (short showPlayer)
void UpdateInflightNavText (short showColon)
void FormatNavCoordinates (unsigned char *out)
void DrawSelectedNavLegendEntry (const char *text, short navPoint)
void DrawNavMapLegend (void)
char * nav_note (short objective)
void DrawNavLocationReadout (const char *title, short showFlightData)
void BriefingMap_LoadShapes (void)
void BriefingMap_DisplayMap (void)
short SelectNavObjectiveAtPoint (short mouseX, short mouseY)
void CentreMouseOnCurrentNavObjective (void)
void ShowConfedNavScan (short refresh)
void FollowSelectedObjectiveSystem (void)
void InflightComputer (void)

Variables

short g_nNavMapCoordinateScaling = 0
short g_nNavMapScale = 1
NavMapObjectiveStyle g_aNavMapObjectiveStyles [12]
unsigned char * g_pNavMapShape = 0
short g_nNavMapLabelCount = 0
short g_nNavMapReservedAreaCount = 0
unsigned char * g_pNavLocationText = 0
char * g_apszShipMissionTypeNames [14]
char g_szNoFurtherObjectives [32]
short g_bBriefingMapActive = 0
int g_bInflightComputerActive = 0
short g_nCurStellarSystem
short g_nNavPlotMaxX
short g_nNavmapMapMinimumX
unsigned short g_awNavObjectiveLabelIndex [8]
short g_nNavmapMapMaximumY
short g_13_nNavmapMapCentreX
short g_2_nNavMapMinimumYValue
TextContext g_stNavMapTextCtx
short g_nNavMapCentreY
TextContext g_5_stNavLabelTextContextInfo
CampaignDate g_1_stElapsedCampaignDate
void * g_4_pDigiData
unsigned short g_wDigiLeft

Detailed Description

Navigation map.

Definition in file nav.c.

Macro Definition Documentation

◆ NAV_C

#define NAV_C

Definition at line 7 of file nav.c.

Function Documentation

◆ achieved()

short achieved ( short objective)

Definition at line 1146 of file cockpt.c.

◆ AddFixedVectors()

void AddFixedVectors ( const FixedVector * left,
const FixedVector * right,
FixedVector * sum )

Definition at line 211 of file geom.c.

◆ AddUniqueObjectiveNavLabel()

void AddUniqueObjectiveNavLabel ( short x,
short y,
unsigned short colour,
const char * text,
short objective,
short missionShip )

◆ BriefingMap_DisplayMap()

◆ BriefingMap_LoadShapes()

◆ Build_objective_list()

◆ BuildMap()

void BuildMap ( short showPlayer)

Definition at line 671 of file nav.c.

References achieved(), AddUniqueObjectiveNavLabel(), TextContext::alignment, BuildMap(), PilotProfile::callsign, DrawNavCrossMarker(), DrawNavHazardMarker(), DrawNavMapBriefingBeacons(), DrawNavMapLabels(), DrawNavPlayerMarker(), DrawNavRectangleMarker(), DrawNavSquareMarker(), DrawNavTriangleMarker(), DrawSpriteDefault(), DrawViewportPixel(), g_1_stElapsedCampaignDate, g_5_stNavLabelTextContextInfo, g_6_szDefaultTextBufferText, g_aMissionNavPoints, g_aMissionObjectives, g_aMissionShips, g_aNavMapObjectiveStyles, g_aShipPosition, g_awNavObjectiveLabelIndex, g_bPrimaryViewBufferColour, g_cCurrentObjective, g_cMissionObjectiveCount, g_cRedColour, g_cYellowColour, g_nCurStellarSystem, g_nNavMapLabelCount, g_pNavMapShape, g_stCurrentPilotProfile, g_stSecondaryViewBufferBlock, g_ucAsteroidNavMarkerColour, g_ucPlayerNavLabelColour, g_ucPrimaryTextColour, hidden_objective(), InitializeTextContextFromFont(), IsObjectiveInDisplayedSystem(), NavMapObjectiveStyle::labelColour, NavMapObjectiveStyle::markerColour, NavMapObjectiveStyle::markerSize, NavMapObjectiveStyle::markerType, MissionNavPoint::missionShips, mobile_objective(), nav_getxy(), objective_name(), MissionShipRecord::objectType, PlaceNavMapLabel(), MissionNavPoint::position, MissionShipRecord::position, ResetNavMapLabels(), ResetNavMapReservedAreas(), ScaleNavMapCoordinates(), SetScale(), SetScreenClipRect(), SetTextContext(), MissionShipRecord::speed, TextContext::text, MissionObjective::type, NavMapObjectiveStyle::unvisitedColour, TextContext::viewport, visited(), and CampaignDate::year.

Referenced by BuildMap(), and DrawNavLocationReadout().

◆ CentreMouseOnCurrentNavObjective()

◆ CheckPoint()

void CheckPoint ( short x,
short y )

◆ DrawNavCrossMarker()

void DrawNavCrossMarker ( short x,
short y,
short size,
short shadow,
unsigned short colour,
short reserve )

◆ DrawNavHazardMarker()

void DrawNavHazardMarker ( FixedVector navPosition,
FixedVector offset,
short size,
unsigned short markerColour,
unsigned short textColour,
const char * text )

◆ DrawNavLocationReadout()

◆ DrawNavMapBriefingBeacons()

◆ DrawNavMapLabels()

void DrawNavMapLabels ( void )

Definition at line 458 of file nav.c.

References DrawFormattedText(), DrawNavMapLabels(), g_1_aNavMapLabels, and g_nNavMapLabelCount.

Referenced by BuildMap(), and DrawNavMapLabels().

◆ DrawNavMapLegend()

◆ DrawNavPlayerMarker()

◆ DrawNavRectangleMarker()

void DrawNavRectangleMarker ( short x,
short y,
short size,
short shadow,
unsigned short colour,
short reserve )

◆ DrawNavSquareMarker()

void DrawNavSquareMarker ( short x,
short y,
short size,
short shadow,
short colour,
short reserve )

◆ DrawNavSquareOutline()

void DrawNavSquareOutline ( Viewport * viewport,
short x,
short y,
short size,
signed char colour )

Definition at line 494 of file nav.c.

References DrawNavSquareOutline(), and DrawViewportBorder().

Referenced by DrawNavSquareMarker(), and DrawNavSquareOutline().

◆ DrawNavTextLine()

void DrawNavTextLine ( unsigned char alignment,
unsigned short colour,
const char * format,
... )

◆ DrawNavTriangleMarker()

void DrawNavTriangleMarker ( short x,
short y,
short size,
short shadow,
unsigned short colour,
short reserve )

◆ DrawNavTriangleOutline()

void DrawNavTriangleOutline ( Viewport * viewport,
short x,
short y,
short size,
signed char colour )

Definition at line 531 of file nav.c.

References DrawNavTriangleOutline(), and DrawViewportLine().

Referenced by DrawNavTriangleMarker(), and DrawNavTriangleOutline().

◆ DrawSelectedNavLegendEntry()

void DrawSelectedNavLegendEntry ( const char * text,
short navPoint )

◆ DrawViewportBorder()

void DrawViewportBorder ( Viewport * viewport,
short left,
short top,
short right,
short bottom,
short colour )

Definition at line 1360 of file gr.c.

◆ DrawViewportLine()

void DrawViewportLine ( Viewport * viewport,
short x1,
short y1,
short x2,
short y2,
short colour )

Definition at line 1060 of file gr.c.

◆ find_ships_sphere()

short find_ships_sphere ( short missionShip)

Definition at line 816 of file logic.c.

◆ FollowSelectedObjectiveSystem()

◆ FormatNavCoordinates()

void FormatNavCoordinates ( unsigned char * out)

◆ hidden_objective()

short hidden_objective ( short objective)

Definition at line 1206 of file cockpt.c.

◆ IncludeNavMapWorldPoint()

void IncludeNavMapWorldPoint ( int worldX,
int worldZ )

Definition at line 132 of file nav.c.

References CheckPoint(), IncludeNavMapWorldPoint(), and nav_getxy().

Referenced by IncludeNavMapWorldPoint(), and SetScale().

◆ InflightComputer()

void InflightComputer ( void )

Definition at line 1096 of file nav.c.

References BriefingMap_LoadShapes(), CentreMouseOnCurrentNavObjective(), ClearViewport(), ConfigureInputPump(), InputManagerState::cursorShape, cycle_next_objective(), DIBslamReal(), DisableMouseCursorDrawing(), DrawNavPlayerMarker(), DrawSpriteDefault(), EnableMouseCursorDrawing(), EndCommMenu(), FetchDiskPacketRetrying(), FollowSelectedObjectiveSystem(), force_view(), FormatNavCoordinates(), free_view_buffer(), free_viewport(), g_101_stScrViewInfo, g_18_nInterfaceEventMode, g_18_pEventManager, g_196_nInputTimerTicks, g_1_cStoredViewDisplayModeValue, g_1_stElapsedCampaignDate, g_26_bMouseCursorEnabled, g_37_stPersonnelMousePointerState, g_3_stDefaultStringContext, g_4_pElapsedCampaignDatePointer, g_5_stNavLabelTextContextInfo, g_6_stHostMouseTextBlock, g_88_nEventRepeatDelayState, g_bInflightComputerActive, g_bPrimaryViewBufferColour, g_bSceneEscapeRequested, g_cCurrentNavPointIndex, g_cCurrentObjective, g_cMissionObjectiveCount, g_cSecondaryViewBufferColour, g_nCurStellarSystem, g_pNavMapShape, g_stNavMapTextCtx, g_stSecondaryViewBufferBlock, g_ucHomeCarrierScannerColour, get_player_input(), hidden_objective(), InflightComputer(), InitializeSpaceFlightInput(), IsObjectiveInDisplayedSystem(), MarkDibDirty(), message_showing(), PlaySfxWaveFileByNumber(), PollInputEvent(), PollJoystickButtonEvents(), ReleasePacketHandle(), SelectNavObjectiveAtPoint(), set_new_objective(), SetFrameTimerAndWait(), SetInputViewport(), SetMenuInputPump(), SetMouseCursorShape(), SetPersonnelMousePosition(), SetRectBounds(), SetTextContext(), ShowConfedNavScan(), InputEventState::status, UpdateInflightNavText(), TextContext::viewport, WaitForAnyInputPress(), HostMouseMessage::x, MouseCursorState::x, HostMouseMessage::y, MouseCursorState::y, and CampaignDate::year.

Referenced by InflightComputer(), and SelectCockpitVduMode().

◆ IsObjectiveInDisplayedSystem()

◆ IsPointInNavMapLabel()

short IsPointInNavMapLabel ( short labelIndex,
short x,
short y )

Definition at line 442 of file nav.c.

References g_1_aNavMapLabels, IsPointInNavMapLabel(), and NavMapLabel::x.

Referenced by IsPointInNavMapLabel(), and SelectNavObjectiveAtPoint().

◆ nav_getxy()

void nav_getxy ( short * x,
short * y,
int worldX,
int worldZ )

◆ nav_note()

char * nav_note ( short objective)

◆ NavMapLabelFits()

short NavMapLabelFits ( short x,
short y,
short width,
short height )

Definition at line 275 of file nav.c.

References NavMapLabelFits().

Referenced by NavMapLabelFits(), NavMapLabelPositionAvailable(), and TryPlaceNavMapLabel().

◆ NavMapLabelPositionAvailable()

short NavMapLabelPositionAvailable ( short x,
short y,
short width,
short height )

◆ NavMapPointInsideReservedArea()

short NavMapPointInsideReservedArea ( short area,
short x,
short y )

◆ ObjectivesShareNavLabel()

short ObjectivesShareNavLabel ( short objective,
short other )

Definition at line 390 of file nav.c.

References g_aMissionObjectives, and ObjectivesShareNavLabel().

Referenced by AddUniqueObjectiveNavLabel(), and ObjectivesShareNavLabel().

◆ PlaceNavMapLabel()

void PlaceNavMapLabel ( short x,
short y,
unsigned short colour,
const char * text )

◆ ReserveNavMapArea()

◆ ResetNavMapLabels()

void ResetNavMapLabels ( void )

Definition at line 331 of file nav.c.

References g_nNavMapLabelCount, and ResetNavMapLabels().

Referenced by BuildMap(), and ResetNavMapLabels().

◆ ResetNavMapReservedAreas()

void ResetNavMapReservedAreas ( void )

Definition at line 311 of file nav.c.

References g_nNavMapReservedAreaCount, and ResetNavMapReservedAreas().

Referenced by BuildMap(), and ResetNavMapReservedAreas().

◆ ScaleNavMapCoordinates()

void ScaleNavMapCoordinates ( short * x,
short * y,
short mapX,
short mapY )

◆ ScaleNavMapMarkerSize()

void ScaleNavMapMarkerSize ( short * size)

Definition at line 95 of file nav.c.

References g_nNavMapScale, and ScaleNavMapMarkerSize().

Referenced by DrawNavHazardMarker(), and ScaleNavMapMarkerSize().

◆ SelectNavObjectiveAtPoint()

◆ set_sphere_point()

void set_sphere_point ( const MissionShipRecord * record,
FixedVector * position )

Definition at line 52 of file mission.c.

◆ SetNavMapCoordinateScaling()

void SetNavMapCoordinateScaling ( short enabled)

◆ SetScale()

◆ SetScreenClipRect()

void SetScreenClipRect ( unsigned short a,
unsigned short b,
unsigned short c,
unsigned short d )

◆ SetTextContext()

void SetTextContext ( TextContext * context)

Definition at line 179 of file eventmgr.c.

◆ ShowConfedNavScan()

◆ TryPlaceNavMapLabel()

short TryPlaceNavMapLabel ( short x,
short y,
short width,
short force )

◆ UpdateInflightNavText()

◆ visited()

short visited ( short objective)

Definition at line 1140 of file cockpt.c.

Variable Documentation

◆ g_13_nNavmapMapCentreX

short g_13_nNavmapMapCentreX

Definition at line 1243 of file nav.c.

Referenced by ScaleNavMapCoordinates(), and SetScale().

◆ g_1_stElapsedCampaignDate

◆ g_2_nNavMapMinimumYValue

short g_2_nNavMapMinimumYValue

Definition at line 1244 of file nav.c.

Referenced by CheckPoint(), and SetScale().

◆ g_4_pDigiData

void* g_4_pDigiData

Definition at line 1249 of file nav.c.

Referenced by PlaySpeechPacketBuffer(), and SoundBlasterDspInterrupt().

◆ g_5_stNavLabelTextContextInfo

◆ g_aNavMapObjectiveStyles

NavMapObjectiveStyle g_aNavMapObjectiveStyles[12]
Initial value:
= {
{ 2, 3, &g_cRedColour,
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 }
}
unsigned char g_cSecondaryViewBufferColour
Definition startup.c:544
unsigned char g_cRedColour
Definition startup.c:548
unsigned char g_ucPrimaryTextColour
Definition startup.c:550
unsigned char g_bPrimaryViewBufferColour
Definition startup.c:545
unsigned char g_ucDefaultTextColour
Definition startup.c:556
unsigned char g_ucNavObjectiveMarkerColour
Definition startup.c:555

Definition at line 12 of file nav.c.

Referenced by BuildMap().

◆ g_apszShipMissionTypeNames

char* g_apszShipMissionTypeNames[14]
Initial value:
= {
"Patrol",
"Escort",
"Strike",
"Defend",
"Wingman",
"Flee",
"Goto Warp",
"Warp Arrive",
"Rendezvous",
"Come Home",
"Tanker",
"Tow",
"Break Off",
0
}

Definition at line 44 of file nav.c.

Referenced by DrawNavLocationReadout().

◆ g_awNavObjectiveLabelIndex

unsigned short g_awNavObjectiveLabelIndex[8]

Definition at line 1241 of file nav.c.

Referenced by BuildMap(), and SelectNavObjectiveAtPoint().

◆ g_bBriefingMapActive

short g_bBriefingMapActive = 0

Definition at line 62 of file nav.c.

Referenced by RefreshObjectiveShipNavPoints(), and UpdateMap().

◆ g_bInflightComputerActive

int g_bInflightComputerActive = 0

Definition at line 63 of file nav.c.

Referenced by InflightComputer(), and SetHudMessageText().

◆ g_nCurStellarSystem

◆ g_nNavMapCentreY

short g_nNavMapCentreY

Definition at line 1246 of file nav.c.

Referenced by ScaleNavMapCoordinates(), and SetScale().

◆ g_nNavMapCoordinateScaling

short g_nNavMapCoordinateScaling = 0

Definition at line 10 of file nav.c.

Referenced by nav_getxy(), and SetNavMapCoordinateScaling().

◆ g_nNavMapLabelCount

short g_nNavMapLabelCount = 0

◆ g_nNavmapMapMaximumY

short g_nNavmapMapMaximumY

Definition at line 1242 of file nav.c.

Referenced by CheckPoint(), and SetScale().

◆ g_nNavmapMapMinimumX

short g_nNavmapMapMinimumX

Definition at line 1240 of file nav.c.

Referenced by CheckPoint(), and SetScale().

◆ g_nNavMapReservedAreaCount

short g_nNavMapReservedAreaCount = 0

Definition at line 42 of file nav.c.

Referenced by NavMapLabelPositionAvailable(), ReserveNavMapArea(), and ResetNavMapReservedAreas().

◆ g_nNavMapScale

short g_nNavMapScale = 1

Definition at line 11 of file nav.c.

Referenced by ScaleNavMapCoordinates(), ScaleNavMapMarkerSize(), and SetScale().

◆ g_nNavPlotMaxX

short g_nNavPlotMaxX

Definition at line 1239 of file nav.c.

Referenced by CheckPoint(), and SetScale().

◆ g_pNavLocationText

unsigned char* g_pNavLocationText = 0

Definition at line 43 of file nav.c.

Referenced by BriefingMap_DisplayMap(), DrawNavLocationReadout(), and free_3Space().

◆ g_pNavMapShape

unsigned char* g_pNavMapShape = 0

Definition at line 40 of file nav.c.

Referenced by BriefingMap_DisplayMap(), BriefingMap_LoadShapes(), BuildMap(), and InflightComputer().

◆ g_stNavMapTextCtx

TextContext g_stNavMapTextCtx

Definition at line 1245 of file nav.c.

Referenced by DrawNavLocationReadout(), InflightComputer(), and UpdateInflightNavText().

◆ g_szNoFurtherObjectives

char g_szNoFurtherObjectives[32]
Initial value:
=
"Further objectives out-system."

Definition at line 60 of file nav.c.

Referenced by nav_note().

◆ g_wDigiLeft

unsigned short g_wDigiLeft

Definition at line 1250 of file nav.c.

Referenced by PlaySpeechPacketBuffer(), and SoundBlasterDspInterrupt().