mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-26 04:12:34 +01:00
- reworked pause menu text input
This commit is contained in:
parent
0004082ede
commit
bd622bf54b
@ -1132,41 +1132,26 @@ void ScoreNameInputHandler(const char* input)
|
||||
gCurrentTextChar = *input;
|
||||
}
|
||||
|
||||
// [D] [T]
|
||||
void EnterScoreName(void)
|
||||
#define REPLAY_NAME_LEN 32
|
||||
#define SCORE_NAME_LEN 5
|
||||
|
||||
typedef void(*OnEntryComplete)(void* data, char* text);
|
||||
|
||||
// [A] Enter the replay name to save
|
||||
char* WaitForTextEntry(char* textBufPtr, int maxLength)
|
||||
{
|
||||
u_char chr;
|
||||
int so;
|
||||
int co;
|
||||
int delay;
|
||||
int so, co;
|
||||
int delay, toggle;
|
||||
char* username;
|
||||
int toggle;
|
||||
SCORE_ENTRY* table;
|
||||
unsigned short npad, dpad;
|
||||
|
||||
username = NULL;
|
||||
username = textBufPtr ? textBufPtr : _overlay_buffer;
|
||||
delay = 0;
|
||||
gEnteringScore = 1;
|
||||
toggle = 0;
|
||||
|
||||
if (gScoreEntered == 0)
|
||||
{
|
||||
gScorePosition = OnScoreTable(&table);
|
||||
|
||||
if (gScorePosition != -1)
|
||||
username = ScoreName[gScorePosition];
|
||||
}
|
||||
else
|
||||
{
|
||||
OnScoreTable(&table);
|
||||
gScorePosition = -1;
|
||||
}
|
||||
|
||||
co = 1;
|
||||
so = 0;
|
||||
|
||||
CreateScoreNames(table, &gPlayerScore, gScorePosition);
|
||||
|
||||
#ifndef PSX
|
||||
gameOnTextInput = ScoreNameInputHandler;
|
||||
gCurrentTextChar = 0;
|
||||
@ -1178,25 +1163,10 @@ void EnterScoreName(void)
|
||||
npad = Pads[0].dirnew;
|
||||
dpad = Pads[0].direct;
|
||||
|
||||
if (gScoreEntered)
|
||||
{
|
||||
if (npad & 0x50)
|
||||
{
|
||||
gEnteringScore = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!username)
|
||||
return;
|
||||
|
||||
// cancel
|
||||
if (npad & 0x10)
|
||||
{
|
||||
gEnteringScore = 0;
|
||||
return;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
#ifdef PSX
|
||||
if (dpad & 0x20)
|
||||
{
|
||||
@ -1247,7 +1217,7 @@ void EnterScoreName(void)
|
||||
delay = 0;
|
||||
}
|
||||
|
||||
if (so == 5)
|
||||
if (so == maxLength)
|
||||
chr = 254;
|
||||
else
|
||||
chr = validchars[co];
|
||||
@ -1268,7 +1238,7 @@ void EnterScoreName(void)
|
||||
break;
|
||||
}
|
||||
|
||||
if (so == 5)
|
||||
if (so == maxLength)
|
||||
{
|
||||
chr = 254;
|
||||
gCurrentTextChar = 0;
|
||||
@ -1279,7 +1249,7 @@ void EnterScoreName(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (so == 5)
|
||||
if (so == maxLength)
|
||||
chr = 254;
|
||||
else
|
||||
chr = '.';
|
||||
@ -1306,7 +1276,7 @@ void EnterScoreName(void)
|
||||
so--;
|
||||
|
||||
username[so] = 0;
|
||||
username[so+1] = 0;
|
||||
username[so + 1] = 0;
|
||||
}
|
||||
|
||||
#ifdef PSX
|
||||
@ -1317,24 +1287,15 @@ void EnterScoreName(void)
|
||||
{
|
||||
gCurrentTextChar = 0;
|
||||
#endif
|
||||
|
||||
// complete
|
||||
if (chr == 254)
|
||||
{
|
||||
username[so] = 0;
|
||||
strcpy(gPlayerScore.name, username);
|
||||
AddScoreToTable(table, gScorePosition);
|
||||
|
||||
sprintf(EnterScoreText, G_LTXT(GTXT_ViewTable));
|
||||
sprintf(EnterNameText, G_LTXT(GTXT_HighScores));
|
||||
|
||||
gEnteringScore = 0;
|
||||
gScoreEntered = 1;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
// delete chars
|
||||
if(chr == 255)
|
||||
if (chr == 255)
|
||||
{
|
||||
if (so > 0)
|
||||
so--;
|
||||
@ -1342,14 +1303,13 @@ void EnterScoreName(void)
|
||||
username[so] = 0;
|
||||
username[so + 1] = 0;
|
||||
}
|
||||
else if (so < 5)
|
||||
else if (so < maxLength)
|
||||
{
|
||||
username[so] = chr;
|
||||
username[so+1] = 0;
|
||||
username[so + 1] = 0;
|
||||
so++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DrawGame();
|
||||
} while (true);
|
||||
@ -1357,6 +1317,53 @@ void EnterScoreName(void)
|
||||
#ifndef PSX
|
||||
gameOnTextInput = NULL;
|
||||
#endif
|
||||
|
||||
return username;
|
||||
}
|
||||
|
||||
// [D] [T]
|
||||
void EnterScoreName(void)
|
||||
{
|
||||
u_char chr;
|
||||
char* username;
|
||||
char* enteredName;
|
||||
|
||||
SCORE_ENTRY* table;
|
||||
unsigned short npad, dpad;
|
||||
|
||||
username = NULL;
|
||||
|
||||
if (!gScoreEntered)
|
||||
{
|
||||
gScorePosition = OnScoreTable(&table);
|
||||
|
||||
if (gScorePosition != -1)
|
||||
username = ScoreName[gScorePosition];
|
||||
|
||||
CreateScoreNames(table, &gPlayerScore, gScorePosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
gScorePosition = -1;
|
||||
}
|
||||
|
||||
gEnteringScore = 1;
|
||||
|
||||
enteredName = WaitForTextEntry(username, SCORE_NAME_LEN);
|
||||
|
||||
if (enteredName && username)
|
||||
{
|
||||
strcpy(gPlayerScore.name, enteredName);
|
||||
|
||||
AddScoreToTable(table, gScorePosition);
|
||||
|
||||
sprintf(EnterScoreText, G_LTXT(GTXT_ViewTable));
|
||||
sprintf(EnterNameText, G_LTXT(GTXT_HighScores));
|
||||
|
||||
gScoreEntered = 1;
|
||||
}
|
||||
|
||||
gEnteringScore = 0;
|
||||
}
|
||||
|
||||
// [D] [T]
|
||||
@ -1651,9 +1658,9 @@ void DrawPauseMenus(void)
|
||||
|
||||
if (gDrawPauseMenus && gShowMap == 0)
|
||||
{
|
||||
if (gEnteringScore == 0)
|
||||
DrawVisibleMenus();
|
||||
else
|
||||
if (gEnteringScore)
|
||||
DrawHighScoreMenu(gScorePosition);
|
||||
else
|
||||
DrawVisibleMenus();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user