fallout2-ce/src/core.h

159 lines
5.2 KiB
C
Raw Normal View History

2022-05-19 01:51:26 -07:00
#ifndef CORE_H
#define CORE_H
2022-09-15 02:38:23 -07:00
#include <SDL.h>
2022-05-19 01:51:26 -07:00
#include "db.h"
#include "dinput.h"
#include "geometry.h"
#include "window.h"
2022-09-23 05:43:44 -07:00
namespace fallout {
2022-05-19 01:51:26 -07:00
typedef struct STRUCT_6ABF50 {
// Time when appropriate key was pressed down or -1 if it's up.
int tick;
int repeatCount;
} STRUCT_6ABF50;
typedef struct InputEvent {
// This is either logical key or input event id, which can be either
// character code pressed or some other numbers used throughout the
// game interface.
int logicalKey;
int mouseX;
int mouseY;
} InputEvent;
2022-08-16 04:14:53 -07:00
typedef void(IdleFunc)();
typedef void(FocusFunc)(bool focus);
typedef void(TickerProc)();
2022-05-19 01:51:26 -07:00
typedef struct TickerListNode {
int flags;
TickerProc* proc;
struct TickerListNode* next;
} TickerListNode;
typedef int(PauseHandler)();
typedef int(ScreenshotHandler)(int width, int height, unsigned char* buffer, unsigned char* palette);
2022-08-16 04:14:53 -07:00
extern IdleFunc* _idle_func;
extern FocusFunc* _focus_func;
2022-05-19 01:51:26 -07:00
extern int gKeyboardKeyRepeatRate;
extern int gKeyboardKeyRepeatDelay;
extern bool _keyboard_hooked;
extern void (*_update_palette_func)();
extern bool gMmxEnabled;
extern bool gMmxProbed;
2022-05-23 01:44:49 -07:00
extern int gNormalizedQwertyKeys[SDL_NUM_SCANCODES];
2022-05-19 01:51:26 -07:00
extern InputEvent gInputEventQueue[40];
2022-05-23 01:44:49 -07:00
extern STRUCT_6ABF50 _GNW95_key_time_stamps[SDL_NUM_SCANCODES];
2022-05-19 01:51:26 -07:00
extern int _input_mx;
extern int _input_my;
extern bool gPaused;
extern int gScreenshotKeyCode;
extern int _using_msec_timer;
extern int gPauseKeyCode;
extern ScreenshotHandler* gScreenshotHandler;
extern int gInputEventQueueReadIndex;
extern unsigned char* gScreenshotBuffer;
extern PauseHandler* gPauseHandler;
extern int gInputEventQueueWriteIndex;
extern bool gRunLoopDisabled;
extern TickerListNode* gTickerListHead;
extern unsigned int gTickerLastTimestamp;
extern unsigned short gSixteenBppPalette[256];
extern Rect _scr_size;
extern int gRedMask;
extern int gGreenMask;
extern int gBlueMask;
extern int gBlueShift;
extern int gRedShift;
extern int gGreenShift;
extern void (*_scr_blit)(unsigned char* src, int src_pitch, int a3, int src_x, int src_y, int src_width, int src_height, int dest_x, int dest_y);
extern void (*_zero_mem)();
extern bool gMmxSupported;
extern unsigned char gLastVideoModePalette[268];
2022-05-24 13:19:36 -07:00
extern SDL_Window* gSdlWindow;
extern SDL_Surface* gSdlSurface;
2022-07-12 00:10:23 -07:00
extern SDL_Renderer* gSdlRenderer;
extern SDL_Texture* gSdlTexture;
extern SDL_Surface* gSdlTextureSurface;
2022-05-24 13:19:36 -07:00
2022-05-19 01:51:26 -07:00
int coreInit(int a1);
void coreExit();
int _get_input();
void _process_bk();
void enqueueInputEvent(int a1);
int dequeueInputEvent();
void inputEventQueueReset();
void tickersExecute();
void tickersAdd(TickerProc* fn);
void tickersRemove(TickerProc* fn);
void tickersEnable();
void tickersDisable();
void pauseGame();
int pauseHandlerDefaultImpl();
void pauseHandlerConfigure(int keyCode, PauseHandler* fn);
void takeScreenshot();
void screenshotBlitter(unsigned char* src, int src_pitch, int a3, int x, int y, int width, int height, int dest_x, int dest_y);
int screenshotHandlerDefaultImpl(int width, int height, unsigned char* data, unsigned char* palette);
void screenshotHandlerConfigure(int keyCode, ScreenshotHandler* handler);
unsigned int _get_time();
void coreDelayProcessingEvents(unsigned int ms);
void coreDelay(unsigned int ms);
unsigned int getTicksSince(unsigned int a1);
unsigned int getTicksBetween(unsigned int a1, unsigned int a2);
unsigned int _get_bk_time();
2022-08-16 04:14:53 -07:00
void inputSetKeyboardKeyRepeatRate(int value);
int inputGetKeyboardKeyRepeatRate();
void inputSetKeyboardKeyRepeatDelay(int value);
int inputGetKeyboardKeyRepeatDelay();
void inputSetFocusFunc(FocusFunc* func);
FocusFunc* inputGetFocusFunc();
void inputSetIdleFunc(IdleFunc* func);
IdleFunc* inputGetIdleFunc();
2022-05-19 01:51:26 -07:00
void buildNormalizedQwertyKeys();
int _GNW95_input_init();
void _GNW95_process_message();
void _GNW95_clear_time_stamps();
void _GNW95_process_key(KeyboardData* data);
void _GNW95_lost_focus();
void mmxSetEnabled(bool a1);
int _init_mode_320_200();
int _init_mode_320_400();
int _init_mode_640_480_16();
int _init_mode_640_480();
int _init_mode_640_400();
int _init_mode_800_600();
int _init_mode_1024_768();
int _init_mode_1280_1024();
void _get_start_mode_();
void _zero_vid_mem();
int _GNW95_init_mode_ex(int width, int height, int bpp);
int _init_vesa_mode(int width, int height);
2022-05-19 04:01:17 -07:00
int _GNW95_init_window(int width, int height, bool fullscreen);
2022-05-19 01:51:26 -07:00
int getShiftForBitMask(int mask);
int directDrawInit(int width, int height, int bpp);
void directDrawFree();
void directDrawSetPaletteInRange(unsigned char* a1, int a2, int a3);
void directDrawSetPalette(unsigned char* palette);
unsigned char* directDrawGetPalette();
void _GNW95_ShowRect(unsigned char* src, int src_pitch, int a3, int src_x, int src_y, int src_width, int src_height, int dest_x, int dest_y);
void _GNW95_MouseShowRect16(unsigned char* src, int srcPitch, int a3, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY);
void _GNW95_ShowRect16(unsigned char* src, int srcPitch, int a3, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY);
void _GNW95_MouseShowTransRect16(unsigned char* src, int srcPitch, int a3, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, unsigned char keyColor);
void _GNW95_zero_vid_mem();
2022-05-20 15:50:14 -07:00
int screenGetWidth();
int screenGetHeight();
int screenGetVisibleHeight();
2022-05-20 15:50:14 -07:00
2022-09-23 05:43:44 -07:00
} // namespace fallout
2022-05-19 01:51:26 -07:00
#endif /* CORE_H */