mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-15 20:20:54 +00:00
- changed some menu related names to match GZDoom.
This commit is contained in:
parent
5584c726ba
commit
0ca4bbd0c4
18 changed files with 1130 additions and 490 deletions
|
@ -1146,7 +1146,7 @@ RESTART:
|
||||||
if (!bAddUserMap && !gGameStarted)
|
if (!bAddUserMap && !gGameStarted)
|
||||||
{
|
{
|
||||||
M_StartControlPanel(false);
|
M_StartControlPanel(false);
|
||||||
M_SetMenu(NAME_MainMenu);
|
M_SetMenu(NAME_Mainmenu);
|
||||||
}
|
}
|
||||||
ready2send = 1;
|
ready2send = 1;
|
||||||
while (!gQuitGame)
|
while (!gQuitGame)
|
||||||
|
|
|
@ -141,7 +141,7 @@ static std::unique_ptr<CGameMenuItemQAV> itemBloodQAV; // This must be global to
|
||||||
void UpdateNetworkMenus(void)
|
void UpdateNetworkMenus(void)
|
||||||
{
|
{
|
||||||
// For now disable the network menu item as it is not yet functional.
|
// For now disable the network menu item as it is not yet functional.
|
||||||
for (auto name : { NAME_MainMenu, NAME_IngameMenu })
|
for (auto name : { NAME_Mainmenu, NAME_IngameMenu })
|
||||||
{
|
{
|
||||||
FMenuDescriptor** desc = MenuDescriptors.CheckKey(name);
|
FMenuDescriptor** desc = MenuDescriptors.CheckKey(name);
|
||||||
if (desc != NULL && (*desc)->mType == MDESC_ListMenu)
|
if (desc != NULL && (*desc)->mType == MDESC_ListMenu)
|
||||||
|
|
|
@ -293,7 +293,7 @@ void CDemo::ProcessKeys(void)
|
||||||
if (!M_Active())
|
if (!M_Active())
|
||||||
{
|
{
|
||||||
M_StartControlPanel(true);
|
M_StartControlPanel(true);
|
||||||
M_SetMenu(NAME_MainMenu);
|
M_SetMenu(NAME_Mainmenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -519,7 +519,7 @@ void netGetPackets(void)
|
||||||
// What are we trying to do here? Opening the menu, maybe?
|
// What are we trying to do here? Opening the menu, maybe?
|
||||||
//inputState.SetKeyStatus(sc_Escape);
|
//inputState.SetKeyStatus(sc_Escape);
|
||||||
M_StartControlPanel(false);
|
M_StartControlPanel(false);
|
||||||
M_SetMenu(NAME_MainMenu);
|
M_SetMenu(NAME_Mainmenu);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,17 +425,17 @@ bool M_SetMenu(FName menu, int param, FName caller)
|
||||||
// skip the menu and go right into the first level.
|
// skip the menu and go right into the first level.
|
||||||
// For tracking memory leaks that normally require operating the menu to start the game so that they always get the same allocation number.
|
// For tracking memory leaks that normally require operating the menu to start the game so that they always get the same allocation number.
|
||||||
GameStartupInfo.Episode = GameStartupInfo.Skill = 0;
|
GameStartupInfo.Episode = GameStartupInfo.Skill = 0;
|
||||||
menu = NAME_StartGame;
|
menu = NAME_Startgame;
|
||||||
#endif
|
#endif
|
||||||
if (DrawBackground == -1)
|
if (DrawBackground == -1)
|
||||||
{
|
{
|
||||||
if (menu == NAME_MainMenu) DrawBackground = 1;
|
if (menu == NAME_Mainmenu) DrawBackground = 1;
|
||||||
else DrawBackground = 0;
|
else DrawBackground = 0;
|
||||||
}
|
}
|
||||||
// some menus need some special treatment (needs to be adjusted for the various frontends.
|
// some menus need some special treatment (needs to be adjusted for the various frontends.
|
||||||
switch (caller.GetIndex())
|
switch (caller.GetIndex())
|
||||||
{
|
{
|
||||||
case NAME_EpisodeMenu:
|
case NAME_Episodemenu:
|
||||||
case NAME_HuntMenu:
|
case NAME_HuntMenu:
|
||||||
case NAME_TargetMenu:
|
case NAME_TargetMenu:
|
||||||
// sent from the episode menu
|
// sent from the episode menu
|
||||||
|
@ -469,7 +469,7 @@ bool M_SetMenu(FName menu, int param, FName caller)
|
||||||
gi->CustomMenuSelection(GameStartupInfo.CustomLevel1, param);
|
gi->CustomMenuSelection(GameStartupInfo.CustomLevel1, param);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_SkillMenu:
|
case NAME_Skillmenu:
|
||||||
GameStartupInfo.Skill = param;
|
GameStartupInfo.Skill = param;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -486,9 +486,9 @@ bool M_SetMenu(FName menu, int param, FName caller)
|
||||||
|
|
||||||
switch (menu.GetIndex())
|
switch (menu.GetIndex())
|
||||||
{
|
{
|
||||||
case NAME_StartGame:
|
case NAME_Startgame:
|
||||||
M_ClearMenus(); // must be done before starting the level.
|
M_ClearMenus(); // must be done before starting the level.
|
||||||
if (caller == NAME_MainMenu || caller == NAME_IngameMenu) GameStartupInfo.Episode = param;
|
if (caller == NAME_Mainmenu || caller == NAME_IngameMenu) GameStartupInfo.Episode = param;
|
||||||
STAT_StartNewGame(gVolumeNames[GameStartupInfo.Episode], GameStartupInfo.Skill);
|
STAT_StartNewGame(gVolumeNames[GameStartupInfo.Episode], GameStartupInfo.Skill);
|
||||||
inputState.ClearAllInput();
|
inputState.ClearAllInput();
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ bool M_SetMenu(FName menu, int param, FName caller)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case NAME_SaveGameMenu:
|
case NAME_Savegamemenu:
|
||||||
if (!gi->CanSave())
|
if (!gi->CanSave())
|
||||||
{
|
{
|
||||||
// cannot save outside the game.
|
// cannot save outside the game.
|
||||||
|
@ -521,12 +521,12 @@ bool M_SetMenu(FName menu, int param, FName caller)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_QuitMenu:
|
case NAME_Quitmenu:
|
||||||
// This is no separate class
|
// This is no separate class
|
||||||
C_DoCommand("menu_quit");
|
C_DoCommand("menu_quit");
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case NAME_EndgameMenu:
|
case NAME_EndGameMenu:
|
||||||
// This is no separate class
|
// This is no separate class
|
||||||
C_DoCommand("menu_endgame");
|
C_DoCommand("menu_endgame");
|
||||||
return true;
|
return true;
|
||||||
|
@ -829,7 +829,7 @@ bool M_DoResponder (event_t *ev)
|
||||||
ConsoleState != c_down && m_use_mouse)
|
ConsoleState != c_down && m_use_mouse)
|
||||||
{
|
{
|
||||||
M_StartControlPanel(true);
|
M_StartControlPanel(true);
|
||||||
M_SetMenu(NAME_MainMenu, -1);
|
M_SetMenu(NAME_Mainmenu, -1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1102,12 +1102,12 @@ CCMD(opensavemenu)
|
||||||
if (gi->CanSave())
|
if (gi->CanSave())
|
||||||
{
|
{
|
||||||
M_StartControlPanel(true);
|
M_StartControlPanel(true);
|
||||||
M_SetMenu(NAME_SaveGameMenu);
|
M_SetMenu(NAME_Savegamemenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CCMD(openloadmenu)
|
CCMD(openloadmenu)
|
||||||
{
|
{
|
||||||
M_StartControlPanel(true);
|
M_StartControlPanel(true);
|
||||||
M_SetMenu(NAME_LoadGameMenu);
|
M_SetMenu(NAME_Loadgamemenu);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1253,7 +1253,7 @@ static void BuildEpisodeMenu()
|
||||||
{
|
{
|
||||||
// Build episode menu
|
// Build episode menu
|
||||||
int addedVolumes = 0;
|
int addedVolumes = 0;
|
||||||
FMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_EpisodeMenu);
|
FMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_Episodemenu);
|
||||||
if (desc != NULL && (*desc)->mType == MDESC_ListMenu)
|
if (desc != NULL && (*desc)->mType == MDESC_ListMenu)
|
||||||
{
|
{
|
||||||
FListMenuDescriptor *ld = static_cast<FListMenuDescriptor*>(*desc);
|
FListMenuDescriptor *ld = static_cast<FListMenuDescriptor*>(*desc);
|
||||||
|
@ -1265,7 +1265,7 @@ static void BuildEpisodeMenu()
|
||||||
if (gVolumeNames[i].IsNotEmpty() && !(gVolumeFlags[i] & EF_HIDEFROMSP))
|
if (gVolumeNames[i].IsNotEmpty() && !(gVolumeFlags[i] & EF_HIDEFROMSP))
|
||||||
|
|
||||||
{
|
{
|
||||||
auto it = new FListMenuItemNativeText(ld->mXpos, y, ld->mLinespacing, gVolumeNames[i][0], gVolumeNames[i], NIT_BigFont, NIT_ActiveState, 1, NAME_SkillMenu, i);
|
auto it = new FListMenuItemNativeText(ld->mXpos, y, ld->mLinespacing, gVolumeNames[i][0], gVolumeNames[i], NIT_BigFont, NIT_ActiveState, 1, NAME_Skillmenu, i);
|
||||||
if ((g_gameType & GAMEFLAG_DUKE) && (g_gameType & GAMEFLAG_SHAREWARE) && i > 0)
|
if ((g_gameType & GAMEFLAG_DUKE) && (g_gameType & GAMEFLAG_SHAREWARE) && i > 0)
|
||||||
{
|
{
|
||||||
it->mEnabled = false;
|
it->mEnabled = false;
|
||||||
|
@ -1301,7 +1301,7 @@ static void BuildEpisodeMenu()
|
||||||
|
|
||||||
// Build skill menu
|
// Build skill menu
|
||||||
int addedSkills = 0;
|
int addedSkills = 0;
|
||||||
desc = MenuDescriptors.CheckKey(NAME_SkillMenu);
|
desc = MenuDescriptors.CheckKey(NAME_Skillmenu);
|
||||||
if (desc != NULL && (*desc)->mType == MDESC_ListMenu)
|
if (desc != NULL && (*desc)->mType == MDESC_ListMenu)
|
||||||
{
|
{
|
||||||
FListMenuDescriptor* ld = static_cast<FListMenuDescriptor*>(*desc);
|
FListMenuDescriptor* ld = static_cast<FListMenuDescriptor*>(*desc);
|
||||||
|
@ -1312,7 +1312,7 @@ static void BuildEpisodeMenu()
|
||||||
{
|
{
|
||||||
if (gSkillNames[i].IsNotEmpty())
|
if (gSkillNames[i].IsNotEmpty())
|
||||||
{
|
{
|
||||||
auto it = new FListMenuItemNativeText(ld->mXpos, y, ld->mLinespacing, gSkillNames[i][0], gSkillNames[i], NIT_BigFont, NIT_ActiveState, 1, NAME_StartGame, i);
|
auto it = new FListMenuItemNativeText(ld->mXpos, y, ld->mLinespacing, gSkillNames[i][0], gSkillNames[i], NIT_BigFont, NIT_ActiveState, 1, NAME_Startgame, i);
|
||||||
y += ld->mLinespacing;
|
y += ld->mLinespacing;
|
||||||
ld->mItems.Push(it);
|
ld->mItems.Push(it);
|
||||||
addedSkills++;
|
addedSkills++;
|
||||||
|
@ -1321,7 +1321,7 @@ static void BuildEpisodeMenu()
|
||||||
if (addedSkills == 0)
|
if (addedSkills == 0)
|
||||||
{
|
{
|
||||||
// Need to add one item with the default skill so that the menu does not break.
|
// Need to add one item with the default skill so that the menu does not break.
|
||||||
auto it = new FListMenuItemNativeText(ld->mXpos, 0, ld->mLinespacing, 0, "", NIT_BigFont, NIT_ActiveState, 1, NAME_StartGame, gDefaultSkill);
|
auto it = new FListMenuItemNativeText(ld->mXpos, 0, ld->mLinespacing, 0, "", NIT_BigFont, NIT_ActiveState, 1, NAME_Startgame, gDefaultSkill);
|
||||||
ld->mItems.Push(it);
|
ld->mItems.Push(it);
|
||||||
}
|
}
|
||||||
if (addedSkills == 1)
|
if (addedSkills == 1)
|
||||||
|
@ -1333,7 +1333,7 @@ static void BuildEpisodeMenu()
|
||||||
if (g_MenuGameplayEntries[0].entry.isValid())
|
if (g_MenuGameplayEntries[0].entry.isValid())
|
||||||
{
|
{
|
||||||
int e = 0;
|
int e = 0;
|
||||||
FMenuDescriptor** desc = MenuDescriptors.CheckKey(NAME_CustomGameMenu);
|
FMenuDescriptor** desc = MenuDescriptors.CheckKey("CustomGameMenu");
|
||||||
if (desc != NULL && (*desc)->mType == MDESC_ListMenu)
|
if (desc != NULL && (*desc)->mType == MDESC_ListMenu)
|
||||||
{
|
{
|
||||||
FListMenuDescriptor* ldo = static_cast<FListMenuDescriptor*>(*desc);
|
FListMenuDescriptor* ldo = static_cast<FListMenuDescriptor*>(*desc);
|
||||||
|
@ -1345,7 +1345,7 @@ static void BuildEpisodeMenu()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
int s = 0;
|
int s = 0;
|
||||||
FMenuDescriptor** sdesc = MenuDescriptors.CheckKey(FName(ENamedName(NAME_CustomSubMenu1 + e)));
|
FMenuDescriptor** sdesc = MenuDescriptors.CheckKey(FName(FStringf("CustomSubMenu%d", e+1)));
|
||||||
if (sdesc != NULL && (*sdesc)->mType == MDESC_ListMenu)
|
if (sdesc != NULL && (*sdesc)->mType == MDESC_ListMenu)
|
||||||
{
|
{
|
||||||
FListMenuDescriptor* ld = static_cast<FListMenuDescriptor*>(*sdesc);
|
FListMenuDescriptor* ld = static_cast<FListMenuDescriptor*>(*sdesc);
|
||||||
|
@ -1356,7 +1356,7 @@ static void BuildEpisodeMenu()
|
||||||
if (!subentry.isValid())
|
if (!subentry.isValid())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
auto li = new FListMenuItemNativeText(ld->mXpos, 0, ld->mLinespacing, 0, subentry.name, NIT_BigFont, NIT_ActiveColor, 1.f, subentry.flags & MGE_UserContent ? NAME_UsermapMenu : NAME_SkillMenu);
|
auto li = new FListMenuItemNativeText(ld->mXpos, 0, ld->mLinespacing, 0, subentry.name, NIT_BigFont, NIT_ActiveColor, 1.f, subentry.flags & MGE_UserContent ? NAME_UsermapMenu : NAME_Skillmenu);
|
||||||
|
|
||||||
if (subentry.flags & MGE_Locked) li->mEnabled = false;
|
if (subentry.flags & MGE_Locked) li->mEnabled = false;
|
||||||
if (subentry.flags & MGE_Hidden) li->mHidden = true;
|
if (subentry.flags & MGE_Hidden) li->mHidden = true;
|
||||||
|
@ -1364,7 +1364,7 @@ static void BuildEpisodeMenu()
|
||||||
++s;
|
++s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FName link = entry.flags & MGE_UserContent ? NAME_UsermapMenu : s == 0 ? NAME_SkillMenu : NAME_CustomSubMenu1;
|
FName link = entry.flags & MGE_UserContent ? NAME_UsermapMenu : s == 0 ? NAME_Skillmenu : NAME_CustomSubMenu1;
|
||||||
|
|
||||||
auto li = new FListMenuItemNativeText(ldo->mXpos, 0, ldo->mLinespacing, 0, entry.name, NIT_BigFont, NIT_ActiveColor, 1.f, link, e);
|
auto li = new FListMenuItemNativeText(ldo->mXpos, 0, ldo->mLinespacing, 0, entry.name, NIT_BigFont, NIT_ActiveColor, 1.f, link, e);
|
||||||
if (entry.flags & MGE_Locked) li->mEnabled = false;
|
if (entry.flags & MGE_Locked) li->mEnabled = false;
|
||||||
|
@ -1375,14 +1375,14 @@ static void BuildEpisodeMenu()
|
||||||
}
|
}
|
||||||
if (e > 0)
|
if (e > 0)
|
||||||
{
|
{
|
||||||
for (auto name : { NAME_MainMenu, NAME_IngameMenu })
|
for (auto name : { NAME_Mainmenu, NAME_IngameMenu })
|
||||||
{
|
{
|
||||||
FMenuDescriptor** desc = MenuDescriptors.CheckKey(name);
|
FMenuDescriptor** desc = MenuDescriptors.CheckKey(name);
|
||||||
if (desc != NULL && (*desc)->mType == MDESC_ListMenu)
|
if (desc != NULL && (*desc)->mType == MDESC_ListMenu)
|
||||||
{
|
{
|
||||||
FListMenuDescriptor* ld = static_cast<FListMenuDescriptor*>(*desc);
|
FListMenuDescriptor* ld = static_cast<FListMenuDescriptor*>(*desc);
|
||||||
auto li = ld->mItems[0];
|
auto li = ld->mItems[0];
|
||||||
if (li->GetAction(nullptr) == NAME_EpisodeMenu)
|
if (li->GetAction(nullptr) == NAME_Episodemenu)
|
||||||
{
|
{
|
||||||
li->SetAction(NAME_CustomGameMenu);
|
li->SetAction(NAME_CustomGameMenu);
|
||||||
}
|
}
|
||||||
|
|
|
@ -643,7 +643,7 @@ CCMD(quicksave)
|
||||||
if (savegameManager.quickSaveSlot == NULL || savegameManager.quickSaveSlot == (FSaveGameNode*)1)
|
if (savegameManager.quickSaveSlot == NULL || savegameManager.quickSaveSlot == (FSaveGameNode*)1)
|
||||||
{
|
{
|
||||||
M_StartControlPanel(true);
|
M_StartControlPanel(true);
|
||||||
M_SetMenu(NAME_SaveGameMenu);
|
M_SetMenu(NAME_Savegamemenu);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,7 +693,7 @@ CCMD(quickload)
|
||||||
M_StartControlPanel(true);
|
M_StartControlPanel(true);
|
||||||
// signal that whatever gets loaded should be the new quicksave
|
// signal that whatever gets loaded should be the new quicksave
|
||||||
savegameManager.quickSaveSlot = (FSaveGameNode*)1;
|
savegameManager.quickSaveSlot = (FSaveGameNode*)1;
|
||||||
M_SetMenu(NAME_LoadGameMenu);
|
M_SetMenu(NAME_Loadgamemenu);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,176 +0,0 @@
|
||||||
/* -*- mode: c; c-file-style: "k&r" -*-
|
|
||||||
|
|
||||||
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
|
|
||||||
Copyright (C) 2000, 2004 by Martin Pool <mbp sourcefrog net>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* partial change history:
|
|
||||||
*
|
|
||||||
* 2004-10-10 mbp: Lift out character type dependencies into macros.
|
|
||||||
*
|
|
||||||
* Eric Sosman pointed out that ctype functions take a parameter whose
|
|
||||||
* value must be that of an unsigned int, even on platforms that have
|
|
||||||
* negative chars in their default char type.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "strnatcmp.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* These are defined as macros to make it easier to adapt this code to
|
|
||||||
* different characters types or comparison functions. */
|
|
||||||
static __inline int
|
|
||||||
nat_isdigit(nat_char a)
|
|
||||||
{
|
|
||||||
return isdigit((unsigned char) a);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static __inline int
|
|
||||||
nat_isspace(nat_char a)
|
|
||||||
{
|
|
||||||
return isspace((unsigned char) a);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static __inline nat_char
|
|
||||||
nat_toupper(nat_char a)
|
|
||||||
{
|
|
||||||
return toupper((unsigned char) a);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
compare_right(nat_char const *a, nat_char const *b)
|
|
||||||
{
|
|
||||||
int bias = 0;
|
|
||||||
|
|
||||||
/* The longest run of digits wins. That aside, the greatest
|
|
||||||
value wins, but we can't know that it will until we've scanned
|
|
||||||
both numbers to know that they have the same magnitude, so we
|
|
||||||
remember it in BIAS. */
|
|
||||||
for (;; a++, b++) {
|
|
||||||
if (!nat_isdigit(*a) && !nat_isdigit(*b))
|
|
||||||
return bias;
|
|
||||||
else if (!nat_isdigit(*a))
|
|
||||||
return -1;
|
|
||||||
else if (!nat_isdigit(*b))
|
|
||||||
return +1;
|
|
||||||
else if (*a < *b) {
|
|
||||||
if (!bias)
|
|
||||||
bias = -1;
|
|
||||||
} else if (*a > *b) {
|
|
||||||
if (!bias)
|
|
||||||
bias = +1;
|
|
||||||
} else if (!*a && !*b)
|
|
||||||
return bias;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
compare_left(nat_char const *a, nat_char const *b)
|
|
||||||
{
|
|
||||||
/* Compare two left-aligned numbers: the first to have a
|
|
||||||
different value wins. */
|
|
||||||
for (;; a++, b++) {
|
|
||||||
if (!nat_isdigit(*a) && !nat_isdigit(*b))
|
|
||||||
return 0;
|
|
||||||
else if (!nat_isdigit(*a))
|
|
||||||
return -1;
|
|
||||||
else if (!nat_isdigit(*b))
|
|
||||||
return +1;
|
|
||||||
else if (*a < *b)
|
|
||||||
return -1;
|
|
||||||
else if (*a > *b)
|
|
||||||
return +1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int strnatcmp0(nat_char const *a, nat_char const *b, int fold_case)
|
|
||||||
{
|
|
||||||
int ai, bi;
|
|
||||||
nat_char ca, cb;
|
|
||||||
int fractional, result;
|
|
||||||
|
|
||||||
assert(a && b);
|
|
||||||
ai = bi = 0;
|
|
||||||
while (1) {
|
|
||||||
ca = a[ai]; cb = b[bi];
|
|
||||||
|
|
||||||
/* skip over leading spaces or zeros */
|
|
||||||
while (nat_isspace(ca))
|
|
||||||
ca = a[++ai];
|
|
||||||
|
|
||||||
while (nat_isspace(cb))
|
|
||||||
cb = b[++bi];
|
|
||||||
|
|
||||||
/* process run of digits */
|
|
||||||
if (nat_isdigit(ca) && nat_isdigit(cb)) {
|
|
||||||
fractional = (ca == '0' || cb == '0');
|
|
||||||
|
|
||||||
if (fractional) {
|
|
||||||
if ((result = compare_left(a+ai, b+bi)) != 0)
|
|
||||||
return result;
|
|
||||||
} else {
|
|
||||||
if ((result = compare_right(a+ai, b+bi)) != 0)
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ca && !cb) {
|
|
||||||
/* The strings compare the same. Perhaps the caller
|
|
||||||
will want to call strcmp to break the tie. */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fold_case) {
|
|
||||||
ca = nat_toupper(ca);
|
|
||||||
cb = nat_toupper(cb);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ca < cb)
|
|
||||||
return -1;
|
|
||||||
else if (ca > cb)
|
|
||||||
return +1;
|
|
||||||
|
|
||||||
++ai; ++bi;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int strnatcmp(nat_char const *a, nat_char const *b) {
|
|
||||||
return strnatcmp0(a, b, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Compare, recognizing numeric string and ignoring case. */
|
|
||||||
int strnatcasecmp(nat_char const *a, nat_char const *b) {
|
|
||||||
return strnatcmp0(a, b, 1);
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
/* -*- mode: c; c-file-style: "k&r" -*-
|
|
||||||
|
|
||||||
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
|
|
||||||
Copyright (C) 2000, 2004 by Martin Pool <mbp sourcefrog net>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* CUSTOMIZATION SECTION
|
|
||||||
*
|
|
||||||
* You can change this typedef, but must then also change the inline
|
|
||||||
* functions in strnatcmp.c */
|
|
||||||
typedef char nat_char;
|
|
||||||
|
|
||||||
int strnatcmp(nat_char const *a, nat_char const *b);
|
|
||||||
int strnatcasecmp(nat_char const *a, nat_char const *b);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,127 +0,0 @@
|
||||||
#include <stdint.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/* ======================================================================== */
|
|
||||||
|
|
||||||
/* By Paul Hsieh (C) 2004, 2005. Covered under the Paul Hsieh derivative
|
|
||||||
license. See:
|
|
||||||
http://www.azillionmonkeys.com/qed/weblicense.html for license details.
|
|
||||||
|
|
||||||
http://www.azillionmonkeys.com/qed/hash.html */
|
|
||||||
|
|
||||||
#undef get16bits
|
|
||||||
#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \
|
|
||||||
|| defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
|
|
||||||
#define get16bits(d) (*((const uint16_t *) (d)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined (get16bits)
|
|
||||||
#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\
|
|
||||||
+(uint32_t)(((const uint8_t *)(d))[0]) )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint32_t SuperFastHash (const char *data, size_t len)
|
|
||||||
{
|
|
||||||
uint32_t hash = 0, tmp;
|
|
||||||
size_t rem;
|
|
||||||
|
|
||||||
if (len == 0 || data == NULL) return 0;
|
|
||||||
|
|
||||||
rem = len & 3;
|
|
||||||
len >>= 2;
|
|
||||||
|
|
||||||
/* Main loop */
|
|
||||||
for (;len > 0; len--)
|
|
||||||
{
|
|
||||||
hash += get16bits (data);
|
|
||||||
tmp = (get16bits (data+2) << 11) ^ hash;
|
|
||||||
hash = (hash << 16) ^ tmp;
|
|
||||||
data += 2*sizeof (uint16_t);
|
|
||||||
hash += hash >> 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Handle end cases */
|
|
||||||
switch (rem)
|
|
||||||
{
|
|
||||||
case 3: hash += get16bits (data);
|
|
||||||
hash ^= hash << 16;
|
|
||||||
hash ^= data[sizeof (uint16_t)] << 18;
|
|
||||||
hash += hash >> 11;
|
|
||||||
break;
|
|
||||||
case 2: hash += get16bits (data);
|
|
||||||
hash ^= hash << 11;
|
|
||||||
hash += hash >> 17;
|
|
||||||
break;
|
|
||||||
case 1: hash += *data;
|
|
||||||
hash ^= hash << 10;
|
|
||||||
hash += hash >> 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Force "avalanching" of final 127 bits */
|
|
||||||
hash ^= hash << 3;
|
|
||||||
hash += hash >> 5;
|
|
||||||
hash ^= hash << 4;
|
|
||||||
hash += hash >> 17;
|
|
||||||
hash ^= hash << 25;
|
|
||||||
hash += hash >> 6;
|
|
||||||
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* A modified version to do a case-insensitive hash */
|
|
||||||
|
|
||||||
#undef get16bits
|
|
||||||
#define get16bits(d) ((((uint32_t)tolower(((const uint8_t *)(d))[1])) << 8)\
|
|
||||||
+(uint32_t)tolower(((const uint8_t *)(d))[0]) )
|
|
||||||
|
|
||||||
uint32_t SuperFastHashI (const char *data, size_t len)
|
|
||||||
{
|
|
||||||
uint32_t hash = 0, tmp;
|
|
||||||
size_t rem;
|
|
||||||
|
|
||||||
if (len <= 0 || data == NULL) return 0;
|
|
||||||
|
|
||||||
rem = len & 3;
|
|
||||||
len >>= 2;
|
|
||||||
|
|
||||||
/* Main loop */
|
|
||||||
for (;len > 0; len--)
|
|
||||||
{
|
|
||||||
hash += get16bits (data);
|
|
||||||
tmp = (get16bits (data+2) << 11) ^ hash;
|
|
||||||
hash = (hash << 16) ^ tmp;
|
|
||||||
data += 2*sizeof (uint16_t);
|
|
||||||
hash += hash >> 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Handle end cases */
|
|
||||||
switch (rem)
|
|
||||||
{
|
|
||||||
case 3: hash += get16bits (data);
|
|
||||||
hash ^= hash << 16;
|
|
||||||
hash ^= tolower(data[sizeof (uint16_t)]) << 18;
|
|
||||||
hash += hash >> 11;
|
|
||||||
break;
|
|
||||||
case 2: hash += get16bits (data);
|
|
||||||
hash ^= hash << 11;
|
|
||||||
hash += hash >> 17;
|
|
||||||
break;
|
|
||||||
case 1: hash += tolower(*data);
|
|
||||||
hash ^= hash << 10;
|
|
||||||
hash += hash >> 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Force "avalanching" of final 127 bits */
|
|
||||||
hash ^= hash << 3;
|
|
||||||
hash += hash >> 5;
|
|
||||||
hash ^= hash << 4;
|
|
||||||
hash += hash >> 17;
|
|
||||||
hash ^= hash << 25;
|
|
||||||
hash += hash >> 6;
|
|
||||||
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ======================================================================== */
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
uint32_t SuperFastHash (const char *data, size_t len);
|
|
||||||
uint32_t SuperFastHashI (const char *data, size_t len);
|
|
||||||
|
|
||||||
inline unsigned int MakeKey(const char* s)
|
|
||||||
{
|
|
||||||
if (s == NULL)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return SuperFastHashI(s, strlen(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline unsigned int MakeKey(const char* s, size_t len)
|
|
||||||
{
|
|
||||||
return SuperFastHashI(s, len);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
#ifndef __W_ZIP
|
|
||||||
#define __W_ZIP
|
|
||||||
|
|
||||||
#pragma pack(1)
|
|
||||||
// FZipCentralInfo
|
|
||||||
struct FZipEndOfCentralDirectory
|
|
||||||
{
|
|
||||||
uint32_t Magic;
|
|
||||||
uint16_t DiskNumber;
|
|
||||||
uint16_t FirstDisk;
|
|
||||||
uint16_t NumEntries;
|
|
||||||
uint16_t NumEntriesOnAllDisks;
|
|
||||||
uint32_t DirectorySize;
|
|
||||||
uint32_t DirectoryOffset;
|
|
||||||
uint16_t ZipCommentLength;
|
|
||||||
};
|
|
||||||
|
|
||||||
// FZipFileInfo
|
|
||||||
struct FZipCentralDirectoryInfo
|
|
||||||
{
|
|
||||||
uint32_t Magic;
|
|
||||||
uint8_t VersionMadeBy[2];
|
|
||||||
uint8_t VersionToExtract[2];
|
|
||||||
uint16_t Flags;
|
|
||||||
uint16_t Method;
|
|
||||||
uint16_t ModTime;
|
|
||||||
uint16_t ModDate;
|
|
||||||
uint32_t CRC32;
|
|
||||||
uint32_t CompressedSize;
|
|
||||||
uint32_t UncompressedSize;
|
|
||||||
uint16_t NameLength;
|
|
||||||
uint16_t ExtraLength;
|
|
||||||
uint16_t CommentLength;
|
|
||||||
uint16_t StartingDiskNumber;
|
|
||||||
uint16_t InternalAttributes;
|
|
||||||
uint32_t ExternalAttributes;
|
|
||||||
uint32_t LocalHeaderOffset;
|
|
||||||
// file name and other variable length info follows
|
|
||||||
};
|
|
||||||
|
|
||||||
// FZipLocalHeader
|
|
||||||
struct FZipLocalFileHeader
|
|
||||||
{
|
|
||||||
uint32_t Magic;
|
|
||||||
uint8_t VersionToExtract[2];
|
|
||||||
uint16_t Flags;
|
|
||||||
uint16_t Method;
|
|
||||||
uint16_t ModTime;
|
|
||||||
uint16_t ModDate;
|
|
||||||
uint32_t CRC32;
|
|
||||||
uint32_t CompressedSize;
|
|
||||||
uint32_t UncompressedSize;
|
|
||||||
uint16_t NameLength;
|
|
||||||
uint16_t ExtraLength;
|
|
||||||
// file name and other variable length info follows
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#pragma pack()
|
|
||||||
|
|
||||||
#define ZIP_LOCALFILE MAKE_ID('P','K',3,4)
|
|
||||||
#define ZIP_CENTRALFILE MAKE_ID('P','K',1,2)
|
|
||||||
#define ZIP_ENDOFDIR MAKE_ID('P','K',5,6)
|
|
||||||
|
|
||||||
// File header flags.
|
|
||||||
#define ZF_ENCRYPTED 0x1
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -5488,7 +5488,7 @@ void G_BackToMenu(void)
|
||||||
ud.warp_on = 0;
|
ud.warp_on = 0;
|
||||||
g_player[myconnectindex].ps->gm = 0;
|
g_player[myconnectindex].ps->gm = 0;
|
||||||
M_StartControlPanel(false);
|
M_StartControlPanel(false);
|
||||||
M_SetMenu(NAME_MainMenu);
|
M_SetMenu(NAME_Mainmenu);
|
||||||
inputState.keyFlushChars();
|
inputState.keyFlushChars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5791,7 +5791,7 @@ MAIN_LOOP_RESTART:
|
||||||
if (g_networkMode != NET_DEDICATED_SERVER)
|
if (g_networkMode != NET_DEDICATED_SERVER)
|
||||||
{
|
{
|
||||||
M_StartControlPanel(false);
|
M_StartControlPanel(false);
|
||||||
M_SetMenu(NAME_MainMenu);
|
M_SetMenu(NAME_Mainmenu);
|
||||||
|
|
||||||
if (G_PlaybackDemo())
|
if (G_PlaybackDemo())
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,7 @@ int menu_Menu(int nVal)
|
||||||
{
|
{
|
||||||
MenuExitCondition = -2;
|
MenuExitCondition = -2;
|
||||||
M_StartControlPanel(false);
|
M_StartControlPanel(false);
|
||||||
M_SetMenu(NAME_MainMenu);
|
M_SetMenu(NAME_Mainmenu);
|
||||||
while (M_Active())
|
while (M_Active())
|
||||||
{
|
{
|
||||||
auto nLogoTile = EXHUMED ? kExhumedLogo : kPowerslaveLogo;
|
auto nLogoTile = EXHUMED ? kExhumedLogo : kPowerslaveLogo;
|
||||||
|
@ -107,7 +107,7 @@ class PSMainMenu : public DListMenu
|
||||||
|
|
||||||
void PreDraw() override
|
void PreDraw() override
|
||||||
{
|
{
|
||||||
if (mDesc->mMenuName == NAME_MainMenu)
|
if (mDesc->mMenuName == NAME_Mainmenu)
|
||||||
menu_DoPlasma();
|
menu_DoPlasma();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -6866,7 +6866,7 @@ void G_BackToMenu(void)
|
||||||
ud.warp_on = 0;
|
ud.warp_on = 0;
|
||||||
g_player[myconnectindex].ps->gm = 0;
|
g_player[myconnectindex].ps->gm = 0;
|
||||||
M_StartControlPanel(false);
|
M_StartControlPanel(false);
|
||||||
M_SetMenu(NAME_MainMenu);
|
M_SetMenu(NAME_Mainmenu);
|
||||||
inputState.keyFlushChars();
|
inputState.keyFlushChars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7170,7 +7170,7 @@ MAIN_LOOP_RESTART:
|
||||||
//if (g_networkMode != NET_DEDICATED_SERVER)
|
//if (g_networkMode != NET_DEDICATED_SERVER)
|
||||||
{
|
{
|
||||||
M_StartControlPanel(false);
|
M_StartControlPanel(false);
|
||||||
M_SetMenu(NAME_MainMenu);
|
M_SetMenu(NAME_Mainmenu);
|
||||||
if (G_PlaybackDemo())
|
if (G_PlaybackDemo())
|
||||||
{
|
{
|
||||||
FX_StopAllSounds();
|
FX_StopAllSounds();
|
||||||
|
|
|
@ -82,7 +82,7 @@ class SWMainMenu : public DListMenu
|
||||||
for (unsigned e = 0; e < mDesc->mItems.Size(); ++e)
|
for (unsigned e = 0; e < mDesc->mItems.Size(); ++e)
|
||||||
{
|
{
|
||||||
auto entry = mDesc->mItems[e];
|
auto entry = mDesc->mItems[e];
|
||||||
if (entry->GetAction(nullptr) == NAME_SaveGameMenu)
|
if (entry->GetAction(nullptr) == NAME_Savegamemenu)
|
||||||
{
|
{
|
||||||
entry->mEnabled = gi->CanSave();
|
entry->mEnabled = gi->CanSave();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1667,7 +1667,7 @@ void MenuLevel(void)
|
||||||
short w,h;
|
short w,h;
|
||||||
|
|
||||||
M_StartControlPanel(false);
|
M_StartControlPanel(false);
|
||||||
M_SetMenu(NAME_MainMenu);
|
M_SetMenu(NAME_Mainmenu);
|
||||||
// do demos only if not playing multi play
|
// do demos only if not playing multi play
|
||||||
if (!CommEnabled && numplayers <= 1 && !FinishAnim && !NoDemoStartup)
|
if (!CommEnabled && numplayers <= 1 && !FinishAnim && !NoDemoStartup)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue