blues/intern.h

80 lines
1.5 KiB
C
Raw Permalink Normal View History

2018-07-08 16:08:53 +02:00
#ifndef INTERN_H__
#define INTERN_H__
#include <assert.h>
2019-05-29 01:54:47 +02:00
#include <limits.h>
2018-07-08 16:08:53 +02:00
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
2022-03-12 23:41:23 +01:00
#define SWAP(x, y) do { __typeof__(x) tmp = x; x = y; y = tmp; } while(0)
2018-07-08 16:08:53 +02:00
2018-12-16 13:34:03 +01:00
#undef MIN
static inline int MIN(int a, int b) {
return (a < b) ? a : b;
}
#undef MAX
static inline int MAX(int a, int b) {
return (a > b) ? a : b;
2018-07-08 16:08:53 +02:00
}
static inline uint32_t READ_BE_UINT32(const uint8_t *p) {
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
}
2018-12-16 13:34:03 +01:00
static inline uint16_t READ_BE_UINT16(const uint8_t *p) {
return (p[0] << 8) | p[1];
}
2018-07-08 16:08:53 +02:00
static inline uint16_t READ_LE_UINT16(const uint8_t *p) {
return p[0] | (p[1] << 8);
}
2018-12-16 13:34:03 +01:00
static inline void WRITE_LE_UINT16(uint8_t *p, uint16_t value) {
p[0] = value & 0xFF;
p[1] = value >> 8;
}
#define GAME_SCREEN_W g_options.screen_w
#define GAME_SCREEN_H g_options.screen_h
struct options_t {
uint32_t cheats;
int start_level;
int start_xpos16;
int start_ypos16;
int screen_w;
int screen_h;
2022-03-12 23:26:29 +01:00
bool dos_scrolling;
2022-03-12 23:41:23 +01:00
bool jump_button;
2018-12-16 13:34:03 +01:00
// 'bb' only options
bool amiga_copper_bars;
bool amiga_colors;
bool amiga_status_bar;
bool cga_colors;
2022-03-12 23:26:29 +01:00
// 'p2' only options
2022-02-25 20:12:38 +01:00
bool hybrid_color;
2018-12-16 13:34:03 +01:00
};
struct game_t {
const char *name;
2022-03-12 23:53:43 +01:00
void (*res_init)(const char *data_path, int vga_size);
void (*res_fini)();
void (*snd_init)();
void (*snd_fini)();
void (*run)();
2018-12-16 13:34:03 +01:00
};
2022-03-12 23:43:11 +01:00
#ifdef _WIN32
#define EXPORT_SYMBOL __attribute__((dllexport))
#else
#define EXPORT_SYMBOL __attribute__((visibility("default")))
#endif
2018-07-08 16:08:53 +02:00
#endif