Some dialog pict fixes
- Pict choice dialog didn't work for present monster graphics - Icon control is a little smarter when setting its picnum
This commit is contained in:
@@ -26,9 +26,9 @@ const size_t cPictChoice::per_page = 36;
|
|||||||
cPictChoice::cPictChoice(std::vector<pic_num_t>& pics,ePicType t,cDialog* parent) : cPictChoice(pics.begin(), pics.end(), t, parent) {}
|
cPictChoice::cPictChoice(std::vector<pic_num_t>& pics,ePicType t,cDialog* parent) : cPictChoice(pics.begin(), pics.end(), t, parent) {}
|
||||||
|
|
||||||
cPictChoice::cPictChoice(std::vector<std::pair<pic_num_t,ePicType>>& pics,cDialog* parent) : dlg("choose-pict.xml",parent) {
|
cPictChoice::cPictChoice(std::vector<std::pair<pic_num_t,ePicType>>& pics,cDialog* parent) : dlg("choose-pict.xml",parent) {
|
||||||
attachHandlers();
|
|
||||||
picts = pics;
|
picts = pics;
|
||||||
sort(picts.begin(),picts.end());
|
sort(picts.begin(),picts.end());
|
||||||
|
attachHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
cPictChoice::cPictChoice(
|
cPictChoice::cPictChoice(
|
||||||
|
@@ -139,15 +139,27 @@ void cPict::setPict(pic_num_t num, ePicType type){
|
|||||||
frame.right = frame.left + 12;
|
frame.right = frame.left + 12;
|
||||||
frame.bottom = frame.top + 12;
|
frame.bottom = frame.top + 12;
|
||||||
break;
|
break;
|
||||||
|
case PIC_MONST:
|
||||||
|
if(picNum < 1000) {
|
||||||
|
if(m_pic_index[num].x == 2) picType += PIC_WIDE;
|
||||||
|
if(m_pic_index[num].y == 2) picType += PIC_TALL;
|
||||||
|
}
|
||||||
|
// Intentional fallthrough
|
||||||
default:
|
default:
|
||||||
frame.right = frame.left + 28;
|
frame.right = frame.left + 28;
|
||||||
frame.bottom = frame.top + 36;
|
frame.bottom = frame.top + 36;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(picNum >= 1000) {
|
||||||
|
picNum -= 1000;
|
||||||
|
picType += PIC_CUSTOM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cPict::setPict(pic_num_t num) {
|
void cPict::setPict(pic_num_t num) {
|
||||||
picNum = num;
|
if(picType - PIC_LARGE == PIC_MONST)
|
||||||
|
setPict(num, PIC_MONST);
|
||||||
|
else setPict(num, picType - PIC_CUSTOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_num_t cPict::getPicNum(){
|
pic_num_t cPict::getPicNum(){
|
||||||
|
@@ -121,6 +121,12 @@ public:
|
|||||||
/// you will need to separately update the bounding rect.
|
/// you will need to separately update the bounding rect.
|
||||||
/// (The bounding rect is mostly ignored when drawing, so if the icon is opaque, the control is not clickable,
|
/// (The bounding rect is mostly ignored when drawing, so if the icon is opaque, the control is not clickable,
|
||||||
/// and there is no frame, you can usually safely skip this step.)
|
/// and there is no frame, you can usually safely skip this step.)
|
||||||
|
///
|
||||||
|
/// This function applies a few automatic adjustments to its input:
|
||||||
|
///
|
||||||
|
/// - If type is PIC_MONST, it automatically looks up the chosen icon to determine
|
||||||
|
/// whether it should apply the tall or wide modifiers.
|
||||||
|
/// - If num is 1000 or greater, it automatically subtracts 1000 and applies the custom modifier.
|
||||||
void setPict(pic_num_t num, ePicType type);
|
void setPict(pic_num_t num, ePicType type);
|
||||||
/// Set the pict's icon.
|
/// Set the pict's icon.
|
||||||
/// @param num The new icon index.
|
/// @param num The new icon index.
|
||||||
|
Reference in New Issue
Block a user