void init() { { std::string szMenuText = getLocalised("system_menus_options_video"); TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(0, 0)); me->clicked = boost::bind(&OptionsMenuPage::onClickedVideo, this); me->m_targetMenu = OPTIONS_VIDEO; addCenter(me, true); } { std::string szMenuText = getLocalised("system_menus_options_audio"); TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(0, 0)); me->m_targetMenu = OPTIONS_AUDIO; addCenter(me, true); } { std::string szMenuText = getLocalised("system_menus_options_input"); TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(0, 0)); me->m_targetMenu = OPTIONS_INPUT; addCenter(me, true); } { ButtonWidget * cb = new ButtonWidget(RATIO_2(Vec2i(20, 380)), "graph/interface/menus/back"); cb->m_targetMenu = MAIN; cb->SetShortCut(Keyboard::Key_Escape); add(cb); } }
void init() { { std::string szMenuText = getLocalised("system_menus_main_editquest_load"); TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(0, 0)); me->clicked = boost::bind(&ChooseLoadOrSaveMenuPage::onClickLoad, this); me->m_targetMenu = EDIT_QUEST_LOAD; me->m_savegame = SavegameHandle::Invalid; addCenter(me, true); } { std::string szMenuText = getLocalised( "system_menus_main_editquest_save"); TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(0, 0)); me->m_targetMenu = EDIT_QUEST_SAVE; if(!ARXMenu_CanResumeGame()) { me->SetCheckOff(); me->lColor = Color(127, 127, 127); } addCenter(me, true); } { ButtonWidget * cb = new ButtonWidget(RATIO_2(Vec2i(20, 380)), "graph/interface/menus/back"); cb->m_targetMenu = MAIN; cb->SetShortCut(Keyboard::Key_Escape); add(cb); } }
void CharacterCreation::loadData() { BookBackground = TextureContainer::LoadUI("graph/interface/book/character_sheet/char_creation_bg", TextureContainer::NoColorKey); str_button_quickgen = getLocalised("system_charsheet_button_quickgen"); str_button_skin = getLocalised("system_charsheet_button_skin"); str_button_done = getLocalised("system_charsheet_button_done"); // TODO unused button descriptions, readd ? // getLocalised("system_charsheet_quickgenerate"); // getLocalised("system_charsheet_done"); // getLocalised("system_charsheet_skin"); }
void init() { { ButtonWidget * cb = new ButtonWidget(Vec2i(0, 0), "graph/interface/icons/menu_main_save"); cb->SetCheckOff(); addCenter(cb, true); } { std::string szMenuText = getLocalised("system_menu_editquest_newsavegame", "---"); TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(RATIO_X(20), 0)); me->m_savegame = SavegameHandle::Invalid; me->eState=EDIT; me->ePlace=CENTER; addCenter(me, true); } HorizontalPanelWidget * pPanel = new HorizontalPanelWidget; // Delete button { std::string szMenuText = getLocalised("system_menus_main_editquest_delete"); TextWidget * me = new TextWidget(BUTTON_MENUEDITQUEST_DELETE, hFontMenu, szMenuText, Vec2i(0, 0)); me->m_targetMenu = EDIT_QUEST_SAVE; me->SetPos(Vec2i(RATIO_X(m_size.x-10)-me->m_rect.width(), RATIO_Y(5))); me->lOldColor = me->lColor; pPanel->AddElementNoCenterIn(me); pDeleteButton = me; } // Save button { std::string szMenuText = getLocalised("system_menus_main_editquest_save"); TextWidget * me = new TextWidget(BUTTON_MENUEDITQUEST_SAVE, hFontMenu, szMenuText, Vec2i(0, 0)); me->m_targetMenu = MAIN; me->SetPos(Vec2i(RATIO_X(m_size.x-10)-me->m_rect.width(), RATIO_Y(380))); pPanel->AddElementNoCenterIn(me); } // Back button { ButtonWidget * cb = new ButtonWidget(RATIO_2(Vec2i(20, 380)), "graph/interface/menus/back"); cb->m_targetMenu = EDIT_QUEST_SAVE; cb->SetShortCut(Keyboard::Key_Escape); pPanel->AddElementNoCenterIn(cb); } add(pPanel); }
static Font * createFont(const res::path & fontFace, const std::string & configSizeKey, unsigned int fontSize, float scaleFactor) { arx_assert(fontSize > 0); arx_assert(scaleFactor > 0.f); arx_assert(scaleFactor < 1000.f); // TODO better maximum try { std::string szFontSize = boost::lexical_cast<std::string>(fontSize); std::string configSize = getLocalised(configSizeKey, szFontSize); fontSize = boost::lexical_cast<unsigned int>(configSize); } catch(const boost::bad_lexical_cast &) { LogError << "Invalid font size for: " << configSizeKey; } fontSize *= scaleFactor; Font * newFont = FontCache::getFont(fontFace, fontSize); if(!newFont) { LogError << "Error loading font: " << fontFace << " of size " << fontSize; } return newFont; }
void init() { { std::string szMenuText = getLocalised("system_menus_main_editquest_confirm"); TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText); me->SetCheckOff(); addCenter(me, true); } { std::string szMenuText = getLocalised("system_menus_main_newquest_confirm"); TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText); me->SetCheckOff(); addCenter(me, true); } HorizontalPanelWidget * pPanel = new HorizontalPanelWidget; { std::string szMenuText = getLocalised("system_yes"); szMenuText += " "; // TODO This space can probably go TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText); me->clicked = boost::bind(ARXMenu_NewQuest); me->SetPos(Vec2i(RATIO_X(m_size.x - (me->m_rect.width() + 10)), 0)); pPanel->AddElementNoCenterIn(me); } { std::string szMenuText = getLocalised("system_no"); TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(RATIO_X(10), 0)); me->m_targetMenu = MAIN; me->SetShortCut(Keyboard::Key_Escape); pPanel->AddElementNoCenterIn(me); } pPanel->Move(Vec2i(0, RATIO_Y(380))); add(pPanel); }
void MiniMap::mapMarkerAdd(float x, float y, int lvl, const std::string &name) { int num = mapMarkerGetID(name); if(num >= 0) { // Already exists, update it m_mapMarkers[num].m_lvl = lvl; m_mapMarkers[num].m_x = x; m_mapMarkers[num].m_y = y; return; } // Else, create one MapMarkerData newMMD; newMMD.m_lvl = lvl; newMMD.m_x = x; newMMD.m_y = y; newMMD.m_name = name; newMMD.m_text = getLocalised(name); m_mapMarkers.push_back(newMMD); }
void spellDataInit() { for(size_t i = 0; i < SPELL_TYPES_COUNT; i++) { // TODO use constructor for initialization for(long j = 0; j < 6; j++) spellicons[i].symbols[j] = RUNE_NONE; spellicons[i].level = 0; spellicons[i].spellid = SPELL_NONE; spellicons[i].tc = NULL; spellicons[i].bSecret = false; spellicons[i].m_hasDuration = true; spellicons[i].bAudibleAtStart = false; } { // Magic_Sight Level 1 SPELL_ICON & s = spellicons[SPELL_MAGIC_SIGHT]; s.name = getLocalised("system_spell_name_magic_sight"); s.description = getLocalised("system_spell_description_magic_sight"); s.level=1; s.spellid=SPELL_MAGIC_SIGHT; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_magic_sight"); s.symbols[0]=RUNE_MEGA; s.symbols[1]=RUNE_VISTA; } { // Magic_Missile Level 1 SPELL_ICON & s = spellicons[SPELL_MAGIC_MISSILE]; s.name = getLocalised("system_spell_name_magic_projectile"); s.description = getLocalised("system_spell_description_magic_projectile"); s.level=1; s.spellid=SPELL_MAGIC_MISSILE; s.m_hasDuration = false; s.bAudibleAtStart = true; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_magic_missile"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_TAAR; } { // Ignit Level 1 SPELL_ICON & s = spellicons[SPELL_IGNIT]; s.name = getLocalised("system_spell_name_ignit"); s.description = getLocalised("system_spell_description_ignit"); s.level=1; s.spellid=SPELL_IGNIT; s.m_hasDuration = false; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_ignite"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_YOK; } { // Douse Level 1 SPELL_ICON & s = spellicons[SPELL_DOUSE]; s.name = getLocalised("system_spell_name_douse"); s.description = getLocalised("system_spell_description_douse"); s.level=1; s.spellid=SPELL_DOUSE; s.m_hasDuration = false; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_douse"); s.symbols[0]=RUNE_NHI; s.symbols[1]=RUNE_YOK; } { // Activate_Portal Level 1 SPELL_ICON & s = spellicons[SPELL_ACTIVATE_PORTAL]; s.name = getLocalised("system_spell_name_activate_portal"); s.description = getLocalised("system_spell_description_activate_portal"); s.level=1; s.spellid=SPELL_ACTIVATE_PORTAL; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_activate_portal"); s.symbols[0]=RUNE_MEGA; s.symbols[1]=RUNE_SPACIUM; s.bSecret = true; } { // Heal Level 2 SPELL_ICON & s = spellicons[SPELL_HEAL]; s.name = getLocalised("system_spell_name_heal"); s.description = getLocalised("system_spell_description_heal"); s.level=2; s.spellid=SPELL_HEAL; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_heal"); s.symbols[0]=RUNE_MEGA; s.symbols[1]=RUNE_VITAE; } { // Detect_trap Level 2 SPELL_ICON & s = spellicons[SPELL_DETECT_TRAP]; s.name = getLocalised("system_spell_name_detect_trap"); s.description = getLocalised("system_spell_description_detect_trap"); s.level=2; s.spellid=SPELL_DETECT_TRAP; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_detect_trap"); s.symbols[0]=RUNE_MORTE; s.symbols[1]=RUNE_COSUM; s.symbols[2]=RUNE_VISTA; } { // Armor Level 2 SPELL_ICON & s = spellicons[SPELL_ARMOR]; s.name = getLocalised("system_spell_name_armor"); s.description = getLocalised("system_spell_description_armor"); s.level=2; s.spellid=SPELL_ARMOR; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_armor"); s.symbols[0]=RUNE_MEGA; s.symbols[1]=RUNE_KAOM; } { // Lower Armor Level 2 SPELL_ICON & s = spellicons[SPELL_LOWER_ARMOR]; s.name = getLocalised("system_spell_name_lower_armor"); s.description = getLocalised("system_spell_description_lower_armor"); s.level=2; s.spellid=SPELL_LOWER_ARMOR; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_lower_armor"); s.symbols[0]=RUNE_RHAA; s.symbols[1]=RUNE_KAOM; } { // Harm Level 2 SPELL_ICON & s = spellicons[SPELL_HARM]; s.name = getLocalised("system_spell_name_harm"); s.description = getLocalised("system_spell_description_harm"); s.level=2; s.spellid=SPELL_HARM; s.bAudibleAtStart = true; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_harm"); s.symbols[0]=RUNE_RHAA; s.symbols[1]=RUNE_VITAE; s.bSecret = true; } { // Speed Level 3 SPELL_ICON & s = spellicons[SPELL_SPEED]; s.name = getLocalised("system_spell_name_speed"); s.description = getLocalised("system_spell_description_speed"); s.level=3; s.spellid=SPELL_SPEED; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_speed"); s.symbols[0]=RUNE_MEGA; s.symbols[1]=RUNE_MOVIS; } { // Reveal Level 3 SPELL_ICON & s = spellicons[SPELL_DISPELL_ILLUSION]; s.name = getLocalised("system_spell_name_reveal"); s.description = getLocalised("system_spell_description_reveal"); s.level=3; s.spellid=SPELL_DISPELL_ILLUSION; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_reveal"); s.symbols[0]=RUNE_NHI; s.symbols[1]=RUNE_STREGUM; s.symbols[2]=RUNE_VISTA; } { // Fireball Level 3 SPELL_ICON & s = spellicons[SPELL_FIREBALL]; s.name = getLocalised("system_spell_name_fireball"); s.description = getLocalised("system_spell_description_fireball"); s.level=3; s.spellid=SPELL_FIREBALL; s.m_hasDuration = false; s.bAudibleAtStart = true; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_fireball"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_YOK; s.symbols[2]=RUNE_TAAR; } { // Create Food Level 3 SPELL_ICON & s = spellicons[SPELL_CREATE_FOOD]; s.name = getLocalised("system_spell_name_create_food"); s.description = getLocalised("system_spell_description_create_food"); s.level=3; s.spellid=SPELL_CREATE_FOOD; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_create_food"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_VITAE; s.symbols[2]=RUNE_COSUM; } { // Ice Projectile Level 3 SPELL_ICON & s = spellicons[SPELL_ICE_PROJECTILE]; s.name = getLocalised("system_spell_name_ice_projectile"); s.description = getLocalised("system_spell_description_ice_projectile"); s.level=3; s.spellid=SPELL_ICE_PROJECTILE; s.m_hasDuration = false; s.bAudibleAtStart = true; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_iceball"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_FRIDD; s.symbols[2]=RUNE_TAAR; s.bSecret = true; } { // Bless Level 4 SPELL_ICON & s = spellicons[SPELL_BLESS]; s.name = getLocalised("system_spell_name_sanctify"); s.description = getLocalised("system_spell_description_sanctify"); s.level=4; s.spellid=SPELL_BLESS; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_bless"); s.symbols[0]=RUNE_MEGA; s.symbols[1]=RUNE_STREGUM; s.symbols[2]=RUNE_VITAE; } { // Dispel_Field Level 4 SPELL_ICON & s = spellicons[SPELL_DISPELL_FIELD]; s.name = getLocalised("system_spell_name_dispell_field"); s.description = getLocalised("system_spell_description_dispell_field"); s.level=4; s.spellid=SPELL_DISPELL_FIELD; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_dispell_field"); s.symbols[0]=RUNE_NHI; s.symbols[1]=RUNE_SPACIUM; } { // Cold Protection Level 4 SPELL_ICON & s = spellicons[SPELL_COLD_PROTECTION]; s.name = getLocalised("system_spell_name_cold_protection"); s.description = getLocalised("system_spell_description_cold_protection"); s.level=4; s.spellid=SPELL_COLD_PROTECTION; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_protection_cold"); s.symbols[0]=RUNE_FRIDD; s.symbols[1]=RUNE_KAOM; s.bSecret = true; } { // Fire Protection Level 4 SPELL_ICON & s = spellicons[SPELL_FIRE_PROTECTION]; s.name = getLocalised("system_spell_name_fire_protection"); s.description = getLocalised("system_spell_description_fire_protection"); s.level=4; s.spellid=SPELL_FIRE_PROTECTION; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_protection_fire"); s.symbols[0]=RUNE_YOK; s.symbols[1]=RUNE_KAOM; } { // Telekinesis Level 4 SPELL_ICON & s = spellicons[SPELL_TELEKINESIS]; s.name = getLocalised("system_spell_name_telekinesis"); s.description = getLocalised("system_spell_description_telekinesis"); s.level=4; s.spellid=SPELL_TELEKINESIS; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_telekinesis"); s.symbols[0]=RUNE_SPACIUM; s.symbols[1]=RUNE_COMUNICATUM; } { // Curse Level 4 SPELL_ICON & s = spellicons[SPELL_CURSE]; s.name = getLocalised("system_spell_name_curse"); s.description = getLocalised("system_spell_description_curse"); s.level=4; s.spellid=SPELL_CURSE; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_curse"); s.symbols[0]=RUNE_RHAA; s.symbols[1]=RUNE_STREGUM; s.symbols[2]=RUNE_VITAE; s.bSecret = true; } { // Rune of Guarding Level 5 SPELL_ICON & s = spellicons[SPELL_RUNE_OF_GUARDING]; s.name = getLocalised("system_spell_name_rune_guarding"); s.description = getLocalised("system_spell_description_rune_guarding"); s.level=5; s.spellid=SPELL_RUNE_OF_GUARDING; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_rune_guarding"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_MORTE; s.symbols[2]=RUNE_COSUM; } { // Levitate Level 5 SPELL_ICON & s = spellicons[SPELL_LEVITATE]; s.name = getLocalised("system_spell_name_levitate"); s.description = getLocalised("system_spell_description_levitate"); s.level=5; s.spellid=SPELL_LEVITATE; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_levitate"); s.symbols[0]=RUNE_MEGA; s.symbols[1]=RUNE_SPACIUM; s.symbols[2]=RUNE_MOVIS; } { // Cure Poison Level 5 SPELL_ICON & s = spellicons[SPELL_CURE_POISON]; s.name = getLocalised("system_spell_name_cure_poison"); s.description = getLocalised("system_spell_description_cure_poison"); s.level=5; s.spellid=SPELL_CURE_POISON; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_cure_poison"); s.symbols[0]=RUNE_NHI; s.symbols[1]=RUNE_CETRIUS; } { // Repel Undead Level 5 SPELL_ICON & s = spellicons[SPELL_REPEL_UNDEAD]; s.name = getLocalised("system_spell_name_repel_undead"); s.description = getLocalised("system_spell_description_repel_undead"); s.level=5; s.spellid=SPELL_REPEL_UNDEAD; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_repel_undead"); s.symbols[0]=RUNE_MORTE; s.symbols[1]=RUNE_KAOM; } { // Poison Projection Level 5 SPELL_ICON & s = spellicons[SPELL_POISON_PROJECTILE]; s.name = getLocalised("system_spell_name_poison_projection"); s.description = getLocalised("system_spell_description_poison_projection"); s.level=5; s.spellid=SPELL_POISON_PROJECTILE; s.m_hasDuration = false; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_poison_projection"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_CETRIUS; s.symbols[2]=RUNE_TAAR; s.bSecret = true; } { // Raise Dead Level 6 SPELL_ICON & s = spellicons[SPELL_RISE_DEAD]; s.name = getLocalised("system_spell_name_raise_dead"); s.description = getLocalised("system_spell_description_raise_dead"); s.level=6; s.spellid=SPELL_RISE_DEAD; s.bAudibleAtStart = true; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_raise_dead"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_MORTE; s.symbols[2]=RUNE_VITAE; } { // Paralyse Dead Level 6 SPELL_ICON & s = spellicons[SPELL_PARALYSE]; s.name = getLocalised("system_spell_name_paralyse"); s.description = getLocalised("system_spell_description_paralyse"); s.level=6; s.spellid=SPELL_PARALYSE; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_paralyse"); s.symbols[0]=RUNE_NHI; s.symbols[1]=RUNE_MOVIS; } { // Create Field Dead Level 6 SPELL_ICON & s = spellicons[SPELL_CREATE_FIELD]; s.name = getLocalised("system_spell_name_create_field"); s.description = getLocalised("system_spell_description_create_field"); s.level=6; s.spellid=SPELL_CREATE_FIELD; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_create_field"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_KAOM; s.symbols[2]=RUNE_SPACIUM; } { // Disarm Trap Level 6 SPELL_ICON & s = spellicons[SPELL_DISARM_TRAP]; s.name = getLocalised("system_spell_name_disarm_trap"); s.description = getLocalised("system_spell_description_disarm_trap"); s.level=6; s.spellid=SPELL_DISARM_TRAP; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_disarm_trap"); s.symbols[0]=RUNE_NHI; s.symbols[1]=RUNE_MORTE; s.symbols[2]=RUNE_COSUM; } { // Slow_Down Level 6 // SECRET SPELL SPELL_ICON & s = spellicons[SPELL_SLOW_DOWN]; s.name = getLocalised("system_spell_name_slowdown"); s.description = getLocalised("system_spell_description_slowdown"); s.level=6; s.spellid=SPELL_SLOW_DOWN; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_slow_down"); s.symbols[0]=RUNE_RHAA; s.symbols[1]=RUNE_MOVIS; s.bSecret = true; } { // Flying Eye Level 7 SPELL_ICON & s = spellicons[SPELL_FLYING_EYE]; s.name = getLocalised("system_spell_name_flying_eye"); s.description = getLocalised("system_spell_description_flying_eye"); s.level=7; s.spellid=SPELL_FLYING_EYE; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_flying_eye"); s.symbols[0]=RUNE_VISTA; s.symbols[1]=RUNE_MOVIS; } { // Fire Field Eye Level 7 SPELL_ICON & s = spellicons[SPELL_FIRE_FIELD]; s.name = getLocalised("system_spell_name_fire_field"); s.description = getLocalised("system_spell_description_fire_field"); s.level=7; s.spellid=SPELL_FIRE_FIELD; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_create_fire_field"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_YOK; s.symbols[2]=RUNE_SPACIUM; } { // Ice Field Level 7 SPELL_ICON & s = spellicons[SPELL_ICE_FIELD]; s.name = getLocalised("system_spell_name_ice_field"); s.description = getLocalised("system_spell_description_ice_field"); s.level=7; s.spellid=SPELL_ICE_FIELD; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_create_cold_field"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_FRIDD; s.symbols[2]=RUNE_SPACIUM; s.bSecret = true; } { // Lightning Strike Level 7 SPELL_ICON & s = spellicons[SPELL_LIGHTNING_STRIKE]; s.name = getLocalised("system_spell_name_lightning_strike"); s.description = getLocalised("system_spell_description_lightning_strike"); s.level=7; s.spellid=SPELL_LIGHTNING_STRIKE; s.m_hasDuration = false; s.bAudibleAtStart = true; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_lightning_strike"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_FOLGORA; s.symbols[2]=RUNE_TAAR; } { // Confusion Level 7 SPELL_ICON & s = spellicons[SPELL_CONFUSE]; s.name = getLocalised("system_spell_name_confuse"); s.description = getLocalised("system_spell_description_confuse"); s.level=7; s.spellid=SPELL_CONFUSE; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_confuse"); s.symbols[0]=RUNE_RHAA; s.symbols[1]=RUNE_VISTA; } { // Invisibility Level 8 SPELL_ICON & s = spellicons[SPELL_INVISIBILITY]; s.name = getLocalised("system_spell_name_invisibility"); s.description = getLocalised("system_spell_description_invisibility"); s.level=8; s.spellid=SPELL_INVISIBILITY; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_invisibility"); s.symbols[0]=RUNE_NHI; s.symbols[1]=RUNE_VISTA; } { // Mana Drain Level 8 SPELL_ICON & s = spellicons[SPELL_MANA_DRAIN]; s.name = getLocalised("system_spell_name_mana_drain"); s.description = getLocalised("system_spell_description_mana_drain"); s.level=8; s.spellid=SPELL_MANA_DRAIN; s.bAudibleAtStart = true; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_drain_mana"); s.symbols[0]=RUNE_STREGUM; s.symbols[1]=RUNE_MOVIS; } { // Explosion Level 8 SPELL_ICON & s = spellicons[SPELL_EXPLOSION]; s.name = getLocalised("system_spell_name_explosion"); s.description = getLocalised("system_spell_description_explosion"); s.level=8; s.spellid=SPELL_EXPLOSION; s.m_hasDuration = false; s.bAudibleAtStart = true; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_explosion"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_MEGA; s.symbols[2]=RUNE_MORTE; } { // Enchant Weapon Level 8 SPELL_ICON & s = spellicons[SPELL_ENCHANT_WEAPON]; s.name = getLocalised("system_spell_name_enchant_weapon"); s.description = getLocalised("system_spell_description_enchant_weapon"); s.level=8; s.spellid=SPELL_ENCHANT_WEAPON; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_enchant_weapon"); s.symbols[0]=RUNE_MEGA; s.symbols[1]=RUNE_STREGUM; s.symbols[2]=RUNE_COSUM; } { // Life Drain Level 8 // SECRET SPELL SPELL_ICON & s = spellicons[SPELL_LIFE_DRAIN]; s.name = getLocalised("system_spell_name_life_drain"); s.description = getLocalised("system_spell_description_life_drain"); s.level=8; s.spellid=SPELL_LIFE_DRAIN; s.bAudibleAtStart = true; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_drain_life"); s.symbols[0]=RUNE_VITAE; s.symbols[1]=RUNE_MOVIS; s.bSecret = true; } { // Summon Creature Level 9 SPELL_ICON & s = spellicons[SPELL_SUMMON_CREATURE]; s.name = getLocalised("system_spell_name_summon_creature"); s.description = getLocalised("system_spell_description_summon_creature"); s.level=9; s.spellid=SPELL_SUMMON_CREATURE; s.bAudibleAtStart = true; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_summon_creature"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_VITAE; s.symbols[2]=RUNE_TERA; } { // FAKE Summon Creature Level 9 SPELL_ICON & s = spellicons[SPELL_FAKE_SUMMON]; s.name = getLocalised("system_spell_name_summon_creature"); s.description = getLocalised("system_spell_description_summon_creature"); s.level=9; s.spellid=SPELL_FAKE_SUMMON; s.bAudibleAtStart = true; s.bSecret = true; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_summon_creature"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_VITAE; s.symbols[2]=RUNE_TERA; } { // Negate Magic Level 9 SPELL_ICON & s = spellicons[SPELL_NEGATE_MAGIC]; s.name = getLocalised("system_spell_name_negate_magic"); s.description = getLocalised("system_spell_description_negate_magic"); s.level=9; s.spellid=SPELL_NEGATE_MAGIC; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_negate_magic"); s.symbols[0]=RUNE_NHI; s.symbols[1]=RUNE_STREGUM; s.symbols[2]=RUNE_SPACIUM; } { // Incinerate Level 9 SPELL_ICON & s = spellicons[SPELL_INCINERATE]; s.name = getLocalised("system_spell_name_incinerate"); s.description = getLocalised("system_spell_description_incinerate"); s.level=9; s.spellid=SPELL_INCINERATE; s.m_hasDuration = false; s.bAudibleAtStart = true; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_incinerate"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_MEGA; s.symbols[2]=RUNE_YOK; } { // Mass paralyse Creature Level 9 SPELL_ICON & s = spellicons[SPELL_MASS_PARALYSE]; s.name = getLocalised("system_spell_name_mass_paralyse"); s.description = getLocalised("system_spell_description_mass_paralyse"); s.level=9; s.spellid=SPELL_MASS_PARALYSE; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_mass_paralyse"); s.symbols[0]=RUNE_MEGA; s.symbols[1]=RUNE_NHI; s.symbols[2]=RUNE_MOVIS; } { // Mass Lightning Strike Level 10 SPELL_ICON & s = spellicons[SPELL_MASS_LIGHTNING_STRIKE]; s.name = getLocalised("system_spell_name_mass_lightning_strike"); s.description = getLocalised("system_spell_description_mass_lightning_strike"); s.level=10; s.spellid=SPELL_MASS_LIGHTNING_STRIKE; s.m_hasDuration = false; s.bAudibleAtStart = true; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_mass_lighting_strike"); s.symbols[0]=RUNE_AAM; s.symbols[1]=RUNE_FOLGORA; s.symbols[2]=RUNE_SPACIUM; } { // Control Target Level 10 SPELL_ICON & s = spellicons[SPELL_CONTROL_TARGET]; s.name = getLocalised("system_spell_name_control_target"); s.description = getLocalised("system_spell_description_control_target"); s.level=10; s.spellid=SPELL_CONTROL_TARGET; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_control_target"); s.symbols[0]=RUNE_MOVIS; s.symbols[1]=RUNE_COMUNICATUM; } { // Freeze time Level 10 SPELL_ICON & s = spellicons[SPELL_FREEZE_TIME]; s.name = getLocalised("system_spell_name_freeze_time"); s.description = getLocalised("system_spell_description_freeze_time"); s.level=10; s.spellid=SPELL_FREEZE_TIME; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_freeze_time"); s.symbols[0] = RUNE_RHAA; s.symbols[1]=RUNE_TEMPUS; } { // Mass incinerate Level 10 SPELL_ICON & s = spellicons[SPELL_MASS_INCINERATE]; s.name = getLocalised("system_spell_name_mass_incinerate"); s.description = getLocalised("system_spell_description_mass_incinerate"); s.level=10; s.spellid=SPELL_MASS_INCINERATE; s.m_hasDuration = false; s.bAudibleAtStart = true; s.tc=TextureContainer::LoadUI("graph/interface/icons/spell_mass_incinerate"); s.symbols[0]=RUNE_MEGA; s.symbols[1]=RUNE_AAM; s.symbols[2]=RUNE_MEGA; s.symbols[3]=RUNE_YOK; } }
void ARX_Menu_Resources_Create() { delete ARXmenu.mda; ARXmenu.mda = new MENU_DYNAMIC_DATA(); ARXmenu.mda->pTexCredits = TextureContainer::LoadUI("graph/interface/menus/menu_credits"); ARXmenu.mda->BookBackground = TextureContainer::LoadUI("graph/interface/book/character_sheet/char_creation_bg", TextureContainer::NoColorKey); ARXmenu.mda->flyover[BOOK_STRENGTH] = getLocalised("system_charsheet_strength"); ARXmenu.mda->flyover[BOOK_MIND] = getLocalised("system_charsheet_intel"); ARXmenu.mda->flyover[BOOK_DEXTERITY] = getLocalised("system_charsheet_dex"); ARXmenu.mda->flyover[BOOK_CONSTITUTION] = getLocalised("system_charsheet_consti"); ARXmenu.mda->flyover[BOOK_STEALTH] = getLocalised("system_charsheet_stealth"); ARXmenu.mda->flyover[BOOK_MECANISM] = getLocalised("system_charsheet_mecanism"); ARXmenu.mda->flyover[BOOK_INTUITION] = getLocalised("system_charsheet_intuition"); ARXmenu.mda->flyover[BOOK_ETHERAL_LINK] = getLocalised("system_charsheet_etheral_link"); ARXmenu.mda->flyover[BOOK_OBJECT_KNOWLEDGE] = getLocalised("system_charsheet_objknoledge"); ARXmenu.mda->flyover[BOOK_CASTING] = getLocalised("system_charsheet_casting"); ARXmenu.mda->flyover[BOOK_PROJECTILE] = getLocalised("system_charsheet_projectile"); ARXmenu.mda->flyover[BOOK_CLOSE_COMBAT] = getLocalised("system_charsheet_closecombat"); ARXmenu.mda->flyover[BOOK_DEFENSE] = getLocalised("system_charsheet_defense"); ARXmenu.mda->flyover[BUTTON_QUICK_GENERATION] = getLocalised("system_charsheet_quickgenerate"); ARXmenu.mda->flyover[BUTTON_DONE] = getLocalised("system_charsheet_done"); ARXmenu.mda->flyover[BUTTON_SKIN] = getLocalised("system_charsheet_skin"); ARXmenu.mda->flyover[WND_ATTRIBUTES] = getLocalised("system_charsheet_atributes"); ARXmenu.mda->flyover[WND_SKILLS] = getLocalised("system_charsheet_skills"); ARXmenu.mda->flyover[WND_STATUS] = getLocalised("system_charsheet_status"); ARXmenu.mda->flyover[WND_LEVEL] = getLocalised("system_charsheet_level"); ARXmenu.mda->flyover[WND_XP] = getLocalised("system_charsheet_xpoints"); ARXmenu.mda->flyover[WND_HP] = getLocalised("system_charsheet_hp"); ARXmenu.mda->flyover[WND_MANA] = getLocalised("system_charsheet_mana"); ARXmenu.mda->flyover[WND_AC] = getLocalised("system_charsheet_ac"); ARXmenu.mda->flyover[WND_RESIST_MAGIC] = getLocalised("system_charsheet_res_magic"); ARXmenu.mda->flyover[WND_RESIST_POISON] = getLocalised("system_charsheet_res_poison"); ARXmenu.mda->flyover[WND_DAMAGE] = getLocalised("system_charsheet_damage"); ARXmenu.mda->str_button_quickgen = getLocalised("system_charsheet_button_quickgen"); ARXmenu.mda->str_button_skin = getLocalised("system_charsheet_button_skin"); ARXmenu.mda->str_button_done = getLocalised("system_charsheet_button_done"); // Load credits. std::string creditsFile = "localisation/ucredits_" + config.language + ".txt"; size_t creditsSize; char * credits = resources->readAlloc(creditsFile, creditsSize); std::string englishCreditsFile; if(!credits) { // Fallback if there is no localised credits file englishCreditsFile = "localisation/ucredits_english.txt"; credits = resources->readAlloc(englishCreditsFile, creditsSize); } if(!credits) { if(!englishCreditsFile.empty() && englishCreditsFile != creditsFile) { LogWarning << "Unable to read credits files " << creditsFile << " and " << englishCreditsFile; } else { LogWarning << "Unable to read credits file " << creditsFile; } } else { LogDebug("Loaded credits file: " << creditsFile << " of size " << creditsSize); ARXmenu.mda->credits = arx_credits; ARXmenu.mda->credits += "\n\n\n" + arx_copyright; ARXmenu.mda->credits += "\n\n\n~ORIGINAL ARX FATALIS CREDITS:\n\n\n"; char * creditsEnd = credits + creditsSize; ARXmenu.mda->credits += util::convert<util::UTF16LE, util::UTF8>(credits, creditsEnd); LogDebug("Converted to UTF8 string of length " << ARXmenu.mda->credits.size()); free(credits); } }
long ARX_SPEECH_AddSpeech(Entity * io, const std::string & data, long mood, SpeechFlags flags) { if(data.empty()) { return -1; } ARX_SPEECH_ClearIOSpeech(io); long num = ARX_SPEECH_GetFree(); if(num < 0) { return -1; } aspeech[num].exist = 1; aspeech[num].time_creation = arxtime.get_updated_ul(); aspeech[num].io = io; // can be NULL aspeech[num].duration = 2000; // Minimum value aspeech[num].flags = flags; aspeech[num].sample = audio::INVALID_ID; aspeech[num].fDeltaY = 0.f; aspeech[num].iTimeScroll = 0; aspeech[num].fPixelScroll = 0.f; aspeech[num].mood = mood; LogDebug("speech \"" << data << '"'); res::path sample; if(flags & ARX_SPEECH_FLAG_NOTEXT) { // For non-conversation speech choose a random variant long count = getLocalisedKeyCount(data); long variant = 1; // TODO For some samples there are no corresponding entries // in the localization file (utext_*.ini) -> count will be 0 // We should probably just count the number of sample files if(count > 1) { do { variant = Random::get(1, count); } while(io->lastspeechflag == variant); io->lastspeechflag = checked_range_cast<short>(variant); } LogDebug(" -> " << variant << " / " << count); if(variant > 1) { sample = data + boost::lexical_cast<std::string>(variant); } else { sample = data; } } else { std::string _output = getLocalised(data); io->lastspeechflag = 0; aspeech[num].text.clear(); aspeech[num].text = _output; aspeech[num].duration = std::max(aspeech[num].duration, (unsigned long)(strlen(_output.c_str()) + 1) * 100); sample = data; } Entity * source = (aspeech[num].flags & ARX_SPEECH_FLAG_OFFVOICE) ? NULL : io; aspeech[num].sample = ARX_SOUND_PlaySpeech(sample, source); if(aspeech[num].sample == ARX_SOUND_TOO_FAR) { aspeech[num].sample = audio::INVALID_ID; } //Next lines must be removed (use callback instead) aspeech[num].duration = (unsigned long)ARX_SOUND_GetDuration(aspeech[num].sample); if ((io->ioflags & IO_NPC) && !(aspeech[num].flags & ARX_SPEECH_FLAG_OFFVOICE)) { float fDiv = aspeech[num].duration /= io->_npcdata->speakpitch; aspeech[num].duration = static_cast<unsigned long>(fDiv); } if (aspeech[num].duration < 500) aspeech[num].duration = 2000; return num; }
//----------------------------------------------------------------------------- // ARX Menu Rendering Func // returns false if no menu needs to be displayed //----------------------------------------------------------------------------- bool ARX_Menu_Render() { if(ARXmenu.currentmode == AMCM_OFF) return false; bool br = Menu2_Render(); if(br) return br; if(ARXmenu.currentmode == AMCM_OFF) return false; if(GInput->getMouseButton(Mouse::Button_0)) { EERIEMouseButton = 1; LastMouseClick = 1; } else if(GInput->getMouseButton(Mouse::Button_1)) { EERIEMouseButton = 2; LastMouseClick = 2; } else { EERIEMouseButton = 0; } GRenderer->BeginScene(); GRenderer->Clear(Renderer::ColorBuffer | Renderer::DepthBuffer); FLYING_OVER = 0; //------------------------------------------------------------------------- if(ARXmenu.currentmode == AMCM_NEWQUEST && ARXmenu.mda) { if(ITC.Get("questbook") == NULL) { ARX_Menu_Resources_Release(false); ARX_Menu_Resources_Create(); // TODO this is also in Interface.cpp ITC.Set("playerbook", "graph/interface/book/character_sheet/char_sheet_book"); ITC.Set("ic_casting", "graph/interface/book/character_sheet/buttons_carac/icone_casting"); ITC.Set("ic_close_combat", "graph/interface/book/character_sheet/buttons_carac/icone_close_combat"); ITC.Set("ic_constitution", "graph/interface/book/character_sheet/buttons_carac/icone_constit"); ITC.Set("ic_defense", "graph/interface/book/character_sheet/buttons_carac/icone_defense"); ITC.Set("ic_dexterity", "graph/interface/book/character_sheet/buttons_carac/icone_dext"); ITC.Set("ic_etheral_link", "graph/interface/book/character_sheet/buttons_carac/icone_etheral_link"); ITC.Set("ic_mind", "graph/interface/book/character_sheet/buttons_carac/icone_intel"); ITC.Set("ic_intuition", "graph/interface/book/character_sheet/buttons_carac/icone_intuition"); ITC.Set("ic_mecanism", "graph/interface/book/character_sheet/buttons_carac/icone_mecanism"); ITC.Set("ic_object_knowledge", "graph/interface/book/character_sheet/buttons_carac/icone_obj_knowledge"); ITC.Set("ic_projectile", "graph/interface/book/character_sheet/buttons_carac/icone_projectile"); ITC.Set("ic_stealth", "graph/interface/book/character_sheet/buttons_carac/icone_stealth"); ITC.Set("ic_strength", "graph/interface/book/character_sheet/buttons_carac/icone_strenght"); ITC.Set("questbook", "graph/interface/book/questbook"); ITC.Set("ptexspellbook", "graph/interface/book/spellbook"); ITC.Set("bookmark_char", "graph/interface/book/bookmark_char"); ITC.Set("bookmark_magic", "graph/interface/book/bookmark_magic"); ITC.Set("bookmark_map", "graph/interface/book/bookmark_map"); ITC.Set("bookmark_quest", "graph/interface/book/bookmark_quest"); ITC.Set("accessible_1", "graph/interface/book/accessible/accessible_1"); ITC.Set("accessible_2", "graph/interface/book/accessible/accessible_2"); ITC.Set("accessible_3", "graph/interface/book/accessible/accessible_3"); ITC.Set("accessible_4", "graph/interface/book/accessible/accessible_4"); ITC.Set("accessible_5", "graph/interface/book/accessible/accessible_5"); ITC.Set("accessible_6", "graph/interface/book/accessible/accessible_6"); ITC.Set("accessible_7", "graph/interface/book/accessible/accessible_7"); ITC.Set("accessible_8", "graph/interface/book/accessible/accessible_8"); ITC.Set("accessible_9", "graph/interface/book/accessible/accessible_9"); ITC.Set("accessible_10", "graph/interface/book/accessible/accessible_10"); ITC.Set("current_1", "graph/interface/book/current_page/current_1"); ITC.Set("current_2", "graph/interface/book/current_page/current_2"); ITC.Set("current_3", "graph/interface/book/current_page/current_3"); ITC.Set("current_4", "graph/interface/book/current_page/current_4"); ITC.Set("current_5", "graph/interface/book/current_page/current_5"); ITC.Set("current_6", "graph/interface/book/current_page/current_6"); ITC.Set("current_7", "graph/interface/book/current_page/current_7"); ITC.Set("current_8", "graph/interface/book/current_page/current_8"); ITC.Set("current_9", "graph/interface/book/current_page/current_9"); ITC.Set("current_10", "graph/interface/book/current_page/current_10"); ITC.Set("ptexcursorredist", "graph/interface/cursors/add_points"); ITC.Level = getLocalised("system_charsheet_player_lvl"); ITC.Xp = getLocalised("system_charsheet_player_xp"); ANIM_Set(&player.bookAnimation[0], herowaitbook); player.bookAnimation[0].flags |= EA_LOOP; ARXOldTimeMenu = ARXTimeMenu = arxtime.get_updated(); ARXDiffTimeMenu = 0; } GRenderer->SetRenderState(Renderer::Fog, false); GRenderer->SetRenderState(Renderer::AlphaBlending, false); if(ARXmenu.mda->BookBackground != NULL) { GRenderer->SetRenderState(Renderer::AlphaBlending, false); GRenderer->SetRenderState(Renderer::Fog, false); GRenderer->SetRenderState(Renderer::DepthWrite, false); GRenderer->SetRenderState(Renderer::DepthTest, false); EERIEDrawBitmap2(0, 0, static_cast<float>(g_size.width()), static_cast<float>(g_size.height()), 0.9f, ARXmenu.mda->BookBackground, Color::white); } BOOKZOOM = 1; ARX_INTERFACE_ManageOpenedBook(); if(ARXmenu.mda) { long DONE = 0; if(player.Skill_Redistribute == 0 && player.Attribute_Redistribute == 0) DONE = 1; float ox, oy; ox = Xratio; oy = Yratio; LASTBOOKBUTTON = BOOKBUTTON; BOOKBUTTON = EERIEMouseButton; Xratio = ox; Yratio = oy; if(!ARXmenu.mda->flyover[FLYING_OVER].empty() ) //=ARXmenu.mda->flyover[FLYING_OVER]; { if(FLYING_OVER != OLD_FLYING_OVER) { float fRandom = rnd() * 2; int t = checked_range_cast<int>(fRandom); pTextManage->Clear(); OLD_FLYING_OVER = FLYING_OVER; UNICODE_ARXDrawTextCenteredScroll(hFontInGame, (g_size.width() * 0.5f), 12, (g_size.center().x) * 0.82f, ARXmenu.mda->flyover[FLYING_OVER], Color(232 + t, 204 + t, 143 + t), 1000, 0.01f, 2); } } else { OLD_FLYING_OVER = -1; } float fPosX = 0; float fPosY = 313 * Yratio + (g_size.height() - 313 * Yratio) * 0.70f; float fSizeX = 100 * Xratio; float fSizeY = 100 * Yratio; Color color = Color::none; //--------------------------------------------------------------------- // Button QUICK GENERATION fPosX = (g_size.width() - (513 * Xratio)) * 0.5f; if(MouseInRect(fPosX, fPosY, fPosX + fSizeX + 50, fPosY + fSizeY)) { SpecialCursor = CURSOR_INTERACTION_ON; FLYING_OVER = BUTTON_QUICK_GENERATION; if (EERIEMouseButton & 1) ; else if ((!(EERIEMouseButton & 1)) && (LastMouseClick & 1)) { QUICK_MOD++; int iSkin = player.skin; ARX_MENU_CLICKSOUND(); if(bQuickGenFirstClick) { ARX_PLAYER_MakeAverageHero(); bQuickGenFirstClick = false; } else { ARX_PLAYER_QuickGeneration(); } player.skin = checked_range_cast<char>(iSkin); } color = Color(255, 255, 255); } else color = Color(232, 204, 143); pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_quickgen, static_cast<long>(fPosX), static_cast<long>(fPosY), color); //--------------------------------------------------------------------- // Button SKIN fPosX = g_size.width() * 0.5f; if(MouseInRect(fPosX, fPosY, fPosX + fSizeX, fPosY + fSizeY)) { SpecialCursor = CURSOR_INTERACTION_ON; FLYING_OVER = BUTTON_SKIN; if(!(EERIEMouseButton & 1) && (LastMouseClick & 1)) { SKIN_MOD++; BOOKZOOM = 1; ARX_MENU_CLICKSOUND(); player.skin++; if(player.skin > 3) player.skin = 0; ARX_PLAYER_Restore_Skin(); } color = Color(255, 255, 255); } else color = Color(232, 204, 143); pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_skin, static_cast<long>(fPosX), static_cast<long>(fPosY), color); //--------------------------------------------------------------------- // Button DONE fPosX = g_size.width() - (g_size.width() - 513 * Xratio) * 0.5f - 40 * Xratio; if(MouseInRect(fPosX, fPosY, fPosX + fSizeX, fPosY + fSizeY)) { if(DONE) SpecialCursor = CURSOR_INTERACTION_ON; FLYING_OVER = BUTTON_DONE; if(DONE && !(EERIEMouseButton & 1) && (LastMouseClick & 1)) { if(SKIN_MOD == 8 && QUICK_MOD == 10) { SKIN_MOD = -2; } else if(SKIN_MOD == -1) { ARX_PLAYER_MakeSpHero(); player.skin = 4; ARX_PLAYER_Restore_Skin(); SKIN_MOD = 0; SP_HEAD = 1; } else { if(SP_HEAD) { player.skin = 4; ARX_PLAYER_Restore_Skin(); SP_HEAD = 0; } ARX_MENU_CLICKSOUND(); bFadeInOut = true; //fade out bFade = true; //active le fade iFadeAction = AMCM_OFF; } } else { if(DONE) color = Color(255, 255, 255); else color = Color(192, 192, 192); } } else { if(DONE) color = Color(232, 204, 143); else color = Color(192, 192, 192); } if(SKIN_MOD < 0) color = Color(255, 0, 255); pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_done, static_cast<long>(fPosX), static_cast<long>(fPosY), color); } } DynLight[0].pos.x = 0.f + GInput->getMousePosAbs().x - (g_size.width() >> 1); DynLight[0].pos.y = 0.f + GInput->getMousePosAbs().y - (g_size.height() >> 1); if(pTextManage) { pTextManage->Update(framedelay); pTextManage->Render(); } if(ARXmenu.currentmode != AMCM_CREDITS) ARX_INTERFACE_RenderCursor(1); if(ARXmenu.currentmode == AMCM_NEWQUEST) { if(ProcessFadeInOut(bFadeInOut, 0.1f)) { switch(iFadeAction) { case AMCM_OFF: arxtime.resume(); ARX_MENU_NEW_QUEST_Clicked_QUIT(); iFadeAction = -1; bFade = false; fFadeInOut = 0.f; if(pTextManage) pTextManage->Clear(); break; } } } GRenderer->EndScene(); return true; }
void init() { // Renderer selection { HorizontalPanelWidget * pc = new HorizontalPanelWidget; std::string szMenuText = getLocalised("system_menus_options_video_renderer", "Renderer"); szMenuText += " "; TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(RATIO_X(20), 0)); me->SetCheckOff(); pc->AddElement(me); CycleTextWidget * slider = new CycleTextWidget; slider->valueChanged = boost::bind(&VideoOptionsMenuPage::onChangedRenderer, this, _1, _2); { TextWidget * text = new TextWidget(BUTTON_INVALID, hFontMenu, "Auto-Select", Vec2i(0, 0)); slider->AddText(text); slider->selectLast(); } #if ARX_HAVE_SDL1 || ARX_HAVE_SDL2 { TextWidget * text = new TextWidget(BUTTON_INVALID, hFontMenu, "OpenGL", Vec2i(0, 0)); slider->AddText(text); if(config.window.framework == "SDL") { slider->selectLast(); } } #endif float fRatio = (RATIO_X(m_size.x-9) - slider->m_rect.width()); slider->Move(Vec2i(checked_range_cast<int>(fRatio), 0)); pc->AddElement(slider); addCenter(pc); } { std::string szMenuText = getLocalised("system_menus_options_videos_full_screen"); if(szMenuText.empty()) { // TODO once we ship our own amendmends to the loc files a cleaner // fix would be to just define system_menus_options_videos_full_screen // for the german version there szMenuText = getLocalised("system_menus_options_video_full_screen"); } szMenuText += " "; TextWidget * text = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(RATIO_X(20), 0.f)); text->SetCheckOff(); CheckboxWidget * cb = new CheckboxWidget(text); cb->stateChanged = boost::bind(&VideoOptionsMenuPage::onChangedFullscreen, this, _1); cb->iState = config.video.fullscreen ? 1 : 0; addCenter(cb); fullscreenCheckbox = cb; } { HorizontalPanelWidget * pc = new HorizontalPanelWidget; std::string szMenuText = getLocalised("system_menus_options_video_resolution"); szMenuText += " "; TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(RATIO_X(20), 0.f)); me->SetCheckOff(); pc->AddElement(me); pMenuSliderResol = new CycleTextWidget; pMenuSliderResol->valueChanged = boost::bind(&VideoOptionsMenuPage::onChangedResolution, this, _1, _2); pMenuSliderResol->setEnabled(config.video.fullscreen); const RenderWindow::DisplayModes & modes = mainApp->getWindow()->getDisplayModes(); for(size_t i = 0; i != modes.size(); ++i) { const DisplayMode & mode = modes[i]; // find the aspect ratio unsigned a = mode.resolution.x; unsigned b = mode.resolution.y; while(b != 0) { unsigned t = a % b; a = b, b = t; } Vec2i aspect = mode.resolution / Vec2i(a); std::stringstream ss; ss << mode; if(aspect.x < 100 && aspect.y < 100) { if(aspect == Vec2i(8, 5)) { aspect = Vec2i(16, 10); } ss << " (" << aspect.x << ':' << aspect.y << ')'; } pMenuSliderResol->AddText(new TextWidget(BUTTON_INVALID, hFontMenu, ss.str())); if(mode.resolution == config.video.resolution) { pMenuSliderResol->selectLast(); } } pMenuSliderResol->AddText(new TextWidget(BUTTON_INVALID, hFontMenu, AUTO_RESOLUTION_STRING)); if(config.video.resolution == Vec2i_ZERO) { pMenuSliderResol->selectLast(); } float fRatio = (RATIO_X(m_size.x-9) - pMenuSliderResol->m_rect.width()); pMenuSliderResol->Move(Vec2i(checked_range_cast<int>(fRatio), 0)); pc->AddElement(pMenuSliderResol); addCenter(pc); } { HorizontalPanelWidget * pc = new HorizontalPanelWidget; std::string szMenuText = getLocalised("system_menus_options_detail"); szMenuText += " "; TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(RATIO_X(20), 0)); me->SetCheckOff(); pc->AddElement(me); CycleTextWidget * cb = new CycleTextWidget; cb->valueChanged = boost::bind(&VideoOptionsMenuPage::onChangedQuality, this, _1, _2); szMenuText = getLocalised("system_menus_options_video_texture_low"); cb->AddText(new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText)); szMenuText = getLocalised("system_menus_options_video_texture_med"); cb->AddText(new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText)); szMenuText = getLocalised("system_menus_options_video_texture_high"); cb->AddText(new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText)); cb->setValue(config.video.levelOfDetail); cb->Move(Vec2i(RATIO_X(m_size.x-9) - cb->m_rect.width(), 0)); pc->AddElement(cb); addCenter(pc); } { HorizontalPanelWidget * pc = new HorizontalPanelWidget; std::string szMenuText = getLocalised("system_menus_options_video_brouillard"); TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(RATIO_X(20), 0.f)); me->SetCheckOff(); pc->AddElement(me); SliderWidget * sld = new SliderWidget(Vec2i(RATIO_X(200), 0)); sld->valueChanged = boost::bind(&VideoOptionsMenuPage::onChangedFogDistance, this, _1); sld->setValue(config.video.fogDistance); pc->AddElement(sld); addCenter(pc); } { std::string szMenuText = getLocalised("system_menus_options_video_crosshair", "Show Crosshair"); szMenuText += " "; TextWidget * text = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(RATIO_X(20), 0.f)); text->SetCheckOff(); CheckboxWidget * cb = new CheckboxWidget(text); cb->stateChanged = boost::bind(&VideoOptionsMenuPage::onChangedCrosshair, this, _1); cb->iState = config.video.showCrosshair ? 1 : 0; addCenter(cb); } { std::string szMenuText = getLocalised("system_menus_options_video_antialiasing", "antialiasing"); szMenuText += " "; TextWidget * text = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(RATIO_X(20), 0)); text->SetCheckOff(); CheckboxWidget * cb = new CheckboxWidget(text); cb->stateChanged = boost::bind(&VideoOptionsMenuPage::onChangedAntialiasing, this, _1); cb->iState = config.video.antialiasing ? 1 : 0; addCenter(cb); } ARX_SetAntiAliasing(); { std::string szMenuText = getLocalised("system_menus_options_video_vsync", "VSync"); szMenuText += " "; TextWidget * text = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(RATIO_X(20), 0)); text->SetCheckOff(); CheckboxWidget * cb = new CheckboxWidget(text); cb->stateChanged = boost::bind(&VideoOptionsMenuPage::onChangedVsync, this, _1); cb->iState = config.video.vsync ? 1 : 0; addCenter(cb); } { std::string szMenuText = getLocalised("system_menus_options_video_hud_scale", "Scale Hud"); szMenuText += " "; TextWidget * text = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(RATIO_X(20), 0)); text->SetCheckOff(); CheckboxWidget * cb = new CheckboxWidget(text); cb->stateChanged = boost::bind(&VideoOptionsMenuPage::onChangedHudScale, this, _1); cb->iState = config.video.hudScale ? 1 : 0; addCenter(cb); } { HorizontalPanelWidget * pc = new HorizontalPanelWidget; std::string szMenuText = getLocalised("system_menus_video_apply"); szMenuText += " "; TextWidget * me = new TextWidget(BUTTON_INVALID, hFontMenu, szMenuText, Vec2i(RATIO_X(240), 0)); me->clicked = boost::bind(&VideoOptionsMenuPage::onClickedApply, this); me->SetPos(Vec2i(RATIO_X(m_size.x-10)-me->m_rect.width(), RATIO_Y(380) + RATIO_Y(40))); me->SetCheckOff(); pc->AddElementNoCenterIn(me); pMenuElementApply = me; ButtonWidget * cb = new ButtonWidget(RATIO_2(Vec2i(20, 420)), "graph/interface/menus/back"); cb->clicked = boost::bind(&VideoOptionsMenuPage::onClickedBack, this); cb->m_targetMenu = OPTIONS; cb->SetShortCut(Keyboard::Key_Escape); pc->AddElementNoCenterIn(cb); add(pc); } }
void init() { { ButtonWidget * cb = new ButtonWidget(Vec2i(RATIO_X(10), 0), "graph/interface/icons/menu_main_save"); cb->SetCheckOff(); addCenter(cb, true); } std::string quicksaveName = getLocalised("system_menus_main_quickloadsave", "Quicksave"); size_t quicksaveNum = 0; // Show quicksaves. for(size_t i = 0; i < savegames.size(); i++) { const SaveGame & save = savegames[i]; if(!save.quicksave) { continue; } std::ostringstream text; text << quicksaveName << ' ' << ++quicksaveNum << " " << save.time; TextWidget * e = new TextWidget(BUTTON_MENUEDITQUEST_SAVEINFO, hFontControls, text.str(), Vec2i(RATIO_X(20), 0.f)); e->m_targetMenu = EDIT_QUEST_SAVE_CONFIRM; e->setColor(Color::grayb(127)); e->SetCheckOff(); e->m_savegame = SavegameHandle(i); addCenter(e); } // Show regular saves. for(size_t i = 0; i < savegames.size(); i++) { const SaveGame & save = savegames[i]; if(save.quicksave) { continue; } std::string text = save.name + " " + save.time; TextWidget * e = new TextWidget(BUTTON_MENUEDITQUEST_SAVEINFO, hFontControls, text, Vec2i(RATIO_X(20), 0.f)); e->m_targetMenu = EDIT_QUEST_SAVE_CONFIRM; e->m_savegame = SavegameHandle(i); addCenter(e); } for(size_t i = savegames.size(); i <= 15; i++) { std::ostringstream text; text << '-' << std::setfill('0') << std::setw(4) << i << '-'; TextWidget * e = new TextWidget(BUTTON_MENUEDITQUEST_SAVEINFO, hFontControls, text.str(), Vec2i(RATIO_X(20), 0)); e->m_targetMenu = EDIT_QUEST_SAVE_CONFIRM; e->m_savegame = SavegameHandle::Invalid; addCenter(e); } { TextWidget * me01 = new TextWidget(BUTTON_INVALID, hFontControls, " ", Vec2i(RATIO_X(20), 0)); me01->m_targetMenu = EDIT_QUEST_SAVE_CONFIRM; me01->m_savegame = SavegameHandle::Invalid; me01->SetCheckOff(); addCenter(me01); } { ButtonWidget * cb = new ButtonWidget(RATIO_2(Vec2i(20, 420)), "graph/interface/menus/back"); cb->m_targetMenu = EDIT_QUEST; cb->SetShortCut(Keyboard::Key_Escape); add(cb); } }
void init() { { ButtonWidget * cb = new ButtonWidget(Vec2i(0, 0), "graph/interface/icons/menu_main_load"); cb->SetCheckOff(); addCenter(cb, true); } std::string quicksaveName = getLocalised("system_menus_main_quickloadsave", "Quicksave"); // TODO make this list scrollable // TODO align the date part to the right! { size_t quicksaveNum = 0; // Show quicksaves. for(size_t i = 0; i < savegames.size(); i++) { const SaveGame & save = savegames[i]; if(!save.quicksave) { continue; } std::ostringstream text; text << quicksaveName << ' ' << ++quicksaveNum << " " << save.time; TextWidget * e = new TextWidget(BUTTON_MENUEDITQUEST_LOAD, hFontControls, text.str(), Vec2i(RATIO_X(20), 0)); e->m_savegame = SavegameHandle(i); addCenter(e); } // Show regular saves. for(size_t i = 0; i < savegames.size(); i++) { const SaveGame & save = savegames[i]; if(save.quicksave) { continue; } std::string text = save.name + " " + save.time; TextWidget * e = new TextWidget(BUTTON_MENUEDITQUEST_LOAD, hFontControls, text, Vec2i(RATIO_X(20), 0)); e->m_savegame = SavegameHandle(i); addCenter(e); } { TextWidget * confirm = new TextWidget(BUTTON_INVALID, hFontControls, " ", Vec2i(RATIO_X(20), 0)); confirm->m_targetMenu = EDIT_QUEST_SAVE_CONFIRM; confirm->SetCheckOff(); confirm->m_savegame = SavegameHandle::Invalid; addCenter(confirm); } // Delete button { std::string szMenuText = getLocalised("system_menus_main_editquest_delete"); szMenuText += " "; TextWidget * me = new TextWidget(BUTTON_MENUEDITQUEST_DELETE_CONFIRM, hFontMenu, szMenuText, Vec2i(0, 0)); me->m_targetMenu = EDIT_QUEST_LOAD; me->SetPos(Vec2i(RATIO_X(m_size.x-10)-me->m_rect.width(), RATIO_Y(42))); me->SetCheckOff(); me->lOldColor = me->lColor; me->lColor = Color::grayb(127); add(me); pDeleteConfirm = me; } // Load button { std::string szMenuText = getLocalised("system_menus_main_editquest_load"); szMenuText += " "; TextWidget * me = new TextWidget(BUTTON_MENUEDITQUEST_LOAD_CONFIRM, hFontMenu, szMenuText, Vec2i(0, 0)); me->m_targetMenu = MAIN; me->SetPos(Vec2i(RATIO_X(m_size.x-10)-me->m_rect.width(), RATIO_Y(380) + RATIO_Y(40))); me->SetCheckOff(); me->lOldColor = me->lColor; me->lColor = Color::grayb(127); add(me); pLoadConfirm = me; } // Back button { ButtonWidget * cb = new ButtonWidget(RATIO_2(Vec2i(20, 420)), "graph/interface/menus/back"); cb->clicked = boost::bind(&LoadMenuPage::onClickBack, this); cb->m_targetMenu = EDIT_QUEST; cb->SetShortCut(Keyboard::Key_Escape); add(cb); } } }
// true: block les zones de checks bool TextWidget::OnMouseClick() { if(!enabled) { return false; } if(clicked) { clicked(this); } switch(eState) { case EDIT: eState=EDIT_TIME; return true; case GETTOUCH: eState=GETTOUCH_TIME; lOldColor=lColorHighlight; return true; default: break; } switch(m_id) { // MENULOADQUEST case BUTTON_MENUEDITQUEST_LOAD: { if(pWindowMenu) { pLoadConfirm->SetCheckOn(); pLoadConfirm->lColor = pLoadConfirm->lOldColor; pDeleteConfirm->SetCheckOn(); pDeleteConfirm->lColor = pDeleteConfirm->lOldColor; for(size_t i = 0; i < pWindowMenu->m_pages.size(); i++) { MenuPage * page = pWindowMenu->m_pages[i]; if(page->eMenuState == EDIT_QUEST_LOAD) { page->m_savegame = m_savegame; for(size_t j = 0; j < page->m_children.m_widgets.size(); j++) { Widget * widget = page->m_children.m_widgets[j]; if(widget->m_id == BUTTON_MENUEDITQUEST_LOAD) { ((TextWidget *)widget)->bSelected = false; } } bSelected = true; } } } } break; case BUTTON_MENUEDITQUEST_LOAD_CONFIRM: { if(pWindowMenu) { for(size_t i = 0; i < pWindowMenu->m_pages.size(); i++) { MenuPage * page = pWindowMenu->m_pages[i]; if(page->eMenuState == EDIT_QUEST_LOAD) { m_savegame = page->m_savegame; if(m_savegame != SavegameHandle()) { m_targetMenu = MAIN; GRenderer->Clear(Renderer::DepthBuffer); ARXMenu_LoadQuest(m_savegame); bNoMenu=true; if(pTextManage) { pTextManage->Clear(); } break; } } } pLoadConfirm->SetCheckOff(); pLoadConfirm->lColor = Color::grayb(127); pDeleteConfirm->SetCheckOff(); pDeleteConfirm->lColor = Color::grayb(127); } } break; // MENUSAVEQUEST case BUTTON_MENUEDITQUEST_SAVE: { if(pWindowMenu) for(size_t i = 0; i < pWindowMenu->m_pages.size(); i++) { MenuPage * page = pWindowMenu->m_pages[i]; if(page->eMenuState == EDIT_QUEST_SAVE_CONFIRM) { page->m_savegame = m_savegame; TextWidget * me = (TextWidget *) page->m_children.m_widgets[1]; if(me) { m_targetMenu = MAIN; ARXMenu_SaveQuest(me->m_text, me->m_savegame); break; } } } } break; // Delete save from the load menu case BUTTON_MENUEDITQUEST_DELETE_CONFIRM: { if(pWindowMenu) { for(size_t i = 0 ; i < pWindowMenu->m_pages.size(); i++) { MenuPage * page = pWindowMenu->m_pages[i]; if(page->eMenuState == EDIT_QUEST_LOAD) { m_savegame = page->m_savegame; if(m_savegame != SavegameHandle()) { m_targetMenu = EDIT_QUEST_LOAD; mainMenu->bReInitAll = true; savegames.remove(m_savegame); break; } } } } pLoadConfirm->SetCheckOff(); pLoadConfirm->lColor = Color::grayb(127); pDeleteConfirm->SetCheckOff(); pDeleteConfirm->lColor = Color::grayb(127); break; } // Delete save from the save menu case BUTTON_MENUEDITQUEST_DELETE: { if(pWindowMenu) { for(size_t i = 0 ; i < pWindowMenu->m_pages.size(); i++) { MenuPage * page = pWindowMenu->m_pages[i]; if(page->eMenuState == EDIT_QUEST_SAVE_CONFIRM) { page->m_savegame = m_savegame; TextWidget * me = (TextWidget *) page->m_children.m_widgets[1]; if(me) { m_targetMenu = EDIT_QUEST_SAVE; mainMenu->bReInitAll = true; savegames.remove(me->m_savegame); break; } } } } break; } default: break; } if(m_targetMenu == EDIT_QUEST_SAVE_CONFIRM) { for(size_t i = 0; i < pWindowMenu->m_pages.size(); i++) { MenuPage * page = pWindowMenu->m_pages[i]; if(page->eMenuState == m_targetMenu) { page->m_savegame = m_savegame; TextWidget * me = (TextWidget *) page->m_children.m_widgets[1]; if(me) { me->m_savegame = m_savegame; if(m_savegame != SavegameHandle()) { me->SetText(savegames[m_savegame.handleData()].name); pDeleteButton->lColor = pDeleteButton->lOldColor; pDeleteButton->SetCheckOn(); } else { pDeleteButton->lColor = Color::grayb(127); pDeleteButton->SetCheckOff(); me->SetText(getLocalised("system_menu_editquest_newsavegame")); } page->AlignElementCenter(me); } } } } ARX_SOUND_PlayMenu(SND_MENU_CLICK); return false; }