Merge remote-tracking branch 'origin/Saturn-Next' into Saturn-Testing

This commit is contained in:
Alug committed 2025-01-01 17:22:51 +01:00
commit bd433e0776
7 files changed
+98 -113

No files matched your search

+5 -2
View File
@@ -172,14 +172,17 @@ static inline void D_DeviceLEDTick(void)
UINT16 color[MAXSPLITSCREENPLAYERS];
UINT16 curcolor[MAXSPLITSCREENPLAYERS];
if (I_NumJoys() == 0 || (cv_gamepadled[0].value == 0 && cv_gamepadled[1].value == 0 && cv_gamepadled[2].value == 0 && cv_gamepadled[3].value == 0))
if (I_NumJoys() == 0)
{
return;
}
for (i = 0; i <= splitscreen; i++)
{
if (cv_usejoystick[i].value == 0)
if (!cv_usejoystick[i].value)
continue;
if (!cv_gamepadled[i].value)
continue;
color[i] = G_GetSkinColor(i);
+5 -31
View File
@@ -4995,33 +4995,6 @@ void M_DrawTextBoxFlags(INT32 x, INT32 y, INT32 width, INT32 boxlines, INT32 fla
V_DrawFill(x+5, y+5, width*8+6, boxlines*8+6, 239|flags);
}
void M_DrawTextInput(INT32 x, INT32 y, textinput_t *input, INT32 flags)
{
INT32 skullx = x;
V_DrawString(x, y, V_ALLOWLOWERCASE|flags, input->buffer);
// draw text cursor for name
if (input->length)
skullx = x+V_SubStringWidth(input->buffer, input->cursor, V_ALLOWLOWERCASE);
if (skullAnimCounter < 4) // blink cursor
V_DrawCharacter(skullx, y+3, '_'|flags, false);
// draw selection
if (input->select != input->cursor)
{
size_t start = min(input->select, input->cursor);
size_t end = max(input->select, input->cursor);
size_t len = end - start;
INT32 startx = V_SubStringWidth(input->buffer, start, V_ALLOWLOWERCASE);
V_DrawFill(x+startx, y, V_SubStringWidth(input->buffer+start, len, V_ALLOWLOWERCASE), 8, 103|V_TRANSLUCENT|flags);
}
}
// horizontally centered text
static void M_CentreText(INT32 y, const char *string)
{
@@ -10196,7 +10169,8 @@ static void M_StartServerMenu(INT32 choice)
// CONNECT VIA IP
// ==============
static char setupm_ip[28];
#define SETUPM_IP_MAXSIZE ((28-1)*8)
static char setupm_ip[64];
static textinput_t setupm_input_ip;
#endif
@@ -10204,8 +10178,8 @@ void M_Multiplayer(INT32 choice)
{
(void)choice;
#ifndef NONET
memset(setupm_ip, 0, 28);
M_TextInputInit(&setupm_input_ip, setupm_ip, 28);
memset(setupm_ip, 0, sizeof(setupm_ip));
M_TextInputInit(&setupm_input_ip, setupm_ip, sizeof(setupm_ip));
#endif
M_SetupNextMenu(&MP_MainDef);
}
@@ -10244,7 +10218,7 @@ Update the maxplayers label...
if (itemOn != 9)
V_DrawString(x+8,y+12, V_ALLOWLOWERCASE, setupm_ip);
else
M_DrawTextInput(x+8, y+12, &setupm_input_ip, 0);
M_DrawTextInputScroll(x+8, y+12, &setupm_input_ip, 0, SETUPM_IP_MAXSIZE);
#endif
// character bar, ripped off the color bar :V
-4
View File
@@ -64,10 +64,6 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines);
// Same but with extra flags applied
void M_DrawTextBoxFlags(INT32 x, INT32 y, INT32 width, INT32 boxlines, INT32 flags);
// Draw text input
typedef struct textinput_s textinput_t;
void M_DrawTextInput(INT32 x, INT32 y, textinput_t *input, INT32 flags);
// Used in d_netcmd to restart time attack
void M_ModeAttackRetry(INT32 choice);
+71
View File
@@ -1,4 +1,7 @@
#include "m_textinput.h"
#include "m_menu.h" // MAXSTRINGLENGTH
#include "v_video.h"
#include "r_main.h" // renderisnewtic
#include "i_system.h"
#include "keys.h"
#include "console.h"
@@ -132,6 +135,8 @@ void M_TextInputInit(textinput_t *input, char *buffer, size_t buffer_size)
input->buffer = buffer;
input->buffer_size = buffer_size;
input->skull = 0;
M_TextInputClear(input);
}
@@ -314,3 +319,69 @@ boolean M_TextInputHandle(textinput_t *input, INT32 key)
return true;
}
void M_DrawTextInputScroll(INT32 x, INT32 y, textinput_t *input, INT32 flags, INT32 MAXINPUTWIDTH)
{
if (renderisnewtic)
input->skull++;
input->skull %= 8;
char nametodraw[MAXSTRINGLENGTH*2+1] = {0};
size_t drawstart = 0;
size_t drawend = 0; // Only used for selection
INT32 skullx = x;
while (V_SubStringWidth(input->buffer+drawstart, input->cursor-drawstart, V_ALLOWLOWERCASE) > MAXINPUTWIDTH)
++drawstart;
size_t drawlength = V_SubStringLengthToFit(input->buffer+drawstart, MAXINPUTWIDTH+8, V_ALLOWLOWERCASE)+1;
drawend = drawstart + drawlength;
memcpy(nametodraw, input->buffer+drawstart, drawlength);
if (input->length)
skullx += V_SubStringWidth(nametodraw, input->cursor-drawstart, V_ALLOWLOWERCASE);
V_DrawString(x, y, V_ALLOWLOWERCASE|flags, nametodraw);
// draw text cursor for name
if (input->skull < 4) // blink cursor
V_DrawCharacter(skullx, y+3, '_'|flags, false);
// draw selection
if (input->select != input->cursor)
{
size_t start = min(input->select, input->cursor);
size_t end = max(input->select, input->cursor);
INT32 startx = 0;
INT32 width = 0;
// I couldn't figure out one formula so here's bunch of separate cases
if (start < drawstart && end > drawend) // Selection covers whole visible portion of demo name
{
startx = -2;
width = V_StringWidth(nametodraw, V_ALLOWLOWERCASE)+4;
}
else if (start < drawstart) // Only left side of selection is off visible part
{
startx = -2;
size_t len = (end - start) - (drawstart - start);
width = V_SubStringWidth(nametodraw, len, V_ALLOWLOWERCASE)+2;
}
else if (end > drawend) // Only right side of selection is off visible part
{
startx = V_SubStringWidth(nametodraw, start-drawstart, V_ALLOWLOWERCASE);
width = V_StringWidth(nametodraw+(start-drawstart), V_ALLOWLOWERCASE)+2;
}
else // All selection is on visible part
{
startx = V_SubStringWidth(nametodraw, start-drawstart, V_ALLOWLOWERCASE);
width = V_SubStringWidth(nametodraw+(start-drawstart), end-start, V_ALLOWLOWERCASE);
}
V_DrawFill(x+startx, y, width, 8, 103|V_TRANSLUCENT|flags);
}
}
+5
View File
@@ -10,6 +10,8 @@ typedef struct textinput_s {
char *buffer;
size_t buffer_size;
unsigned skull;
} textinput_t;
void M_TextInputInit(textinput_t *input, char *buffer, size_t buffer_size);
@@ -20,4 +22,7 @@ void M_TextInputSetString(textinput_t *input, const char *c);
boolean M_TextInputHandle(textinput_t *input, INT32 key);
#define M_DrawTextInput(x, y, input, flags) M_DrawTextInputScroll((x), (y), (input), (flags), ((input)->buffer_size-1)*8)
void M_DrawTextInputScroll(INT32 x, INT32 y, textinput_t *input, INT32 flags, INT32 MAXINPUTWIDTH);
#endif
+11 -6
View File
@@ -372,21 +372,25 @@ static void P_DeviceRumbleTick(void)
{
UINT8 i;
if (I_NumJoys() == 0 || (cv_rumble[0].value == 0 && cv_rumble[1].value == 0 && cv_rumble[2].value == 0 && cv_rumble[3].value == 0))
if (I_NumJoys() == 0 || gamestate != GS_LEVEL)
{
return;
}
for (i = 0; i <= splitscreen; i++)
{
player_t *player = &players[displayplayers[i]];
UINT16 low = 0;
UINT16 high = 0;
if (!P_IsLocalPlayer(player))
if (!cv_usejoystick[i].value)
continue;
if (cv_usejoystick[i].value == 0)
if (!cv_rumble[i].value)
continue;
player_t *player = &players[displayplayers[i]];
if (!P_IsLocalPlayer(player))
continue;
if (!playeringame[displayplayers[i]] || player->spectator)
@@ -420,10 +424,11 @@ static void P_DeviceRumbleTick(void)
high = 65536 / 256;
}
if (low == 0 && high == 0)
// hack alert! i just dont want this thing constantly resetting the rumble lol
if (low == 0 && high == 0)
continue;
G_PlayerDeviceRumble(i, low, high, 57); // hack alert! i just dont want this think constantly resetting the rumble lol
G_PlayerDeviceRumble(i, low, high, 57);
}
}
+1 -70
View File
@@ -831,82 +831,13 @@ static void ST_overlayDrawer(void)
}
}
static void ST_DrawTextInput(INT32 x, INT32 y, textinput_t *input, INT32 flags)
{
static UINT8 skullAnimCounter = 0;
static const INT32 MAXINPUTWIDTH = (MAXSTRINGLENGTH-1)*8;
if (renderisnewtic)
skullAnimCounter++;
skullAnimCounter %= 8;
char nametodraw[MAXSTRINGLENGTH*2+1] = {0};
size_t drawstart = 0;
size_t drawend = 0; // Only used for selection
INT32 skullx = x;
while (V_SubStringWidth(input->buffer+drawstart, input->cursor-drawstart, V_ALLOWLOWERCASE) > MAXINPUTWIDTH)
++drawstart;
size_t drawlength = V_SubStringLengthToFit(input->buffer+drawstart, MAXINPUTWIDTH+8, V_ALLOWLOWERCASE)+1;
drawend = drawstart + drawlength;
memcpy(nametodraw, input->buffer+drawstart, drawlength);
if (input->length)
skullx += V_SubStringWidth(nametodraw, input->cursor-drawstart, V_ALLOWLOWERCASE);
V_DrawString(x, y, V_ALLOWLOWERCASE|flags, nametodraw);
// draw text cursor for name
if (skullAnimCounter < 4) // blink cursor
V_DrawCharacter(skullx, y+3, '_'|flags, false);
// draw selection
if (input->select != input->cursor)
{
size_t start = min(input->select, input->cursor);
size_t end = max(input->select, input->cursor);
INT32 startx = 0;
INT32 width = 0;
// I couldn't figure out one formula so here's bunch of separate cases
if (start < drawstart && end > drawend) // Selection covers whole visible portion of demo name
{
startx = -2;
width = V_StringWidth(nametodraw, V_ALLOWLOWERCASE)+4;
}
else if (start < drawstart) // Only left side of selection is off visible part
{
startx = -2;
size_t len = (end - start) - (drawstart - start);
width = V_SubStringWidth(nametodraw, len, V_ALLOWLOWERCASE)+2;
}
else if (end > drawend) // Only right side of selection is off visible part
{
startx = V_SubStringWidth(nametodraw, start-drawstart, V_ALLOWLOWERCASE);
width = V_StringWidth(nametodraw+(start-drawstart), V_ALLOWLOWERCASE)+2;
}
else // All selection is on visible part
{
startx = V_SubStringWidth(nametodraw, start-drawstart, V_ALLOWLOWERCASE);
width = V_SubStringWidth(nametodraw+(start-drawstart), end-start, V_ALLOWLOWERCASE);
}
V_DrawFill(x+startx, y, width, 8, 103|V_TRANSLUCENT|flags);
}
}
void ST_DrawDemoTitleEntry(void)
{
#define x (BASEVIDWIDTH/2 - 139)
#define y (BASEVIDHEIGHT/2)
M_DrawTextBox(x, y + 4, MAXSTRINGLENGTH, 1);
ST_DrawTextInput(x + 8, y + 12, &demo.titlenameinput, 0);
M_DrawTextInputScroll(x + 8, y + 12, &demo.titlenameinput, 0, (MAXSTRINGLENGTH-1)*8);
M_DrawTextBox(x + 30, y - 24, 26, 1);
V_DrawString(x + 38, y - 16, V_ALLOWLOWERCASE, "Enter the name of the replay.");