mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
Playerlist Improvements and Username Character Limit Increase (#476)
* xLuigiGamerxsDevFork * xLuigiGamerxsDevFork * Fixed Accidentally used older character.c file * Modified the playerlist so that it can support more than 16 players if it is to be added and increased the username character limit from 20 to 60 so people with longer names can use hex codes * Changed the Makefile back * Just Fixing up the makefile which for some reason changed * Fr this time I hopefully fixed the Makefile * Bruh why did this even change it's fucking annoying * Modified the playerlist so that it can support more than 16 players if it is to be added and increased the username character limit from 20 to 60 so people with longer names can use hex codes (Removed Whitespace lol) * Modified the playerlist so that it can support more than 16 players if it is to be added and increased the username character limit from 20 to 60 so people with longer names can use hex codes (Removed Whitespace V2 lol) * Used MAX_PLAYER_STRING instead of a number * Apparently math.h wasn't needed * Me when I use google translate only for it to fuck up french: * Used MAX_PLAYER_STRING and removed ceils and removed multiplicaion by sPlayerListSize * Added comment for p variable * Removed 16 * Update djui_panel_playerlist.c --------- Co-authored-by: xLuigiGamerx <mohammmedsadawi666@gmail.com> Co-authored-by: PeachyPeach <72323920+PeachyPeachSM64@users.noreply.github.com>
This commit is contained in:
parent
62eeb01b4b
commit
46b3167cce
16 changed files with 60 additions and 6 deletions
|
@ -102,6 +102,8 @@ D_LEFT = "D-Pad vlevo"
|
|||
D_RIGHT = "D-Pad vpravo"
|
||||
X = "X"
|
||||
Y = "Y"
|
||||
PREV = "Před Stránka"
|
||||
NEXT = "Další Strana"
|
||||
|
||||
UP = "Nahoru"
|
||||
DOWN = "Dolů"
|
||||
|
|
|
@ -101,6 +101,8 @@ D_LEFT = "D Links"
|
|||
D_RIGHT = "D Rechts"
|
||||
X = "X"
|
||||
Y = "Y"
|
||||
PREV = "Vori Bladzijde"
|
||||
NEXT = "Volg Bladzijde"
|
||||
|
||||
UP = "Omhoog"
|
||||
DOWN = "Naar Beneden"
|
||||
|
|
|
@ -102,6 +102,8 @@ D_LEFT = "D Left"
|
|||
D_RIGHT = "D Right"
|
||||
X = "X"
|
||||
Y = "Y"
|
||||
PREV = "Prev Page"
|
||||
NEXT = "Next Page"
|
||||
|
||||
UP = "Up"
|
||||
DOWN = "Down"
|
||||
|
|
|
@ -102,6 +102,8 @@ D_LEFT = "D Gauche"
|
|||
D_RIGHT = "D Droite"
|
||||
X = "X"
|
||||
Y = "Y"
|
||||
PREV = "Page Préc"
|
||||
NEXT = "Page Suiv"
|
||||
|
||||
UP = "Haut"
|
||||
DOWN = "Bas"
|
||||
|
|
|
@ -102,6 +102,8 @@ D_LEFT = "D Links"
|
|||
D_RIGHT = "D Rechts"
|
||||
X = "X"
|
||||
Y = "Y"
|
||||
PREV = "Vorh Seite"
|
||||
NEXT = "Näch Seite"
|
||||
|
||||
UP = "Hoch"
|
||||
DOWN = "Unten"
|
||||
|
|
|
@ -100,6 +100,8 @@ D_LEFT = "D Sinistra"
|
|||
D_RIGHT = "D Destra"
|
||||
X = "X"
|
||||
Y = "Y"
|
||||
PREV = "Pagina Prec"
|
||||
NEXT = "Pagina Succ"
|
||||
|
||||
UP = "Su"
|
||||
DOWN = "Giù"
|
||||
|
|
|
@ -102,6 +102,8 @@ D_LEFT = "D LEFT"
|
|||
D_RIGHT = "D RIGHT"
|
||||
X = "X"
|
||||
Y = "Y"
|
||||
PREV = "Página Ante"
|
||||
NEXT = "Próx Página"
|
||||
|
||||
UP = "UP"
|
||||
DOWN = "DOWN"
|
||||
|
|
|
@ -101,6 +101,8 @@ D_LEFT = "Крестовина влево"
|
|||
D_RIGHT = "Крестовина вправо"
|
||||
X = "X"
|
||||
Y = "Y"
|
||||
PREV = "Пред Cтраница"
|
||||
NEXT = "След Cтраница"
|
||||
|
||||
UP = "Вверх"
|
||||
DOWN = "Вниз"
|
||||
|
|
|
@ -102,6 +102,8 @@ D_LEFT = "Cruz Izquierda"
|
|||
D_RIGHT = "Cruz Derecha"
|
||||
X = "X"
|
||||
Y = "Y"
|
||||
PREV = "Pagina Ante"
|
||||
NEXT = "Sigu Página"
|
||||
|
||||
UP = "Arriba"
|
||||
DOWN = "Abajo"
|
||||
|
|
|
@ -97,6 +97,8 @@ 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 configKeyPrevPage[MAX_BINDS] = { 0x0016, VK_INVALID, VK_INVALID };
|
||||
unsigned int configKeyNextPage[MAX_BINDS] = { 0x0018, VK_INVALID, VK_INVALID };
|
||||
unsigned int configStickDeadzone = 16; // 16*DEADZONE_STEP=4960 (the original default deadzone)
|
||||
unsigned int configRumbleStrength = 50;
|
||||
#ifdef EXTERNAL_DATA
|
||||
|
@ -196,6 +198,8 @@ static const struct ConfigOption options[] = {
|
|||
{.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 = "key_prev", .type = CONFIG_TYPE_BIND, .uintValue = configKeyPrevPage},
|
||||
{.name = "key_next", .type = CONFIG_TYPE_BIND, .uintValue = configKeyNextPage},
|
||||
{.name = "stick_deadzone", .type = CONFIG_TYPE_UINT, .uintValue = &configStickDeadzone},
|
||||
{.name = "rumble_strength", .type = CONFIG_TYPE_UINT, .uintValue = &configRumbleStrength},
|
||||
#ifdef EXTERNAL_DATA
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#define MAX_BINDS 3
|
||||
#define MAX_VOLUME 127
|
||||
#define MAX_CONFIG_STRING 64
|
||||
#define MAX_PLAYER_STRING 20
|
||||
#define MAX_PLAYER_STRING 60
|
||||
#define MAX_DESCRIPTION_STRING 20
|
||||
|
||||
#define DEFAULT_PORT 7777
|
||||
|
@ -56,6 +56,8 @@ extern unsigned int configKeyDUp[];
|
|||
extern unsigned int configKeyDDown[];
|
||||
extern unsigned int configKeyDLeft[];
|
||||
extern unsigned int configKeyDRight[];
|
||||
extern unsigned int configKeyPrevPage[];
|
||||
extern unsigned int configKeyNextPage[];
|
||||
extern unsigned int configStickDeadzone;
|
||||
extern unsigned int configRumbleStrength;
|
||||
extern unsigned int configGamepadNumber;
|
||||
|
|
|
@ -251,6 +251,24 @@ bool djui_interactable_on_key_down(int scancode) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
if (gDjuiPlayerList->base.visible) {
|
||||
if (scancode == (int)configKeyNextPage[i]) {
|
||||
sPageIndex++;
|
||||
if (sPageIndex > ((network_player_connected_count() - 1) / sPlayerListSize)) {
|
||||
sPageIndex = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (scancode == (int)configKeyPrevPage[i]) {
|
||||
if (sPageIndex == 0) {
|
||||
sPageIndex = ((network_player_connected_count() - 1) / sPlayerListSize);
|
||||
}
|
||||
else {
|
||||
sPageIndex--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@ extern struct DjuiBase* gDjuiCursorDownOn;
|
|||
extern struct DjuiBase* gInteractableFocus;
|
||||
extern struct DjuiBase* gInteractableBinding;
|
||||
extern struct DjuiBase* gInteractableMouseDown;
|
||||
extern const u8 sPlayerListSize;
|
||||
extern u8 sPageIndex;
|
||||
|
||||
bool djui_interactable_is_binding(void);
|
||||
void djui_interactable_set_binding(struct DjuiBase* base);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "src/pc/configfile.h"
|
||||
|
||||
void djui_panel_controls_extra_create(struct DjuiBase* caller) {
|
||||
f32 bindBodyHeight = 28 * 8 + 1 * 7;
|
||||
f32 bindBodyHeight = 28 * 10 + 1 * 7;
|
||||
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(CONTROLS, CONTROLS));
|
||||
struct DjuiBase* body = djui_three_panel_get_body(panel);
|
||||
|
@ -23,6 +23,8 @@ void djui_panel_controls_extra_create(struct DjuiBase* caller) {
|
|||
djui_bind_create(&bindBody->base, DLANG(CONTROLS, D_RIGHT), configKeyDRight);
|
||||
djui_bind_create(&bindBody->base, DLANG(CONTROLS, X), configKeyX);
|
||||
djui_bind_create(&bindBody->base, DLANG(CONTROLS, Y), configKeyY);
|
||||
djui_bind_create(&bindBody->base, DLANG(CONTROLS, PREV), configKeyPrevPage);
|
||||
djui_bind_create(&bindBody->base, DLANG(CONTROLS, NEXT), configKeyNextPage);
|
||||
}
|
||||
|
||||
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
|
||||
|
|
|
@ -190,7 +190,7 @@ static void djui_panel_player_name_on_focus_end(struct DjuiBase* caller) {
|
|||
if (!djui_panel_player_name_valid(inputbox1->buffer)) {
|
||||
djui_inputbox_set_text(inputbox1, DLANG(PLAYER, PLAYER));
|
||||
}
|
||||
snprintf(configPlayerName, 20, "%s", inputbox1->buffer);
|
||||
snprintf(configPlayerName, MAX_PLAYER_STRING, "%s", inputbox1->buffer);
|
||||
djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
|
||||
|
||||
if (gNetworkType != NT_NONE) {
|
||||
|
@ -246,7 +246,7 @@ void djui_panel_player_create(struct DjuiBase* caller) {
|
|||
djui_base_set_size(&text1->base, 0.585f, 64);
|
||||
djui_base_set_alignment(&text1->base, DJUI_HALIGN_LEFT, DJUI_VALIGN_TOP);
|
||||
|
||||
struct DjuiInputbox* inputbox1 = djui_inputbox_create(&rect1->base, 20);
|
||||
struct DjuiInputbox* inputbox1 = djui_inputbox_create(&rect1->base, MAX_PLAYER_STRING);
|
||||
djui_base_set_size_type(&inputbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&inputbox1->base, 0.4f, 32);
|
||||
djui_base_set_alignment(&inputbox1->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP);
|
||||
|
|
|
@ -18,6 +18,10 @@ static struct DjuiText* djuiTextDescriptions[MAX_PLAYERS] = { 0 };
|
|||
static struct DjuiText* djuiTextLocations[MAX_PLAYERS] = { 0 };
|
||||
static struct DjuiText* djuiTextAct[MAX_PLAYERS] = { 0 };
|
||||
|
||||
const u8 sPlayerListSize = 16;
|
||||
u8 sPageIndex = 0;
|
||||
static u8 p = 0; // All player slots always exist this switches their visibility on and off if they're connected or not
|
||||
|
||||
static void playerlist_update_row(u8 i, struct NetworkPlayer *np) {
|
||||
u8 charIndex = np->overrideModelIndex;
|
||||
char sActNum[7];
|
||||
|
@ -34,6 +38,9 @@ static void playerlist_update_row(u8 i, struct NetworkPlayer *np) {
|
|||
u8 visible = np->connected;
|
||||
if (np == gNetworkPlayerServer && gServerSettings.headlessServer) {
|
||||
visible = false;
|
||||
} else if (p < sPlayerListSize * sPageIndex) {
|
||||
visible = false;
|
||||
p++;
|
||||
}
|
||||
|
||||
djui_base_set_visible(&djuiRow[i]->base, visible);
|
||||
|
@ -51,6 +58,7 @@ static void playerlist_update_row(u8 i, struct NetworkPlayer *np) {
|
|||
|
||||
void djui_panel_playerlist_on_render_pre(UNUSED struct DjuiBase* base, UNUSED bool* skipRender) {
|
||||
s32 j = 0;
|
||||
p = 0;
|
||||
|
||||
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||
struct NetworkPlayer *np = &gNetworkPlayers[i];
|
||||
|
@ -65,7 +73,7 @@ void djui_panel_playerlist_on_render_pre(UNUSED struct DjuiBase* base, UNUSED bo
|
|||
}
|
||||
|
||||
void djui_panel_playerlist_create(UNUSED struct DjuiBase* caller) {
|
||||
f32 bodyHeight = (MAX_PLAYERS * 32) + (MAX_PLAYERS - 1) * 4;
|
||||
f32 bodyHeight = (sPlayerListSize * 32) + (sPlayerListSize - 1) * 4;
|
||||
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(PLAYER_LIST, PLAYERS));
|
||||
djui_three_panel_set_body_size(panel, bodyHeight);
|
||||
|
@ -78,7 +86,7 @@ void djui_panel_playerlist_create(UNUSED struct DjuiBase* caller) {
|
|||
struct DjuiBase* body = djui_three_panel_get_body(panel);
|
||||
djui_flow_layout_set_margin((struct DjuiFlowLayout*)body, 4);
|
||||
|
||||
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||
for (u8 i = 0; i < MAX_PLAYERS; i++) {
|
||||
struct DjuiFlowLayout* row = djui_flow_layout_create(body);
|
||||
djui_base_set_size_type(&row->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&row->base, 1.0f, 32.0f);
|
||||
|
|
Loading…
Reference in a new issue