summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/newgame.cc
diff options
context:
space:
mode:
authorelliptic <hyperelliptical@gmail.com>2011-09-09 17:22:47 -0400
committerelliptic <hyperelliptical@gmail.com>2011-09-09 17:25:25 -0400
commitca7fa58159771c705e7b3834a366083c413dba6f (patch)
tree7396e2bab1a9b485e36362bcf32f1291c2379fe5 /crawl-ref/source/newgame.cc
parent56ed2f7a0f0c455735377c0126f725afd84a114d (diff)
downloadcrawl-ref-ca7fa58159771c705e7b3834a366083c413dba6f.tar.gz
crawl-ref-ca7fa58159771c705e7b3834a366083c413dba6f.zip
Artificer changes.
They don't get to choose their wands, their skills are a little lower, and their starting weapon is a weak staff... but they start with three wands instead of two: flame, enslavement, and random effects.
Diffstat (limited to 'crawl-ref/source/newgame.cc')
-rw-r--r--crawl-ref/source/newgame.cc338
1 files changed, 2 insertions, 336 deletions
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index b73aefe190..052265c6a6 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -38,8 +38,6 @@ static void _choose_gamemode_map(newgame_def* ng, newgame_def* ng_choice,
const newgame_def& defaults);
static bool _choose_weapon(newgame_def* ng, newgame_def* ng_choice,
const newgame_def& defaults);
-static bool _choose_wand(newgame_def* ng, newgame_def* ng_choice,
- const newgame_def& defaults);
////////////////////////////////////////////////////////////////////////
// Remember player's startup options
@@ -48,7 +46,7 @@ static bool _choose_wand(newgame_def* ng, newgame_def* ng_choice,
newgame_def::newgame_def()
: name(), type(GAME_TYPE_NORMAL),
species(SP_UNKNOWN), job(JOB_UNKNOWN),
- weapon(WPN_UNKNOWN), wand(SWT_NO_SELECTION),
+ weapon(WPN_UNKNOWN),
fully_random(false)
{
}
@@ -58,7 +56,6 @@ void newgame_def::clear_character()
species = SP_UNKNOWN;
job = JOB_UNKNOWN;
weapon = WPN_UNKNOWN;
- wand = SWT_NO_SELECTION;
}
enum MenuOptions
@@ -443,8 +440,7 @@ static void _choose_char(newgame_def* ng, newgame_def* choice,
continue;
}
- if (_choose_weapon(ng, choice, defaults)
- && _choose_wand(ng, choice, defaults))
+ if (_choose_weapon(ng, choice, defaults))
{
// We're done!
return;
@@ -1804,336 +1800,6 @@ static bool _choose_weapon(newgame_def* ng, newgame_def* ng_choice,
return (true);
}
-int start_to_wand(int wandtype, bool& is_rod)
-{
- is_rod = false;
-
- switch (wandtype)
- {
- case SWT_ENSLAVEMENT:
- return (WAND_ENSLAVEMENT);
-
- case SWT_CONFUSION:
- return (WAND_CONFUSION);
-
- case SWT_MAGIC_DARTS:
- return (WAND_MAGIC_DARTS);
-
- case SWT_FROST:
- return (WAND_FROST);
-
- case SWT_FLAME:
- return (WAND_FLAME);
-
- case SWT_STRIKING:
- is_rod = true;
- return (STAFF_STRIKING);
-
- default:
- return (-1);
- }
-}
-
-static void _construct_wand_menu(const startup_wand_type& defwand,
- MenuFreeform* menu)
-{
- static const int ITEMS_START_Y = 5;
- TextItem* tmp = NULL;
- std::string text;
- coord_def min_coord(0,0);
- coord_def max_coord(0,0);
-
-
- for (int i = 0; i < NUM_STARTUP_WANDS; i++)
- {
- tmp = new TextItem();
- text.clear();
- startup_wand_type sw = static_cast<startup_wand_type>(i);
-
- tmp->set_fg_colour(LIGHTGREY);
- tmp->set_highlight_colour(GREEN);
-
- const char letter = 'a' + i;
- text += letter;
- text += " - ";
-
- if (sw == SWT_STRIKING)
- {
- item_def rod;
- make_rod(rod, STAFF_STRIKING, 8);
- text += rod.name(DESC_QUALNAME, false, true);
- }
- else
- {
- bool dummy;
- wand_type w = static_cast<wand_type>(start_to_wand(sw, dummy));
- text += wand_type_name(w);
- }
- // Add padding
- text.append(COLUMN_WIDTH - text.size() - 1 , ' ');
- tmp->set_text(text);
-
- tmp->add_hotkey(letter);
- tmp->set_id(sw);
-
- min_coord.x = X_MARGIN;
- min_coord.y = ITEMS_START_Y + i;
- max_coord.x = min_coord.x + text.size();
- max_coord.y = min_coord.y + 1;
- tmp->set_bounds(min_coord, max_coord);
-
- menu->attach_item(tmp);
- tmp->set_visible(true);
- // Is this item our default wand?
- if (sw == defwand)
- {
- menu->set_active_item(tmp);
- }
- }
-
- // Add all the special button entries
- // Wands do not have unviable choices
- //tmp = new TextItem();
- //tmp->set_text("+ - Viable random choice");
- //min_coord.x = X_MARGIN;
- //min_coord.y = SPECIAL_KEYS_START_Y;
- //max_coord.x = min_coord.x + tmp->get_text().size();
- //max_coord.y = min_coord.y + 1;
- //tmp->set_bounds(min_coord, max_coord);
- //tmp->set_fg_colour(BROWN);
- //tmp->add_hotkey('+');
- //tmp->set_highlight_colour(LIGHTGRAY);
- //tmp->set_description_text("Picks a random viable god");
- //menu->attach_item(tmp);
- //tmp->set_visible(true);
-
- tmp = new TextItem();
- tmp->set_text("% - List aptitudes");
- min_coord.x = X_MARGIN;
- min_coord.y = SPECIAL_KEYS_START_Y + 1;
- max_coord.x = min_coord.x + tmp->get_text().size();
- max_coord.y = min_coord.y + 1;
- tmp->set_bounds(min_coord, max_coord);
- tmp->set_fg_colour(BROWN);
- tmp->add_hotkey('%');
- tmp->set_id(M_APTITUDES);
- tmp->set_highlight_colour(LIGHTGRAY);
- tmp->set_description_text("Lists the numerical skill train aptitudes for all races");
- menu->attach_item(tmp);
- tmp->set_visible(true);
-
- tmp = new TextItem();
- tmp->set_text("? - Help");
- min_coord.x = X_MARGIN;
- min_coord.y = SPECIAL_KEYS_START_Y + 2;
- max_coord.x = min_coord.x + tmp->get_text().size();
- max_coord.y = min_coord.y + 1;
- tmp->set_bounds(min_coord, max_coord);
- tmp->set_fg_colour(BROWN);
- tmp->add_hotkey('?');
- tmp->set_id(M_HELP);
- tmp->set_highlight_colour(LIGHTGRAY);
- tmp->set_description_text("Opens the help screen");
- menu->attach_item(tmp);
- tmp->set_visible(true);
-
- tmp = new TextItem();
- tmp->set_text("* - Random wand");
- min_coord.x = X_MARGIN + COLUMN_WIDTH;
- min_coord.y = SPECIAL_KEYS_START_Y;
- max_coord.x = min_coord.x + tmp->get_text().size();
- max_coord.y = min_coord.y + 1;
- tmp->set_bounds(min_coord, max_coord);
- tmp->set_fg_colour(BROWN);
- tmp->add_hotkey('*');
- tmp->set_id(M_RANDOM);
- tmp->set_highlight_colour(LIGHTGRAY);
- tmp->set_description_text("Picks a random wand");
- menu->attach_item(tmp);
- tmp->set_visible(true);
-
- // Adjust the end marker to align the - because Bksp text is longer by 3
- tmp = new TextItem();
- tmp->set_text("Bksp - Return to character menu");
- tmp->set_description_text("Lets you return back to Character choice menu");
- min_coord.x = X_MARGIN + COLUMN_WIDTH - 3;
- min_coord.y = SPECIAL_KEYS_START_Y + 1;
- max_coord.x = min_coord.x + tmp->get_text().size();
- max_coord.y = min_coord.y + 1;
- tmp->set_bounds(min_coord, max_coord);
- tmp->set_fg_colour(BROWN);
- tmp->add_hotkey(CK_BKSP);
- tmp->set_id(M_ABORT);
- tmp->set_highlight_colour(LIGHTGRAY);
- menu->attach_item(tmp);
- tmp->set_visible(true);
-
- // Only add tab entry if we have a previous wand choice
- if (defwand != SWT_NO_SELECTION)
- {
- tmp = new TextItem();
- text.clear();
- text = "Tab - ";
-
- text += defwand == SWT_ENSLAVEMENT ? "Enslavement" :
- defwand == SWT_CONFUSION ? "Confusion" :
- defwand == SWT_MAGIC_DARTS ? "Magic Darts" :
- defwand == SWT_FROST ? "Frost" :
- defwand == SWT_FLAME ? "Flame" :
- defwand == SWT_STRIKING ? "Striking" :
- defwand == SWT_RANDOM ? "Random" :
- "Buggy";
-
- // Adjust the end marker to aling the - because
- // Tab text is longer by 2
- tmp = new TextItem();
- tmp->set_text(text);
- min_coord.x = X_MARGIN + COLUMN_WIDTH - 2;
- min_coord.y = SPECIAL_KEYS_START_Y + 2;
- max_coord.x = min_coord.x + tmp->get_text().size();
- max_coord.y = min_coord.y + 1;
- tmp->set_bounds(min_coord, max_coord);
- tmp->set_fg_colour(BROWN);
- tmp->add_hotkey('\t');
- tmp->set_id(M_DEFAULT_CHOICE);
- tmp->set_highlight_colour(LIGHTGRAY);
- tmp->set_description_text("Select your previous wand choice");
- menu->attach_item(tmp);
- tmp->set_visible(true);
- }
-}
-
-static bool _prompt_wand(const newgame_def* ng, newgame_def* ng_choice,
- const newgame_def& defaults)
-{
- PrecisionMenu menu;
- menu.set_select_type(PrecisionMenu::PRECISION_SINGLESELECT);
- MenuFreeform* freeform = new MenuFreeform();
- freeform->init(coord_def(1,1), coord_def(get_number_of_cols(),
- get_number_of_lines()), "freeform");
- menu.attach_object(freeform);
- menu.set_active_object(freeform);
-
- const startup_wand_type defwand = defaults.wand;
-
- _construct_wand_menu(defwand, freeform);
-
- BoxMenuHighlighter* highlighter = new BoxMenuHighlighter(&menu);
- highlighter->init(coord_def(0,0), coord_def(0,0), "highlighter");
- menu.attach_object(highlighter);
-
- // Did we have a previous wand?
- if (menu.get_active_item() == NULL)
- {
- freeform->activate_first_item();
- }
- _print_character_info(ng); // calls clrscr() so needs to be before attach()
-
-#ifdef USE_TILE_LOCAL
- tiles.get_crt()->attach_menu(&menu);
-#endif
-
- freeform->set_visible(true);
- highlighter->set_visible(true);
-
- textcolor(CYAN);
- cprintf("\nYou have a choice of tools:");
-
- while (true)
- {
- menu.draw_menu();
-
- int keyn = getch_ck();
-
- // First process menu entries
- if (!menu.process_key(keyn))
- {
- // Process all the keys that are not attached to items
- switch (keyn)
- {
- case 'X':
- cprintf("\nGoodbye!");
- end(0);
- break;
- case ' ':
- CASE_ESCAPE
- return false;
- default:
- // if we get this far, we did not get a significant selection
- // from the menu, nor did we get an escape character
- // continue the while loop from the beginning and poll a new key
- continue;
- }
- }
- // We have a significant key input!
- // Construct selection vector
- std::vector<MenuItem*> selection = menu.get_selected_items();
- // There should only be one selection, otherwise something broke
- if (selection.size() != 1)
- {
- // poll a new key
- continue;
- }
-
- // Get the stored id from the selection
- int selection_ID = selection.at(0)->get_id();
- switch (selection_ID)
- {
- case M_ABORT:
- return false;
- case M_APTITUDES:
- list_commands('%', false, _highlight_pattern(ng));
- return _prompt_wand(ng, ng_choice, defaults);
- case M_HELP:
- list_commands('?');
- return _prompt_wand(ng, ng_choice, defaults);
- case M_DEFAULT_CHOICE:
- if (defwand != SWT_NO_SELECTION)
- {
- ng_choice->wand = defwand;
- return true;
- }
- // This case should not happen if defwand == swt_no_selection
- continue;
- case M_RANDOM:
- ng_choice->wand = SWT_RANDOM;
- return true;
- default:
- // We got an item selection
- ng_choice->wand = static_cast<startup_wand_type> (selection_ID);
- return true;
- }
- }
- return false;
-}
-
-static void _resolve_wand(newgame_def* ng, const newgame_def* ng_choice)
-{
- switch (ng_choice->wand)
- {
- case SWT_RANDOM:
- ng->wand = static_cast<startup_wand_type>(random2(NUM_STARTUP_WANDS));
- return;
- default:
- ng->wand = ng_choice->wand;
- return;
- }
-}
-
-static bool _choose_wand(newgame_def* ng, newgame_def* ng_choice,
- const newgame_def& defaults)
-{
- if (ng->job != JOB_ARTIFICER)
- return (true);
-
- if (ng_choice->wand == SWT_NO_SELECTION)
- if (!_prompt_wand(ng, ng_choice, defaults))
- return (false);
-
- _resolve_wand(ng, ng_choice);
- return (true);
-}
-
static void _construct_gamemode_map_menu(const mapref_vector& maps,
const newgame_def& defaults,
MenuFreeform* menu)