Make fields paintable

This commit is contained in:
2015-09-26 02:29:45 -04:00
parent df6c0afa6e
commit b437045f12
3 changed files with 47 additions and 16 deletions

View File

@@ -865,54 +865,56 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
break;
case MODE_PLACE_WEB:
make_field_type(spot_hit.x,spot_hit.y,FIELD_WEB);
overall_mode = MODE_DRAWING;
mouse_button_held = true;
break;
case MODE_PLACE_CRATE:
make_field_type(spot_hit.x,spot_hit.y,OBJECT_CRATE);
overall_mode = MODE_DRAWING;
mouse_button_held = true;
break;
case MODE_PLACE_BARREL:
make_field_type(spot_hit.x,spot_hit.y,OBJECT_BARREL);
overall_mode = MODE_DRAWING;
mouse_button_held = true;
break;
case MODE_PLACE_FIRE_BARRIER:
make_field_type(spot_hit.x,spot_hit.y,BARRIER_FIRE);
overall_mode = MODE_DRAWING;
mouse_button_held = true;
break;
case MODE_PLACE_FORCE_BARRIER:
make_field_type(spot_hit.x,spot_hit.y,BARRIER_FORCE);
overall_mode = MODE_DRAWING;
mouse_button_held = true;
break;
case MODE_PLACE_QUICKFIRE:
make_field_type(spot_hit.x,spot_hit.y,FIELD_QUICKFIRE);
overall_mode = MODE_DRAWING;
mouse_button_held = true;
break;
case MODE_PLACE_STONE_BLOCK:
make_field_type(spot_hit.x,spot_hit.y,OBJECT_BLOCK);
overall_mode = MODE_DRAWING;
mouse_button_held = true;
break;
case MODE_PLACE_FORCECAGE:
make_field_type(spot_hit.x,spot_hit.y,BARRIER_CAGE);
overall_mode = MODE_DRAWING;
mouse_button_held = true;
break;
case MODE_TOGGLE_SPECIAL_DOT:
if(!editing_town){
current_terrain->special_spot[spot_hit.x][spot_hit.y] = !current_terrain->special_spot[spot_hit.x][spot_hit.y];
overall_mode = MODE_DRAWING;
if(!mouse_button_held)
mode_count = !current_terrain->special_spot[spot_hit.x][spot_hit.y];
current_terrain->special_spot[spot_hit.x][spot_hit.y] = mode_count;
mouse_button_held = true;
break;
}
make_field_type(spot_hit.x, spot_hit.y, SPECIAL_SPOT);
overall_mode = MODE_DRAWING;
mouse_button_held = true;
break;
case MODE_CLEAR_FIELDS:
for(int i = 8; i <= BARRIER_CAGE; i++)
take_field_type(spot_hit.x,spot_hit.y, eFieldType(i));
set_cursor(wand_curs);
overall_mode = MODE_DRAWING;
mouse_button_held = true;
break;
case MODE_PLACE_SFX:
make_field_type(spot_hit.x,spot_hit.y,eFieldType(SFX_SMALL_BLOOD + mode_count));
overall_mode = MODE_DRAWING;
mouse_button_held = true;
break;
case MODE_EYEDROPPER:
if(editing_town)

View File

@@ -33,7 +33,7 @@ enum eScenMode {
MODE_ROOM_RECT = 3,
MODE_PLACE_ITEM = 4,
MODE_EDIT_ITEM = 5,
MODE_TOGGLE_SPECIAL_DOT = 6, // I suspect that's what this was for, anyway it currently does nothing
MODE_TOGGLE_SPECIAL_DOT = 6,
MODE_SET_TOWN_START = 7, // unused; for something I'd like to add
MODE_PLACE_SAME_CREATURE = 8,
MODE_SET_TOWN_RECT = 9,

View File

@@ -1373,9 +1373,9 @@ void place_location() {
if(overall_mode < MODE_MAIN_SCREEN) {
place_selected_terrain(current_terrain_type, draw_rect);
extern short mode_count;
if(overall_mode == MODE_PLACE_CREATURE || overall_mode == MODE_PLACE_SAME_CREATURE) {
rectangle to_rect = draw_rect;
extern short mode_count;
picture_wanted = scenario.scen_monsters[mode_count].picture_num;
if(picture_wanted >= 4000) {
picture_wanted %= 1000;
@@ -1471,7 +1471,6 @@ void place_location() {
}
}
} else if(overall_mode == MODE_PLACE_ITEM || overall_mode == MODE_PLACE_SAME_ITEM) {
extern short mode_count;
picture_wanted = scenario.scen_items[mode_count].graphic_num;
if(picture_wanted >= 1000) {
sf::Texture* source_gworld;
@@ -1486,6 +1485,36 @@ void place_location() {
tiny_from.offset((picture_wanted % 10) * 18,(picture_wanted / 10) * 18);
rect_draw_some_item(tiny_obj_gworld,tiny_from,terrain_buttons_gworld,draw_rect,sf::BlendAlpha);
}
} else if(overall_mode == MODE_TOGGLE_SPECIAL_DOT) {
source_rect = calc_rect(4, 0);
rect_draw_some_item(fields_gworld,source_rect,terrain_buttons_gworld,draw_rect,sf::BlendAlpha);
} else if(overall_mode == MODE_PLACE_FORCECAGE) {
source_rect = calc_rect(0, 0);
rect_draw_some_item(fields_gworld,source_rect,terrain_buttons_gworld,draw_rect,sf::BlendAlpha);
} else if(overall_mode == MODE_PLACE_WEB) {
source_rect = calc_rect(5, 0);
rect_draw_some_item(fields_gworld,source_rect,terrain_buttons_gworld,draw_rect,sf::BlendAlpha);
} else if(overall_mode == MODE_PLACE_CRATE) {
source_rect = calc_rect(6, 0);
rect_draw_some_item(fields_gworld,source_rect,terrain_buttons_gworld,draw_rect,sf::BlendAlpha);
} else if(overall_mode == MODE_PLACE_BARREL) {
source_rect = calc_rect(7, 0);
rect_draw_some_item(fields_gworld,source_rect,terrain_buttons_gworld,draw_rect,sf::BlendAlpha);
} else if(overall_mode == MODE_PLACE_FIRE_BARRIER) {
source_rect = calc_rect(8, 4);
rect_draw_some_item(anim_gworld,source_rect,terrain_buttons_gworld,draw_rect,sf::BlendAlpha);
} else if(overall_mode == MODE_PLACE_FORCE_BARRIER) {
source_rect = calc_rect(8, 4);
rect_draw_some_item(anim_gworld,source_rect,terrain_buttons_gworld,draw_rect,sf::BlendAlpha);
} else if(overall_mode == MODE_PLACE_QUICKFIRE) {
source_rect = calc_rect(7, 1);
rect_draw_some_item(fields_gworld,source_rect,terrain_buttons_gworld,draw_rect,sf::BlendAlpha);
} else if(overall_mode == MODE_PLACE_STONE_BLOCK) {
source_rect = calc_rect(3, 0);
rect_draw_some_item(fields_gworld,source_rect,terrain_buttons_gworld,draw_rect,sf::BlendAlpha);
} else if(overall_mode == MODE_PLACE_SFX) {
source_rect = calc_rect(mode_count, 3);
rect_draw_some_item(fields_gworld,source_rect,terrain_buttons_gworld,draw_rect,sf::BlendAlpha);
}
draw_rect.offset(0,40);
place_selected_terrain(current_ground, draw_rect);