make editing special items a mode
This commit is contained in:
@@ -131,7 +131,7 @@ void init_screen_locs() {
|
|||||||
static cursor_type get_edit_cursor() {
|
static cursor_type get_edit_cursor() {
|
||||||
switch(overall_mode) {
|
switch(overall_mode) {
|
||||||
case MODE_INTRO_SCREEN: case MODE_MAIN_SCREEN: case MODE_EDIT_TYPES:
|
case MODE_INTRO_SCREEN: case MODE_MAIN_SCREEN: case MODE_EDIT_TYPES:
|
||||||
case MODE_EDIT_SPECIALS:
|
case MODE_EDIT_SPECIALS: case MODE_EDIT_SPECIAL_ITEMS:
|
||||||
|
|
||||||
case MODE_PLACE_CREATURE: case MODE_PLACE_ITEM: case MODE_PLACE_SPECIAL:
|
case MODE_PLACE_CREATURE: case MODE_PLACE_ITEM: case MODE_PLACE_SPECIAL:
|
||||||
|
|
||||||
@@ -282,7 +282,7 @@ static bool handle_lb_action(int i){
|
|||||||
start_string_editing(STRS_SCEN,0);
|
start_string_editing(STRS_SCEN,0);
|
||||||
break;
|
break;
|
||||||
case LB_EDIT_SPECITEM:
|
case LB_EDIT_SPECITEM:
|
||||||
start_special_item_editing(false);
|
start_special_item_editing();
|
||||||
break;
|
break;
|
||||||
case LB_EDIT_QUEST:
|
case LB_EDIT_QUEST:
|
||||||
start_quest_editing(false);
|
start_quest_editing(false);
|
||||||
@@ -491,7 +491,6 @@ static bool handle_rb_action(location the_point, bool option_hit) {
|
|||||||
if(!edit_spec_item(j) && j == size_before)
|
if(!edit_spec_item(j) && j == size_before)
|
||||||
scenario.special_items.pop_back();
|
scenario.special_items.pop_back();
|
||||||
}
|
}
|
||||||
start_special_item_editing(size_before == scenario.special_items.size());
|
|
||||||
if(size_before > scenario.special_items.size())
|
if(size_before > scenario.special_items.size())
|
||||||
pos_before--;
|
pos_before--;
|
||||||
right_sbar->setPosition(pos_before);
|
right_sbar->setPosition(pos_before);
|
||||||
@@ -1181,6 +1180,7 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
|
|||||||
case MODE_EDIT_TYPES:
|
case MODE_EDIT_TYPES:
|
||||||
case MODE_MAIN_SCREEN:
|
case MODE_MAIN_SCREEN:
|
||||||
case MODE_EDIT_SPECIALS:
|
case MODE_EDIT_SPECIALS:
|
||||||
|
case MODE_EDIT_SPECIAL_ITEMS:
|
||||||
break; // Nothing to do here, of course.
|
break; // Nothing to do here, of course.
|
||||||
case MODE_COPY_CREATURE:
|
case MODE_COPY_CREATURE:
|
||||||
for(short x = 0; x < town->creatures.size(); x++)
|
for(short x = 0; x < town->creatures.size(); x++)
|
||||||
@@ -2937,27 +2937,16 @@ void start_type_editing(eDrawMode mode) {
|
|||||||
update_mouse_spot(translate_mouse_coordinates(sf::Mouse::getPosition(mainPtr())));
|
update_mouse_spot(translate_mouse_coordinates(sf::Mouse::getPosition(mainPtr())));
|
||||||
}
|
}
|
||||||
|
|
||||||
void start_special_item_editing(bool just_redo_text) {
|
void start_special_item_editing() {
|
||||||
int num_options = scenario.special_items.size() + 1;
|
int num_options = scenario.special_items.size() + 1;
|
||||||
|
|
||||||
if(!just_redo_text) {
|
handle_close_terrain_view(MODE_EDIT_SPECIAL_ITEMS);
|
||||||
handle_close_terrain_view(MODE_MAIN_SCREEN);
|
right_sbar->show();
|
||||||
right_sbar->show();
|
pal_sbar->hide();
|
||||||
pal_sbar->hide();
|
right_sbar->setPosition(0);
|
||||||
|
reset_rb();
|
||||||
|
right_sbar->setMaximum(num_options - NRSONPAGE);
|
||||||
|
|
||||||
right_sbar->setPosition(0);
|
|
||||||
reset_rb();
|
|
||||||
right_sbar->setMaximum(num_options - NRSONPAGE);
|
|
||||||
}
|
|
||||||
for(short i = 0; i < num_options; i++) {
|
|
||||||
std::string title;
|
|
||||||
if(i == scenario.special_items.size())
|
|
||||||
title = "Create New Special Item";
|
|
||||||
else title = scenario.special_items[i].name;
|
|
||||||
title = std::to_string(i) + " - " + title;
|
|
||||||
set_rb(i,RB_SPEC_ITEM, i, title);
|
|
||||||
}
|
|
||||||
set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"Alt-click to delete",true);
|
|
||||||
update_mouse_spot(translate_mouse_coordinates(sf::Mouse::getPosition(mainPtr())));
|
update_mouse_spot(translate_mouse_coordinates(sf::Mouse::getPosition(mainPtr())));
|
||||||
redraw_screen();
|
redraw_screen();
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,7 @@ void set_up_main_screen();
|
|||||||
void start_town_edit();
|
void start_town_edit();
|
||||||
void start_out_edit();
|
void start_out_edit();
|
||||||
void start_type_editing(eDrawMode mode);
|
void start_type_editing(eDrawMode mode);
|
||||||
void start_special_item_editing(bool just_redo_text);
|
void start_special_item_editing();
|
||||||
void start_quest_editing(bool just_redo_text);
|
void start_quest_editing(bool just_redo_text);
|
||||||
void start_shops_editing(bool just_redo_text);
|
void start_shops_editing(bool just_redo_text);
|
||||||
void start_string_editing(eStrMode mode,short just_redo_text);
|
void start_string_editing(eStrMode mode,short just_redo_text);
|
||||||
|
@@ -82,6 +82,8 @@ enum eScenMode {
|
|||||||
MODE_INTRO_SCREEN = 61,
|
MODE_INTRO_SCREEN = 61,
|
||||||
MODE_EDIT_TYPES = 62, // currently only used for editing terrain, but I'd like to use it for editing monsters and items too.
|
MODE_EDIT_TYPES = 62, // currently only used for editing terrain, but I'd like to use it for editing monsters and items too.
|
||||||
MODE_EDIT_SPECIALS = 63, // editing a LIST of specials, not to be confused with MODE_EDIT_SPECIAL singular
|
MODE_EDIT_SPECIALS = 63, // editing a LIST of specials, not to be confused with MODE_EDIT_SPECIAL singular
|
||||||
|
MODE_EDIT_SPECIAL_ITEMS = 64,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eDrawMode {
|
enum eDrawMode {
|
||||||
|
@@ -422,9 +422,31 @@ void redraw_screen() {
|
|||||||
mainPtr().display();
|
mainPtr().display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void apply_mode_buttons() {
|
||||||
|
right_button_status.clear();
|
||||||
|
int num_options;
|
||||||
|
switch(overall_mode){
|
||||||
|
case MODE_EDIT_SPECIAL_ITEMS:
|
||||||
|
num_options = scenario.special_items.size() + 1;
|
||||||
|
for(int i = 0; i < num_options; i++) {
|
||||||
|
std::string title;
|
||||||
|
if(i == scenario.special_items.size())
|
||||||
|
title = "Create New Special Item";
|
||||||
|
else title = scenario.special_items[i].name;
|
||||||
|
title = std::to_string(i) + " - " + title;
|
||||||
|
set_rb(i,RB_SPEC_ITEM, i, title);
|
||||||
|
}
|
||||||
|
set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"Alt-click to delete",true);
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void draw_main_screen() {
|
void draw_main_screen() {
|
||||||
rectangle draw_rect;
|
rectangle draw_rect;
|
||||||
|
|
||||||
|
apply_mode_buttons();
|
||||||
|
|
||||||
draw_lb();
|
draw_lb();
|
||||||
|
|
||||||
// draw right buttons (only when not editing terrain)
|
// draw right buttons (only when not editing terrain)
|
||||||
|
Reference in New Issue
Block a user