mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Added stick and dpad binds to controls menu
This commit is contained in:
parent
1cce3dd884
commit
0845cb036d
13 changed files with 140 additions and 23 deletions
|
@ -464,6 +464,8 @@
|
|||
<ClCompile Include="..\src\pc\djui\djui_inputbox.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_cheats.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_controls.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_controls_extra.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_controls_n64.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_host.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_host_message.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_host_mods.c" />
|
||||
|
@ -935,6 +937,8 @@
|
|||
<ClInclude Include="..\src\pc\djui\djui_inputbox.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_cheats.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_controls.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_controls_extra.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_controls_n64.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_host.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_host_message.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_host_mods.h" />
|
||||
|
|
|
@ -4872,6 +4872,12 @@
|
|||
<ClCompile Include="..\src\pc\network\packets\packet_lua_sync_table.c">
|
||||
<Filter>Source Files\src\pc\network\packets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_controls_n64.c">
|
||||
<Filter>Source Files\src\pc\djui\panel</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_controls_extra.c">
|
||||
<Filter>Source Files\src\pc\djui\panel</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\actors\common0.h">
|
||||
|
@ -6022,5 +6028,11 @@
|
|||
<ClInclude Include="..\src\pc\lua\smlua_sync_table.h">
|
||||
<Filter>Source Files\src\pc\lua</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_controls_n64.h">
|
||||
<Filter>Source Files\src\pc\djui\panel</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_controls_extra.h">
|
||||
<Filter>Source Files\src\pc\djui\panel</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -74,7 +74,11 @@ unsigned int configKeyStickDown[MAX_BINDS] = { 0x001F, VK_INVALID, VK_INVALID
|
|||
unsigned int configKeyStickLeft[MAX_BINDS] = { 0x001E, VK_INVALID, VK_INVALID };
|
||||
unsigned int configKeyStickRight[MAX_BINDS] = { 0x0020, VK_INVALID, VK_INVALID };
|
||||
unsigned int configKeyChat[MAX_BINDS] = { 0x001C, VK_INVALID, VK_INVALID };
|
||||
unsigned int configKeyPlayerList[MAX_BINDS] = { 0x000F, VK_INVALID, 0x1004 };
|
||||
unsigned int configKeyPlayerList[MAX_BINDS] = { 0x000F, 0x1004, VK_INVALID };
|
||||
unsigned int configKeyDUp[MAX_BINDS] = { 0x0147, 0x100b, VK_INVALID };
|
||||
unsigned int configKeyDDown[MAX_BINDS] = { 0x014f, 0x100c, VK_INVALID };
|
||||
unsigned int configKeyDLeft[MAX_BINDS] = { 0x0153, 0x100d, VK_INVALID };
|
||||
unsigned int configKeyDRight[MAX_BINDS] = { 0x0151, 0x100e, VK_INVALID };
|
||||
unsigned int configStickDeadzone = 16; // 16*DEADZONE_STEP=4960 (the original default deadzone)
|
||||
unsigned int configRumbleStrength = 50;
|
||||
#ifdef EXTERNAL_DATA
|
||||
|
@ -144,6 +148,10 @@ static const struct ConfigOption options[] = {
|
|||
{.name = "key_stickright", .type = CONFIG_TYPE_BIND, .uintValue = configKeyStickRight},
|
||||
{.name = "key_chat", .type = CONFIG_TYPE_BIND, .uintValue = configKeyChat},
|
||||
{.name = "key_playerlist", .type = CONFIG_TYPE_BIND, .uintValue = configKeyPlayerList},
|
||||
{.name = "key_dup", .type = CONFIG_TYPE_BIND, .uintValue = configKeyDUp},
|
||||
{.name = "key_ddown", .type = CONFIG_TYPE_BIND, .uintValue = configKeyDDown},
|
||||
{.name = "key_dleft", .type = CONFIG_TYPE_BIND, .uintValue = configKeyDLeft},
|
||||
{.name = "key_dright", .type = CONFIG_TYPE_BIND, .uintValue = configKeyDRight},
|
||||
{.name = "stick_deadzone", .type = CONFIG_TYPE_UINT, .uintValue = &configStickDeadzone},
|
||||
{.name = "rumble_strength", .type = CONFIG_TYPE_UINT, .uintValue = &configRumbleStrength},
|
||||
#ifdef EXTERNAL_DATA
|
||||
|
|
|
@ -43,6 +43,10 @@ extern unsigned int configKeyStickLeft[];
|
|||
extern unsigned int configKeyStickRight[];
|
||||
extern unsigned int configKeyChat[];
|
||||
extern unsigned int configKeyPlayerList[];
|
||||
extern unsigned int configKeyDUp[];
|
||||
extern unsigned int configKeyDDown[];
|
||||
extern unsigned int configKeyDLeft[];
|
||||
extern unsigned int configKeyDRight[];
|
||||
extern unsigned int configStickDeadzone;
|
||||
extern unsigned int configRumbleStrength;
|
||||
#ifdef EXTERNAL_DATA
|
||||
|
|
|
@ -100,6 +100,10 @@ static void keyboard_bindkeys(void) {
|
|||
keyboard_add_binds(L_TRIG, configKeyL);
|
||||
keyboard_add_binds(R_TRIG, configKeyR);
|
||||
keyboard_add_binds(START_BUTTON, configKeyStart);
|
||||
keyboard_add_binds(U_JPAD, configKeyDUp);
|
||||
keyboard_add_binds(D_JPAD, configKeyDDown);
|
||||
keyboard_add_binds(L_JPAD, configKeyDLeft);
|
||||
keyboard_add_binds(R_JPAD, configKeyDRight);
|
||||
}
|
||||
|
||||
static void keyboard_init(void) {
|
||||
|
|
|
@ -100,6 +100,10 @@ static void controller_sdl_bind(void) {
|
|||
controller_add_binds(L_TRIG, configKeyL);
|
||||
controller_add_binds(R_TRIG, configKeyR);
|
||||
controller_add_binds(START_BUTTON, configKeyStart);
|
||||
controller_add_binds(U_JPAD, configKeyDUp);
|
||||
controller_add_binds(D_JPAD, configKeyDDown);
|
||||
controller_add_binds(L_JPAD, configKeyDLeft);
|
||||
controller_add_binds(R_JPAD, configKeyDRight);
|
||||
}
|
||||
|
||||
static void controller_sdl_init(void) {
|
||||
|
|
|
@ -87,6 +87,10 @@ static void controller_sdl_bind(void) {
|
|||
controller_add_binds(L_TRIG, configKeyL);
|
||||
controller_add_binds(R_TRIG, configKeyR);
|
||||
controller_add_binds(START_BUTTON, configKeyStart);
|
||||
controller_add_binds(U_JPAD, configKeyDUp);
|
||||
controller_add_binds(D_JPAD, configKeyDDown);
|
||||
controller_add_binds(L_JPAD, configKeyDLeft);
|
||||
controller_add_binds(R_JPAD, configKeyDRight);
|
||||
}
|
||||
|
||||
static void controller_sdl_init(void) {
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
#include "djui_panel_playerlist.h"
|
||||
#include "djui_panel_camera.h"
|
||||
#include "djui_panel_controls.h"
|
||||
#include "djui_panel_controls_n64.h"
|
||||
#include "djui_panel_controls_extra.h"
|
||||
#include "djui_panel_display.h"
|
||||
#include "djui_panel_sound.h"
|
||||
#include "djui_panel_confirm.h"
|
||||
|
|
|
@ -8,33 +8,22 @@ void djui_panel_controls_value_change(UNUSED struct DjuiBase* caller) {
|
|||
}
|
||||
|
||||
void djui_panel_controls_create(struct DjuiBase* caller) {
|
||||
f32 bindBodyHeight = 32 * 11 + 1 * 10;
|
||||
f32 bodyHeight = bindBodyHeight + 16 * 3 + 32 * 2 + 64;
|
||||
f32 bodyHeight = 16 * 5 + 32 * 2 + 64 * 3;
|
||||
|
||||
struct DjuiBase* defaultBase = NULL;
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\C\\#1be700\\O\\#00b3ff\\N\\#ffef00\\T\\#ff0800\\R\\#1be700\\O\\#00b3ff\\L\\#ffef00\\S");
|
||||
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
|
||||
{
|
||||
struct DjuiFlowLayout* bindBody = djui_flow_layout_create(&body->base);
|
||||
djui_base_set_size_type(&bindBody->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&bindBody->base, 1.0f, bindBodyHeight);
|
||||
djui_base_set_color(&bindBody->base, 0, 0, 0, 0);
|
||||
djui_flow_layout_set_margin(bindBody, 1);
|
||||
{
|
||||
struct DjuiBind* bind1 = djui_bind_create(&bindBody->base, "A", configKeyA);
|
||||
djui_bind_create(&bindBody->base, "B", configKeyB);
|
||||
djui_bind_create(&bindBody->base, "Start", configKeyStart);
|
||||
djui_bind_create(&bindBody->base, "L", configKeyL);
|
||||
djui_bind_create(&bindBody->base, "R", configKeyR);
|
||||
djui_bind_create(&bindBody->base, "Z", configKeyZ);
|
||||
djui_bind_create(&bindBody->base, "C Up", configKeyCUp);
|
||||
djui_bind_create(&bindBody->base, "C Down", configKeyCDown);
|
||||
djui_bind_create(&bindBody->base, "C Left", configKeyCLeft);
|
||||
djui_bind_create(&bindBody->base, "C Right", configKeyCRight);
|
||||
djui_bind_create(&bindBody->base, "Chat", configKeyChat);
|
||||
djui_bind_create(&bindBody->base, "Players", configKeyPlayerList);
|
||||
defaultBase = &bind1->buttons[0]->base;
|
||||
}
|
||||
struct DjuiButton* button1 = djui_button_create(&body->base, "N64 Binds");
|
||||
djui_base_set_size_type(&button1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button1->base, 1.0f, 64);
|
||||
djui_interactable_hook_click(&button1->base, djui_panel_controls_n64_create);
|
||||
defaultBase = &button1->base;
|
||||
|
||||
struct DjuiButton* button2 = djui_button_create(&body->base, "Extra Binds");
|
||||
djui_base_set_size_type(&button2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button2->base, 1.0f, 64);
|
||||
djui_interactable_hook_click(&button2->base, djui_panel_controls_extra_create);
|
||||
|
||||
struct DjuiSlider* slider1 = djui_slider_create(&body->base, "Deadzone", &configStickDeadzone, 0, 100);
|
||||
djui_base_set_size_type(&slider1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
|
|
35
src/pc/djui/djui_panel_controls_extra.c
Normal file
35
src/pc/djui/djui_panel_controls_extra.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
#include "djui.h"
|
||||
#include "src/pc/configfile.h"
|
||||
|
||||
void djui_panel_controls_extra_create(struct DjuiBase* caller) {
|
||||
f32 bindBodyHeight = 28 * 6 + 1 * 5;
|
||||
f32 bodyHeight = bindBodyHeight + 16 + 64;
|
||||
|
||||
struct DjuiBase* defaultBase = NULL;
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\C\\#1be700\\O\\#00b3ff\\N\\#ffef00\\T\\#ff0800\\R\\#1be700\\O\\#00b3ff\\L\\#ffef00\\S");
|
||||
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
|
||||
{
|
||||
struct DjuiFlowLayout* bindBody = djui_flow_layout_create(&body->base);
|
||||
djui_base_set_size_type(&bindBody->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&bindBody->base, 1.0f, bindBodyHeight);
|
||||
djui_base_set_color(&bindBody->base, 0, 0, 0, 0);
|
||||
djui_flow_layout_set_margin(bindBody, 1);
|
||||
{
|
||||
djui_bind_create(&bindBody->base, "Chat", configKeyChat);
|
||||
djui_bind_create(&bindBody->base, "Players", configKeyPlayerList);
|
||||
djui_bind_create(&bindBody->base, "D Up", configKeyDUp);
|
||||
djui_bind_create(&bindBody->base, "D Down", configKeyDDown);
|
||||
djui_bind_create(&bindBody->base, "D Left", configKeyDLeft);
|
||||
djui_bind_create(&bindBody->base, "D Right", configKeyDRight);
|
||||
}
|
||||
|
||||
struct DjuiButton* buttonBack = djui_button_create(&body->base, "Back");
|
||||
djui_base_set_size_type(&buttonBack->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&buttonBack->base, 1.0f, 64);
|
||||
djui_button_set_style(buttonBack, 1);
|
||||
djui_interactable_hook_click(&buttonBack->base, djui_panel_menu_back);
|
||||
defaultBase = &buttonBack->base;
|
||||
}
|
||||
|
||||
djui_panel_add(caller, &panel->base, defaultBase);
|
||||
}
|
4
src/pc/djui/djui_panel_controls_extra.h
Normal file
4
src/pc/djui/djui_panel_controls_extra.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
#include "djui.h"
|
||||
|
||||
void djui_panel_controls_extra_create(struct DjuiBase* caller);
|
43
src/pc/djui/djui_panel_controls_n64.c
Normal file
43
src/pc/djui/djui_panel_controls_n64.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
#include "djui.h"
|
||||
#include "src/pc/configfile.h"
|
||||
|
||||
void djui_panel_controls_n64_create(struct DjuiBase* caller) {
|
||||
f32 bindBodyHeight = 28 * 14 + 1 * 13;
|
||||
f32 bodyHeight = bindBodyHeight + 16 + 64;
|
||||
|
||||
struct DjuiBase* defaultBase = NULL;
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\C\\#1be700\\O\\#00b3ff\\N\\#ffef00\\T\\#ff0800\\R\\#1be700\\O\\#00b3ff\\L\\#ffef00\\S");
|
||||
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
|
||||
{
|
||||
struct DjuiFlowLayout* bindBody = djui_flow_layout_create(&body->base);
|
||||
djui_base_set_size_type(&bindBody->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&bindBody->base, 1.0f, bindBodyHeight);
|
||||
djui_base_set_color(&bindBody->base, 0, 0, 0, 0);
|
||||
djui_flow_layout_set_margin(bindBody, 1);
|
||||
{
|
||||
djui_bind_create(&bindBody->base, "Up", configKeyStickUp);
|
||||
djui_bind_create(&bindBody->base, "Down", configKeyStickDown);
|
||||
djui_bind_create(&bindBody->base, "Left", configKeyStickLeft);
|
||||
djui_bind_create(&bindBody->base, "Right", configKeyStickRight);
|
||||
djui_bind_create(&bindBody->base, "A", configKeyA);
|
||||
djui_bind_create(&bindBody->base, "B", configKeyB);
|
||||
djui_bind_create(&bindBody->base, "Start", configKeyStart);
|
||||
djui_bind_create(&bindBody->base, "L", configKeyL);
|
||||
djui_bind_create(&bindBody->base, "R", configKeyR);
|
||||
djui_bind_create(&bindBody->base, "Z", configKeyZ);
|
||||
djui_bind_create(&bindBody->base, "C Up", configKeyCUp);
|
||||
djui_bind_create(&bindBody->base, "C Down", configKeyCDown);
|
||||
djui_bind_create(&bindBody->base, "C Left", configKeyCLeft);
|
||||
djui_bind_create(&bindBody->base, "C Right", configKeyCRight);
|
||||
}
|
||||
|
||||
struct DjuiButton* buttonBack = djui_button_create(&body->base, "Back");
|
||||
djui_base_set_size_type(&buttonBack->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&buttonBack->base, 1.0f, 64);
|
||||
djui_button_set_style(buttonBack, 1);
|
||||
djui_interactable_hook_click(&buttonBack->base, djui_panel_menu_back);
|
||||
defaultBase = &buttonBack->base;
|
||||
}
|
||||
|
||||
djui_panel_add(caller, &panel->base, defaultBase);
|
||||
}
|
4
src/pc/djui/djui_panel_controls_n64.h
Normal file
4
src/pc/djui/djui_panel_controls_n64.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
#include "djui.h"
|
||||
|
||||
void djui_panel_controls_n64_create(struct DjuiBase* caller);
|
Loading…
Reference in a new issue