implement vehicle pictype (presets only, for now)
This commit is contained in:
@@ -14,3 +14,7 @@ Dialog Icon (large)
|
||||
Scenario Icon (large)
|
||||
Terrain Map Icon
|
||||
Status Icon
|
||||
|
||||
|
||||
Vehicle
|
||||
Vehicle (Occupied)
|
@@ -69,6 +69,10 @@ void cPict::init(){
|
||||
drawPict()[PIC_PARTY_MONST_TALL] = &cPict::drawPartyMonstTall;
|
||||
drawPict()[PIC_PARTY_MONST_LG] = &cPict::drawPartyMonstLg;
|
||||
drawPict()[PIC_BTN] = &cPict::drawInvenBtn;
|
||||
drawPict()[PIC_VEHICLE] = &cPict::drawPresetVehicle;
|
||||
drawPict()[PIC_VEHICLE_OCCUPIED] = &cPict::drawPresetVehicleOccupied;
|
||||
drawPict()[PIC_CUSTOM_VEHICLE] = &cPict::drawPresetVehicle; // TODO
|
||||
drawPict()[PIC_CUSTOM_VEHICLE_OCCUPIED] = &cPict::drawPresetVehicleOccupied;
|
||||
}
|
||||
|
||||
std::map<ePicType,void(cPict::*)(short,rectangle,sf::RenderTarget&)>& cPict::drawPict(){
|
||||
@@ -562,6 +566,7 @@ void cPict::recalcRect() {
|
||||
case PIC_PC: case PIC_PARTY_PC:
|
||||
case PIC_FIELD:
|
||||
case PIC_BOOM: case PIC_CUSTOM_BOOM:
|
||||
case PIC_VEHICLE: case PIC_VEHICLE_OCCUPIED: case PIC_CUSTOM_VEHICLE: case PIC_CUSTOM_VEHICLE_OCCUPIED:
|
||||
bounds.width() = 28;
|
||||
bounds.height() = 36;
|
||||
break;
|
||||
@@ -716,7 +721,12 @@ std::shared_ptr<const sf::Texture> cPict::getSheetInternal(eSheetType type, size
|
||||
// TODO: The scenario should be allowed to define a sheet1400.png without it being ignored in favour of outhelp.png
|
||||
purgeable = false;
|
||||
sout << "sheet" << n;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SHEET_VEHICLE:
|
||||
sout << "vehicle";
|
||||
break;
|
||||
}
|
||||
auto name = sout.str();
|
||||
try {
|
||||
@@ -1388,8 +1398,30 @@ void cPict::drawInvenBtn(short num, rectangle to_rect, sf::RenderTarget& targ){
|
||||
if(num >= n_pics) return;
|
||||
auto from_gw = getSheet(SHEET_INVENBTN);
|
||||
if(!from_gw) return;
|
||||
if(filled) fill_rect(getWindow(), to_rect, fillClr);
|
||||
rect_draw_some_item(*from_gw, from_rect[num], getWindow(), to_rect, sf::BlendAlpha);
|
||||
if(filled) fill_rect(targ, to_rect, fillClr);
|
||||
rect_draw_some_item(*from_gw, from_rect[num], targ, to_rect, sf::BlendAlpha);
|
||||
}
|
||||
|
||||
void cPict::drawPresetVehicle(short num, rectangle to_rect, sf::RenderTarget& targ){
|
||||
if(num >= 3) return;
|
||||
rectangle from_rect = {0, 0, 36, 28};
|
||||
auto from_gw = getSheet(SHEET_VEHICLE);
|
||||
if(!from_gw) return;
|
||||
if(filled) fill_rect(targ, to_rect, fillClr);
|
||||
from_rect.offset(0, num * 36);
|
||||
rect_draw_some_item(*from_gw, from_rect, targ, to_rect, sf::BlendAlpha);
|
||||
}
|
||||
|
||||
void cPict::drawPresetVehicleOccupied(short num, rectangle to_rect, sf::RenderTarget& targ){
|
||||
LOG("occupied draw");
|
||||
if(num >= 3) return;
|
||||
rectangle from_rect = {0, 0, 36, 28};
|
||||
auto from_gw = getSheet(SHEET_VEHICLE);
|
||||
if(!from_gw) return;
|
||||
if(filled) fill_rect(targ, to_rect, fillClr);
|
||||
from_rect.offset(56, num * 36);
|
||||
rect_draw_some_item(*from_gw, from_rect, targ, to_rect, sf::BlendAlpha);
|
||||
LOG("occupied draw done");
|
||||
}
|
||||
|
||||
cPict::~cPict() {}
|
||||
|
@@ -146,6 +146,8 @@ private:
|
||||
void drawPartyItem(short num, rectangle to_rect, sf::RenderTarget& targ);
|
||||
void drawPartyPc(short num, rectangle to_rect, sf::RenderTarget& targ);
|
||||
void drawInvenBtn(short num, rectangle to_rect, sf::RenderTarget& targ);
|
||||
void drawPresetVehicle(short num, rectangle to_rect, sf::RenderTarget& targ);
|
||||
void drawPresetVehicleOccupied(short num, rectangle to_rect, sf::RenderTarget& targ);
|
||||
static std::map<ePicType,void(cPict::*)(short,rectangle,sf::RenderTarget&)>& drawPict();
|
||||
};
|
||||
|
||||
|
@@ -34,6 +34,8 @@ enum ePicType {
|
||||
PIC_STATUS = 16, ///< 12x12 status icon
|
||||
PIC_TINY_ITEM = 17, ///< 18x18 item graphic from the small item sheet
|
||||
PIC_BTN = 18, ///< Button graphic from the inventory buttons sheet (various sizes)
|
||||
PIC_VEHICLE = 19, ///< 28x36 vehicle graphic from the preset vehicles sheet
|
||||
PIC_VEHICLE_OCCUPIED = 20, ///< 28x36 vehicle graphic from the preset vehicles sheet, occupied
|
||||
PIC_MONST_WIDE = 23, ///< 56x36 monster graphic from the preset sheets, resized to fit and centred in a 28x36 space
|
||||
PIC_MONST_TALL = 43, ///< 28x72 monster graphic from the preset sheets, resized to fit and centred in a 28x36 space
|
||||
PIC_MONST_LG = 63, ///< 56x72 monster graphic from the preset sheets, resized to fit in a 28x36 space
|
||||
@@ -50,6 +52,8 @@ enum ePicType {
|
||||
PIC_CUSTOM_DLOG_LG = 113, ///< 72x72 dialog graphic from the custom sheet, taken from 8 successive slots
|
||||
PIC_CUSTOM_TER_MAP = 115, ///< 12x12 map graphic taken from the custom sheet and expanded to 24x24
|
||||
PIC_CUSTOM_TINY_ITEM = 117, ///< 28x36 custom item graphic shrunk down into an 18x18 space
|
||||
PIC_CUSTOM_VEHICLE = 119, ///< 28x36 custom vehicle graphic (TODO not implemented)
|
||||
PIC_CUSTOM_VEHICLE_OCCUPIED = 120,///< 28x36 custom vehicle graphic, occupied (TODO not implemented)
|
||||
PIC_CUSTOM_MONST_WIDE = 123,///< 56x36 monster graphic from the custom sheets, resized to fit and centred in a 28x36 space
|
||||
PIC_CUSTOM_MONST_TALL = 143,///< 28x72 monster graphic from the custom sheets, resized to fit and centred in a 28x36 space
|
||||
PIC_CUSTOM_MONST_LG = 163, ///< 56x72 monster graphic from the custom sheets, resized to fit in a 28x36 space
|
||||
@@ -96,7 +100,7 @@ enum eSheetType {
|
||||
SHEET_STATUS, ///< The status icons sheet, staticons.png
|
||||
SHEET_INVENBTN, ///< Inventory buttons sheet, invenbtns.png
|
||||
SHEET_CUSTOM, ///< Any custom graphics sheet
|
||||
// TODO: Vehicle sheet is missing.
|
||||
SHEET_VEHICLE, ///< Preset vehicle graphics in vehicles.png
|
||||
// TODO: Documentation of full, custom, header, and exported sheets is still lacking.
|
||||
NUM_SHEET_TYPES
|
||||
};
|
||||
|
@@ -724,8 +724,8 @@ std::istream& operator>> (std::istream& in, eSpellPat& pat) {
|
||||
|
||||
cEnumLookup pic_type_strs = {
|
||||
"none", "terrain", "terrain-anim", "monster-small", "dialog", "talk", "scenario", "item", "player", "field",
|
||||
"boom", "sheet", "missile", "dialog-large", "scenario-large", "terrain-map", "status", "item-small", "", "",
|
||||
"", "", "", "monster-wide", "", "", "", "", "", "",
|
||||
"boom", "sheet", "missile", "dialog-large", "scenario-large", "terrain-map", "status", "item-small", "button", "vehicle",
|
||||
"vehicle-occ", "", "", "monster-wide", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "monster-tall", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "", "",
|
||||
|
@@ -322,6 +322,7 @@ pic_num_t choose_graphic(short cur_choice,ePicType g_type,cDialog* parent, bool
|
||||
case PIC_STATUS: total_pics = 27; break;
|
||||
case PIC_SCEN_LG: total_pics = 4; break;
|
||||
case PIC_TER_MAP: total_pics = 990; break;
|
||||
case PIC_VEHICLE: case PIC_VEHICLE_OCCUPIED: total_pics = 3; break;
|
||||
case PIC_FULL:{
|
||||
fs::path pic_dir = tempDir/scenario_temp_dir_name/"graphics";
|
||||
if(!scenario.scen_file.has_extension()) // It's an unpacked scenario
|
||||
|
Reference in New Issue
Block a user