Imports the current Win32 source for the pod-racing game 'Red Planet', built on the MUNGA engine and its L4 (Win32/DirectX) platform layer: - MUNGA / MUNGA_L4: cross-platform engine core and Win32 backend - RP / RP_L4: Red Planet game logic and Win32 application - DivLoader, Setup1: asset loader and installer project - lib, MUNGA_L4/openal, MUNGA_L4/sos: third-party audio dependencies Removed stale Subversion metadata and added .gitignore/.gitattributes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
192 lines
3.3 KiB
C++
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;
|
|
}
|