diff --git a/src/d_player.h b/src/d_player.h index f89d66550..7c21358c8 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -151,8 +151,6 @@ enum extern AActor *WP_NOCHANGE; -#define MAXPLAYERNAME 15 - // [GRB] Custom player classes enum { diff --git a/src/utility/configfile.cpp b/src/utility/configfile.cpp index b841e8d3d..2dc016e9e 100644 --- a/src/utility/configfile.cpp +++ b/src/utility/configfile.cpp @@ -623,15 +623,15 @@ void FConfigFile::LoadConfigFile () bool FConfigFile::ReadConfig (void *file) { - char readbuf[READBUFFERSIZE]; + uint8_t readbuf[READBUFFERSIZE]; FConfigSection *section = NULL; ClearConfig (); - while (ReadLine (readbuf, READBUFFERSIZE, file) != NULL) + while (ReadLine ((char*)readbuf, READBUFFERSIZE, file) != NULL) { - char *start = readbuf; - char *equalpt; - char *endpt; + uint8_t *start = readbuf; + uint8_t *equalpt; + uint8_t *endpt; // Remove white space at start of line while (*start && *start <= ' ') @@ -644,7 +644,7 @@ bool FConfigFile::ReadConfig (void *file) continue; } // Do not process tail of long line - const bool longline = (READBUFFERSIZE - 1) == strlen(readbuf) && '\n' != readbuf[READBUFFERSIZE - 2]; + const bool longline = (READBUFFERSIZE - 1) == strlen((char*)readbuf) && '\n' != readbuf[READBUFFERSIZE - 2]; if (longline) { endpt = start + READBUFFERSIZE - 2; @@ -652,7 +652,7 @@ bool FConfigFile::ReadConfig (void *file) else { // Remove white space at end of line - endpt = start + strlen (start) - 1; + endpt = start + strlen ((char*)start) - 1; while (endpt > start && *endpt <= ' ') { endpt--; @@ -667,7 +667,7 @@ bool FConfigFile::ReadConfig (void *file) { // Section header if (*endpt == ']') *endpt = 0; - section = NewConfigSection (start+1); + section = NewConfigSection ((char*)start+1); } else if (section == NULL) { @@ -675,11 +675,11 @@ bool FConfigFile::ReadConfig (void *file) } else { // Should be key=value - equalpt = strchr (start, '='); + equalpt = (uint8_t*)strchr ((char*)start, '='); if (equalpt != NULL && equalpt > start) { // Remove white space in front of = - char *whiteprobe = equalpt - 1; + uint8_t *whiteprobe = equalpt - 1; while (whiteprobe > start && isspace(*whiteprobe)) { whiteprobe--; @@ -695,16 +695,16 @@ bool FConfigFile::ReadConfig (void *file) // Check for multi-line value if (whiteprobe[0] == '<' && whiteprobe[1] == '<' && whiteprobe[2] == '<' && whiteprobe[3] != '\0') { - ReadMultiLineValue (file, section, start, whiteprobe + 3); + ReadMultiLineValue (file, section, (char*)start, (char*)whiteprobe + 3); } else if (longline) { - const FString key = start; - FString value = whiteprobe; + const FString key = (char*)start; + FString value = (char*)whiteprobe; - while (ReadLine (readbuf, READBUFFERSIZE, file) != NULL) + while (ReadLine ((char*)readbuf, READBUFFERSIZE, file) != NULL) { - const size_t endpos = (0 == readbuf[0]) ? 0 : (strlen(readbuf) - 1); + const size_t endpos = (0 == readbuf[0]) ? 0 : (strlen((char*)readbuf) - 1); const bool endofline = '\n' == readbuf[endpos]; if (endofline) @@ -712,7 +712,7 @@ bool FConfigFile::ReadConfig (void *file) readbuf[endpos] = 0; } - value += readbuf; + value += (char*)readbuf; if (endofline) { @@ -724,7 +724,7 @@ bool FConfigFile::ReadConfig (void *file) } else { - NewConfigEntry (section, start, whiteprobe); + NewConfigEntry (section, (char*)start, (char*)whiteprobe); } } } diff --git a/src/utility/utf8.cpp b/src/utility/utf8.cpp index 1a8e4648a..14f7b7983 100644 --- a/src/utility/utf8.cpp +++ b/src/utility/utf8.cpp @@ -94,7 +94,7 @@ int utf8_decode(const uint8_t *src, int *size) return c; } - int c1 = src[1]; + int c1 = src[1] & 0x3f; if ((c & 0xE0) == 0xC0) { @@ -107,7 +107,7 @@ int utf8_decode(const uint8_t *src, int *size) return -1; } - int c2 = src[2]; + int c2 = src[2] & 0x3f; if ((c & 0xF0) == 0xE0) { @@ -120,7 +120,7 @@ int utf8_decode(const uint8_t *src, int *size) return -1; } - int c3 = src[3]; + int c3 = src[3] & 0x3f; if ((c & 0xF8) == 0xF0) { diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index 0df017485..6ac2ddc27 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -1,7 +1,6 @@ // for flag changer functions. const FLAG_NO_CHANGE = -1; const MAXPLAYERS = 8; -const MAXPLAYERNAME = 15; enum EStateUseFlags { diff --git a/wadsrc/static/zscript/menu/loadsavemenu.txt b/wadsrc/static/zscript/menu/loadsavemenu.txt index 09cf2a33b..e6e453d36 100644 --- a/wadsrc/static/zscript/menu/loadsavemenu.txt +++ b/wadsrc/static/zscript/menu/loadsavemenu.txt @@ -460,8 +460,7 @@ class SaveMenu : LoadSaveMenu // // //============================================================================= - const SAVESTRINGSIZE = 32; - + override bool MenuEvent (int mkey, bool fromcontroller) { if (Super.MenuEvent(mkey, fromcontroller)) @@ -476,7 +475,7 @@ class SaveMenu : LoadSaveMenu if (mkey == MKEY_Enter) { String SavegameString = (Selected != 0)? manager.GetSavegame(Selected).SaveTitle : ""; - mInput = TextEnterMenu.Open(self, SavegameString, SAVESTRINGSIZE, 1, fromcontroller); + mInput = TextEnterMenu.Open(self, SavegameString, -1, 1, fromcontroller); mInput.ActivateMenu(); mEntering = true; } diff --git a/wadsrc/static/zscript/menu/playercontrols.txt b/wadsrc/static/zscript/menu/playercontrols.txt index 6b3a9bcf4..70eceb727 100644 --- a/wadsrc/static/zscript/menu/playercontrols.txt +++ b/wadsrc/static/zscript/menu/playercontrols.txt @@ -92,7 +92,7 @@ class ListMenuItemPlayerNameBox : ListMenuItemSelectable { if (i == 0) { - mPlayerName = s.Mid(0, MAXPLAYERNAME); + mPlayerName = s; return true; } return false; @@ -164,7 +164,7 @@ class ListMenuItemPlayerNameBox : ListMenuItemSelectable // Draw player name box double x = mXpos + mFont.StringWidth(text) + 16 + mFrameSize; - DrawBorder (x, mYpos - mFrameSize, MAXPLAYERNAME+1); + DrawBorder (x, mYpos - mFrameSize, 16); // This creates a 128 pixel wide text box. if (!mEnter) { screen.DrawText (SmallFont, Font.CR_UNTRANSLATED, x + mFrameSize, mYpos, mPlayerName, DTA_Clean, true); @@ -187,7 +187,7 @@ class ListMenuItemPlayerNameBox : ListMenuItemSelectable if (mkey == Menu.MKEY_Enter) { Menu.MenuSound ("menu/choose"); - mEnter = TextEnterMenu.Open(Menu.GetCurrentMenu(), mPlayerName, MAXPLAYERNAME, 2, fromcontroller); + mEnter = TextEnterMenu.Open(Menu.GetCurrentMenu(), mPlayerName, -1, 2, fromcontroller); mEnter.ActivateMenu(); return true; }