Files
BT411/engine/MUNGA_L4/L4JOYSTK.h
T
arcattackandClaude Opus 4.8 7b7d465e5e Initial commit: bt411 -- standalone Windows BattleTech (Tesla 4.10 port)
Clean, self-contained extraction of the BattleTech-specific work from the
reverse-engineering workspace -- engine + game + content + build, with nothing
from Red Planet or the raw archive dumps. Builds green (Win32) and runs the
single-player drive->animate->target->fire->damage->destroy loop out of the box.

Layout:
  engine/   MUNGA + MUNGA_L4 shared 2007 engine, carrying our BT render/loader
            work (bgfload/L4D3D/L4VIDEO: BSL bit-slice decode, LOD/ground/shadow
            models) + image codec; the minimal rp/ headers the audio HAL needs
  game/     reconstructed BT logic + surviving-original BT source + fwd shims
            + WinMain launcher
  content/  full runtime tree (BTL4.RES, VIDEO/, GAUGE/, AUDIO/, eggs, BTDPL.INI)
  docs/     format specs + reconstruction ledgers
  reference/ raw Ghidra pseudocode (recon source-of-truth) + decomp exporter
  tools/    MP console emulator + map/resource scanners

One top-level CMake builds munga_engine lib + bt410_l4 game lib + btl4.exe.
All paths relativized (186 fwd shims + ~437 CMake abs paths -> repo-relative);
DXSDK is the one external, overridable via -DDXSDK. Verified: builds to a
byte-identical 2.27MB exe and runs combat (TARGET DESTROYED, 0 crashes) against
the bundled content.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 21:03:40 -05:00

98 lines
3.2 KiB
C

#pragma once
#include "..\munga\style.h"
#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