43 state = (value >> 2) |
64 short secondaryButton)
69 primaryButton, secondaryButton, 0);
107 for (slot = 0; slot < 0x100; used++, slot++) {
115 int primaryButton,
int secondaryButton,
116 unsigned int timestamp)
118 unsigned int modifiers;
128 if (primaryButton != 0)
130 if (secondaryButton != 0)
186 if (event->type != type) {
187 if (event->previous != 0)
188 event->previous->next = next;
191 if (event->next != 0)
205 if (event->
next != 0) {
206 event->previous->next =
event->next;
207 event->next->previous =
event->previous;
211 event->previous->next = 0;
216 if (event->
next != 0) {
351 while (event != 0 && event->
type != type)
354 state->
type =
event->type;
355 state->
value =
event->modifiers;
357 eventType = (int)event->
type;
358 if (eventType == 2 || eventType == 1)
360 modifiers |= ((
unsigned short)
event->primaryButton < 1 ? 0 : -1) & 2;
361 modifiers |= ((
unsigned short)
event->secondaryButton < 1 ? 0 : -1) & 4;
375 while (event != 0 && event->type != type)
824 if (scanCode >= 0 && scanCode < 0x80) {
838 unsigned int distance;
847 previous = -999999999;
854 if (previous < (
int)distance) {
855 previous = (int)distance;
862 *sortedEntry = bestObject;
864 if (bestObject == -1)
873 screenOffset +=
sizeof(short), placed++, obj++) {
876 screenOffset) != (
short)0x8001) {
877 distance = *(
unsigned short *)(
880 if (best < (
int)distance && previous >= (
int)distance) {
882 best = (int)distance;
909 switch (objectClass) {
913 struct Shape *objectShape;
917 objectX = (short)(objectX +
921 objectY = (short)(objectY +
924 if (objectShape != 0) {
944 if (specialObject == obj) {
973 switch (objectClass) {
1030 ->geometryOffsets[mode]);
1143 return malloc(size);
1216 if (abs((
int)range << 8) >= magnitude)
1224 unsigned int shrinking;
1227 shrinking =
shrink(&vector->
x);
1228 shrinking |=
shrink(&vector->
y);
1229 shrinking |=
shrink(&vector->
z);
1230 }
while (shrinking != 0);
1238 unsigned int fraction;
1239 unsigned int integerPart;
1240 short signedIntegerPart;
1242 value = *component / 2;
1245 integerPart = (
unsigned int)value >> 16;
1246 signedIntegerPart = (short)integerPart;
1247 if (signedIntegerPart == 0)
1248 return (
unsigned short)fraction > 0x0f00;
1249 if (signedIntegerPart == -1)
1250 return (
unsigned short)fraction < 0xf100;
1251 if (signedIntegerPart != 0)
1263 int xCoordinates[16];
1264 int yCoordinates[16];
1271 xCoordinates[pointCount] = first->
left;
1272 yCoordinates[pointCount] = first->
top;
1274 xCoordinates[pointCount] = first->
left;
1275 yCoordinates[pointCount] = first->
bottom;
1277 xCoordinates[pointCount] = first->
right;
1278 yCoordinates[pointCount] = first->
top;
1280 xCoordinates[pointCount] = first->
right;
1281 yCoordinates[pointCount] = first->
bottom;
1283 xCoordinates[pointCount] = second->
left;
1284 yCoordinates[pointCount] = second->
top;
1286 xCoordinates[pointCount] = second->
left;
1287 yCoordinates[pointCount] = second->
bottom;
1289 xCoordinates[pointCount] = second->
right;
1290 yCoordinates[pointCount] = second->
top;
1292 xCoordinates[pointCount] = second->
right;
1293 yCoordinates[pointCount] = second->
bottom;
1295 xCoordinates[pointCount] = first->
left;
1296 yCoordinates[pointCount] = second->
top;
1298 xCoordinates[pointCount] = first->
left;
1299 yCoordinates[pointCount] = second->
bottom;
1301 xCoordinates[pointCount] = first->
right;
1302 yCoordinates[pointCount] = second->
top;
1304 xCoordinates[pointCount] = first->
right;
1305 yCoordinates[pointCount] = second->
bottom;
1307 xCoordinates[pointCount] = second->
left;
1308 yCoordinates[pointCount] = first->
top;
1310 xCoordinates[pointCount] = second->
left;
1311 yCoordinates[pointCount] = first->
bottom;
1313 xCoordinates[pointCount] = second->
right;
1314 yCoordinates[pointCount] = first->
top;
1316 xCoordinates[pointCount] = second->
right;
1317 yCoordinates[pointCount] = first->
bottom;
1322 for (pointIndex = 0; pointIndex++; pointIndex < pointCount) {
1323 x = xCoordinates[pointIndex];
1324 y = yCoordinates[pointIndex];
1325 if (first->
left <= x && x <= first->right &&
1326 second->
left <= x && x <= second->right &&
1327 first->
top <= y && y <= first->bottom &&
1328 second->
top <= y && y <= second->bottom) {
1329 if (insideCount == 4)
1331 inside[insideCount] = 1;
1334 if (insideCount == 4)
1336 inside[insideCount] = 0;
1340 if (insideCount != 4)
1344 (
short)xCoordinates[inside[0]],
1345 MinShort((
short)xCoordinates[inside[1]],
1346 (
short)xCoordinates[inside[2]]));
1348 (
short)yCoordinates[inside[0]],
1349 MinShort((
short)yCoordinates[inside[1]],
1350 (
short)yCoordinates[inside[2]]));
1352 (
short)xCoordinates[inside[0]],
1353 MaxShort((
short)xCoordinates[inside[1]],
1354 (
short)xCoordinates[inside[2]]));
1356 (
short)yCoordinates[inside[0]],
1357 MaxShort((
short)yCoordinates[inside[1]],
1358 (
short)yCoordinates[inside[2]]));
1373 suffix[digits] =
'\0';
1381 text[digits] = (char)(number % 10) +
'0';
void(__cdecl *pIxFree)(void *)
void InterruptVectorHook(void)
short IsMouseInstalled(void)
int __stdcall MemoryServiceTransferHook(int first, int second)
void JoystickResetHook(void)
int __stdcall MemoryServiceMapHook(int value)
void __stdcall MemoryServiceReleaseHook(int value)
void MouseCursorDisplayHook(void)
short MemoryServiceResetHook(void)
void KeyboardStateHook(void)
int MemoryServiceStatusHook(void)
void MouseActivityHook(void)
void MemoryServiceShutdownHook(void)
void MouseCursorRedrawHook(void)
short MemoryServiceVersionHook(void)
void MouseCursorCaptureHook(void)
void KeyboardScanHook(void)
int __stdcall MemoryServiceQueryHook(int value)
void RefreshMouseCursorHook(void)
void ScreenViewportResetHook(void)
short MemoryServiceErrorHook(void)
static unsigned char abCursorSaveArea[0x1000]
int UntaggedMemoryHook(void)
void ResetInputKeyStatePreservingModifiers(void)
int ScreenViewportHook(void)
short __stdcall GetViewportIntersection(ShortRect *intersection, const ShortRect *first, const ShortRect *second)
void DosInterruptHandlerHook(void)
short ExitStatusHook(void)
short JoystickStatusHook(void)
InputDeviceSample aInputDevSamples[2]
short asObjectDrawPosX[SPACE_OBJECT_COUNT]
short nViewportOriginPositionX
short asObjScreenScalesArray[SPACE_OBJECT_COUNT]
int anEventObjectDepthPlacedList[SPACE_OBJECT_COUNT]
int nMouseCursorSavedCoordY
short asObjScreenAngles[SPACE_OBJECT_COUNT]
int nMouseCursorDamageRight
int nEventMousePointerDamageBottom
int bMouseCursorDamagePending
InputEvent * pInputEventTail
short nPktDecompressSourceFile
short nViewportOriginPositionY
const ScreenViewportGeometry * pScreenViewGeometry
int bEventMouseCursorDrawnFlag
ScreenViewportGeometry aScreenViewportGeometry[7]
int nMousePointerDamageTopValue
unsigned char bInputModeState
short asObjectDrawPosY[SPACE_OBJECT_COUNT]
enum ObjectClass aeObjectClass[SPACE_OBJECT_COUNT]
short bCurrentExpandedMemoryAvail
int anSortedObjects[SPACE_OBJECT_COUNT]
struct Shape * pCurrentConstellationShape
MouseCursorState stMouseCursorState
short asObjectScreenYArray[SPACE_OBJECT_COUNT]
signed char cCurrentCockpitView
unsigned char cPrimaryViewBufferColour
short nEventManagerActive
short nCurrentViewCenterPosX
unsigned char abInputKeyStateArray[0x80]
InputEvent aInputEvtPool[0x100]
int aiInputEventSlotUsedTable[0x100]
unsigned short asObjDistancesTable[SPACE_OBJECT_COUNT]
Viewport stSpaceBufferViewport
int nMouseCursorDamageLeft
short asObjectScreenXList[SPACE_OBJECT_COUNT]
int bHostPrimaryMouseButton
struct Shape * apObjShapeArray[SPACE_OBJECT_COUNT]
short nCurrentActiveInputDevice
signed char cScreenViewMode
enum ObjectType aeObjectTypeList[SPACE_OBJECT_COUNT]
short asObjectViewFrames[SPACE_OBJECT_COUNT]
struct Shape * pDrawnMouseCursorShape
int bHostSecondaryMouseButton
short asObjectFlipArray[SPACE_OBJECT_COUNT]
ScreenViewportPacket * pCurrentScreenViewportPkt
unsigned char bFilteredKeyWaitActive
InputEvent * pInputEventHead
volatile int bFrameTickPendingFlag
short nCurrentViewCenterPosY
int nMouseCursorShowCount
int bInputEventPoolInitialized
unsigned char secondaryButton
unsigned char shapeChanged
unsigned char primaryButton
Umbrella header for the game core.
void SystemDebugPrintf(const char *fmt,...)
void set_up_screen_viewport(signed char mode)
void RefreshMouseCursorDisplay(void)
void * AllocateTaggedMemory(int size, unsigned short flags)
void LeaveAllocationScope(void)
void QueueInputEventAtCursor(unsigned short type, short primaryButton, short secondaryButton)
unsigned int GetPacketDecompressionResult(void *)
void TimerResetHook(void)
char PumpMessagesDuringWait(void)
short __stdcall PollInputEvent(InputEventState *event, short filter)
char *__stdcall DosStrchr(const char *s, short c)
short __stdcall ResetAllocationDepth(int x, int y)
void StartupHook(unsigned int(*callback)(unsigned int, short))
unsigned int GetFixedOneMillion(void)
long Vector_magnitude(const FixedVector *vector)
void intro_drawbackgroundships(void)
void RestoreMouseCursorBackground(void)
void __stdcall SetFrameTimerAndWait(short period)
void DrawSpriteScaled(Viewport *viewport, short x, short y, struct Shape *shape, short frame, short angle, short scale, short flip)
void ClearInputKeyStatePreservingModifiers(void)
void DrawSpriteDefault(Viewport *viewport, short x, short y, struct Shape *shape, short frame)
int IsFrameTickElapsed(void)
void FlushInputEvents(void)
void SetInputKeyState(int scanCode, unsigned char pressed)
void SetMultimediaTimerCallback(int period)
short MinShort(short a, short b)
unsigned int GetFixedOneMillionAlt(void)
void DrawMouseCursor(void)
void QueueInputEvent(int type, int x, int y, int value, int primaryButton, int secondaryButton, unsigned int timestamp)
void EnterAllocationScope(void)
void __stdcall SetMouseHomePosition(short x, short y)
void ClearInputKeyState(void)
unsigned int PumpWindowMessages(void)
void CaptureMouseCursorBackground(void)
short __stdcall GetNextInputEvent(InputEventState *event)
InputEvent * AllocateInputEvent(void)
unsigned short GetOriginalFreeMemory(void)
void __stdcall SetFrameTimerPeriodDirect(short p)
void ClearDebugPauseFlags(void)
void ShutdownHook(int vector, void *handler)
void TranslatePolledInputEvent(unsigned short type, unsigned int value)
void RestoreSpriteBackground(Viewport *viewport, unsigned char *background, short x, short y, struct Shape *shape, short frame)
void ExitCleanupHook(void)
void draw_sorted_objects_to_buffer(void)
void RetainInputEventsOfType(int type)
void FinishPacketDecompressionHook(void)
void DrawSolidColourSprite(Viewport *viewport, short x, short y, struct Shape *shape, short frame, short colour)
int GetControlKeyState(void)
void __stdcall GetMouseCursorPosition(ShortPoint *point)
void sort_object_depth(void)
void SetFrameTimerPeriod(short period)
unsigned short IdentityWord(unsigned short v)
void ReleaseInputEvent(InputEvent *event)
void WaitForFrameTick(void)
void __stdcall ApplyPackedMousePosition(ShortPoint point)
unsigned short GetNavRangeSentinel(void)
unsigned int IsVectorWithinRange(FixedVector *vector, short range)
void __stdcall ConvertChar_Int(char *text, short number, short digits)
void DrawSolidColourSpriteScaled(Viewport *viewport, short x, short y, struct Shape *shape, short frame, short angle, short scale, short flip, short colour)
unsigned int shrink_vector(FixedVector *vector)
unsigned int GetStartupErrorCode(int vector)
void CaptureSpriteBackground(Viewport *viewport, unsigned char *background, short x, short y, struct Shape *shape, short frame)
unsigned int JoystickEdgeHook(int button)
void ReleasePacketHandle(void *handle)
unsigned int shrink(int *component)
void SetMousePositionDuplicate(int x, int y)
short GetCurrentDiskDriveHook(void)
void DIBupdate(int left, int top, int right, int bottom)
void __stdcall SetMouseCursorShape(struct Shape *shape, short frame)
int GetShiftKeyState(void)
short MaxShort(short a, short b,...)
short __stdcall IsInputEventQueued(short type)
unsigned int GetKeyboardModifiers(void)
void FreeIfNotNull(void *p)
unsigned short __stdcall GetShutdownErrorCode(unsigned char *driveState)
void * AllocateUntaggedMemory(unsigned int size)
void * AllocateSmallMemoryBlock(short size)
void RemoveInputEvent(InputEvent *event)
void __stdcall FillGraphicSuffix(char *path, short number, short digits)
void ReleaseUntaggedMemory(void *memory)
unsigned short GetSoundHardwareFlag(void)
void ReleaseInputEventQueue(void)
short __stdcall PeekInputEvent(InputEventState *event, short type)
unsigned short __stdcall SelectDiskDriveHook(short drive)
#define SPACE_OBJECT_COUNT