Move some kconfig symbols into namespace dsx
This commit is contained in:
parent
0109355ae0
commit
10aa2e5106
|
@ -88,12 +88,19 @@ extern control_info Controls;
|
||||||
#define CONTROL_USING_JOYSTICK 1
|
#define CONTROL_USING_JOYSTICK 1
|
||||||
#define CONTROL_USING_MOUSE 2
|
#define CONTROL_USING_MOUSE 2
|
||||||
#define MOUSEFS_DELTA_RANGE 512
|
#define MOUSEFS_DELTA_RANGE 512
|
||||||
|
#ifdef dsx
|
||||||
|
namespace dsx {
|
||||||
#if defined(DXX_BUILD_DESCENT_I)
|
#if defined(DXX_BUILD_DESCENT_I)
|
||||||
#define MAX_DXX_REBIRTH_CONTROLS 30
|
constexpr unsigned MAX_CONTROLS = 50;
|
||||||
#define MAX_CONTROLS 50
|
|
||||||
#elif defined(DXX_BUILD_DESCENT_II)
|
#elif defined(DXX_BUILD_DESCENT_II)
|
||||||
#define MAX_DXX_REBIRTH_CONTROLS 30
|
constexpr unsigned MAX_CONTROLS = 60; // there are actually 48, so this leaves room for more
|
||||||
#define MAX_CONTROLS 60 // there are actually 48, so this leaves room for more
|
#endif
|
||||||
|
extern const array<array<uint8_t, MAX_CONTROLS>, 3> DefaultKeySettings;
|
||||||
|
}
|
||||||
|
namespace dcx {
|
||||||
|
constexpr unsigned MAX_DXX_REBIRTH_CONTROLS = 30;
|
||||||
|
extern const array<uint8_t, MAX_DXX_REBIRTH_CONTROLS> DefaultKeySettingsRebirth;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void kconfig_read_controls(const d_event &event, int automap_flag);
|
extern void kconfig_read_controls(const d_event &event, int automap_flag);
|
||||||
|
@ -110,11 +117,6 @@ enum class kconfig_type
|
||||||
|
|
||||||
void kconfig(kconfig_type n);
|
void kconfig(kconfig_type n);
|
||||||
|
|
||||||
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
|
||||||
extern const array<array<ubyte, MAX_CONTROLS>, 3> DefaultKeySettings;
|
|
||||||
extern const array<ubyte, MAX_DXX_REBIRTH_CONTROLS> DefaultKeySettingsRebirth;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void kc_set_controls();
|
extern void kc_set_controls();
|
||||||
|
|
||||||
//set the cruise speed to zero
|
//set the cruise speed to zero
|
||||||
|
|
|
@ -125,26 +125,38 @@ fix Cruise_speed=0;
|
||||||
|
|
||||||
#define INFO_Y (188)
|
#define INFO_Y (188)
|
||||||
|
|
||||||
|
namespace dcx {
|
||||||
|
|
||||||
|
const array<uint8_t, MAX_DXX_REBIRTH_CONTROLS> DefaultKeySettingsRebirth{{ 0x2,0xff,0xff,0x3,0xff,0xff,0x4,0xff,0xff,0x5,0xff,0xff,0x6,0xff,0xff,0x7,0xff,0xff,0x8,0xff,0xff,0x9,0xff,0xff,0xa,0xff,0xff,0xb,0xff,0xff }};
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
struct kc_mitem {
|
||||||
|
uint8_t value; // what key,button,etc
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace dsx {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct kc_item
|
struct kc_item
|
||||||
{
|
{
|
||||||
const short x, y; // x, y pos of label
|
const short x, y; // x, y pos of label
|
||||||
const short xinput; // x pos of input field
|
const short xinput; // x pos of input field
|
||||||
const short w2; // length of input field
|
const int8_t w2; // length of input field
|
||||||
const short u,d,l,r; // neighboring field ids for cursor navigation
|
const uint8_t u,d,l,r; // neighboring field ids for cursor navigation
|
||||||
const ubyte type;
|
const uint8_t type;
|
||||||
const int state_bit;
|
const uint8_t state_bit;
|
||||||
union {
|
union {
|
||||||
ubyte control_info::state_controls_t::*ci_state_ptr;
|
uint8_t control_info::state_controls_t::*const ci_state_ptr;
|
||||||
ubyte control_info::state_controls_t::*ci_count_ptr;
|
uint8_t control_info::state_controls_t::*const ci_count_ptr;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct kc_mitem {
|
|
||||||
ubyte value; // what key,button,etc
|
|
||||||
};
|
|
||||||
|
|
||||||
struct kc_menu : embed_window_pointer_t
|
struct kc_menu : embed_window_pointer_t
|
||||||
{
|
{
|
||||||
const char *litems;
|
const char *litems;
|
||||||
|
@ -175,7 +187,6 @@ const array<array<ubyte, MAX_CONTROLS>, 3> DefaultKeySettings{{
|
||||||
{{0x0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0x0}},
|
{{0x0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0x0}},
|
||||||
#endif
|
#endif
|
||||||
}};
|
}};
|
||||||
const array<ubyte, MAX_DXX_REBIRTH_CONTROLS> DefaultKeySettingsRebirth{{ 0x2,0xff,0xff,0x3,0xff,0xff,0x4,0xff,0xff,0x5,0xff,0xff,0x6,0xff,0xff,0x7,0xff,0xff,0x8,0xff,0xff,0x9,0xff,0xff,0xa,0xff,0xff,0xb,0xff,0xff }};
|
|
||||||
|
|
||||||
// id, x, y, w1, w2, u, d, l, r, text, type, value
|
// id, x, y, w1, w2, u, d, l, r, text, type, value
|
||||||
constexpr kc_item kc_keyboard[] = {
|
constexpr kc_item kc_keyboard[] = {
|
||||||
|
@ -638,6 +649,8 @@ constexpr const char *kcl_rebirth =
|
||||||
;
|
;
|
||||||
static array<kc_mitem, lengthof(kc_rebirth)> kcm_rebirth;
|
static array<kc_mitem, lengthof(kc_rebirth)> kcm_rebirth;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static void kc_drawinput( const kc_item &item, kc_mitem& mitem, int is_current, const char *label );
|
static void kc_drawinput( const kc_item &item, kc_mitem& mitem, int is_current, const char *label );
|
||||||
static void kc_change_key( kc_menu &menu,const d_event &event, kc_mitem& mitem );
|
static void kc_change_key( kc_menu &menu,const d_event &event, kc_mitem& mitem );
|
||||||
#if DXX_MAX_BUTTONS_PER_JOYSTICK || DXX_MAX_HATS_PER_JOYSTICK
|
#if DXX_MAX_BUTTONS_PER_JOYSTICK || DXX_MAX_HATS_PER_JOYSTICK
|
||||||
|
@ -1103,7 +1116,7 @@ static void reset_mitem_values(array<kc_mitem, M> &m, const array<ubyte, C> &c)
|
||||||
m[i].value = c[i];
|
m[i].value = c[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void step_citem_past_empty_cell(unsigned &citem, const kc_item *items, const short kc_item::*next)
|
static void step_citem_past_empty_cell(unsigned &citem, const kc_item *const items, const uint8_t kc_item::*const next)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
citem = items[citem].*next;
|
citem = items[citem].*next;
|
||||||
|
|
Loading…
Reference in a new issue