Merge pull request #543 from NQNStudios:editor-bounds
Scenedit Quality of life: be helpful when scrolling past boundaries I've implemented 2 features here: * When scrolling past the boundaries of the current outdoor section, you will get a yes/no prompt which can load the adjacent section for you at the corresponding center position. * When scrolling past the boundaries (literal, not the changeable rectangle) of the current town, the editor will ask if you want to jump to the town's entrance in the outdoors. If there are more than one, you can choose. I did this because I need to be able to find town entrances in the built-in scenarios so I can debug things.
This commit is contained in:
@@ -440,33 +440,27 @@ static void handle_scenario_args() {
|
||||
}
|
||||
// Try to put the party in an outdoor section from which you can enter the town --
|
||||
// so when you leave, you'll hopefully be in the right place.
|
||||
bool found_entrance = false;
|
||||
for(int x = 0; x < univ.scenario.outdoors.width(); ++x){
|
||||
for(int y = 0; y < univ.scenario.outdoors.height(); ++y){
|
||||
for(spec_loc_t& entrance : univ.scenario.outdoors[x][y]->city_locs){
|
||||
if(entrance.spec == *scen_arg_town){
|
||||
// Very janky but I don't know how else to make it properly load the right sections and set i_w_c
|
||||
while(univ.party.outdoor_corner.x > x){
|
||||
shift_universe_left();
|
||||
}
|
||||
while(univ.party.outdoor_corner.x < x){
|
||||
shift_universe_right();
|
||||
}
|
||||
while(univ.party.outdoor_corner.y > y){
|
||||
shift_universe_up();
|
||||
}
|
||||
while(univ.party.outdoor_corner.y < y){
|
||||
shift_universe_down();
|
||||
}
|
||||
outd_move_party(local_to_global(entrance), true);
|
||||
|
||||
found_entrance = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found_entrance) break;
|
||||
auto town_entrances = univ.scenario.find_town_entrances(*scen_arg_town);
|
||||
if(!town_entrances.empty()){
|
||||
// When there are multiple entrances, this part of the code shouldn't matter,
|
||||
// but also won't hurt.
|
||||
town_entrance_t first_entrance_found = town_entrances[0];
|
||||
int x = first_entrance_found.out_sec.x;
|
||||
int y = first_entrance_found.out_sec.y;
|
||||
// Very janky but I don't know how else to make it properly load the right sections and set i_w_c
|
||||
while(univ.party.outdoor_corner.x > x){
|
||||
shift_universe_left();
|
||||
}
|
||||
if(found_entrance) break;
|
||||
while(univ.party.outdoor_corner.x < x){
|
||||
shift_universe_right();
|
||||
}
|
||||
while(univ.party.outdoor_corner.y > y){
|
||||
shift_universe_up();
|
||||
}
|
||||
while(univ.party.outdoor_corner.y < y){
|
||||
shift_universe_down();
|
||||
}
|
||||
outd_move_party(local_to_global(first_entrance_found.loc), true);
|
||||
}
|
||||
|
||||
short town_entrance = 0;
|
||||
|
Reference in New Issue
Block a user