New toolbar buttons for placing boats and horses; replaces the edit boats/horses dialogs
This commit is contained in:
@@ -1,56 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
|
||||||
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
|
|
||||||
<dialog defbtn='okay'>
|
|
||||||
<field name='town1' type='int' top='100' left='214' width='67' height='16'/>
|
|
||||||
<field name='town2' type='int' top='128' left='214' width='67' height='16'/>
|
|
||||||
<field name='town3' type='int' top='156' left='214' width='67' height='16'/>
|
|
||||||
<field name='town4' type='int' top='184' left='214' width='67' height='16'/>
|
|
||||||
<field name='town5' type='int' top='212' left='214' width='67' height='16'/>
|
|
||||||
<field name='town6' type='int' top='240' left='214' width='67' height='16'/>
|
|
||||||
<field name='x1' type='uint' top='100' left='329' width='39' height='16'/>
|
|
||||||
<field name='x2' type='uint' top='128' left='329' width='39' height='16'/>
|
|
||||||
<field name='x3' type='uint' top='156' left='329' width='39' height='16'/>
|
|
||||||
<field name='x4' type='uint' top='184' left='329' width='39' height='16'/>
|
|
||||||
<field name='x5' type='uint' top='212' left='329' width='39' height='16'/>
|
|
||||||
<field name='x6' type='uint' top='240' left='329' width='39' height='16'/>
|
|
||||||
<field name='y1' type='uint' top='100' left='410' width='39' height='16'/>
|
|
||||||
<field name='y2' type='uint' top='128' left='410' width='39' height='16'/>
|
|
||||||
<field name='y3' type='uint' top='156' left='410' width='39' height='16'/>
|
|
||||||
<field name='y4' type='uint' top='184' left='410' width='39' height='16'/>
|
|
||||||
<field name='y5' type='uint' top='212' left='410' width='39' height='16'/>
|
|
||||||
<field name='y6' type='uint' top='240' left='410' width='39' height='16'/>
|
|
||||||
<button name='okay' type='regular' top='268' left='468'>OK</button>
|
|
||||||
<text top='268' left='381' width='75' height='16'/>
|
|
||||||
<button name='left' type='left' top='268' left='51'/>
|
|
||||||
<button name='right' type='right' top='268' left='114'/>
|
|
||||||
<text name='num1' top='100' left='152' width='46' height='14'/>
|
|
||||||
<text name='num2' top='128' left='152' width='46' height='14'/>
|
|
||||||
<text name='num3' top='156' left='153' width='46' height='14'/>
|
|
||||||
<text name='num4' top='184' left='153' width='46' height='14'/>
|
|
||||||
<text name='num5' top='211' left='153' width='46' height='14'/>
|
|
||||||
<text name='num6' top='239' left='153' width='46' height='14'/>
|
|
||||||
<pict type='dlog' num='16' top='8' left='8'/>
|
|
||||||
<text size='large' top='6' left='50' width='256' height='17'>Edit Boats</text>
|
|
||||||
<text top='25' left='50' width='439' height='39'>
|
|
||||||
There can be up to 24 boats in your scenario,
|
|
||||||
each of which must start in some town.
|
|
||||||
The boats can start as the parties property, if you want.
|
|
||||||
If the town is left at -1, the boat won't exist.
|
|
||||||
</text>
|
|
||||||
<text top='70' left='199' width='106' height='14'>Town to start in</text>
|
|
||||||
<text top='64' left='310' width='76' height='25'>X Location in town</text>
|
|
||||||
<text top='64' left='392' width='81' height='26'>Y Location in town</text>
|
|
||||||
<text top='100' left='50' width='97' height='14'>Horse number</text>
|
|
||||||
<text top='128' left='50' width='97' height='14'>Horse number</text>
|
|
||||||
<text top='156' left='51' width='97' height='14'>Horse number</text>
|
|
||||||
<text top='184' left='51' width='97' height='14'>Horse number</text>
|
|
||||||
<text top='211' left='51' width='97' height='14'>Horse number</text>
|
|
||||||
<text top='239' left='51' width='97' height='14'>Horse number</text>
|
|
||||||
<text top='64' left='477' width='70' height='26'>Not Party Property</text>
|
|
||||||
<led name='owned1' state='off' top='100' left='487'/>
|
|
||||||
<led name='owned2' state='off' top='128' left='487'/>
|
|
||||||
<led name='owned3' state='off' top='156' left='488'/>
|
|
||||||
<led name='owned4' state='off' top='184' left='488'/>
|
|
||||||
<led name='owned5' state='off' top='211' left='488'/>
|
|
||||||
<led name='owned6' state='off' top='239' left='488'/>
|
|
||||||
</dialog>
|
|
@@ -1,60 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
|
||||||
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
|
|
||||||
<dialog defbtn='okay'>
|
|
||||||
<field name='town1' type='int' top='143' left='214' width='67' height='16'/>
|
|
||||||
<field name='town2' type='int' top='171' left='214' width='67' height='16'/>
|
|
||||||
<field name='town3' type='int' top='199' left='214' width='67' height='16'/>
|
|
||||||
<field name='town4' type='int' top='227' left='214' width='67' height='16'/>
|
|
||||||
<field name='town5' type='int' top='255' left='214' width='67' height='16'/>
|
|
||||||
<field name='town6' type='int' top='283' left='214' width='67' height='16'/>
|
|
||||||
<field name='x1' type='uint' top='143' left='329' width='39' height='16'/>
|
|
||||||
<field name='x2' type='uint' top='171' left='329' width='39' height='16'/>
|
|
||||||
<field name='x3' type='uint' top='199' left='329' width='39' height='16'/>
|
|
||||||
<field name='x4' type='uint' top='227' left='329' width='39' height='16'/>
|
|
||||||
<field name='x5' type='uint' top='255' left='329' width='39' height='16'/>
|
|
||||||
<field name='x6' type='uint' top='283' left='329' width='39' height='16'/>
|
|
||||||
<field name='y1' type='uint' top='143' left='410' width='39' height='16'/>
|
|
||||||
<field name='y2' type='uint' top='171' left='410' width='39' height='16'/>
|
|
||||||
<field name='y3' type='uint' top='199' left='410' width='39' height='16'/>
|
|
||||||
<field name='y4' type='uint' top='227' left='410' width='39' height='16'/>
|
|
||||||
<field name='y5' type='uint' top='255' left='410' width='39' height='16'/>
|
|
||||||
<field name='y6' type='uint' top='283' left='410' width='39' height='16'/>
|
|
||||||
<button name='okay' type='regular' top='309' left='463'>OK</button>
|
|
||||||
<button name='left' type='left' top='309' left='52'/>
|
|
||||||
<button name='right' type='right' top='309' left='115'/>
|
|
||||||
<text name='num1' top='143' left='152' width='46' height='14'/>
|
|
||||||
<text name='num2' top='171' left='152' width='46' height='14'/>
|
|
||||||
<text name='num3' top='199' left='153' width='46' height='14'/>
|
|
||||||
<text name='num4' top='227' left='153' width='46' height='14'/>
|
|
||||||
<text name='num5' top='254' left='153' width='46' height='14'/>
|
|
||||||
<text name='num6' top='282' left='153' width='46' height='14'/>
|
|
||||||
<pict type='dlog' num='16' top='8' left='8'/>
|
|
||||||
<text size='large' top='6' left='50' width='256' height='17'>Edit Horses</text>
|
|
||||||
<text top='25' left='50' width='439' height='39'>
|
|
||||||
There can be up to 24 horses in your scenario,
|
|
||||||
each of which must start in some town.
|
|
||||||
The horses can start as the parties property, if you want.
|
|
||||||
Leave the town at -1 to make the horse not exist.
|
|
||||||
</text>
|
|
||||||
<text top='65' left='50' width='439' height='41'>
|
|
||||||
Note that horses can't walk over certain terrain types (like floors).
|
|
||||||
Be careful not to place horses where they're stuck and can't get out.
|
|
||||||
This makes them sad.
|
|
||||||
</text>
|
|
||||||
<text top='113' left='199' width='106' height='14'>Town to start in</text>
|
|
||||||
<text top='107' left='310' width='76' height='25'>X Location in town</text>
|
|
||||||
<text top='107' left='392' width='81' height='26'>Y Location in town</text>
|
|
||||||
<text top='143' left='50' width='97' height='14'>Horse number</text>
|
|
||||||
<text top='171' left='50' width='97' height='14'>Horse number</text>
|
|
||||||
<text top='199' left='51' width='97' height='14'>Horse number</text>
|
|
||||||
<text top='227' left='51' width='97' height='14'>Horse number</text>
|
|
||||||
<text top='254' left='51' width='97' height='14'>Horse number</text>
|
|
||||||
<text top='282' left='51' width='97' height='14'>Horse number</text>
|
|
||||||
<text top='107' left='477' width='70' height='26'>Not Party Property</text>
|
|
||||||
<led name='owned1' state='off' top='143' left='488'/>
|
|
||||||
<led name='owned2' state='off' top='171' left='488'/>
|
|
||||||
<led name='owned3' state='off' top='199' left='488'/>
|
|
||||||
<led name='owned4' state='off' top='227' left='488'/>
|
|
||||||
<led name='owned5' state='off' top='254' left='488'/>
|
|
||||||
<led name='owned6' state='off' top='282' left='488'/>
|
|
||||||
</dialog>
|
|
21
rsrc/dialogs/edit-vehicle.xml
Normal file
21
rsrc/dialogs/edit-vehicle.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
||||||
|
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
|
||||||
|
<dialog defbtn='okay'>
|
||||||
|
<pict type='dlog' num='16' top='8' left='8'/>
|
||||||
|
<text name='title' size='large' top='6' left='50' width='256' height='17'>Edit Vehicle</text>
|
||||||
|
|
||||||
|
<text top='25' left='50' width='97' height='14'>Number</text>
|
||||||
|
<field name='num' top='25' left='152' width='46' height='14'/>
|
||||||
|
|
||||||
|
<text top='50' left='50' width='106' height='14'>Starting Area</text>
|
||||||
|
<text name='area' top='50' left='152' width='100' height='16' framed='true'/>
|
||||||
|
|
||||||
|
<text top='75' left='50' width='76' height='25'>Location</text>
|
||||||
|
<text name='loc' top='75' left='152' width='40' height='16'/>
|
||||||
|
|
||||||
|
<led name='owned' state='off' top='100' left='60' width='70'>Not Party Property</led>
|
||||||
|
|
||||||
|
<button name='cancel' type='regular' def-key='esc' top='125' left='51'>Cancel</button>
|
||||||
|
<button name='del' type='regular' top='125' left='114'>Delete</button>
|
||||||
|
<button name='okay' type='regular' top='125' left='277'>OK</button>
|
||||||
|
</dialog>
|
Binary file not shown.
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.8 KiB |
@@ -135,6 +135,8 @@ void cScenario::import_legacy(legacy::scenario_data_type& old){
|
|||||||
rating = eContentRating(old.rating);
|
rating = eContentRating(old.rating);
|
||||||
// TODO: Is this used anywhere?
|
// TODO: Is this used anywhere?
|
||||||
uses_custom_graphics = old.uses_custom_graphics;
|
uses_custom_graphics = old.uses_custom_graphics;
|
||||||
|
boats.resize(30);
|
||||||
|
horses.resize(30);
|
||||||
for(short i = 0; i < 30; i++) {
|
for(short i = 0; i < 30; i++) {
|
||||||
boats[i].import_legacy(old.scen_boats[i]);
|
boats[i].import_legacy(old.scen_boats[i]);
|
||||||
horses[i].import_legacy(old.scen_horses[i]);
|
horses[i].import_legacy(old.scen_horses[i]);
|
||||||
|
@@ -76,8 +76,8 @@ public:
|
|||||||
eContentRating rating;
|
eContentRating rating;
|
||||||
std::vector<ePicType> custom_graphics;
|
std::vector<ePicType> custom_graphics;
|
||||||
std::vector<cMonster> scen_monsters;
|
std::vector<cMonster> scen_monsters;
|
||||||
std::array<cVehicle,30> boats;
|
std::vector<cVehicle> boats;
|
||||||
std::array<cVehicle,30> horses;
|
std::vector<cVehicle> horses;
|
||||||
std::vector<cTerrain> ter_types;
|
std::vector<cTerrain> ter_types;
|
||||||
std::array<cTimer,20> scenario_timers;
|
std::array<cTimer,20> scenario_timers;
|
||||||
std::vector<cSpecial> scen_specials;
|
std::vector<cSpecial> scen_specials;
|
||||||
|
@@ -72,7 +72,7 @@ ePalBtn out_buttons[6][10] = {
|
|||||||
{PAL_PENCIL, PAL_BRUSH_LG, PAL_BRUSH_SM, PAL_SPRAY_LG, PAL_SPRAY_SM, PAL_ERASER, PAL_DROPPER, PAL_RECT_HOLLOW, PAL_RECT_FILLED, PAL_BUCKET},
|
{PAL_PENCIL, PAL_BRUSH_LG, PAL_BRUSH_SM, PAL_SPRAY_LG, PAL_SPRAY_SM, PAL_ERASER, PAL_DROPPER, PAL_RECT_HOLLOW, PAL_RECT_FILLED, PAL_BUCKET},
|
||||||
{PAL_EDIT_TOWN, PAL_ERASE_TOWN, PAL_BLANK, PAL_BLANK, PAL_EDIT_SIGN, PAL_TEXT_AREA, PAL_WANDER, PAL_CHANGE, PAL_ZOOM, PAL_BLANK},
|
{PAL_EDIT_TOWN, PAL_ERASE_TOWN, PAL_BLANK, PAL_BLANK, PAL_EDIT_SIGN, PAL_TEXT_AREA, PAL_WANDER, PAL_CHANGE, PAL_ZOOM, PAL_BLANK},
|
||||||
{PAL_SPEC, PAL_COPY_SPEC, PAL_PASTE_SPEC, PAL_ERASE_SPEC, PAL_EDIT_SPEC, PAL_SPEC_SPOT, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK},
|
{PAL_SPEC, PAL_COPY_SPEC, PAL_PASTE_SPEC, PAL_ERASE_SPEC, PAL_EDIT_SPEC, PAL_SPEC_SPOT, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK},
|
||||||
{PAL_BLANK, PAL_ROAD, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK},
|
{PAL_BOAT, PAL_HORSE, PAL_ROAD, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK},
|
||||||
{PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK},
|
{PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK},
|
||||||
{PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK},
|
{PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK},
|
||||||
};
|
};
|
||||||
@@ -81,7 +81,7 @@ ePalBtn town_buttons[6][10] = {
|
|||||||
{PAL_PENCIL, PAL_BRUSH_LG, PAL_BRUSH_SM, PAL_SPRAY_LG, PAL_SPRAY_SM, PAL_ERASER, PAL_DROPPER, PAL_RECT_HOLLOW, PAL_RECT_FILLED, PAL_BUCKET},
|
{PAL_PENCIL, PAL_BRUSH_LG, PAL_BRUSH_SM, PAL_SPRAY_LG, PAL_SPRAY_SM, PAL_ERASER, PAL_DROPPER, PAL_RECT_HOLLOW, PAL_RECT_FILLED, PAL_BUCKET},
|
||||||
{PAL_ENTER_N, PAL_ENTER_W, PAL_ENTER_S, PAL_ENTER_E, PAL_EDIT_SIGN, PAL_TEXT_AREA, PAL_WANDER, PAL_CHANGE, PAL_ZOOM, PAL_TERRAIN},
|
{PAL_ENTER_N, PAL_ENTER_W, PAL_ENTER_S, PAL_ENTER_E, PAL_EDIT_SIGN, PAL_TEXT_AREA, PAL_WANDER, PAL_CHANGE, PAL_ZOOM, PAL_TERRAIN},
|
||||||
{PAL_SPEC, PAL_COPY_SPEC, PAL_PASTE_SPEC, PAL_ERASE_SPEC, PAL_EDIT_SPEC, PAL_SPEC_SPOT, PAL_EDIT_ITEM, PAL_SAME_ITEM, PAL_ERASE_ITEM, PAL_ITEM},
|
{PAL_SPEC, PAL_COPY_SPEC, PAL_PASTE_SPEC, PAL_ERASE_SPEC, PAL_EDIT_SPEC, PAL_SPEC_SPOT, PAL_EDIT_ITEM, PAL_SAME_ITEM, PAL_ERASE_ITEM, PAL_ITEM},
|
||||||
{PAL_BLANK, PAL_ROAD, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_EDIT_MONST, PAL_SAME_MONST, PAL_ERASE_MONST, PAL_MONST},
|
{PAL_BOAT, PAL_HORSE, PAL_ROAD, PAL_BLANK, PAL_BLANK, PAL_BLANK, PAL_EDIT_MONST, PAL_SAME_MONST, PAL_ERASE_MONST, PAL_MONST},
|
||||||
{PAL_WEB, PAL_CRATE, PAL_BARREL, PAL_BLOCK, PAL_FIRE_BARR, PAL_FORCE_BARR, PAL_QUICKFIRE, PAL_FORCECAGE, PAL_ERASE_FIELD, PAL_BLANK},
|
{PAL_WEB, PAL_CRATE, PAL_BARREL, PAL_BLOCK, PAL_FIRE_BARR, PAL_FORCE_BARR, PAL_QUICKFIRE, PAL_FORCECAGE, PAL_ERASE_FIELD, PAL_BLANK},
|
||||||
{PAL_SFX_SB, PAL_SFX_MB, PAL_SFX_LB, PAL_SFX_SS, PAL_SFX_LS, PAL_SFX_ASH, PAL_SFX_BONE, PAL_SFX_ROCK, PAL_BLANK, PAL_BLANK},
|
{PAL_SFX_SB, PAL_SFX_MB, PAL_SFX_LB, PAL_SFX_SS, PAL_SFX_LS, PAL_SFX_ASH, PAL_SFX_BONE, PAL_SFX_ROCK, PAL_BLANK, PAL_BLANK},
|
||||||
};
|
};
|
||||||
@@ -132,6 +132,7 @@ static cursor_type get_edit_cursor() {
|
|||||||
case MODE_PLACE_STONE_BLOCK: case MODE_PLACE_FIRE_BARRIER:
|
case MODE_PLACE_STONE_BLOCK: case MODE_PLACE_FIRE_BARRIER:
|
||||||
case MODE_PLACE_FORCE_BARRIER: case MODE_PLACE_QUICKFIRE:
|
case MODE_PLACE_FORCE_BARRIER: case MODE_PLACE_QUICKFIRE:
|
||||||
case MODE_PLACE_FORCECAGE: case MODE_PLACE_SFX:
|
case MODE_PLACE_FORCECAGE: case MODE_PLACE_SFX:
|
||||||
|
case MODE_PLACE_HORSE: case MODE_PLACE_BOAT:
|
||||||
case MODE_TOGGLE_SPECIAL_DOT: case MODE_TOGGLE_ROAD:
|
case MODE_TOGGLE_SPECIAL_DOT: case MODE_TOGGLE_ROAD:
|
||||||
|
|
||||||
case MODE_DRAWING:
|
case MODE_DRAWING:
|
||||||
@@ -1131,6 +1132,32 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
|
|||||||
overall_mode = MODE_DRAWING;
|
overall_mode = MODE_DRAWING;
|
||||||
change_made = true;
|
change_made = true;
|
||||||
break;
|
break;
|
||||||
|
case MODE_PLACE_BOAT: case MODE_PLACE_HORSE: {
|
||||||
|
auto& all = overall_mode == MODE_PLACE_BOAT ? scenario.boats : scenario.horses;
|
||||||
|
auto iter = std::find_if(all.begin(), all.end(), [](const cVehicle& what) {
|
||||||
|
if(editing_town && cur_town != what.which_town) return false;
|
||||||
|
else if(!editing_town && what.which_town != 200) return false;
|
||||||
|
return what.loc == spot_hit;
|
||||||
|
});
|
||||||
|
if(iter == all.end()) {
|
||||||
|
iter = std::find_if(all.begin(), all.end(), [](const cVehicle& what) {
|
||||||
|
return what.which_town < 0;
|
||||||
|
});
|
||||||
|
if(iter == all.end()) {
|
||||||
|
all.emplace_back();
|
||||||
|
iter = all.end() - 1;
|
||||||
|
}
|
||||||
|
iter->loc = spot_hit;
|
||||||
|
iter->which_town = editing_town ? cur_town : 200;
|
||||||
|
iter->property = false;
|
||||||
|
iter->exists = false;
|
||||||
|
if(!editing_town) iter->sector = cur_out;
|
||||||
|
}
|
||||||
|
if(!edit_vehicle(*iter, iter - all.begin(), overall_mode == MODE_PLACE_BOAT))
|
||||||
|
all.erase(iter);
|
||||||
|
overall_mode = MODE_DRAWING;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case MODE_INTRO_SCREEN:
|
case MODE_INTRO_SCREEN:
|
||||||
case MODE_EDIT_TYPES:
|
case MODE_EDIT_TYPES:
|
||||||
case MODE_MAIN_SCREEN:
|
case MODE_MAIN_SCREEN:
|
||||||
@@ -1507,6 +1534,14 @@ static bool handle_toolpal_action(location cur_point2) {
|
|||||||
draw_mode = DRAW_MONST;
|
draw_mode = DRAW_MONST;
|
||||||
set_up_terrain_buttons(true);
|
set_up_terrain_buttons(true);
|
||||||
break;
|
break;
|
||||||
|
case PAL_BOAT:
|
||||||
|
set_string("Place/edit boat","Select boat location");
|
||||||
|
overall_mode = MODE_PLACE_BOAT;
|
||||||
|
break;
|
||||||
|
case PAL_HORSE:
|
||||||
|
set_string("Place/edit horse","Select horse location");
|
||||||
|
overall_mode = MODE_PLACE_HORSE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -2533,75 +2533,44 @@ void edit_save_rects() {
|
|||||||
save_dlg.run();
|
save_dlg.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool save_vehicles(cDialog& me, cVehicle* vehicles, const short page) {
|
static void put_vehicle_area(cDialog& me, const cVehicle& what) {
|
||||||
for(short i = 0; i < 6; i++) {
|
std::ostringstream sout;
|
||||||
std::string id = std::to_string(i + 1);
|
if(what.which_town == 200) {
|
||||||
vehicles[6 * page + i].which_town = me["town" + id].getTextAsNum();
|
sout << "Outdoors @ " << what.sector;
|
||||||
if(cre(vehicles[6 * page + i].which_town,
|
} else {
|
||||||
-1,199,"Town number must be from 0 to 199 (or -1 for it to not exist).","",&me)) return false;
|
sout << "Town " << what.which_town;
|
||||||
vehicles[6 * page + i].loc.x = me["x" + id].getTextAsNum();
|
|
||||||
if(cre(vehicles[6 * page + i].loc.x,
|
|
||||||
0,63,"coordinates must be from 0 to 63.","",&me)) return false;
|
|
||||||
vehicles[6 * page + i].loc.y = me["y" + id].getTextAsNum();
|
|
||||||
if(cre(vehicles[6 * page + i].loc.y,
|
|
||||||
0,63,"coordinates must be from 0 to 63.","",&me)) return false;
|
|
||||||
vehicles[6 * page + i].property = dynamic_cast<cLed&>(me["owned" + id]).getState() != led_off;
|
|
||||||
}
|
}
|
||||||
return true;
|
me["area"].setText(sout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void put_vehicles_in_dlog(cDialog& me, cVehicle* vehicles, const short page) {
|
bool edit_vehicle(cVehicle& what, int num, bool is_boat) {
|
||||||
for(short i = 0; i < 6; i++) {
|
|
||||||
std::string id = std::to_string(i + 1);
|
|
||||||
me["num" + id].setTextToNum(6 * page + i);
|
|
||||||
me["town" + id].setTextToNum(vehicles[6 * page + i].which_town);
|
|
||||||
me["x" + id].setTextToNum(vehicles[6 * page + i].loc.x);
|
|
||||||
me["y" + id].setTextToNum(vehicles[6 * page + i].loc.y);
|
|
||||||
dynamic_cast<cLed&>(me["owned" + id]).setState(vehicles[6 * page + i].property ? led_red : led_off);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool edit_vehicles_event_filter(cDialog& me, std::string hit, cVehicle* vehicles, size_t nVehicles, size_t& page) {
|
|
||||||
|
|
||||||
if(hit == "okay") {
|
|
||||||
if(save_vehicles(me, vehicles, page))
|
|
||||||
me.toast(true);
|
|
||||||
} else if(hit == "left") {
|
|
||||||
if(!save_vehicles(me, vehicles, page)) return true;
|
|
||||||
if(page == 0) page = (nVehicles - 1) / 6;
|
|
||||||
else page--;
|
|
||||||
put_vehicles_in_dlog(me, vehicles, page);
|
|
||||||
} else if(hit == "right") {
|
|
||||||
if(!save_vehicles(me, vehicles, page)) return true;
|
|
||||||
page++;
|
|
||||||
if(page > (nVehicles - 1) / 6) page = 0;
|
|
||||||
put_vehicles_in_dlog(me, vehicles, page);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void edit_horses() {
|
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
size_t page = 0;
|
cDialog dlg("edit-vehicle");
|
||||||
|
dlg["okay"].attachClickHandler(std::bind(&cDialog::toast, &dlg, true));
|
||||||
|
dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &dlg, false));
|
||||||
|
dlg["del"].attachClickHandler([](cDialog& me, std::string, eKeyMod) {
|
||||||
|
me.setResult(false);
|
||||||
|
return me.toast(false);
|
||||||
|
});
|
||||||
|
|
||||||
cDialog horse_dlg("edit-horses");
|
put_vehicle_area(dlg, what);
|
||||||
horse_dlg.attachClickHandlers(std::bind(edit_vehicles_event_filter, _1, _2, scenario.horses.data(), 30, std::ref(page)), {"okay", "left", "right"});
|
dlg["loc"].setText(boost::lexical_cast<std::string>(what.loc));
|
||||||
|
dlg["num"].setTextToNum(num);
|
||||||
|
dlg["title"].setText(is_boat ? "Edit Boat" : "Edit Horse");
|
||||||
|
|
||||||
put_vehicles_in_dlog(horse_dlg, scenario.horses.data(), page);
|
cLed& prop = dynamic_cast<cLed&>(dlg["owned"]);
|
||||||
|
prop.setState(what.property ? led_red : led_off);
|
||||||
|
|
||||||
horse_dlg.run();
|
dlg.setResult(true);
|
||||||
}
|
dlg.run();
|
||||||
|
if(!dlg.getResult<bool>())
|
||||||
void edit_boats() {
|
return false;
|
||||||
using namespace std::placeholders;
|
|
||||||
size_t page = 0;
|
|
||||||
|
|
||||||
cDialog boat_dlg("edit-boats");
|
if(dlg.accepted()) {
|
||||||
boat_dlg.attachClickHandlers(std::bind(edit_vehicles_event_filter, _1, _2, scenario.boats.data(), 30, std::ref(page)), {"okay", "left", "right"});
|
what.property = prop.getState() != led_off;
|
||||||
|
what.exists = true;
|
||||||
put_vehicles_in_dlog(boat_dlg, scenario.boats.data(), page);
|
}
|
||||||
|
return what.exists;
|
||||||
boat_dlg.run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool save_add_town(cDialog& me) {
|
static bool save_add_town(cDialog& me) {
|
||||||
|
@@ -13,7 +13,6 @@ bool edit_spec_item(short which_item);
|
|||||||
bool edit_quest(size_t which_quest);
|
bool edit_quest(size_t which_quest);
|
||||||
bool edit_shop(size_t which_shop, cDialog* parent = nullptr);
|
bool edit_shop(size_t which_shop, cDialog* parent = nullptr);
|
||||||
void edit_save_rects();
|
void edit_save_rects();
|
||||||
void edit_horses();
|
|
||||||
void edit_add_town();
|
void edit_add_town();
|
||||||
void edit_item_placement();
|
void edit_item_placement();
|
||||||
void edit_scen_details();
|
void edit_scen_details();
|
||||||
@@ -21,7 +20,7 @@ bool edit_make_scen_2(short& out_w, short& out_h, short& town_l, short& town_m,
|
|||||||
bool edit_make_scen_1(std::string& filename,std::string& title,bool& grass);
|
bool edit_make_scen_1(std::string& filename,std::string& title,bool& grass);
|
||||||
void edit_scenario_events();
|
void edit_scenario_events();
|
||||||
bool build_scenario();
|
bool build_scenario();
|
||||||
void edit_boats();
|
bool edit_vehicle(class cVehicle& what, int num, bool is_boat);
|
||||||
|
|
||||||
bool check_range_msg(cDialog& me,std::string id,bool losing,long min_val,long max_val,std::string fld_name,std::string xtra);
|
bool check_range_msg(cDialog& me,std::string id,bool losing,long min_val,long max_val,std::string fld_name,std::string xtra);
|
||||||
bool check_range(cDialog& me,std::string id,bool losing,long min_val,long max_val,std::string fld_name);
|
bool check_range(cDialog& me,std::string id,bool losing,long min_val,long max_val,std::string fld_name);
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
enum eScenMode {
|
enum eScenMode {
|
||||||
MODE_DRAWING = 0,
|
MODE_DRAWING = 0,
|
||||||
|
MODE_TOGGLE_ROAD = 1,
|
||||||
MODE_SET_WANDER_POINTS = 2,
|
MODE_SET_WANDER_POINTS = 2,
|
||||||
MODE_ROOM_RECT = 3,
|
MODE_ROOM_RECT = 3,
|
||||||
MODE_PLACE_ITEM = 4,
|
MODE_PLACE_ITEM = 4,
|
||||||
@@ -42,7 +43,8 @@ enum eScenMode {
|
|||||||
MODE_PLACE_SOUTH_ENTRANCE = 12,
|
MODE_PLACE_SOUTH_ENTRANCE = 12,
|
||||||
MODE_PLACE_WEST_ENTRANCE = 13,
|
MODE_PLACE_WEST_ENTRANCE = 13,
|
||||||
MODE_FLOOD_FILL = 14,
|
MODE_FLOOD_FILL = 14,
|
||||||
MODE_TOGGLE_ROAD = 15,
|
MODE_PLACE_HORSE = 15,
|
||||||
|
MODE_PLACE_BOAT = 16,
|
||||||
MODE_PLACE_FORCECAGE = 19,
|
MODE_PLACE_FORCECAGE = 19,
|
||||||
MODE_PLACE_WEB = 20,
|
MODE_PLACE_WEB = 20,
|
||||||
MODE_PLACE_CRATE = 21,
|
MODE_PLACE_CRATE = 21,
|
||||||
@@ -102,6 +104,7 @@ enum ePalBtn {
|
|||||||
PAL_WEB = 40, PAL_CRATE = 41, PAL_BARREL = 42, PAL_FIRE_BARR = 43, PAL_FORCE_BARR = 44, PAL_QUICKFIRE = 45, PAL_SPEC_SPOT = 46, PAL_BLOCK = 47, PAL_FORCECAGE = 48, PAL_ERASE_FIELD = 33,
|
PAL_WEB = 40, PAL_CRATE = 41, PAL_BARREL = 42, PAL_FIRE_BARR = 43, PAL_FORCE_BARR = 44, PAL_QUICKFIRE = 45, PAL_SPEC_SPOT = 46, PAL_BLOCK = 47, PAL_FORCECAGE = 48, PAL_ERASE_FIELD = 33,
|
||||||
PAL_SFX_SB = 50, PAL_SFX_MB = 51, PAL_SFX_LB = 52, PAL_SFX_SS = 53, PAL_SFX_LS = 54, PAL_SFX_ASH = 55, PAL_SFX_BONE = 56, PAL_SFX_ROCK = 57, PAL_ROAD = 58,
|
PAL_SFX_SB = 50, PAL_SFX_MB = 51, PAL_SFX_LB = 52, PAL_SFX_SS = 53, PAL_SFX_LS = 54, PAL_SFX_ASH = 55, PAL_SFX_BONE = 56, PAL_SFX_ROCK = 57, PAL_ROAD = 58,
|
||||||
PAL_ARROW_UP = 9, PAL_ARROW_DOWN = 69, PAL_TERRAIN = 29, PAL_ITEM = 39, PAL_MONST = 49,
|
PAL_ARROW_UP = 9, PAL_ARROW_DOWN = 69, PAL_TERRAIN = 29, PAL_ITEM = 39, PAL_MONST = 49,
|
||||||
|
PAL_BOAT = 60, PAL_HORSE = 61,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -375,14 +375,6 @@ void handle_menu_choice(eMenu item_hit) {
|
|||||||
edit_save_rects();
|
edit_save_rects();
|
||||||
change_made = true;
|
change_made = true;
|
||||||
break;
|
break;
|
||||||
case eMenu::SCEN_HORSES:
|
|
||||||
edit_horses();
|
|
||||||
change_made = true;
|
|
||||||
break;
|
|
||||||
case eMenu::SCEN_BOATS:
|
|
||||||
edit_boats();
|
|
||||||
change_made = true;
|
|
||||||
break;
|
|
||||||
case eMenu::TOWN_VARYING:
|
case eMenu::TOWN_VARYING:
|
||||||
edit_add_town();
|
edit_add_town();
|
||||||
change_made = true;
|
change_made = true;
|
||||||
|
@@ -20,7 +20,7 @@ enum class eMenu {
|
|||||||
// Scenario menu
|
// Scenario menu
|
||||||
TOWN_CREATE, OUT_RESIZE, SCEN_DETAILS, SCEN_INTRO, TOWN_START,
|
TOWN_CREATE, OUT_RESIZE, SCEN_DETAILS, SCEN_INTRO, TOWN_START,
|
||||||
SCEN_SPECIALS, SCEN_TEXT, SCEN_JOURNALS, TOWN_IMPORT, OUT_IMPORT,
|
SCEN_SPECIALS, SCEN_TEXT, SCEN_JOURNALS, TOWN_IMPORT, OUT_IMPORT,
|
||||||
SCEN_SAVE_ITEM_RECTS, SCEN_HORSES, SCEN_BOATS,
|
SCEN_SAVE_ITEM_RECTS,
|
||||||
TOWN_VARYING, SCEN_TIMERS, SCEN_ITEM_SHORTCUTS, TOWN_DELETE,
|
TOWN_VARYING, SCEN_TIMERS, SCEN_ITEM_SHORTCUTS, TOWN_DELETE,
|
||||||
SCEN_DATA_DUMP, SCEN_TEXT_DUMP,
|
SCEN_DATA_DUMP, SCEN_TEXT_DUMP,
|
||||||
SCEN_PICS, SCEN_SHEETS, SCEN_SNDS,
|
SCEN_PICS, SCEN_SHEETS, SCEN_SNDS,
|
||||||
|
@@ -55,7 +55,7 @@ void init_menubar() {
|
|||||||
eMenu::TOWN_CREATE, eMenu::OUT_RESIZE, eMenu::NONE,
|
eMenu::TOWN_CREATE, eMenu::OUT_RESIZE, eMenu::NONE,
|
||||||
eMenu::SCEN_DETAILS, eMenu::SCEN_INTRO, eMenu::SCEN_SHEETS, eMenu::SCEN_PICS, eMenu::SCEN_SNDS, eMenu::NONE, eMenu::NONE,
|
eMenu::SCEN_DETAILS, eMenu::SCEN_INTRO, eMenu::SCEN_SHEETS, eMenu::SCEN_PICS, eMenu::SCEN_SNDS, eMenu::NONE, eMenu::NONE,
|
||||||
eMenu::SCEN_SPECIALS, eMenu::SCEN_TEXT, eMenu::SCEN_JOURNALS, eMenu::TOWN_IMPORT, eMenu::OUT_IMPORT, eMenu::SCEN_SAVE_ITEM_RECTS,
|
eMenu::SCEN_SPECIALS, eMenu::SCEN_TEXT, eMenu::SCEN_JOURNALS, eMenu::TOWN_IMPORT, eMenu::OUT_IMPORT, eMenu::SCEN_SAVE_ITEM_RECTS,
|
||||||
eMenu::SCEN_HORSES, eMenu::SCEN_BOATS, eMenu::TOWN_VARYING, eMenu::SCEN_TIMERS, eMenu::SCEN_ITEM_SHORTCUTS,
|
eMenu::TOWN_VARYING, eMenu::SCEN_TIMERS, eMenu::SCEN_ITEM_SHORTCUTS,
|
||||||
eMenu::TOWN_DELETE, eMenu::SCEN_DATA_DUMP, eMenu::SCEN_TEXT_DUMP,
|
eMenu::TOWN_DELETE, eMenu::SCEN_DATA_DUMP, eMenu::SCEN_TEXT_DUMP,
|
||||||
};
|
};
|
||||||
static const eMenu town_choices[] = {
|
static const eMenu town_choices[] = {
|
||||||
|
@@ -83,7 +83,7 @@ void init_menubar() {
|
|||||||
eMenu::TOWN_CREATE, eMenu::OUT_RESIZE, eMenu::NONE,
|
eMenu::TOWN_CREATE, eMenu::OUT_RESIZE, eMenu::NONE,
|
||||||
eMenu::SCEN_DETAILS, eMenu::SCEN_INTRO, eMenu::SCEN_SHEETS, eMenu::SCEN_PICS, eMenu::SCEN_SNDS, eMenu::NONE, eMenu::NONE,
|
eMenu::SCEN_DETAILS, eMenu::SCEN_INTRO, eMenu::SCEN_SHEETS, eMenu::SCEN_PICS, eMenu::SCEN_SNDS, eMenu::NONE, eMenu::NONE,
|
||||||
eMenu::SCEN_SPECIALS, eMenu::SCEN_TEXT, eMenu::SCEN_JOURNALS, eMenu::TOWN_IMPORT, eMenu::OUT_IMPORT, eMenu::SCEN_SAVE_ITEM_RECTS,
|
eMenu::SCEN_SPECIALS, eMenu::SCEN_TEXT, eMenu::SCEN_JOURNALS, eMenu::TOWN_IMPORT, eMenu::OUT_IMPORT, eMenu::SCEN_SAVE_ITEM_RECTS,
|
||||||
eMenu::SCEN_HORSES, eMenu::SCEN_BOATS, eMenu::TOWN_VARYING, eMenu::SCEN_TIMERS, eMenu::SCEN_ITEM_SHORTCUTS,
|
eMenu::TOWN_VARYING, eMenu::SCEN_TIMERS, eMenu::SCEN_ITEM_SHORTCUTS,
|
||||||
eMenu::TOWN_DELETE, eMenu::SCEN_DATA_DUMP, eMenu::SCEN_TEXT_DUMP,
|
eMenu::TOWN_DELETE, eMenu::SCEN_DATA_DUMP, eMenu::SCEN_TEXT_DUMP,
|
||||||
};
|
};
|
||||||
static const eMenu town_choices[] = {
|
static const eMenu town_choices[] = {
|
||||||
|
Reference in New Issue
Block a user