|
Wing Commander
Reconstructed Win32 source (1996)
|
Random numbers, fixed-point arithmetic and trigonometry computed in floating point, and text-cursor and shape-frame helpers. More...
#include "wc1.h"Go to the source code of this file.
Functions | |
| short | RandomBelow (short n) |
| void __stdcall | SeedRandomFromClock (int seed) |
| unsigned short | RandomWord (void) |
| short __stdcall | RandomInRange (short lo, short hi) |
| short | RandomBelowOrEqual (short n) |
| long | MultiplyFixed (int left, int right) |
| long | DivideFixed (int numerator, int denominator) |
| long | SinFixed (short degrees) |
| long | CosFixed (short degrees) |
| long | ArcSin (int value) |
| long | ArcCos (int value) |
| long | Magnitude (int value) |
| long | PlanarMagnitude (int x, int y) |
| long | Vector_magnitude (const FixedVector *vector) |
| void __stdcall | SetTextCursor (unsigned short a, unsigned short b) |
| void __stdcall | SetTextContext (TextContext *context) |
| void | WaitForVerticalBlankThunk (void) |
| void *__stdcall | IdentityHandle (void *v) |
| void __stdcall | SetWholePaletteFromTriplets (unsigned char *palette) |
| unsigned short __stdcall | FontHeight (const void *p) |
| unsigned short __stdcall | GetFontCharWidth (char i) |
| void | ReleaseVideoResourcesHook (void) |
| short __stdcall | GetShapeFrameBounds (short *bounds, short x, short y, struct Shape *shape, short frame) |
| short __stdcall | IsPointInRect (short x, short y, const short *rect) |
| void __stdcall | SplitPackedPoint (ShortPoint point, short *p) |
| void __stdcall | DrawTextString (const char *text) |
| void __stdcall | DrawTextCharacter (char character) |
| void __stdcall | AppendTextCharacter (char character) |
| int __stdcall | MeasureShapeFrameStorage (struct Shape *shape, short frame) |
| void | ResetTextCursor (void) |
Variables | |
| short | nPacketDecompressPending |
| unsigned short | wPacketDecompressInputSize |
| short | nCurrentPacketDecompressScratchSegment |
| volatile int | bFrameTickPendingFlag |
| int | bMouseCursorDamagePending |
| int | nMouseCursorDamageRight |
| int | nEventMousePointerDamageBottom |
| int | nSavedDosInterruptVector |
| short | nViewportOriginPositionY |
| short | nViewportOriginPositionX |
| int | nTickCount60Hz |
| unsigned char | bEscapePressedFlag |
| int | nMouseCursorDamageLeft |
| int | nMousePointerDamageTopValue |
Random numbers, fixed-point arithmetic and trigonometry computed in floating point, and text-cursor and shape-frame helpers.
Address range 434cd0-43540f. The preceding smart unit ends at chase_speed (434c70).
Definition in file mathfp.c.
| void __stdcall AppendTextCharacter | ( | char | character | ) |
Definition at line 341 of file mathfp.c.
References AppendTextCharacter(), pCurTextContext, and TextContext::textCursor.
Referenced by AppendFormattedText(), AppendTextCharacter(), DrawNavTextLine(), FormatTextBufferFromStart(), and PlaySfxWaveFileByNumber().
| long ArcCos | ( | int | value | ) |
Definition at line 108 of file mathfp.c.
References ArcCos().
Referenced by ArcCos(), get_right_shape(), match_roll_orientation(), PlaySfxWaveFileByNumber(), rectangular_to_spherical(), and set_background_objects_rotation().
| long ArcSin | ( | int | value | ) |
Definition at line 101 of file mathfp.c.
References ArcSin().
Referenced by ArcSin(), PlaySfxWaveFileByNumber(), and set_ship_rotation_goals().
| long CosFixed | ( | short | degrees | ) |
Definition at line 95 of file mathfp.c.
References CosFixed(), and DEGREES_TO_RADIANS.
Referenced by ConvertSphericalToRectangular(), CosFixed(), draw_target_box(), PlaySfxWaveFileByNumber(), reposition_fixed_child_objects(), rotate_about_i(), rotate_about_j(), and rotate_about_k().
| long DivideFixed | ( | int | numerator, |
| int | denominator ) |
Definition at line 76 of file mathfp.c.
References DivideFixed().
Referenced by accelerate_and_move_object(), apply_force_to_object(), divide_vector(), DivideFixed(), draw_nav_pointer(), IsPointWithinEyeViewCone(), NormalizeFixedVector(), object_collision(), PlaySfxWaveFileByNumber(), real_crash_time(), rectangular_to_spherical(), rotational_acceleration(), set_ship_rotation_goals(), and transform_objects_to_your_view().
| void __stdcall DrawTextCharacter | ( | char | character | ) |
Definition at line 313 of file mathfp.c.
References TextContext::cursorX, TextContext::cursorY, DrawFontGlyph(), DrawTextCharacter(), TextContext::font, Viewport::left, pCurTextContext, and TextContext::viewport.
Referenced by DrawFormattedText(), DrawTextCharacter(), DrawTextString(), and PlaySfxWaveFileByNumber().
| void __stdcall DrawTextString | ( | const char * | text | ) |
Definition at line 232 of file mathfp.c.
References TextContext::alignment, ClearDebugPauseFlags(), TextContext::cursorX, TextContext::cursorY, DrawTextCharacter(), DrawTextString(), TextContext::font, Viewport::left, pCurTextContext, PumpMessagesDuringWait(), ShapeFrame::right, Viewport::right, SystemDebugPrintf(), and TextContext::viewport.
Referenced by DrawNavTextLine(), DrawTextAt(), DrawTextString(), FormatTextTokens(), PlaySfxWaveFileByNumber(), and PromptInsertNumberedDisk().
| unsigned short __stdcall FontHeight | ( | const void * | p | ) |
Definition at line 178 of file mathfp.c.
References FontHeight().
Referenced by AnimateTrainSimTitle(), ClearTextInputCharacter(), EraseLastTextInputCharacter(), FontHeight(), InitializeDiskPromptTextContext(), PlaySfxWaveFileByNumber(), ReadTextInput(), and ShowTrainSimHighScores().
| unsigned short __stdcall GetFontCharWidth | ( | char | i | ) |
Definition at line 184 of file mathfp.c.
References TextContext::font, GetFontCharWidth(), and pCurTextContext.
Referenced by ClearTextInputCharacter(), EraseLastTextInputCharacter(), GetFontCharWidth(), MeasureTextPixelWidthClamped(), and PlaySfxWaveFileByNumber().
| short __stdcall GetShapeFrameBounds | ( | short * | bounds, |
| short | x, | ||
| short | y, | ||
| struct Shape * | shape, | ||
| short | frame ) |
Definition at line 195 of file mathfp.c.
References ShapeFrame::bottom, Shape::frameOffsets, GetShapeFrameBounds(), ShapeFrame::left, ShapeFrame::right, and ShapeFrame::top.
Referenced by AlignSpriteFrameToRectCorner(), GetShapeFrameBounds(), GetShapeFrameExtent(), PlaySfxWaveFileByNumber(), RecRoom(), SelectTrainSimMission(), and Title_Sequence().
Definition at line 164 of file mathfp.c.
References IdentityHandle().
Referenced by DecompressPacketSection(), IdentityHandle(), and PlaySfxWaveFileByNumber().
| short __stdcall IsPointInRect | ( | short | x, |
| short | y, | ||
| const short * | rect ) |
Definition at line 217 of file mathfp.c.
References IsPointInRect().
Referenced by FindMenuRegionAtPoint(), IsPointInRect(), PlaySfxWaveFileByNumber(), SplitPackedPoint(), UpdateRoomMenuCursor(), UpdateTitleMenuCursor(), and UpdateTrainSimMenuCursor().
| long Magnitude | ( | int | value | ) |
Definition at line 115 of file mathfp.c.
References Magnitude().
Referenced by Magnitude(), and PlaySfxWaveFileByNumber().
| int __stdcall MeasureShapeFrameStorage | ( | struct Shape * | shape, |
| short | frame ) |
Definition at line 349 of file mathfp.c.
References Shape::frameOffsets, and MeasureShapeFrameStorage().
Referenced by InitializeCockpitResources(), MeasureShapeFrameStorage(), and PlaySfxWaveFileByNumber().
| long MultiplyFixed | ( | int | left, |
| int | right ) |
Definition at line 67 of file mathfp.c.
References MultiplyFixed().
Referenced by accelerate_and_move_object(), apply_force_to_object(), approach_speed(), ConvertSphericalToRectangular(), dot_product(), draw_nav_pointer(), MultiplyFixed(), object_collision(), PlaySfxWaveFileByNumber(), reposition_fixed_child_objects(), rotate_about_i(), rotate_about_j(), rotate_about_k(), rotational_acceleration(), ScaleFixedVector(), transform_objects_to_your_view(), update_digital_readouts(), vector_cross_product(), and vector_length_in_dir().
| long PlanarMagnitude | ( | int | x, |
| int | y ) |
Definition at line 121 of file mathfp.c.
References PlanarMagnitude().
Referenced by apply_force_to_object(), PlanarMagnitude(), PlaySfxWaveFileByNumber(), rectangular_to_spherical(), and set_ship_rotation_goals().
| short RandomBelow | ( | short | n | ) |
Definition at line 29 of file mathfp.c.
References RandomBelow().
Referenced by AddRandomTrainSimHighScores(), call_enemy(), check_destroy_target(), Explosion(), init_hazard(), intelligence_events(), Mgloat(), pick_from_list(), pick_regular_maneuver(), PlaySfxWaveFileByNumber(), pop_flack(), RandomBelow(), request(), run_away(), select_target(), skew_randomly(), streak_toward(), and try_far_spot().
| short RandomBelowOrEqual | ( | short | n | ) |
Definition at line 59 of file mathfp.c.
References RandomBelowOrEqual().
Referenced by abandoned(), accelerate_and_move_object(), AddRandomTrainSimHighScores(), any_defense(), asteroid_velocity(), check_for_lost_control(), CheckTargetLockMalfunction(), Create_explosion_debris(), Create_ship_hit_debris(), explode(), fire(), fire_flack(), fire_turrets(), hit_asteroid(), house_keep_objects(), inflict_damage(), init_hazard(), InitializeTrainSimHighScores(), internal_damage(), Mfish_hook(), Mhard_turn(), mine_intelligence(), Mroll_over(), Mtarget_missile(), Mtry2tail(), Mveer_away(), Mwabble(), npc_communication(), perform_maneuver(), pick_from_list(), pick_regular_maneuver(), pilot_hit(), PlaySfxWaveFileByNumber(), pop_flack(), random_radial(), RandomBelowOrEqual(), repair_internal_damage(), ReturnToBriefingLongShot(), rnd_aim(), rnd_sign(), select_safe_target(), select_weighted_value(), send_appropriate_message(), ShowCampaignVictorySequence(), ShowTheEndScreen(), ShowVictoryScreen(), signed_random(), skill_check(), start_lock(), tanker_intelligence(), try2allow_engage(), update_hazards(), veer_random(), and your_internal_damage().
| short __stdcall RandomInRange | ( | short | lo, |
| short | hi ) |
Definition at line 49 of file mathfp.c.
References RandomInRange().
Referenced by AddRandomTrainSimHighScores(), animate_object(), AnimateBarracks(), ChooseRandomSignedMagnitude(), DrawConstellationField(), GameFlow(), generate_stars(), HandleSpaceFlightControls(), house_keep_objects(), InitializeBarracksAnimation(), InitializeConstellationField(), InitializeTrainSimHighScores(), internal_damage(), landing(), make_shard(), MakeRandomNormalizedVector(), malf(), MoveNewCampaign(), new_space_music_changes(), place_exhaust_on_ships(), PlaySfxWaveFileByNumber(), PostMission(), RandomInRange(), RecRoom(), replenish_weapon_energy_bank(), ShowTheEndScreen(), ShowTrainSimHighScores(), ShowVictoryScreen(), start_dust(), update_star_field(), and vid_transmit().
| unsigned short RandomWord | ( | void | ) |
Definition at line 43 of file mathfp.c.
References RandomWord().
Referenced by PlayScrambleHangarScene(), PlaySfxWaveFileByNumber(), and RandomWord().
Definition at line 190 of file mathfp.c.
References ReleaseVideoResourcesHook().
Referenced by PlaySfxWaveFileByNumber(), ReleaseVideoResourcesHook(), and ShutdownVideoHook().
Definition at line 401 of file mathfp.c.
References TextContext::cursorX, TextContext::cursorY, pCurTextContext, and ResetTextCursor().
Referenced by PlaySfxWaveFileByNumber(), and ResetTextCursor().
| void __stdcall SeedRandomFromClock | ( | int | seed | ) |
Definition at line 37 of file mathfp.c.
References SeedRandomFromClock().
Referenced by PlaySfxWaveFileByNumber(), and SeedRandomFromClock().
| void __stdcall SetTextContext | ( | TextContext * | context | ) |
Definition at line 152 of file mathfp.c.
References pCurTextContext, and SetTextContext().
Referenced by BuildMap(), DeBriefing(), Dismissed(), DrawCockpitReadout(), DrawNavLocationReadout(), DrawRoomMenuLabel(), DrawTextAt(), InflightComputer(), InitializeCockpitResources(), InitializeConversationText(), InitializeGameTextContexts(), InitializeTextContextFromFont(), InitializeTrainSimTextPanel(), LoadBriefingRoom(), PlaySfxWaveFileByNumber(), PromptInsertNumberedDisk(), SelectTrainSimMission(), SetTextContext(), ShowCampaignVictorySequence(), ShowChalkBoard(), ShowMeanwhileTransition(), ShowMemoryStatusDebug(), ShowTigerClawEscapeScene(), ShowTrainSimHighScores(), update_digital_readouts(), update_VDUs(), UpdateArcadeScoreDisplay(), UpdateInflightNavText(), and UpdateMap().
| void __stdcall SetTextCursor | ( | unsigned short | a, |
| unsigned short | b ) |
Definition at line 145 of file mathfp.c.
References TextContext::cursorX, TextContext::cursorY, pCurTextContext, and SetTextCursor().
Referenced by DrawCockpitReadout(), DrawModalTextPanel(), DrawNavMapLegend(), DrawTextAt(), InitializeCockpitResources(), PlaySfxWaveFileByNumber(), PromptForPilotField(), PromptInsertNumberedDisk(), ReadRequiredPilotField(), ReadTextInput(), SelectTrainSimMission(), SetTextCursor(), ShowTrainSimHighScores(), ShowTrainSimTextMessage(), and UpdateArcadeScoreDisplay().
| void __stdcall SetWholePaletteFromTriplets | ( | unsigned char * | palette | ) |
Definition at line 172 of file mathfp.c.
References DIBwholePaletteFromTriplets(), and SetWholePaletteFromTriplets().
Referenced by FadeViewportPaletteToColour(), LoadPaletteTripletsFile(), PlaySfxWaveFileByNumber(), and SetWholePaletteFromTriplets().
| long SinFixed | ( | short | degrees | ) |
Definition at line 89 of file mathfp.c.
References DEGREES_TO_RADIANS, and SinFixed().
Referenced by ConvertSphericalToRectangular(), draw_target_box(), PlaySfxWaveFileByNumber(), reposition_fixed_child_objects(), rotate_about_i(), rotate_about_j(), rotate_about_k(), and SinFixed().
| void __stdcall SplitPackedPoint | ( | ShortPoint | point, |
| short * | p ) |
Definition at line 226 of file mathfp.c.
References IsPointInRect(), SplitPackedPoint(), ShortPoint::x, and ShortPoint::y.
Referenced by PlaySfxWaveFileByNumber(), and SplitPackedPoint().
| long Vector_magnitude | ( | const FixedVector * | vector | ) |
Definition at line 132 of file mathfp.c.
References Vector_magnitude(), FixedVector::x, FixedVector::y, and FixedVector::z.
Referenced by accelerate_and_move_object(), distance_between_points(), distance_from_point(), draw_nav_pointer(), explosion_shock_wave(), fire_afterburner(), fire_weapon(), GetShipDistanceToNavPoint(), GetVectorMagnitude(), IsPointWithinEyeViewCone(), IsVectorWithinRange(), NormalizeFixedVector(), object_collision(), PlaySfxWaveFileByNumber(), PlaySfxWaveFileByNumber(), real_crash_time(), real_velocity(), rectangular_to_spherical(), RenderSpaceViewFrame(), set_eye_direction_and_position(), set_ship_rotation_goals(), SetFleetOverviewView(), transform_objects_to_your_view(), update_canned_sequence(), update_digital_readouts(), update_objective_location(), vector_length_in_dir(), and Vector_magnitude().
Definition at line 158 of file mathfp.c.
References DIBwaitForVerticalBlank(), and WaitForVerticalBlankThunk().
Referenced by PanToScreen(), PlaySfxWaveFileByNumber(), RefreshMemoryStatusOverlay(), RestoreGamePalette(), ShowCampaignVictorySequence(), ShowCarrierLaunchSequence(), ShowOffscreenBuffer(), and WaitForVerticalBlankThunk().
| unsigned char bEscapePressedFlag |
Definition at line 24 of file mathfp.c.
Referenced by AnimateScrambleWalk(), AwardCampaignMedal(), Briefing(), death_sequence(), DeBriefing(), ejection_sequence(), funeral_sequence(), funeral_wingman(), HandleSpaceFlightControls(), InflightComputer(), landing(), LaunchPlayerShip(), LoadBriefingRoom(), main(), MainWindowProc(), Office(), PlaySceneAnimation(), PlayScrambleHangarScene(), RecRoom(), SceneDirector(), scramble(), SelectTrainSimMission(), ShowCampaignVictorySequence(), ShowCarrierLaunchSequence(), ShowGameOverScreen(), ShowGetReadyScreen(), ShowTheEndScreen(), ShowTigerClawEscapeScene(), ShowVictoryScreen(), stranded_sequence(), Title_Sequence(), wait_for_end_of_music(), and WaitForMusicOrInput().
| volatile int bFrameTickPendingFlag |
Definition at line 16 of file mathfp.c.
Referenced by FrameTimerCallback(), IsFrameTickElapsed(), SetMultimediaTimerCallback(), and WaitForFrameTick().
| int bMouseCursorDamagePending |
Definition at line 17 of file mathfp.c.
Referenced by CaptureMouseCursorBackground(), DrawMouseCursor(), and RefreshMouseCursorDisplay().
| short nCurrentPacketDecompressScratchSegment |
Definition at line 15 of file mathfp.c.
Referenced by DecompressPacketSection().
| int nEventMousePointerDamageBottom |
Definition at line 19 of file mathfp.c.
Referenced by CaptureMouseCursorBackground(), DrawMouseCursor(), RefreshMouseCursorDisplay(), and RestoreMouseCursorBackground().
| int nMouseCursorDamageLeft |
Definition at line 25 of file mathfp.c.
Referenced by CaptureMouseCursorBackground(), DrawMouseCursor(), RefreshMouseCursorDisplay(), and RestoreMouseCursorBackground().
| int nMouseCursorDamageRight |
Definition at line 18 of file mathfp.c.
Referenced by CaptureMouseCursorBackground(), DrawMouseCursor(), RefreshMouseCursorDisplay(), and RestoreMouseCursorBackground().
| int nMousePointerDamageTopValue |
Definition at line 26 of file mathfp.c.
Referenced by CaptureMouseCursorBackground(), DrawMouseCursor(), RefreshMouseCursorDisplay(), and RestoreMouseCursorBackground().
| short nPacketDecompressPending |
Definition at line 13 of file mathfp.c.
Referenced by DecompressPacketSection().
| int nSavedDosInterruptVector |
Definition at line 20 of file mathfp.c.
Referenced by LogMemoryUsage(), and main().
| int nTickCount60Hz |
Definition at line 23 of file mathfp.c.
Referenced by AnimateBarracks(), BarracksScreen(), DrawHudMessageSlot(), InflightComputer(), player_input(), PumpWindowMessages(), RecRoom(), and UpdateInputDeviceTransitions().
| short nViewportOriginPositionX |
Definition at line 22 of file mathfp.c.
Referenced by set_up_screen_viewport().
| short nViewportOriginPositionY |
Definition at line 21 of file mathfp.c.
Referenced by set_up_screen_viewport().
| unsigned short wPacketDecompressInputSize |
Definition at line 14 of file mathfp.c.
Referenced by DecompressPacketSection().