mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
Make protocol version a bit less secret
This commit is contained in:
parent
d6d5ebe01d
commit
02dda83fde
@ -48,9 +48,13 @@ extern cc_bool Game_ScreenshotRequested;
|
|||||||
extern cc_bool Game_HideGui;
|
extern cc_bool Game_HideGui;
|
||||||
extern cc_bool Game_DefaultZipMissing;
|
extern cc_bool Game_DefaultZipMissing;
|
||||||
|
|
||||||
|
enum GAME_VERSION_ {
|
||||||
|
VERSION_0017 = 27, VERSION_0019 = 28, VERSION_0023 = 29, VERSION_0030 = 30, VERSION_CPE = 31
|
||||||
|
};
|
||||||
struct GameVersion {
|
struct GameVersion {
|
||||||
const char* Name;
|
const char* Name;
|
||||||
cc_uint8 Protocol, MaxBlock, BlocksPerRow, InventorySize;
|
cc_uint8 Version, Protocol, MaxBlock;
|
||||||
|
cc_uint8 BlocksPerRow, InventorySize;
|
||||||
const cc_uint8* Inventory;
|
const cc_uint8* Inventory;
|
||||||
const cc_uint8* Hotbar;
|
const cc_uint8* Hotbar;
|
||||||
};
|
};
|
||||||
|
@ -40,39 +40,44 @@ static const cc_uint8 v4_hotbar[INVENTORY_BLOCKS_PER_HOTBAR] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct GameVersion version_cpe = {
|
static const struct GameVersion version_cpe = {
|
||||||
"0.30", PROTOCOL_0030, BLOCK_MAX_CPE, 10,
|
"0.30", VERSION_CPE,
|
||||||
sizeof(v7_inventory), NULL, v7_hotbar
|
PROTOCOL_0030, BLOCK_MAX_CPE,
|
||||||
|
10, sizeof(v7_inventory), NULL, v7_hotbar
|
||||||
};
|
};
|
||||||
static const struct GameVersion version_0030 = {
|
static const struct GameVersion version_0030 = {
|
||||||
"0.30", PROTOCOL_0030, BLOCK_OBSIDIAN, 9,
|
"0.30", VERSION_0030,
|
||||||
sizeof(v7_inventory), v7_inventory, v7_hotbar
|
PROTOCOL_0030, BLOCK_OBSIDIAN,
|
||||||
|
9, sizeof(v7_inventory), v7_inventory, v7_hotbar
|
||||||
};
|
};
|
||||||
static const struct GameVersion version_0023 = {
|
static const struct GameVersion version_0023 = {
|
||||||
"0.0.23a", PROTOCOL_0020, BLOCK_GOLD, 8,
|
"0.0.23a", VERSION_0023,
|
||||||
sizeof(v6_inventory), v6_inventory, v6_hotbar
|
PROTOCOL_0020, BLOCK_GOLD,
|
||||||
|
8, sizeof(v6_inventory), v6_inventory, v6_hotbar
|
||||||
};
|
};
|
||||||
static const struct GameVersion version_0019 = {
|
static const struct GameVersion version_0019 = {
|
||||||
"0.0.19a", PROTOCOL_0019, BLOCK_GLASS, 6,
|
"0.0.19a", VERSION_0019,
|
||||||
sizeof(v5_inventory), v5_inventory, v5_hotbar
|
PROTOCOL_0019, BLOCK_GLASS,
|
||||||
|
6, sizeof(v5_inventory), v5_inventory, v5_hotbar
|
||||||
};
|
};
|
||||||
static const struct GameVersion version_0017 = {
|
static const struct GameVersion version_0017 = {
|
||||||
"0.0.17a", PROTOCOL_0017, BLOCK_LEAVES, 6,
|
"0.0.17a", VERSION_0017,
|
||||||
sizeof(v4_inventory), v4_inventory, v4_hotbar
|
PROTOCOL_0017, BLOCK_LEAVES,
|
||||||
|
6, sizeof(v4_inventory), v4_inventory, v4_hotbar
|
||||||
};
|
};
|
||||||
|
|
||||||
void GameVersion_Load(void) {
|
void GameVersion_Load(void) {
|
||||||
int version = Options_GetInt("protocol-version", PROTOCOL_0017, PROTOCOL_0030, PROTOCOL_0030);
|
int version = Options_GetInt(OPT_GAME_VERSION, VERSION_0017, VERSION_0030, VERSION_0030);
|
||||||
const struct GameVersion* ver = NULL;
|
const struct GameVersion* ver = NULL;
|
||||||
|
|
||||||
if (Game_UseCPE) {
|
if (Game_UseCPE) {
|
||||||
ver = &version_cpe;
|
ver = &version_cpe;
|
||||||
} else if (version == PROTOCOL_0030) {
|
} else if (version == VERSION_0030) {
|
||||||
ver = &version_0030;
|
ver = &version_0030;
|
||||||
} else if (version == PROTOCOL_0020) {
|
} else if (version == VERSION_0023) {
|
||||||
ver = &version_0023;
|
ver = &version_0023;
|
||||||
} else if (version == PROTOCOL_0019) {
|
} else if (version == VERSION_0019) {
|
||||||
ver = &version_0019;
|
ver = &version_0019;
|
||||||
} else if (version == PROTOCOL_0017) {
|
} else if (version == VERSION_0017) {
|
||||||
ver = &version_0017;
|
ver = &version_0017;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
124
src/Menus.c
124
src/Menus.c
@ -2199,8 +2199,8 @@ static void MenuOptionsScreen_Layout(void* screen);
|
|||||||
static struct MenuOptionsScreen {
|
static struct MenuOptionsScreen {
|
||||||
Screen_Body
|
Screen_Body
|
||||||
struct MenuInputDesc* descs;
|
struct MenuInputDesc* descs;
|
||||||
const char** descriptions;
|
const char* descriptions[MENUOPTS_MAX_OPTS + 1];
|
||||||
int activeI, selectedI, descriptionsCount;
|
int activeI, selectedI;
|
||||||
InitMenuOptions DoInit, DoRecreateExtra, OnHacksChanged;
|
InitMenuOptions DoInit, DoRecreateExtra, OnHacksChanged;
|
||||||
int numButtons, numCore;
|
int numButtons, numCore;
|
||||||
struct FontDesc titleFont, textFont;
|
struct FontDesc titleFont, textFont;
|
||||||
@ -2278,9 +2278,10 @@ static void MenuOptionsScreen_SelectExtHelp(struct MenuOptionsScreen* s, int idx
|
|||||||
cc_string descRaw, descLines[5];
|
cc_string descRaw, descLines[5];
|
||||||
|
|
||||||
MenuOptionsScreen_FreeExtHelp(s);
|
MenuOptionsScreen_FreeExtHelp(s);
|
||||||
if (!s->descriptions || s->activeI >= 0) return;
|
if (s->activeI >= 0) return;
|
||||||
desc = s->descriptions[idx];
|
desc = s->descriptions[idx];
|
||||||
if (!desc) return;
|
if (!desc) return;
|
||||||
|
if (!s->widgets[idx] || s->widgets[idx]->disabled) return;
|
||||||
|
|
||||||
descRaw = String_FromReadonly(desc);
|
descRaw = String_FromReadonly(desc);
|
||||||
s->extHelp.lines = String_UNSAFE_Split(&descRaw, '\n', descLines, Array_Elems(descLines));
|
s->extHelp.lines = String_UNSAFE_Split(&descRaw, '\n', descLines, Array_Elems(descLines));
|
||||||
@ -2307,7 +2308,6 @@ static int MenuOptionsScreen_PointerMove(void* screen, int id, int x, int y) {
|
|||||||
struct MenuOptionsScreen* s = (struct MenuOptionsScreen*)screen;
|
struct MenuOptionsScreen* s = (struct MenuOptionsScreen*)screen;
|
||||||
int i = Menu_DoPointerMove(s, id, x, y);
|
int i = Menu_DoPointerMove(s, id, x, y);
|
||||||
if (i == -1 || i == s->selectedI) return true;
|
if (i == -1 || i == s->selectedI) return true;
|
||||||
if (!s->descriptions || i >= s->descriptionsCount) return true;
|
|
||||||
|
|
||||||
s->selectedI = i;
|
s->selectedI = i;
|
||||||
if (s->activeI == -1) MenuOptionsScreen_SelectExtHelp(s, i);
|
if (s->activeI == -1) MenuOptionsScreen_SelectExtHelp(s, i);
|
||||||
@ -2403,10 +2403,14 @@ static void MenuOptionsScreen_Init(void* screen) {
|
|||||||
|
|
||||||
s->widgets = menuOpts_widgets;
|
s->widgets = menuOpts_widgets;
|
||||||
s->numWidgets = MENUOPTS_MAX_OPTS + 1; /* always have back button */
|
s->numWidgets = MENUOPTS_MAX_OPTS + 1; /* always have back button */
|
||||||
/* The various menu options screens might have different number of widgets */
|
|
||||||
for (i = 0; i < MENUOPTS_MAX_OPTS; i++) { s->widgets[i] = NULL; }
|
|
||||||
s->maxVertices = BUTTONWIDGET_MAX;
|
s->maxVertices = BUTTONWIDGET_MAX;
|
||||||
|
|
||||||
|
/* The various menu options screens might have different number of widgets */
|
||||||
|
for (i = 0; i < MENUOPTS_MAX_OPTS; i++) {
|
||||||
|
s->widgets[i] = NULL;
|
||||||
|
s->descriptions[i] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
s->activeI = -1;
|
s->activeI = -1;
|
||||||
s->selectedI = -1;
|
s->selectedI = -1;
|
||||||
s->DoInit(s);
|
s->DoInit(s);
|
||||||
@ -2477,16 +2481,13 @@ static const struct ScreenVTABLE MenuOptionsScreen_VTABLE = {
|
|||||||
Menu_PointerDown, Screen_PointerUp, MenuOptionsScreen_PointerMove, Screen_TMouseScroll,
|
Menu_PointerDown, Screen_PointerUp, MenuOptionsScreen_PointerMove, Screen_TMouseScroll,
|
||||||
MenuOptionsScreen_Layout, MenuOptionsScreen_ContextLost, MenuOptionsScreen_ContextRecreated
|
MenuOptionsScreen_Layout, MenuOptionsScreen_ContextLost, MenuOptionsScreen_ContextRecreated
|
||||||
};
|
};
|
||||||
void MenuOptionsScreen_Show(struct MenuInputDesc* descs, const char** descriptions, int descsCount, InitMenuOptions init) {
|
void MenuOptionsScreen_Show(struct MenuInputDesc* descs, InitMenuOptions init) {
|
||||||
struct MenuOptionsScreen* s = &MenuOptionsScreen_Instance;
|
struct MenuOptionsScreen* s = &MenuOptionsScreen_Instance;
|
||||||
s->grabsInput = true;
|
s->grabsInput = true;
|
||||||
s->closable = true;
|
s->closable = true;
|
||||||
s->VTABLE = &MenuOptionsScreen_VTABLE;
|
s->VTABLE = &MenuOptionsScreen_VTABLE;
|
||||||
|
|
||||||
s->descs = descs;
|
s->descs = descs;
|
||||||
s->descriptions = descriptions;
|
|
||||||
s->descriptionsCount = descsCount;
|
|
||||||
|
|
||||||
s->DoInit = init;
|
s->DoInit = init;
|
||||||
s->DoRecreateExtra = NULL;
|
s->DoRecreateExtra = NULL;
|
||||||
s->OnHacksChanged = NULL;
|
s->OnHacksChanged = NULL;
|
||||||
@ -2594,7 +2595,7 @@ void ClassicOptionsScreen_Show(void) {
|
|||||||
MenuInput_Enum(descs[2], viewDistNames, VIEW_COUNT);
|
MenuInput_Enum(descs[2], viewDistNames, VIEW_COUNT);
|
||||||
MenuInput_Enum(descs[7], FpsLimit_Names, FPS_LIMIT_COUNT);
|
MenuInput_Enum(descs[7], FpsLimit_Names, FPS_LIMIT_COUNT);
|
||||||
|
|
||||||
MenuOptionsScreen_Show(descs, NULL, 0, ClassicOptionsScreen_InitWidgets);
|
MenuOptionsScreen_Show(descs, ClassicOptionsScreen_InitWidgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2678,7 +2679,7 @@ void EnvSettingsScreen_Show(void) {
|
|||||||
MenuInput_Float(descs[8], -100, 100, 1);
|
MenuInput_Float(descs[8], -100, 100, 1);
|
||||||
MenuInput_Int(descs[9], -2048, 2048, World.Height / 2);
|
MenuInput_Int(descs[9], -2048, 2048, World.Height / 2);
|
||||||
|
|
||||||
MenuOptionsScreen_Show(descs, NULL, 0, EnvSettingsScreen_InitWidgets);
|
MenuOptionsScreen_Show(descs, EnvSettingsScreen_InitWidgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2746,38 +2747,36 @@ static void GraphicsOptionsScreen_InitWidgets(struct MenuOptionsScreen* s) {
|
|||||||
s->numCore = 8;
|
s->numCore = 8;
|
||||||
s->maxVertices += 8 * BUTTONWIDGET_MAX;
|
s->maxVertices += 8 * BUTTONWIDGET_MAX;
|
||||||
MenuOptionsScreen_InitButtons(s, buttons, Array_Elems(buttons), Menu_SwitchOptions);
|
MenuOptionsScreen_InitButtons(s, buttons, Array_Elems(buttons), Menu_SwitchOptions);
|
||||||
}
|
|
||||||
|
|
||||||
void GraphicsOptionsScreen_Show(void) {
|
s->descriptions[0] = "&eChange the smoothness of the smooth camera.";
|
||||||
static struct MenuInputDesc descs[8];
|
s->descriptions[1] = \
|
||||||
static const char* extDescs[Array_Elems(descs)];
|
|
||||||
|
|
||||||
extDescs[0] = "&eChange the smoothness of the smooth camera.";
|
|
||||||
extDescs[1] = \
|
|
||||||
"&eVSync: &fNumber of frames rendered is at most the monitor's refresh rate.\n" \
|
"&eVSync: &fNumber of frames rendered is at most the monitor's refresh rate.\n" \
|
||||||
"&e30/60/120/144 FPS: &fRenders 30/60/120/144 frames at most each second.\n" \
|
"&e30/60/120/144 FPS: &fRenders 30/60/120/144 frames at most each second.\n" \
|
||||||
"&eNoLimit: &fRenders as many frames as possible each second.\n" \
|
"&eNoLimit: &fRenders as many frames as possible each second.\n" \
|
||||||
"&cNoLimit is pointless - it wastefully renders frames that you don't even see!";
|
"&cNoLimit is pointless - it wastefully renders frames that you don't even see!";
|
||||||
extDescs[3] = "&cNote: &eSmooth lighting is still experimental and can heavily reduce performance.";
|
s->descriptions[3] = "&cNote: &eSmooth lighting is still experimental and can heavily reduce performance.";
|
||||||
extDescs[5] = \
|
s->descriptions[5] = \
|
||||||
"&eNone: &fNo names of players are drawn.\n" \
|
"&eNone: &fNo names of players are drawn.\n" \
|
||||||
"&eHovered: &fName of the targeted player is drawn see-through.\n" \
|
"&eHovered: &fName of the targeted player is drawn see-through.\n" \
|
||||||
"&eAll: &fNames of all other players are drawn normally.\n" \
|
"&eAll: &fNames of all other players are drawn normally.\n" \
|
||||||
"&eAllHovered: &fAll names of players are drawn see-through.\n" \
|
"&eAllHovered: &fAll names of players are drawn see-through.\n" \
|
||||||
"&eAllUnscaled: &fAll names of players are drawn see-through without scaling.";
|
"&eAllUnscaled: &fAll names of players are drawn see-through without scaling.";
|
||||||
extDescs[6] = \
|
s->descriptions[6] = \
|
||||||
"&eNone: &fNo entity shadows are drawn.\n" \
|
"&eNone: &fNo entity shadows are drawn.\n" \
|
||||||
"&eSnapToBlock: &fA square shadow is shown on block you are directly above.\n" \
|
"&eSnapToBlock: &fA square shadow is shown on block you are directly above.\n" \
|
||||||
"&eCircle: &fA circular shadow is shown across the blocks you are above.\n" \
|
"&eCircle: &fA circular shadow is shown across the blocks you are above.\n" \
|
||||||
"&eCircleAll: &fA circular shadow is shown underneath all entities.";
|
"&eCircleAll: &fA circular shadow is shown underneath all entities.";
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicsOptionsScreen_Show(void) {
|
||||||
|
static struct MenuInputDesc descs[8];
|
||||||
MenuInput_Float(descs[0], 1, 100, 20);
|
MenuInput_Float(descs[0], 1, 100, 20);
|
||||||
MenuInput_Enum(descs[1], FpsLimit_Names, FPS_LIMIT_COUNT);
|
MenuInput_Enum(descs[1], FpsLimit_Names, FPS_LIMIT_COUNT);
|
||||||
MenuInput_Int(descs[2], 8, 4096, 512);
|
MenuInput_Int(descs[2], 8, 4096, 512);
|
||||||
MenuInput_Enum(descs[5], NameMode_Names, NAME_MODE_COUNT);
|
MenuInput_Enum(descs[5], NameMode_Names, NAME_MODE_COUNT);
|
||||||
MenuInput_Enum(descs[6], ShadowMode_Names, SHADOW_MODE_COUNT);
|
MenuInput_Enum(descs[6], ShadowMode_Names, SHADOW_MODE_COUNT);
|
||||||
|
|
||||||
MenuOptionsScreen_Show(descs, extDescs, Array_Elems(extDescs), GraphicsOptionsScreen_InitWidgets);
|
MenuOptionsScreen_Show(descs, GraphicsOptionsScreen_InitWidgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2831,7 +2830,7 @@ void ChatOptionsScreen_Show(void) {
|
|||||||
static struct MenuInputDesc descs[5];
|
static struct MenuInputDesc descs[5];
|
||||||
MenuInput_Float(descs[0], 0.25f, 4.00f, 1);
|
MenuInput_Float(descs[0], 0.25f, 4.00f, 1);
|
||||||
MenuInput_Int(descs[1], 0, 30, Gui.DefaultLines);
|
MenuInput_Int(descs[1], 0, 30, Gui.DefaultLines);
|
||||||
MenuOptionsScreen_Show(descs, NULL, 0, ChatOptionsScreen_InitWidgets);
|
MenuOptionsScreen_Show(descs, ChatOptionsScreen_InitWidgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2890,7 +2889,7 @@ void GuiOptionsScreen_Show(void) {
|
|||||||
static struct MenuInputDesc descs[8];
|
static struct MenuInputDesc descs[8];
|
||||||
MenuInput_Float(descs[2], 0.25f, 4.00f, 1);
|
MenuInput_Float(descs[2], 0.25f, 4.00f, 1);
|
||||||
MenuInput_Float(descs[3], 0.25f, 4.00f, 1);
|
MenuInput_Float(descs[3], 0.25f, 4.00f, 1);
|
||||||
MenuOptionsScreen_Show(descs, NULL, 0, GuiOptionsScreen_InitWidgets);
|
MenuOptionsScreen_Show(descs, GuiOptionsScreen_InitWidgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3005,25 +3004,22 @@ static void HacksSettingsScreen_InitWidgets(struct MenuOptionsScreen* s) {
|
|||||||
|
|
||||||
MenuOptionsScreen_InitButtons(s, buttons, Array_Elems(buttons), Menu_SwitchOptions);
|
MenuOptionsScreen_InitButtons(s, buttons, Array_Elems(buttons), Menu_SwitchOptions);
|
||||||
HacksSettingsScreen_CheckHacksAllowed(s);
|
HacksSettingsScreen_CheckHacksAllowed(s);
|
||||||
|
|
||||||
|
s->descriptions[2] = "&eIf &fON&e, then the third person cameras will limit\nðeir zoom distance if they hit a solid block.";
|
||||||
|
s->descriptions[3] = "&eSets how many blocks high you can jump up.\n&eNote: You jump much higher when holding down the Speed key binding.";
|
||||||
|
s->descriptions[7] = \
|
||||||
|
"&eIf &fON&e, placing blocks that intersect your own position cause\n" \
|
||||||
|
"ðe block to be placed, and you to be moved out of the way.\n" \
|
||||||
|
"&fThis is mainly useful for quick pillaring/towering.";
|
||||||
|
s->descriptions[8] = "&eIf &fOFF&e, you will immediately stop when in noclip\n&emode and no movement keys are held down.";
|
||||||
}
|
}
|
||||||
|
|
||||||
void HacksSettingsScreen_Show(void) {
|
void HacksSettingsScreen_Show(void) {
|
||||||
static struct MenuInputDesc descs[11];
|
static struct MenuInputDesc descs[11];
|
||||||
static const char* extDescs[Array_Elems(descs)];
|
|
||||||
|
|
||||||
extDescs[2] = "&eIf &fON&e, then the third person cameras will limit\nðeir zoom distance if they hit a solid block.";
|
|
||||||
extDescs[3] = "&eSets how many blocks high you can jump up.\n&eNote: You jump much higher when holding down the Speed key binding.";
|
|
||||||
extDescs[7] = \
|
|
||||||
"&eIf &fON&e, placing blocks that intersect your own position cause\n" \
|
|
||||||
"ðe block to be placed, and you to be moved out of the way.\n" \
|
|
||||||
"&fThis is mainly useful for quick pillaring/towering.";
|
|
||||||
extDescs[8] = "&eIf &fOFF&e, you will immediately stop when in noclip\n&emode and no movement keys are held down.";
|
|
||||||
|
|
||||||
MenuInput_Float(descs[1], 0.1f, 50, 10);
|
MenuInput_Float(descs[1], 0.1f, 50, 10);
|
||||||
MenuInput_Float(descs[3], 0.1f, 2048, 1.233f);
|
MenuInput_Float(descs[3], 0.1f, 2048, 1.233f);
|
||||||
MenuInput_Int(descs[9], 1, 179, 70);
|
MenuInput_Int(descs[9], 1, 179, 70);
|
||||||
|
MenuOptionsScreen_Show(descs, HacksSettingsScreen_InitWidgets);
|
||||||
MenuOptionsScreen_Show(descs, extDescs, Array_Elems(extDescs), HacksSettingsScreen_InitWidgets);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3100,7 +3096,7 @@ void MiscOptionsScreen_Show(void) {
|
|||||||
MenuInput_Int(descs[6], 1, 200, 30);
|
MenuInput_Int(descs[6], 1, 200, 30);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MenuOptionsScreen_Show(descs, NULL, 0, MiscSettingsScreen_InitWidgets);
|
MenuOptionsScreen_Show(descs, MiscSettingsScreen_InitWidgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3228,13 +3224,17 @@ static void NostalgiaAppearanceScreen_InitWidgets(struct MenuOptionsScreen* s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NostalgiaAppearanceScreen_Show(void) {
|
void NostalgiaAppearanceScreen_Show(void) {
|
||||||
MenuOptionsScreen_Show(NULL, NULL, 0, NostalgiaAppearanceScreen_InitWidgets);
|
MenuOptionsScreen_Show(NULL, NostalgiaAppearanceScreen_InitWidgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*----------------------------------------------NostalgiaFunctionalityScreen-----------------------------------------------*
|
*----------------------------------------------NostalgiaFunctionalityScreen-----------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
|
static void NostalgiaScreen_UpdateVersionDisabled(void) {
|
||||||
|
MenuOptionsScreen_Instance.buttons[3].disabled = Game_UseCPE;
|
||||||
|
}
|
||||||
|
|
||||||
static void NostalgiaScreen_GetTexs(cc_string* v) { Menu_GetBool(v, Game_AllowServerTextures); }
|
static void NostalgiaScreen_GetTexs(cc_string* v) { Menu_GetBool(v, Game_AllowServerTextures); }
|
||||||
static void NostalgiaScreen_SetTexs(const cc_string* v) { Game_AllowServerTextures = Menu_SetBool(v, OPT_SERVER_TEXTURES); }
|
static void NostalgiaScreen_SetTexs(const cc_string* v) { Game_AllowServerTextures = Menu_SetBool(v, OPT_SERVER_TEXTURES); }
|
||||||
|
|
||||||
@ -3242,22 +3242,40 @@ static void NostalgiaScreen_GetCustom(cc_string* v) { Menu_GetBool(v, Game_Allow
|
|||||||
static void NostalgiaScreen_SetCustom(const cc_string* v) { Game_AllowCustomBlocks = Menu_SetBool(v, OPT_CUSTOM_BLOCKS); }
|
static void NostalgiaScreen_SetCustom(const cc_string* v) { Game_AllowCustomBlocks = Menu_SetBool(v, OPT_CUSTOM_BLOCKS); }
|
||||||
|
|
||||||
static void NostalgiaScreen_GetCPE(cc_string* v) { Menu_GetBool(v, Game_UseCPE); }
|
static void NostalgiaScreen_GetCPE(cc_string* v) { Menu_GetBool(v, Game_UseCPE); }
|
||||||
static void NostalgiaScreen_SetCPE(const cc_string* v) { Game_UseCPE = Menu_SetBool(v, OPT_CPE); }
|
static void NostalgiaScreen_SetCPE(const cc_string* v) {
|
||||||
|
Game_UseCPE = Menu_SetBool(v, OPT_CPE);
|
||||||
|
NostalgiaScreen_UpdateVersionDisabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void NostalgiaScreen_Version(void* screen, void* widget) {
|
||||||
|
struct MenuOptionsScreen* s = (struct MenuOptionsScreen*)screen;
|
||||||
|
int ver = Game_Version.Version - 1;
|
||||||
|
if (ver < VERSION_0017) ver = VERSION_0030;
|
||||||
|
|
||||||
|
Options_SetInt(OPT_GAME_VERSION, ver);
|
||||||
|
GameVersion_Load();
|
||||||
|
MenuOptionsScreen_Update(s, Screen_Index(s, widget));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void NostalgiaScreen_GetVersion(cc_string* v) { String_AppendConst(v, Game_Version.Name); }
|
||||||
|
static void NostalgiaScreen_SetVersion(const cc_string* v) { }
|
||||||
|
|
||||||
static struct TextWidget nostalgia_desc;
|
static struct TextWidget nostalgia_desc;
|
||||||
static void NostalgiaScreen_RecreateExtra(struct MenuOptionsScreen* s) {
|
static void NostalgiaScreen_RecreateExtra(struct MenuOptionsScreen* s) {
|
||||||
TextWidget_SetConst(&nostalgia_desc, "&eButtons on the right require restarting game", &s->textFont);
|
TextWidget_SetConst(&nostalgia_desc, "&eRequires restarting game to take full effect", &s->textFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NostalgiaFunctionalityScreen_InitWidgets(struct MenuOptionsScreen* s) {
|
static void NostalgiaFunctionalityScreen_InitWidgets(struct MenuOptionsScreen* s) {
|
||||||
static const struct MenuOptionDesc buttons[] = {
|
static const struct MenuOptionDesc buttons[] = {
|
||||||
{ -1, 0, "Use server textures", MenuOptionsScreen_Bool,
|
{ -1, -50, "Use server textures", MenuOptionsScreen_Bool,
|
||||||
NostalgiaScreen_GetTexs, NostalgiaScreen_SetTexs },
|
NostalgiaScreen_GetTexs, NostalgiaScreen_SetTexs },
|
||||||
|
{ -1, 0, "Allow custom blocks", MenuOptionsScreen_Bool,
|
||||||
|
NostalgiaScreen_GetCustom, NostalgiaScreen_SetCustom },
|
||||||
|
|
||||||
{ 1, -50, "Allow custom blocks", MenuOptionsScreen_Bool,
|
{ 1, -50, "Non-classic features", MenuOptionsScreen_Bool,
|
||||||
NostalgiaScreen_GetCustom, NostalgiaScreen_SetCustom },
|
NostalgiaScreen_GetCPE, NostalgiaScreen_SetCPE },
|
||||||
{ 1, - 0, "Non-classic features", MenuOptionsScreen_Bool,
|
{ 1, 0, "Game version", NostalgiaScreen_Version,
|
||||||
NostalgiaScreen_GetCPE, NostalgiaScreen_SetCPE }
|
NostalgiaScreen_GetVersion, NostalgiaScreen_SetVersion }
|
||||||
};
|
};
|
||||||
s->numCore = Array_Elems(buttons) + 1;
|
s->numCore = Array_Elems(buttons) + 1;
|
||||||
s->maxVertices += Array_Elems(buttons) * BUTTONWIDGET_MAX + TEXTWIDGET_MAX;
|
s->maxVertices += Array_Elems(buttons) * BUTTONWIDGET_MAX + TEXTWIDGET_MAX;
|
||||||
@ -3266,11 +3284,17 @@ static void NostalgiaFunctionalityScreen_InitWidgets(struct MenuOptionsScreen* s
|
|||||||
MenuOptionsScreen_InitButtons(s, buttons, Array_Elems(buttons), Menu_SwitchNostalgia);
|
MenuOptionsScreen_InitButtons(s, buttons, Array_Elems(buttons), Menu_SwitchNostalgia);
|
||||||
TextWidget_Init(&nostalgia_desc);
|
TextWidget_Init(&nostalgia_desc);
|
||||||
Widget_SetLocation(&nostalgia_desc, ANCHOR_CENTRE, ANCHOR_CENTRE, 0, 100);
|
Widget_SetLocation(&nostalgia_desc, ANCHOR_CENTRE, ANCHOR_CENTRE, 0, 100);
|
||||||
s->widgets[3] = (struct Widget*)&nostalgia_desc;
|
s->widgets[4] = (struct Widget*)&nostalgia_desc;
|
||||||
|
|
||||||
|
NostalgiaScreen_UpdateVersionDisabled();
|
||||||
|
s->descriptions[3] = \
|
||||||
|
"&eNote that support for versions earlier than 0.30 is incomplete.\n" \
|
||||||
|
"\n" \
|
||||||
|
"&cNote that some servers only support 0.30 game version";
|
||||||
}
|
}
|
||||||
|
|
||||||
void NostalgiaFunctionalityScreen_Show(void) {
|
void NostalgiaFunctionalityScreen_Show(void) {
|
||||||
MenuOptionsScreen_Show(NULL, NULL, 0, NostalgiaFunctionalityScreen_InitWidgets);
|
MenuOptionsScreen_Show(NULL, NostalgiaFunctionalityScreen_InitWidgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,6 +76,7 @@ Copyright 2014-2022 ClassiCube | Licensed under BSD-3
|
|||||||
#define OPT_SKIN_SERVER "http-skinserver"
|
#define OPT_SKIN_SERVER "http-skinserver"
|
||||||
#define OPT_RAW_INPUT "win-raw-input"
|
#define OPT_RAW_INPUT "win-raw-input"
|
||||||
#define OPT_DPI_SCALING "win-dpi-scaling"
|
#define OPT_DPI_SCALING "win-dpi-scaling"
|
||||||
|
#define OPT_GAME_VERSION "game-version"
|
||||||
|
|
||||||
#define LOPT_SESSION "launcher-session"
|
#define LOPT_SESSION "launcher-session"
|
||||||
#define LOPT_USERNAME "launcher-cc-username"
|
#define LOPT_USERNAME "launcher-cc-username"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user