Files
BT411/engine/MUNGA_L4/L4MOUSE.cpp
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

192 lines
3.3 KiB
C++

#include "mungal4.h"
#pragma hdrstop
#include "l4mouse.h"
#define MOUSEINT 0x33
//
//############################################################################
// Creator - reset the driver and check for existence
//
//############################################################################
//
Mouse::Mouse()
{
/*STUBBED: RB 2/11/07
Check_Pointer(this);
//
//-----------------------------------------------
// Reset driver and read status
//-----------------------------------------------
//
__int16 _AX, _BX;
__asm
{
MOV AX, 0x00
INT MOUSEINT
MOV _AX, AX
MOV _BX, BX
}
//
//-----------------------------------------------
// AX will be zero if error, 0xFFFF if ok.
// BX is the number of buttons.
//-----------------------------------------------
//
if (_AX == 0xFFFF)
{
ButtonCount = _BX;
Errors = 0;
}
else
{
Errors = 1;
ButtonCount = 0;
}
Check_Fpu();
*/
Errors = 0;
}
Logical Mouse::TestInstance() const
{
return True;
}
//
//############################################################################
// ReadCounters - return how many 'mickeys' the mouse has moved
// since the last call
//############################################################################
//
void Mouse::ReadCounters(int *xp, int *yp)
{
/*
Check(this);
Check_Pointer(xp);
Check_Pointer(yp);
if (Errors)
{
*xp = 0;
*yp = 0;
}
else
{
//
//-----------------------------------------------
// Read motion counters
// RETURN:
// CX = UNSIGNED x counter,
// DX = UNSIGNED y counter.
// These must be converted to signed values.
//-----------------------------------------------
//
__int16 a, b;
__asm
{
MOV AX, 0xB
INT MOUSEINT
MOV a, CX
MOV b, DX
}
if (a & 0x8000)
{
a |= (int)(~65535L);
}
if (b & 0x8000)
{
b |= (int)(~65535L);
}
*xp = a;
*yp = b;
}
Check_Fpu();
*/
}
//
//############################################################################
// ButtonPressed - return the number of times a given button was pressed
// since the last call
//############################################################################
//
int Mouse::ButtonPressed(int buttonNum)
{
/*
Check(this);
if (Errors)
{
return 0;
}
else
{
//
//-----------------------------------------------
// Read button press data
// RETURN:
// AX = current button states
// BX = number of times pressed since last call
//-----------------------------------------------
//
__int16 retVal;
__int16 _BX = buttonNum;
_asm
{
MOV AX, 0x05
MOV BX, _BX
INT MOUSEINT
MOV retVal, BX
}
return retVal;
}
*/
return 0;
}
//
//############################################################################
// ButtonReleased - return the number of times a given button was released
// since the last call
//############################################################################
//
int Mouse::ButtonReleased(int buttonNum)
{
/*
Check(this);
if (Errors)
{
return 0;
}
else
{
//
//-----------------------------------------------
// Read button press data
// RETURN:
// AX = current button states
// BX = number of times pressed since last call
//-----------------------------------------------
//
__int16 retVal;
__int16 _BX = buttonNum;
_asm
{
MOV AX, 0x06
MOV BX, _BX
INT MOUSEINT
MOV retVal, BX
}
return retVal;
}
*/
return 0;
}