widen main menu so longer translations fit

This commit is contained in:
darkrose 2014-10-27 03:33:09 +10:00
parent 18c31365d8
commit d82e8db4c2
3 changed files with 168 additions and 173 deletions

View File

@ -377,7 +377,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
Calculate new sizes and positions Calculate new sizes and positions
*/ */
v2s32 size(600, 500); v2s32 size(800, 500);
core::rect<s32> rect( core::rect<s32> rect(
screensize.X/2 - size.X/2, screensize.X/2 - size.X/2,
@ -389,38 +389,44 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
DesiredRect = rect; DesiredRect = rect;
recalculateAbsolutePosition(false); recalculateAbsolutePosition(false);
// Character Creator button
{
core::rect<s32> rect(0, 0, 200, 40);
rect += v2s32(25, 200);
Environment->addButton(rect, this, GUI_ID_CHARACTER_CREATOR, wgettext("Character Creator"));
}
// Single Player button // Single Player button
{ {
core::rect<s32> rect(0, 0, 150, 30); core::rect<s32> rect(0, 0, 200, 40);
rect += v2s32(25, 200); rect += v2s32(25, 260);
Environment->addButton(rect, this, GUI_ID_TAB_SINGLEPLAYER, wgettext("Single Player")); Environment->addButton(rect, this, GUI_ID_TAB_SINGLEPLAYER, wgettext("Single Player"));
} }
// Multi Player button // Multi Player button
{ {
core::rect<s32> rect(0, 0, 150, 30); core::rect<s32> rect(0, 0, 200, 40);
rect += v2s32(25, 240); rect += v2s32(25, 305);
Environment->addButton(rect, this, GUI_ID_TAB_MULTIPLAYER, wgettext("Multi Player")); Environment->addButton(rect, this, GUI_ID_TAB_MULTIPLAYER, wgettext("Multi Player"));
} }
// Settings button // Settings button
{ {
core::rect<s32> rect(0, 0, 130, 30); core::rect<s32> rect(0, 0, 180, 40);
rect += v2s32(35, 280); rect += v2s32(35, 350);
Environment->addButton(rect, this, GUI_ID_TAB_SETTINGS, wgettext("Settings")); Environment->addButton(rect, this, GUI_ID_TAB_SETTINGS, wgettext("Settings"));
} }
// Credits button // Credits button
{ {
core::rect<s32> rect(0, 0, 130, 30); core::rect<s32> rect(0, 0, 180, 40);
rect += v2s32(35, 320); rect += v2s32(35, 395);
Environment->addButton(rect, this, GUI_ID_TAB_CREDITS, wgettext("Credits")); Environment->addButton(rect, this, GUI_ID_TAB_CREDITS, wgettext("Credits"));
} }
// Quit button // Quit button
{ {
core::rect<s32> rect(0, 0, 130, 30); core::rect<s32> rect(0, 0, 180, 40);
rect += v2s32(35, 360); rect += v2s32(35, 440);
Environment->addButton(rect, this, GUI_ID_TAB_QUIT, wgettext("Quit")); Environment->addButton(rect, this, GUI_ID_TAB_QUIT, wgettext("Quit"));
} }
v2s32 topleft_content(200, 0); v2s32 topleft_content(250, 0);
v2s32 size_content = size - v2s32(300, 0); v2s32 size_content = size - v2s32(300, 0);
//v2s32 size = rect.getSize(); //v2s32 size = rect.getSize();
@ -450,7 +456,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
if (m_data->selected_tab == TAB_MULTIPLAYER) { if (m_data->selected_tab == TAB_MULTIPLAYER) {
changeCtype(""); changeCtype("");
{ {
core::rect<s32> rect(0, 0, 400, 20); core::rect<s32> rect(0, 0, 550, 20);
rect += topleft_content + v2s32(0, 20); rect += topleft_content + v2s32(0, 20);
gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Multi Player"), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Multi Player"), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
@ -459,25 +465,25 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
// Nickname + password // Nickname + password
{ {
core::rect<s32> rect(0, 0, 110, 20); core::rect<s32> rect(0, 0, 110, 20);
rect += topleft_content + v2s32(70, 60); rect += topleft_content + v2s32(120, 60);
Environment->addStaticText(wgettext("Name/Password"), rect, false, true, this, -1); Environment->addStaticText(wgettext("Name/Password"), rect, false, true, this, -1);
} }
changeCtype("C"); changeCtype("C");
{ {
core::rect<s32> rect(0, 0, 230, 30); core::rect<s32> rect(0, 0, 230, 30);
rect += topleft_content + v2s32(85, 90); rect += topleft_content + v2s32(135, 90);
gui::IGUIElement *e = gui::IGUIElement *e =
Environment->addEditBox(text_name.c_str(), rect, false, this, GUI_ID_NAME_INPUT); Environment->addEditBox(text_name.c_str(), rect, false, this, GUI_ID_NAME_INPUT);
if(text_name == L"") if (text_name == L"")
Environment->setFocus(e); Environment->setFocus(e);
} }
{ {
core::rect<s32> rect(0, 0, 230, 30); core::rect<s32> rect(0, 0, 230, 30);
rect += topleft_content + v2s32(85, 125); rect += topleft_content + v2s32(135, 125);
gui::IGUIEditBox *e = gui::IGUIEditBox *e =
Environment->addEditBox(L"", rect, false, this, 264); Environment->addEditBox(L"", rect, false, this, 264);
e->setPasswordBox(true); e->setPasswordBox(true);
if(text_name != L"" && text_address != L"") if (text_name != L"" && text_address != L"")
Environment->setFocus(e); Environment->setFocus(e);
} }
@ -485,100 +491,99 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
// Address + port // Address + port
{ {
core::rect<s32> rect(0, 0, 110, 20); core::rect<s32> rect(0, 0, 110, 20);
rect += topleft_content + v2s32(70, 170); rect += topleft_content + v2s32(120, 170);
Environment->addStaticText(wgettext("Address/Port"), Environment->addStaticText(wgettext("Address/Port"), rect, false, true, this, -1);
rect, false, true, this, -1);
} }
changeCtype("C"); changeCtype("C");
{ {
core::rect<s32> rect(0, 0, 230, 30); core::rect<s32> rect(0, 0, 230, 30);
rect += topleft_content + v2s32(85, 200); rect += topleft_content + v2s32(135, 200);
gui::IGUIElement *e = gui::IGUIElement *e =
Environment->addEditBox(text_address.c_str(), rect, false, this, GUI_ID_ADDRESS_INPUT); Environment->addEditBox(text_address.c_str(), rect, false, this, GUI_ID_ADDRESS_INPUT);
if(text_name != L"" && text_address == L"") if (text_name != L"" && text_address == L"")
Environment->setFocus(e); Environment->setFocus(e);
} }
{ {
core::rect<s32> rect(0, 0, 120, 30); core::rect<s32> rect(0, 0, 120, 30);
rect += topleft_content + v2s32(195, 240); rect += topleft_content + v2s32(245, 240);
Environment->addEditBox(text_port.c_str(), rect, false, this, GUI_ID_PORT_INPUT); Environment->addEditBox(text_port.c_str(), rect, false, this, GUI_ID_PORT_INPUT);
} }
changeCtype(""); changeCtype("");
// Start game button // Start game button
{ {
core::rect<s32> rect(0, 0, 180, 30); core::rect<s32> rect(0, 0, 180, 30);
rect += topleft_content + v2s32(110, 290); rect += topleft_content + v2s32(160, 290);
Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, wgettext("Connect")); Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, wgettext("Connect"));
} }
}else if (m_data->selected_tab == TAB_SETTINGS) { }else if (m_data->selected_tab == TAB_SETTINGS) {
changeCtype(""); changeCtype("");
{ {
core::rect<s32> rect(0, 0, 400, 20); core::rect<s32> rect(0, 0, 550, 20);
rect += topleft_content + v2s32(0, 20); rect += topleft_content + v2s32(0, 20);
gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Settings"), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Settings"), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(40, 60); rect += topleft_content + v2s32(80, 60);
Environment->addCheckBox(fancy_trees, rect, this, GUI_ID_FANCYTREE_CB, wgettext("Fancy trees")); Environment->addCheckBox(fancy_trees, rect, this, GUI_ID_FANCYTREE_CB, wgettext("Fancy trees"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(40, 90); rect += topleft_content + v2s32(80, 90);
Environment->addCheckBox(smooth_lighting, rect, this, GUI_ID_SMOOTH_LIGHTING_CB, wgettext("Smooth Lighting")); Environment->addCheckBox(smooth_lighting, rect, this, GUI_ID_SMOOTH_LIGHTING_CB, wgettext("Smooth Lighting"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(40, 120); rect += topleft_content + v2s32(80, 120);
Environment->addCheckBox(clouds_3d, rect, this, GUI_ID_3D_CLOUDS_CB, wgettext("3D Clouds")); Environment->addCheckBox(clouds_3d, rect, this, GUI_ID_3D_CLOUDS_CB, wgettext("3D Clouds"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(40, 150); rect += topleft_content + v2s32(80, 150);
Environment->addCheckBox(opaque_water, rect, this, GUI_ID_OPAQUE_WATER_CB, wgettext("Opaque water")); Environment->addCheckBox(opaque_water, rect, this, GUI_ID_OPAQUE_WATER_CB, wgettext("Opaque water"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(200, 60); rect += topleft_content + v2s32(290, 60);
Environment->addCheckBox(fullscreen, rect, this, GUI_ID_FULLSCREEN_CB, wgettext("Fullscreen")); Environment->addCheckBox(fullscreen, rect, this, GUI_ID_FULLSCREEN_CB, wgettext("Fullscreen"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(200, 90); rect += topleft_content + v2s32(290, 90);
Environment->addCheckBox(particles, rect, this, GUI_ID_PARTICLES_CB, wgettext("Particles")); Environment->addCheckBox(particles, rect, this, GUI_ID_PARTICLES_CB, wgettext("Particles"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(200, 120); rect += topleft_content + v2s32(290, 120);
Environment->addCheckBox(mipmap, rect, this, GUI_ID_MIPMAP_CB, wgettext("Mip-Mapping")); Environment->addCheckBox(mipmap, rect, this, GUI_ID_MIPMAP_CB, wgettext("Mip-Mapping"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(200, 150); rect += topleft_content + v2s32(290, 150);
Environment->addCheckBox(bilinear, rect, this, GUI_ID_BILINEAR_CB, wgettext("Bi-Linear Filtering")); Environment->addCheckBox(bilinear, rect, this, GUI_ID_BILINEAR_CB, wgettext("Bi-Linear Filtering"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(200, 180); rect += topleft_content + v2s32(290, 180);
Environment->addCheckBox(trilinear, rect, this, GUI_ID_TRILINEAR_CB, wgettext("Tri-Linear Filtering")); Environment->addCheckBox(trilinear, rect, this, GUI_ID_TRILINEAR_CB, wgettext("Tri-Linear Filtering"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(200, 210); rect += topleft_content + v2s32(290, 210);
Environment->addCheckBox(anisotropic, rect, this, GUI_ID_ANISOTROPIC_CB, wgettext("Anisotropic Filtering")); Environment->addCheckBox(anisotropic, rect, this, GUI_ID_ANISOTROPIC_CB, wgettext("Anisotropic Filtering"));
} }
// Key change button // Key change button
{ {
core::rect<s32> rect(0, 0, 130, 30); core::rect<s32> rect(0, 0, 130, 30);
rect += topleft_content + v2s32(140, 280); rect += topleft_content + v2s32(210, 280);
Environment->addButton(rect, this, GUI_ID_CHANGE_KEYS_BUTTON, wgettext("Change keys")); Environment->addButton(rect, this, GUI_ID_CHANGE_KEYS_BUTTON, wgettext("Change keys"));
} }
}else if (m_data->selected_tab == TAB_SINGLEPLAYER) { }else if (m_data->selected_tab == TAB_SINGLEPLAYER) {
changeCtype(""); changeCtype("");
{ {
core::rect<s32> rect(0, 0, 400, 20); core::rect<s32> rect(0, 0, 550, 20);
rect += topleft_content + v2s32(0, 20); rect += topleft_content + v2s32(0, 20);
gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Single Player"), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Single Player"), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
@ -587,7 +592,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
// Server parameters // Server parameters
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(100, 60); rect += topleft_content + v2s32(175, 60);
gui::IGUIComboBox *c = Environment->addComboBox(rect, this, GUI_ID_GAME_MODE_COMBO); gui::IGUIComboBox *c = Environment->addComboBox(rect, this, GUI_ID_GAME_MODE_COMBO);
u32 cm = c->addItem(wgettext("Creative Mode"),GUI_ID_GAME_MODE_CREATIVE); u32 cm = c->addItem(wgettext("Creative Mode"),GUI_ID_GAME_MODE_CREATIVE);
u32 am = c->addItem(wgettext("Adventure Mode"),GUI_ID_GAME_MODE_ADVENTURE); u32 am = c->addItem(wgettext("Adventure Mode"),GUI_ID_GAME_MODE_ADVENTURE);
@ -602,26 +607,26 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
} }
// Advanced settings button // Advanced settings button
{ {
core::rect<s32> rect(0, 0, 130, 30); core::rect<s32> rect(0, 0, 170, 30);
rect += topleft_content + v2s32(40, 100); rect += topleft_content + v2s32(90, 100);
Environment->addButton(rect, this, GUI_ID_GAME_SETTINGS_ADV, wgettext("Advanced Settings")); Environment->addButton(rect, this, GUI_ID_GAME_SETTINGS_ADV, wgettext("Advanced Settings"));
} }
// Map options button // Map options button
{ {
core::rect<s32> rect(0, 0, 130, 30); core::rect<s32> rect(0, 0, 170, 30);
rect += topleft_content + v2s32(200, 100); rect += topleft_content + v2s32(290, 100);
Environment->addButton(rect, this, GUI_ID_MAP_OPTIONS_BUTTON, wgettext("Map Options")); Environment->addButton(rect, this, GUI_ID_MAP_OPTIONS_BUTTON, wgettext("Map Options"));
} }
// Start game button // Start game button
{ {
core::rect<s32> rect(0, 0, 180, 30); core::rect<s32> rect(0, 0, 180, 30);
rect += topleft_content + v2s32(110, 170); rect += topleft_content + v2s32(185, 170);
Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, wgettext("Start Game")); Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, wgettext("Start Game"));
} }
}else if (m_data->selected_tab == TAB_SINGLEPLAYER_ADVANCED) { }else if (m_data->selected_tab == TAB_SINGLEPLAYER_ADVANCED) {
changeCtype(""); changeCtype("");
{ {
core::rect<s32> rect(0, 0, 400, 20); core::rect<s32> rect(0, 0, 550, 20);
rect += topleft_content + v2s32(0, 20); rect += topleft_content + v2s32(0, 20);
gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Single Player"), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Single Player"), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
@ -630,39 +635,40 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
// Server parameters // Server parameters
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(100, 60); rect += topleft_content + v2s32(175, 60);
gui::IGUIComboBox *c = Environment->addComboBox(rect, this, GUI_ID_GAME_MODE_COMBO); gui::IGUIComboBox *c = Environment->addComboBox(rect, this, GUI_ID_GAME_MODE_COMBO);
u32 cm = c->addItem(wgettext("Creative Mode"),GUI_ID_GAME_MODE_CREATIVE); u32 cm = c->addItem(wgettext("Creative Mode"),GUI_ID_GAME_MODE_CREATIVE);
u32 am = c->addItem(wgettext("Adventure Mode"),GUI_ID_GAME_MODE_ADVENTURE); u32 am = c->addItem(wgettext("Adventure Mode"),GUI_ID_GAME_MODE_ADVENTURE);
u32 sm = c->addItem(wgettext("Survival Mode"),GUI_ID_GAME_MODE_SURVIVAL); u32 sm = c->addItem(wgettext("Survival Mode"),GUI_ID_GAME_MODE_SURVIVAL);
if (game_mode == L"creative") { if (game_mode == L"creative") {
c->setSelected(cm); c->setSelected(cm);
}else if (game_mode == L"adventure") {
c->setSelected(am);
}else if (game_mode == L"survival") { }else if (game_mode == L"survival") {
c->setSelected(sm); c->setSelected(sm);
}else{
c->setSelected(am);
} }
} }
// Basic settings button // Basic settings button
{ {
core::rect<s32> rect(0, 0, 150, 30); core::rect<s32> rect(0, 0, 170, 30);
rect += topleft_content + v2s32(40, 100); rect += topleft_content + v2s32(90, 100);
Environment->addButton(rect, this, GUI_ID_GAME_SETTINGS_BASIC, wgettext("Hide Advanced Settings")); Environment->addButton(rect, this, GUI_ID_GAME_SETTINGS_BASIC, wgettext("Hide Advanced Settings"));
} }
// Map options button // Map options button
{ {
core::rect<s32> rect(0, 0, 130, 30); core::rect<s32> rect(0, 0, 170, 30);
rect += topleft_content + v2s32(200, 100); rect += topleft_content + v2s32(290, 100);
Environment->addButton(rect, this, GUI_ID_MAP_OPTIONS_BUTTON, wgettext("Map Options")); Environment->addButton(rect, this, GUI_ID_MAP_OPTIONS_BUTTON, wgettext("Map Options"));
} }
{ {
core::rect<s32> rect(0, 0, 100, 20); core::rect<s32> rect(0, 0, 125, 20);
rect += topleft_content + v2s32(40, 160); rect += topleft_content + v2s32(40, 160);
Environment->addStaticText(wgettext("Creatures"), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Creatures"), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_LOWERRIGHT, gui::EGUIA_UPPERLEFT);
} }
{ {
core::rect<s32> rect(0, 0, 240, 30); core::rect<s32> rect(0, 0, 240, 30);
rect += topleft_content + v2s32(120, 155); rect += topleft_content + v2s32(170, 155);
gui::IGUIComboBox *c = Environment->addComboBox(rect, this, GUI_ID_MOBS_COMBO); gui::IGUIComboBox *c = Environment->addComboBox(rect, this, GUI_ID_MOBS_COMBO);
u32 pm = c->addItem(wgettext("Passive"),GUI_ID_MOBS_PASSIVE); u32 pm = c->addItem(wgettext("Passive"),GUI_ID_MOBS_PASSIVE);
u32 am = c->addItem(wgettext("Passive & Aggressive"),GUI_ID_MOBS_AGGRESSIVE); u32 am = c->addItem(wgettext("Passive & Aggressive"),GUI_ID_MOBS_AGGRESSIVE);
@ -677,49 +683,49 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(40, 200); rect += topleft_content + v2s32(70, 200);
Environment->addCheckBox(enable_damage, rect, this, GUI_ID_DAMAGE_CB, wgettext("Player Damage")); Environment->addCheckBox(enable_damage, rect, this, GUI_ID_DAMAGE_CB, wgettext("Player Damage"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(50, 230); rect += topleft_content + v2s32(80, 230);
Environment->addCheckBox(suffocation, rect, this, GUI_ID_SUFFOCATE_CB, wgettext("Suffocation/Drowning")); Environment->addCheckBox(suffocation, rect, this, GUI_ID_SUFFOCATE_CB, wgettext("Suffocation/Drowning"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(50, 260); rect += topleft_content + v2s32(80, 260);
Environment->addCheckBox(hunger, rect, this, GUI_ID_HUNGER_CB, wgettext("Hunger")); Environment->addCheckBox(hunger, rect, this, GUI_ID_HUNGER_CB, wgettext("Hunger"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(40, 290); rect += topleft_content + v2s32(70, 290);
Environment->addCheckBox(tool_wear, rect, this, GUI_ID_TOOL_WEAR_CB, wgettext("Tool Wear")); Environment->addCheckBox(tool_wear, rect, this, GUI_ID_TOOL_WEAR_CB, wgettext("Tool Wear"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(220, 200); rect += topleft_content + v2s32(300, 200);
Environment->addCheckBox(infinite_inventory, rect, this, GUI_ID_INFINITE_INV_CB, wgettext("Infinite Inventory")); Environment->addCheckBox(infinite_inventory, rect, this, GUI_ID_INFINITE_INV_CB, wgettext("Infinite Inventory"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(230, 230); rect += topleft_content + v2s32(310, 230);
Environment->addCheckBox(initial_inventory, rect, this, GUI_ID_INITIAL_INV_CB, wgettext("Initial Inventory")); Environment->addCheckBox(initial_inventory, rect, this, GUI_ID_INITIAL_INV_CB, wgettext("Initial Inventory"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(220, 260); rect += topleft_content + v2s32(300, 260);
Environment->addCheckBox(droppable_inventory, rect, this, GUI_ID_DROPPABLE_INV_CB, wgettext("Droppable Inventory")); Environment->addCheckBox(droppable_inventory, rect, this, GUI_ID_DROPPABLE_INV_CB, wgettext("Droppable Inventory"));
} }
// Start game button // Start game button
{ {
core::rect<s32> rect(0, 0, 180, 30); core::rect<s32> rect(0, 0, 180, 30);
rect += topleft_content + v2s32(110, 340); rect += topleft_content + v2s32(185, 340);
Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, wgettext("Start Game")); Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, wgettext("Start Game"));
} }
}else if (m_data->selected_tab == TAB_SINGLEPLAYER_MAP) { }else if (m_data->selected_tab == TAB_SINGLEPLAYER_MAP) {
changeCtype(""); changeCtype("");
{ {
core::rect<s32> rect(0, 0, 400, 20); core::rect<s32> rect(0, 0, 550, 20);
rect += topleft_content + v2s32(0, 20); rect += topleft_content + v2s32(0, 20);
gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Single Player"), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Single Player"), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
@ -728,7 +734,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
// Server parameters // Server parameters
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(100, 60); rect += topleft_content + v2s32(175, 60);
gui::IGUIComboBox *c = Environment->addComboBox(rect, this, GUI_ID_GAME_MODE_COMBO); gui::IGUIComboBox *c = Environment->addComboBox(rect, this, GUI_ID_GAME_MODE_COMBO);
u32 cm = c->addItem(wgettext("Creative Mode"),GUI_ID_GAME_MODE_CREATIVE); u32 cm = c->addItem(wgettext("Creative Mode"),GUI_ID_GAME_MODE_CREATIVE);
u32 am = c->addItem(wgettext("Adventure Mode"),GUI_ID_GAME_MODE_ADVENTURE); u32 am = c->addItem(wgettext("Adventure Mode"),GUI_ID_GAME_MODE_ADVENTURE);
@ -743,37 +749,37 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
} }
// Advanced settings button // Advanced settings button
{ {
core::rect<s32> rect(0, 0, 150, 30); core::rect<s32> rect(0, 0, 170, 30);
rect += topleft_content + v2s32(40, 100); rect += topleft_content + v2s32(90, 100);
Environment->addButton(rect, this, GUI_ID_GAME_SETTINGS_ADV, wgettext("Advanced Settings")); Environment->addButton(rect, this, GUI_ID_GAME_SETTINGS_ADV, wgettext("Advanced Settings"));
} }
// Basic settings button // Basic settings button
{ {
core::rect<s32> rect(0, 0, 150, 30); core::rect<s32> rect(0, 0, 170, 30);
rect += topleft_content + v2s32(200, 100); rect += topleft_content + v2s32(290, 100);
Environment->addButton(rect, this, GUI_ID_GAME_SETTINGS_BASIC, wgettext("Hide Map Options")); Environment->addButton(rect, this, GUI_ID_GAME_SETTINGS_BASIC, wgettext("Hide Map Options"));
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(100, 130); rect += topleft_content + v2s32(150, 130);
Environment->addCheckBox(delete_map, rect, this, GUI_ID_MAP_DELETE_CB, wgettext("Create New Map")); Environment->addCheckBox(delete_map, rect, this, GUI_ID_MAP_DELETE_CB, wgettext("Create New Map"));
} }
if (delete_map) { if (delete_map) {
{ {
core::rect<s32> rect(0, 0, 300, 20); core::rect<s32> rect(0, 0, 300, 20);
rect += topleft_content + v2s32(70, 160); rect += topleft_content + v2s32(120, 160);
Environment->addStaticText(wgettext("Warning! Your old map will be deleted!"), Environment->addStaticText(wgettext("Warning! Your old map will be deleted!"),
rect, false, true, this, -1); rect, false, true, this, -1);
} }
{ {
core::rect<s32> rect(0, 0, 110, 20); core::rect<s32> rect(0, 0, 120, 20);
rect += topleft_content + v2s32(40, 195); rect += topleft_content + v2s32(45, 195);
Environment->addStaticText(wgettext("Map Type"), gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Map Type"), rect, false, true, this, -1);
rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_LOWERRIGHT, gui::EGUIA_UPPERLEFT);
} }
{ {
core::rect<s32> rect(0, 0, 240, 30); core::rect<s32> rect(0, 0, 240, 30);
rect += topleft_content + v2s32(120, 190); rect += topleft_content + v2s32(170, 190);
gui::IGUIComboBox *c = Environment->addComboBox(rect, this, GUI_ID_MAP_TYPE_COMBO); gui::IGUIComboBox *c = Environment->addComboBox(rect, this, GUI_ID_MAP_TYPE_COMBO);
u32 m1 = c->addItem(wgettext("Flat"),GUI_ID_MAP_TYPE_FLAT); u32 m1 = c->addItem(wgettext("Flat"),GUI_ID_MAP_TYPE_FLAT);
u32 m2 = c->addItem(wgettext("Flatter"),GUI_ID_MAP_TYPE_FLATTER); u32 m2 = c->addItem(wgettext("Flatter"),GUI_ID_MAP_TYPE_FLATTER);
@ -803,20 +809,20 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
} }
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(70, 230); rect += topleft_content + v2s32(150, 230);
Environment->addCheckBox(use_fixed_seed, rect, this, GUI_ID_MAP_SEED_CB, wgettext("Use Fixed Seed")); Environment->addCheckBox(use_fixed_seed, rect, this, GUI_ID_MAP_SEED_CB, wgettext("Use Fixed Seed"));
} }
if (use_fixed_seed) { if (use_fixed_seed) {
{ {
core::rect<s32> rect(0, 0, 110, 20); core::rect<s32> rect(0, 0, 120, 20);
rect += topleft_content + v2s32(70, 265); rect += topleft_content + v2s32(65, 265);
Environment->addStaticText(wgettext("Map Seed"), gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Map Seed"), rect, false, true, this, -1);
rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_LOWERRIGHT, gui::EGUIA_UPPERLEFT);
} }
changeCtype("C"); changeCtype("C");
{ {
core::rect<s32> rect(0, 0, 190, 30); core::rect<s32> rect(0, 0, 190, 30);
rect += topleft_content + v2s32(140, 260); rect += topleft_content + v2s32(190, 260);
Environment->addEditBox(fixed_seed.c_str(), rect, false, this, GUI_ID_MAP_SEED_INPUT); Environment->addEditBox(fixed_seed.c_str(), rect, false, this, GUI_ID_MAP_SEED_INPUT);
} }
changeCtype(""); changeCtype("");
@ -824,12 +830,12 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
}else{ }else{
{ {
core::rect<s32> rect(0, 0, 200, 30); core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(100, 160); rect += topleft_content + v2s32(150, 160);
Environment->addCheckBox(clear_map, rect, this, GUI_ID_MAP_CLEAR_CB, wgettext("Clear Map")); Environment->addCheckBox(clear_map, rect, this, GUI_ID_MAP_CLEAR_CB, wgettext("Clear Map"));
} }
if (clear_map) { if (clear_map) {
core::rect<s32> rect(0, 0, 300, 40); core::rect<s32> rect(0, 0, 300, 40);
rect += topleft_content + v2s32(70, 190); rect += topleft_content + v2s32(120, 190);
Environment->addStaticText(wgettext("Warning! This will delete all construction from your map!"), Environment->addStaticText(wgettext("Warning! This will delete all construction from your map!"),
rect, false, true, this, -1); rect, false, true, this, -1);
} }
@ -837,19 +843,19 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
// Start game button // Start game button
{ {
core::rect<s32> rect(0, 0, 180, 30); core::rect<s32> rect(0, 0, 180, 30);
rect += topleft_content + v2s32(110, 310); rect += topleft_content + v2s32(185, 310);
Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, wgettext("Start Game")); Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, wgettext("Start Game"));
} }
}else if(m_data->selected_tab == TAB_CREDITS) { }else if(m_data->selected_tab == TAB_CREDITS) {
// CREDITS // CREDITS
{ {
core::rect<s32> rect(0, 0, 400, 20); core::rect<s32> rect(0, 0, 550, 20);
rect += topleft_content + v2s32(0, 20); rect += topleft_content + v2s32(0, 20);
gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Credits"), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Credits"), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
{ {
core::rect<s32> rect(0, 0, 400, 350); core::rect<s32> rect(0, 0, 550, 350);
rect += topleft_content + v2s32(0, 50); rect += topleft_content + v2s32(0, 50);
gui::IGUIStaticText *t = Environment->addStaticText( gui::IGUIStaticText *t = Environment->addStaticText(
wgettext( wgettext(
@ -886,11 +892,11 @@ void GUIMainMenu::drawMenu()
core::rect<s32> left( core::rect<s32> left(
AbsoluteRect.UpperLeftCorner.X, AbsoluteRect.UpperLeftCorner.X,
AbsoluteRect.UpperLeftCorner.Y, AbsoluteRect.UpperLeftCorner.Y,
AbsoluteRect.LowerRightCorner.X-400, AbsoluteRect.LowerRightCorner.X-550,
AbsoluteRect.LowerRightCorner.Y AbsoluteRect.LowerRightCorner.Y
); );
core::rect<s32> right( core::rect<s32> right(
AbsoluteRect.UpperLeftCorner.X+200, AbsoluteRect.UpperLeftCorner.X+250,
AbsoluteRect.UpperLeftCorner.Y, AbsoluteRect.UpperLeftCorner.Y,
AbsoluteRect.LowerRightCorner.X, AbsoluteRect.LowerRightCorner.X,
AbsoluteRect.LowerRightCorner.Y AbsoluteRect.LowerRightCorner.Y
@ -901,9 +907,9 @@ void GUIMainMenu::drawMenu()
if (texture != 0) { if (texture != 0) {
const core::dimension2d<u32>& img_origsize = texture->getOriginalSize(); const core::dimension2d<u32>& img_origsize = texture->getOriginalSize();
core::rect<s32> logo( core::rect<s32> logo(
AbsoluteRect.UpperLeftCorner.X, AbsoluteRect.UpperLeftCorner.X+25,
AbsoluteRect.UpperLeftCorner.Y, AbsoluteRect.UpperLeftCorner.Y,
AbsoluteRect.UpperLeftCorner.X+200, AbsoluteRect.UpperLeftCorner.X+225,
AbsoluteRect.UpperLeftCorner.Y+200 AbsoluteRect.UpperLeftCorner.Y+200
); );
const video::SColor color(255,255,255,255); const video::SColor color(255,255,255,255);

View File

@ -75,6 +75,7 @@ enum {
GUI_ID_MAP_TYPE_MOUNTAINS, GUI_ID_MAP_TYPE_MOUNTAINS,
GUI_ID_MAP_TYPE_CRAZY, GUI_ID_MAP_TYPE_CRAZY,
GUI_ID_MAP_TYPE_CRAZYHILLS, GUI_ID_MAP_TYPE_CRAZYHILLS,
GUI_ID_CHARACTER_CREATOR,
GUI_ID_TAB_SINGLEPLAYER, GUI_ID_TAB_SINGLEPLAYER,
GUI_ID_TAB_MULTIPLAYER, GUI_ID_TAB_MULTIPLAYER,
GUI_ID_TAB_SETTINGS, GUI_ID_TAB_SETTINGS,
@ -116,7 +117,8 @@ struct MainMenuData
clear_map(false), clear_map(false),
use_fixed_seed(false), use_fixed_seed(false),
fixed_seed(L""), fixed_seed(L""),
map_type("default") map_type("default"),
character_creator(false)
{} {}
// These are in the native format of the gui elements // These are in the native format of the gui elements
@ -155,6 +157,8 @@ struct MainMenuData
bool use_fixed_seed; bool use_fixed_seed;
std::wstring fixed_seed; std::wstring fixed_seed;
std:: string map_type; std:: string map_type;
// go to character creator, not the game
bool character_creator;
}; };
class GUIMainMenu : public GUIModalMenu class GUIMainMenu : public GUIModalMenu

View File

@ -748,28 +748,16 @@ int main(int argc, char *argv[])
bool ret = cmd_args.parseCommandLine(argc, argv, allowed_options); bool ret = cmd_args.parseCommandLine(argc, argv, allowed_options);
if(ret == false || cmd_args.getFlag("help")) if (ret == false || cmd_args.getFlag("help")) {
{
dstream<<"Allowed options:"<<std::endl; dstream<<"Allowed options:"<<std::endl;
for(core::map<std::string, ValueSpec>::Iterator for (core::map<std::string, ValueSpec>::Iterator i = allowed_options.getIterator(); i.atEnd() == false; i++) {
i = allowed_options.getIterator();
i.atEnd() == false; i++)
{
dstream<<" --"<<i.getNode()->getKey(); dstream<<" --"<<i.getNode()->getKey();
if(i.getNode()->getValue().type == VALUETYPE_FLAG) if(i.getNode()->getValue().type != VALUETYPE_FLAG)
{
}
else
{
dstream<<" <value>"; dstream<<" <value>";
}
dstream<<std::endl; dstream<<std::endl;
if(i.getNode()->getValue().help != NULL) if (i.getNode()->getValue().help != NULL)
{ dstream<<" "<<i.getNode()->getValue().help<<std::endl;
dstream<<" "<<i.getNode()->getValue().help
<<std::endl;
}
} }
return cmd_args.getFlag("help") ? 0 : 1; return cmd_args.getFlag("help") ? 0 : 1;
@ -781,11 +769,11 @@ int main(int argc, char *argv[])
bool disable_stderr = false; bool disable_stderr = false;
#ifdef _WIN32 #ifdef _WIN32
if(cmd_args.getFlag("dstream-on-stderr") == false) if (cmd_args.getFlag("dstream-on-stderr") == false)
disable_stderr = true; disable_stderr = true;
#endif #endif
if(cmd_args.getFlag("info-on-stderr")) if (cmd_args.getFlag("info-on-stderr"))
log_add_output(&main_stderr_log_out, LMT_INFO); log_add_output(&main_stderr_log_out, LMT_INFO);
porting::signal_handler_init(); porting::signal_handler_init();
@ -841,19 +829,15 @@ int main(int argc, char *argv[])
// Path of configuration file in use // Path of configuration file in use
std::string configpath = ""; std::string configpath = "";
if(cmd_args.exists("config")) if (cmd_args.exists("config")) {
{
bool r = g_settings->readConfigFile(cmd_args.get("config").c_str()); bool r = g_settings->readConfigFile(cmd_args.get("config").c_str());
if(r == false) if (r == false) {
{
errorstream<<"Could not read configuration from \"" errorstream<<"Could not read configuration from \""
<<cmd_args.get("config")<<"\""<<std::endl; <<cmd_args.get("config")<<"\""<<std::endl;
return 1; return 1;
} }
configpath = cmd_args.get("config"); configpath = cmd_args.get("config");
} }else{
else
{
core::array<std::string> filenames; core::array<std::string> filenames;
filenames.push_back(porting::path_userdata + filenames.push_back(porting::path_userdata +
DIR_DELIM + "voxelands.conf"); DIR_DELIM + "voxelands.conf");
@ -862,18 +846,16 @@ int main(int argc, char *argv[])
DIR_DELIM + ".." + DIR_DELIM + "voxelands.conf"); DIR_DELIM + ".." + DIR_DELIM + "voxelands.conf");
#endif #endif
for(u32 i=0; i<filenames.size(); i++) for (u32 i=0; i<filenames.size(); i++) {
{
bool r = g_settings->readConfigFile(filenames[i].c_str()); bool r = g_settings->readConfigFile(filenames[i].c_str());
if(r) if (r) {
{
configpath = filenames[i]; configpath = filenames[i];
break; break;
} }
} }
// If no path found, use the first one (menu creates the file) // If no path found, use the first one (menu creates the file)
if(configpath == "") if (configpath == "")
configpath = filenames[0]; configpath = filenames[0];
} }
@ -904,11 +886,11 @@ int main(int argc, char *argv[])
Run unit tests Run unit tests
*/ */
if((ENABLE_TESTS && cmd_args.getFlag("disable-unittests") == false) if (
|| cmd_args.getFlag("enable-unittests") == true) (ENABLE_TESTS && cmd_args.getFlag("disable-unittests") == false)
{ || cmd_args.getFlag("enable-unittests") == true
)
run_tests(); run_tests();
}
/*for(s16 y=-100; y<100; y++) /*for(s16 y=-100; y<100; y++)
for(s16 x=-100; x<100; x++) for(s16 x=-100; x<100; x++)
@ -923,23 +905,24 @@ int main(int argc, char *argv[])
// Port // Port
u16 port = 30000; u16 port = 30000;
if(cmd_args.exists("port")) if (cmd_args.exists("port")) {
port = cmd_args.getU16("port"); port = cmd_args.getU16("port");
else if(g_settings->exists("port")) }else if (g_settings->exists("port")) {
port = g_settings->getU16("port"); port = g_settings->getU16("port");
if(port == 0) }
if (port == 0)
port = 30000; port = 30000;
// Map directory // Map directory
std::string map_dir = porting::path_userdata+DIR_DELIM+"world"; std::string map_dir = porting::path_userdata+DIR_DELIM+"world";
if(cmd_args.exists("map-dir")) if (cmd_args.exists("map-dir")) {
map_dir = cmd_args.get("map-dir"); map_dir = cmd_args.get("map-dir");
else if(g_settings->exists("map-dir")) }else if (g_settings->exists("map-dir")) {
map_dir = g_settings->get("map-dir"); map_dir = g_settings->get("map-dir");
}
// Run dedicated server if asked to // Run dedicated server if asked to
if(cmd_args.getFlag("server")) if (cmd_args.getFlag("server")) {
{
DSTACK("Dedicated server branch"); DSTACK("Dedicated server branch");
// Create time getter // Create time getter
@ -963,12 +946,9 @@ int main(int argc, char *argv[])
// Address to connect to // Address to connect to
std::string address = ""; std::string address = "";
if(cmd_args.exists("address")) if (cmd_args.exists("address")) {
{
address = cmd_args.get("address"); address = cmd_args.get("address");
} }else{
else
{
address = g_settings->get("address"); address = g_settings->get("address");
} }
@ -996,20 +976,19 @@ int main(int argc, char *argv[])
std::string driverstring = g_settings->get("video_driver"); std::string driverstring = g_settings->get("video_driver");
if(driverstring == "null") if (driverstring == "null") {
driverType = video::EDT_NULL; driverType = video::EDT_NULL;
else if(driverstring == "software") }else if (driverstring == "software") {
driverType = video::EDT_SOFTWARE; driverType = video::EDT_SOFTWARE;
else if(driverstring == "burningsvideo") }else if (driverstring == "burningsvideo") {
driverType = video::EDT_BURNINGSVIDEO; driverType = video::EDT_BURNINGSVIDEO;
else if(driverstring == "direct3d8") }else if (driverstring == "direct3d8") {
driverType = video::EDT_DIRECT3D8; driverType = video::EDT_DIRECT3D8;
else if(driverstring == "direct3d9") }else if (driverstring == "direct3d9") {
driverType = video::EDT_DIRECT3D9; driverType = video::EDT_DIRECT3D9;
else if(driverstring == "opengl") }else if (driverstring == "opengl") {
driverType = video::EDT_OPENGL; driverType = video::EDT_OPENGL;
else }else{
{
errorstream<<"WARNING: Invalid video_driver specified; defaulting " errorstream<<"WARNING: Invalid video_driver specified; defaulting "
"to opengl"<<std::endl; "to opengl"<<std::endl;
driverType = video::EDT_OPENGL; driverType = video::EDT_OPENGL;
@ -1074,8 +1053,7 @@ int main(int argc, char *argv[])
/* /*
Speed tests (done after irrlicht is loaded to get timer) Speed tests (done after irrlicht is loaded to get timer)
*/ */
if(cmd_args.getFlag("speedtests")) if (cmd_args.getFlag("speedtests")) {
{
dstream<<"Running speed tests"<<std::endl; dstream<<"Running speed tests"<<std::endl;
SpeedTests(); SpeedTests();
return 0; return 0;
@ -1086,21 +1064,22 @@ int main(int argc, char *argv[])
bool random_input = g_settings->getBool("random_input") bool random_input = g_settings->getBool("random_input")
|| cmd_args.getFlag("random-input"); || cmd_args.getFlag("random-input");
InputHandler *input = NULL; InputHandler *input = NULL;
if(random_input) if (random_input) {
input = new RandomInputHandler(); input = new RandomInputHandler();
else }else{
input = new RealInputHandler(device, &receiver); input = new RealInputHandler(device, &receiver);
}
scene::ISceneManager* smgr = device->getSceneManager(); scene::ISceneManager* smgr = device->getSceneManager();
guienv = device->getGUIEnvironment(); guienv = device->getGUIEnvironment();
gui::IGUISkin* skin = guienv->getSkin(); gui::IGUISkin* skin = guienv->getSkin();
gui::IGUIFont* font = guienv->getFont(getTexturePath("fontlucida.png").c_str()); gui::IGUIFont* font = guienv->getFont(getTexturePath("fontlucida.png").c_str());
if(font) if (font) {
skin->setFont(font); skin->setFont(font);
else }else{
errorstream<<"WARNING: Font file was not found." errorstream<<"WARNING: Font file was not found. Using default font."<<std::endl;
" Using default font."<<std::endl; }
// If font was not found, this will get us one // If font was not found, this will get us one
font = skin->getFont(); font = skin->getFont();
assert(font); assert(font);
@ -1146,15 +1125,16 @@ int main(int argc, char *argv[])
// The password entered during the menu screen, // The password entered during the menu screen,
std::string password; std::string password;
// if there's no chardef then put the player directly into the character creator
bool character_creator = !g_settings->exists("character_definition");
/* /*
Menu-game loop Menu-game loop
*/ */
while(device->run() && kill == false) while (device->run() && kill == false) {
{
// This is used for catching disconnects // This is used for catching disconnects
try try{
{
/* /*
Clear everything from the GUIEnvironment Clear everything from the GUIEnvironment
@ -1166,16 +1146,14 @@ int main(int argc, char *argv[])
custom gui elements directly on the screen. custom gui elements directly on the screen.
Otherwise they won't be automatically drawn. Otherwise they won't be automatically drawn.
*/ */
guiroot = guienv->addStaticText(L"", guiroot = guienv->addStaticText(L"",core::rect<s32>(0, 0, 10000, 10000));
core::rect<s32>(0, 0, 10000, 10000));
/* /*
Out-of-game menu loop. Out-of-game menu loop.
Loop quits when menu returns proper parameters. Loop quits when menu returns proper parameters.
break out immediately if we should be in the character creator
*/ */
while(kill == false) while (kill == false && character_creator == false) {
{
// Cursor can be non-visible when coming from the game // Cursor can be non-visible when coming from the game
device->getCursorControl()->setVisible(true); device->getCursorControl()->setVisible(true);
// Some stuff are left to scene manager when coming from the game // Some stuff are left to scene manager when coming from the game
@ -1223,8 +1201,7 @@ int main(int argc, char *argv[])
&g_menumgr, &menudata, g_gamecallback); &g_menumgr, &menudata, g_gamecallback);
menu->allowFocusRemoval(true); menu->allowFocusRemoval(true);
if(error_message != L"") if (error_message != L"") {
{
errorstream<<"error_message = " errorstream<<"error_message = "
<<wide_to_narrow(error_message)<<std::endl; <<wide_to_narrow(error_message)<<std::endl;
@ -1239,9 +1216,8 @@ int main(int argc, char *argv[])
infostream<<"Created main menu"<<std::endl; infostream<<"Created main menu"<<std::endl;
while(device->run() && kill == false) while (device->run() && kill == false) {
{ if (menu->getStatus() == true)
if(menu->getStatus() == true)
break; break;
//driver->beginScene(true, true, video::SColor(255,0,0,0)); //driver->beginScene(true, true, video::SColor(255,0,0,0));
@ -1259,13 +1235,18 @@ int main(int argc, char *argv[])
} }
// Break out of menu-game loop to shut down cleanly // Break out of menu-game loop to shut down cleanly
if(device->run() == false || kill == true) if (device->run() == false || kill == true)
break; break;
infostream<<"Dropping main menu"<<std::endl; infostream<<"Dropping main menu"<<std::endl;
menu->drop(); menu->drop();
character_creator = menudata.character_creator;
if (character_creator)
break;
// Delete map if requested // Delete map if requested
if (menudata.delete_map) { if (menudata.delete_map) {
bool r = fs::RecursiveDeleteContent(map_dir); bool r = fs::RecursiveDeleteContent(map_dir);
@ -1293,7 +1274,7 @@ int main(int argc, char *argv[])
address = wide_to_narrow(menudata.address); address = wide_to_narrow(menudata.address);
int newport = mywstoi(menudata.port); int newport = mywstoi(menudata.port);
if(newport != 0) if (newport != 0)
port = newport; port = newport;
g_settings->set("new_style_leaves", itos(menudata.fancy_trees)); g_settings->set("new_style_leaves", itos(menudata.fancy_trees));
g_settings->set("smooth_lighting", itos(menudata.smooth_lighting)); g_settings->set("smooth_lighting", itos(menudata.smooth_lighting));
@ -1320,7 +1301,7 @@ int main(int argc, char *argv[])
g_settings->set("address", address); g_settings->set("address", address);
g_settings->set("port", itos(port)); g_settings->set("port", itos(port));
// Update configuration file // Update configuration file
if(configpath != "") if (configpath != "")
g_settings->updateConfigFile(configpath.c_str()); g_settings->updateConfigFile(configpath.c_str());
// Continue to game // Continue to game
@ -1328,9 +1309,13 @@ int main(int argc, char *argv[])
} }
// Break out of menu-game loop to shut down cleanly // Break out of menu-game loop to shut down cleanly
if(device->run() == false) if (device->run() == false)
break; break;
if (character_creator) {
character_creator = false;
continue;
}
// Initialize mapnode again to enable changed graphics settings // Initialize mapnode again to enable changed graphics settings
init_mapnode(driver); init_mapnode(driver);