Archival snapshot of the Virtual World Entertainment Tesla cockpit software, 1994-1996: MUNGA engine and L4 pod layer source (Borland C++ 5.0), BT/RP game code, and game content (models, audio, maps, gauges, Division renderer data). Includes third-party libraries: Division dVS/DPL graphics, HMI SOS audio, WATTCP networking. Files are preserved byte-for-byte (.gitattributes disables all line-ending conversion). README.md documents the layout, target hardware, and toolchain. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
119 lines
4.6 KiB
C++
119 lines
4.6 KiB
C++
//===========================================================================//
|
|
// File: PCjoystk.hh //
|
|
// Project: MUNGA Brick: Platform-specific IO //
|
|
// Contents: PC joystick interface routines //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- -----------------------------------------------------------//
|
|
// ??/??/?? JMA Initial coding. //
|
|
// 01/04/95 CPB Made pretty. //
|
|
// 01/20/95 CPB Added PC_Joystick_Mask //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1995, Virtual World Entertainment, Inc. All rights reserved //
|
|
// PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
#if !defined(L4JOYSTK_HPP)
|
|
|
|
# define L4JOYSTK_HPP
|
|
|
|
# if !defined(STYLE_HPP)
|
|
# include "c:\source\munga\style.hpp"
|
|
# endif
|
|
|
|
# define PCJ1_Button1 0x10
|
|
# define PCJ1_Button2 0x20
|
|
# define PCJ2_Button1 0x40
|
|
# define PCJ2_Button2 0x80
|
|
# define PC_All_Buttons 0xF0
|
|
|
|
// These are used to build "mask" values, below
|
|
# define PCJ_AnalogChannel1 0x01
|
|
# define PCJ_AnalogChannel2 0x02
|
|
# define PCJ_AnalogChannel3 0x04
|
|
# define PCJ_AnalogChannel4 0x08
|
|
# define PC_All_Analog 0x0F
|
|
|
|
// Definitions for standard old 2-axis joystick
|
|
# define PCJ_Standard_Button1 0x10
|
|
# define PCJ_Standard_Button2 0x20
|
|
# define PCJ_Standard_Mask PCJ_AnalogChannel1|PCJ_AnalogChannel2
|
|
|
|
// Definitions for Flightstick Pro (CH products)
|
|
//
|
|
// These states are mutually exclusive and ordered by decreasing
|
|
// priority (only the highest priority state is returned).
|
|
// Yes, this means that you cannot activate two states at a time:
|
|
// while you hold the "thumb joystick", you cannot fire.
|
|
# define PCJ_FSP_Up 0xF0 // "thumb joystick" up
|
|
# define PCJ_FSP_Down 0x70 // "thumb joystick" down
|
|
# define PCJ_FSP_Left 0x30 // "thumb joystick" left
|
|
# define PCJ_FSP_Right 0xB0 // "thumb joystick" right
|
|
# define PCJ_FSP_Trigger 0x10 // Trigger
|
|
# define PCJ_FSP_LButton 0x20 // Leftmost button
|
|
# define PCJ_FSP_RButton 0x40 // Rightmost button
|
|
# define PCJ_FSP_CButton 0x80 // Center button
|
|
|
|
# define PCJ_FSP_Mask PCJ_AnalogChannel1|PCJ_AnalogChannel2|\
|
|
PCJ_AnalogChannel4
|
|
|
|
// Handy equates for reading the analog values
|
|
# define PCJ_FSP_X PC_Joystick1_Raw_X;
|
|
# define PCJ_FSP_Y PC_Joystick1_Raw_Y;
|
|
# define PCJ_FSP_Dial PC_Joystick2_Raw_Y;
|
|
|
|
// Definitions for Thrustmaster
|
|
//
|
|
// The "hat" actually is connected to resistors on
|
|
// analog channel 3.
|
|
// Full value is open
|
|
// Up is low value
|
|
// Down is 1/2 value
|
|
// Left is 3/4 value
|
|
// Right is 1/4 value
|
|
//
|
|
# define PCJ_TM_Trigger 0x10 // Trigger
|
|
# define PCJ_TM_ThumbHigh 0x20 // Button next to "hat"
|
|
# define PCJ_TM_ThumbMid 0x40 // Button halfway down stick
|
|
# define PCJ_TM_ThumbLow 0x80 // Lowest thumb button
|
|
|
|
# define PCJ_TM_Mask PCJ_AnalogChannel1|PCJ_AnalogChannel2|\
|
|
PCJ_AnalogChannel4
|
|
|
|
// Handy equates for reading the analog values
|
|
# define PCJ_FSP_X PC_Joystick1_Raw_X;
|
|
# define PCJ_FSP_Y PC_Joystick1_Raw_Y;
|
|
# define PCJ_FSP_Dial PC_Joystick2_Raw_Y;
|
|
|
|
|
|
extern "C" Word PC_Joystick1_Raw_X, PC_Joystick1_Raw_Y;
|
|
extern "C" Word PC_Joystick2_Raw_X, PC_Joystick2_Raw_Y;
|
|
extern "C" Byte PC_Joystick_Buttons;
|
|
|
|
//
|
|
// The PC_Joystick_Mask defaults at power-up to all four channels.
|
|
// It should be set according to one of the PCJ_...Mask values from above.
|
|
// This will speed up joystick updates by ignoring unused analog channels.
|
|
//
|
|
extern "C" Byte PC_Joystick_Mask;
|
|
|
|
extern "C" void PC_Joystick_Update(void);
|
|
|
|
extern "C" void test1(void);
|
|
extern "C" void test2(Byte a, Word b, LWord l, char *p);
|
|
extern "C" void test3(void);
|
|
extern "C" void test4(Byte a, Word b, LWord l, char *p);
|
|
|
|
//
|
|
// In watcom, force stack-based addressing
|
|
//
|
|
|
|
# if defined(__WATCOMC__)
|
|
# pragma aux PC_Joystick_Update parm [];
|
|
# pragma aux test1 parm [];
|
|
# pragma aux test2 parm [];
|
|
# pragma aux test3 parm [];
|
|
# pragma aux test4 parm [];
|
|
# endif
|
|
|
|
#endif
|