diff --git a/src/dialog/subscr_props.cpp b/src/dialog/subscr_props.cpp index 00254c5d30..c00887b11e 100644 --- a/src/dialog/subscr_props.cpp +++ b/src/dialog/subscr_props.cpp @@ -249,25 +249,24 @@ std::shared_ptr SubscrPropDialog::view() bool show_wh = true; switch(local_subref->getType()) { - case sso2X2FRAME: - case ssoCURRENTITEM: - case ssoMCGUFFIN: - case ssoTILEBLOCK: - case ssoTEXTBOX: + case widgFRAME: + case widgITEMSLOT: + case widgMCGUFF: + case widgTILEBLOCK: + case widgTEXTBOX: loadw = local_subref->w; loadh = local_subref->h; break; - case ssoMAGICMETER: - case ssoLIFEMETER: - case ssoMINIMAP: - case ssoLARGEMAP: - case ssoSELECTOR1: - case ssoSELECTOR2: - case ssoMINITILE: - case ssoTRIFRAME: + case widgMMETER: + case widgLMETER: + case widgMMAP: + case widgLMAP: + case widgSELECTOR: + case widgMINITILE: + case widgMCGUFF_FRAME: show_wh = false; break; - case ssoCLEAR: + case widgBGCOLOR: show_xy = false; show_wh = false; break; @@ -368,15 +367,13 @@ std::shared_ptr SubscrPropDialog::view() { switch(local_subref->getType()) { - case sso2X2FRAME: + case widgFRAME: { SW_2x2Frame* w = dynamic_cast(local_subref); col_grid->add(MISC_CSET_SEL(w->cs, "CSet", 1)); break; } - case ssoBSTIME: - case ssoTIME: - case ssoSSTIME: + case widgTIME: { SW_Time* w = dynamic_cast(local_subref); col_grid->add(MISC_COLOR_SEL(w->c_text, "Text Color", 1)); @@ -384,10 +381,10 @@ std::shared_ptr SubscrPropDialog::view() col_grid->add(MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); break; } - case ssoBUTTONITEM: + case widgBTNITM: addcolor = false; break; - case ssoCOUNTER: + case widgCOUNTER: { SW_Counter* w = dynamic_cast(local_subref); col_grid->add(MISC_COLOR_SEL(w->c_text, "Text Color", 1)); @@ -395,7 +392,7 @@ std::shared_ptr SubscrPropDialog::view() col_grid->add(MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); break; } - case ssoCOUNTERS: + case widgOLDCTR: { SW_Counters* w = dynamic_cast(local_subref); col_grid->add(MISC_COLOR_SEL(w->c_text, "Text Color", 1)); @@ -403,41 +400,41 @@ std::shared_ptr SubscrPropDialog::view() col_grid->add(MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); break; } - case ssoCURRENTITEM: + case widgITEMSLOT: addcolor = false; break; - case ssoCLEAR: + case widgBGCOLOR: { SW_Clear* w = dynamic_cast(local_subref); col_grid->add(MISC_COLOR_SEL(w->c_bg, "Subscreen Color", 1)); break; } - case ssoLARGEMAP: + case widgLMAP: { SW_LMap* w = dynamic_cast(local_subref); col_grid->add(MISC_COLOR_SEL(w->c_room, "Room Color", 1)); col_grid->add(MISC_COLOR_SEL(w->c_plr, "Player Color", 2)); break; } - case ssoLIFEGAUGE: + case widgLGAUGE: addcolor = false; break; - case ssoLIFEMETER: + case widgLMETER: addcolor = false; break; - case ssoLINE: + case widgLINE: { SW_Line* w = dynamic_cast(local_subref); col_grid->add(MISC_COLOR_SEL(w->c_line, "Line Color", 1)); break; } - case ssoMAGICGAUGE: + case widgMGAUGE: addcolor = false; break; - case ssoMAGICMETER: + case widgMMETER: addcolor = false; break; - case ssoMINIMAP: + case widgMMAP: { SW_MMap* w = dynamic_cast(local_subref); col_grid->add(MISC_COLOR_SEL(w->c_plr, "Player Color", 1)); @@ -445,7 +442,7 @@ std::shared_ptr SubscrPropDialog::view() col_grid->add(MISC_COLOR_SEL(w->c_cmp_off, "Compass Const Color", 3)); break; } - case ssoMINIMAPTITLE: + case widgMMAPTITLE: { SW_MMapTitle* w = dynamic_cast(local_subref); col_grid->add(MISC_COLOR_SEL(w->c_text, "Text Color", 1)); @@ -453,20 +450,20 @@ std::shared_ptr SubscrPropDialog::view() col_grid->add(MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); break; } - case ssoMINITILE: + case widgMINITILE: { SW_MiniTile* w = dynamic_cast(local_subref); col_grid->add(MISC_CSET_SEL(w->cs, "CSet", 1)); break; } - case ssoRECT: + case widgRECT: { SW_Rect* w = dynamic_cast(local_subref); col_grid->add(MISC_COLOR_SEL(w->c_outline, "Outline Color", 1)); col_grid->add(MISC_COLOR_SEL(w->c_fill, "Fill Color", 2)); break; } - case ssoSELECTEDITEMNAME: + case widgSELECTEDTEXT: { SW_SelectedText* w = dynamic_cast(local_subref); col_grid->add(MISC_COLOR_SEL(w->c_text, "Text Color", 1)); @@ -474,11 +471,10 @@ std::shared_ptr SubscrPropDialog::view() col_grid->add(MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); break; } - case ssoSELECTOR1: - case ssoSELECTOR2: + case widgSELECTOR: addcolor = false; break; - case ssoTEXT: + case widgTEXT: { SW_Text* w = dynamic_cast(local_subref); col_grid->add(MISC_COLOR_SEL(w->c_text, "Text Color", 1)); @@ -486,7 +482,7 @@ std::shared_ptr SubscrPropDialog::view() col_grid->add(MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); break; } - case ssoTEXTBOX: + case widgTEXTBOX: { SW_TextBox* w = dynamic_cast(local_subref); col_grid->add(MISC_COLOR_SEL(w->c_text, "Text Color", 1)); @@ -494,20 +490,20 @@ std::shared_ptr SubscrPropDialog::view() col_grid->add(MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); break; } - case ssoTILEBLOCK: + case widgTILEBLOCK: { SW_TileBlock* w = dynamic_cast(local_subref); col_grid->add(MISC_CSET_SEL(w->cs, "CSet", 1)); break; } - case ssoTRIFRAME: + case widgMCGUFF_FRAME: { SW_TriFrame* w = dynamic_cast(local_subref); col_grid->add(MISC_COLOR_SEL(w->c_outline, "Frame Outline Color", 1)); col_grid->add(MISC_COLOR_SEL(w->c_number, "Number Color", 2)); break; } - case ssoMCGUFFIN: + case widgMCGUFF: { SW_McGuffin* w = dynamic_cast(local_subref); col_grid->add(MISC_CSET_SEL(w->cs, "CSet", 1)); @@ -524,7 +520,7 @@ std::shared_ptr SubscrPropDialog::view() { switch(local_subref->getType()) { - case sso2X2FRAME: + case widgFRAME: { SW_2x2Frame* w = dynamic_cast(local_subref); attrib_grid = Column( @@ -550,9 +546,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoTIME: - case ssoSSTIME: - case ssoBSTIME: + case widgTIME: { SW_Time* w = dynamic_cast(local_subref); attrib_grid = Columns<3>( @@ -565,7 +559,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoBUTTONITEM: + case widgBTNITM: { SW_ButtonItem* w = dynamic_cast(local_subref); attrib_grid = Rows<2>( @@ -575,7 +569,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoCOUNTER: + case widgCOUNTER: { SW_Counter* w = dynamic_cast(local_subref); mergetype = mtFORCE_TAB; //too wide to fit! @@ -613,7 +607,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoCOUNTERS: + case widgOLDCTR: { SW_Counters* w = dynamic_cast(local_subref); attrib_grid = Rows<2>( @@ -638,7 +632,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoCURRENTITEM: + case widgITEMSLOT: { SW_CurrentItem* w = dynamic_cast(local_subref); attrib_grid = Rows<3>( @@ -668,12 +662,12 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoCLEAR: + case widgBGCOLOR: { addattrib = false; break; } - case ssoLARGEMAP: + case widgLMAP: { SW_LMap* w = dynamic_cast(local_subref); attrib_grid = Column( @@ -684,7 +678,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoLIFEGAUGE: + case widgLGAUGE: { SW_LifeGaugePiece* w = dynamic_cast(local_subref); attrib_grid = Row(padding = 0_px, @@ -715,7 +709,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoLIFEMETER: + case widgLMETER: { SW_LifeMeter* w = dynamic_cast(local_subref); attrib_grid = Rows<2>( @@ -725,7 +719,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoLINE: + case widgLINE: { SW_Line* w = dynamic_cast(local_subref); attrib_grid = Column( @@ -733,7 +727,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoMAGICGAUGE: + case widgMGAUGE: { SW_MagicGaugePiece* w = dynamic_cast(local_subref); attrib_grid = Row(padding = 0_px, @@ -774,12 +768,12 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoMAGICMETER: + case widgMMETER: { addattrib = false; break; } - case ssoMINIMAP: + case widgMMAP: { SW_MMap* w = dynamic_cast(local_subref); attrib_grid = Column( @@ -789,7 +783,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoMINIMAPTITLE: + case widgMMAPTITLE: { SW_MMapTitle* w = dynamic_cast(local_subref); attrib_grid = Rows<2>( @@ -803,7 +797,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoMINITILE: + case widgMINITILE: { SW_MiniTile* w = dynamic_cast(local_subref); mergetype = mtLOCTOP; //too wide to fit all 3 horiz, but has vert room @@ -900,7 +894,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoRECT: + case widgRECT: { SW_Rect* w = dynamic_cast(local_subref); attrib_grid = Column( @@ -909,7 +903,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoSELECTEDITEMNAME: + case widgSELECTEDTEXT: { SW_SelectedText* w = dynamic_cast(local_subref); attrib_grid = Rows<2>( @@ -926,8 +920,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoSELECTOR1: - case ssoSELECTOR2: + case widgSELECTOR: { SW_Selector* w = dynamic_cast(local_subref); attrib_grid = Column( @@ -937,7 +930,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoTEXT: + case widgTEXT: { SW_Text* w = dynamic_cast(local_subref); attrib_grid = Rows<2>( @@ -965,7 +958,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoTEXTBOX: + case widgTEXTBOX: { SW_TextBox* w = dynamic_cast(local_subref); attrib_grid = Rows<2>( @@ -998,7 +991,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoTILEBLOCK: + case widgTILEBLOCK: { SW_TileBlock* w = dynamic_cast(local_subref); mergetype = mtLOCTOP; //too wide to fit all 3 horiz, but has vert room @@ -1028,7 +1021,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoTRIFRAME: + case widgMCGUFF_FRAME: { SW_TriFrame* w = dynamic_cast(local_subref); mergetype = mtFORCE_TAB; //Way too wide to fit @@ -1092,7 +1085,7 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case ssoMCGUFFIN: + case widgMCGUFF: { SW_McGuffin* w = dynamic_cast(local_subref); mergetype = mtLOCTOP; @@ -1173,9 +1166,9 @@ void SubscrPropDialog::updateColors() { switch(local_subref->getType()) { - case sso2X2FRAME: - case ssoMINITILE: - case ssoTILEBLOCK: + case widgFRAME: + case widgMINITILE: + case widgTILEBLOCK: { tswatches[0]->setCSet(SubscrColorInfo::get_cset(cs_sel[0]->getC1(), cs_sel[0]->getC2())); break; @@ -1187,7 +1180,7 @@ void SubscrPropDialog::update_wh() { switch(local_subref->getType()) { - case ssoTILEBLOCK: + case widgTILEBLOCK: tswatches[0]->setTileWid(std::min(local_subref->w, (word)TB_LA)); tswatches[0]->setTileHei(std::min(local_subref->h, (word)TB_LA)); break; diff --git a/src/new_subscr.cpp b/src/new_subscr.cpp index 0dbc1287a2..a4fd4ad074 100644 --- a/src/new_subscr.cpp +++ b/src/new_subscr.cpp @@ -434,7 +434,7 @@ int16_t SubscrWidget::getYOffs() const } byte SubscrWidget::getType() const { - return type; + return widgNULL; } int32_t SubscrWidget::getItemVal(bool display) const { @@ -582,7 +582,7 @@ word SW_2x2Frame::getH() const } byte SW_2x2Frame::getType() const { - return sso2X2FRAME; + return widgFRAME; } void SW_2x2Frame::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -672,7 +672,7 @@ int16_t SW_Text::getXOffs() const } byte SW_Text::getType() const { - return ssoTEXT; + return widgTEXT; } void SW_Text::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -755,7 +755,7 @@ bool SW_Line::load_old(subscreen_object const& old) } byte SW_Line::getType() const { - return ssoLINE; + return widgLINE; } void SW_Line::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -814,7 +814,7 @@ bool SW_Rect::load_old(subscreen_object const& old) } byte SW_Rect::getType() const { - return ssoRECT; + return widgRECT; } void SW_Rect::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -925,7 +925,7 @@ int16_t SW_Time::getXOffs() const } byte SW_Time::getType() const { - return type; //ssoBSTIME,ssoTIME,ssoSSTIME + return widgTIME; } void SW_Time::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -1029,7 +1029,7 @@ word SW_MagicMeter::getH() const } byte SW_MagicMeter::getType() const { - return ssoMAGICMETER; + return widgMMETER; } void SW_MagicMeter::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -1089,7 +1089,7 @@ word SW_LifeMeter::getH() const } byte SW_LifeMeter::getType() const { - return ssoLIFEMETER; + return widgLMETER; } void SW_LifeMeter::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -1148,7 +1148,7 @@ word SW_ButtonItem::getH() const } byte SW_ButtonItem::getType() const { - return ssoBUTTONITEM; + return widgBTNITM; } void SW_ButtonItem::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -1244,7 +1244,7 @@ int16_t SW_Counter::getXOffs() const } byte SW_Counter::getType() const { - return ssoCOUNTER; + return widgCOUNTER; } void SW_Counter::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -1377,7 +1377,7 @@ word SW_Counters::getH() const } byte SW_Counters::getType() const { - return ssoCOUNTERS; + return widgOLDCTR; } void SW_Counters::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -1490,7 +1490,7 @@ int16_t SW_MMapTitle::getXOffs() const } byte SW_MMapTitle::getType() const { - return ssoMINIMAPTITLE; + return widgMMAPTITLE; } void SW_MMapTitle::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -1581,7 +1581,7 @@ word SW_MMap::getH() const } byte SW_MMap::getType() const { - return ssoMINIMAP; + return widgMMAP; } void SW_MMap::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -1657,7 +1657,7 @@ word SW_LMap::getH() const } byte SW_LMap::getType() const { - return ssoLARGEMAP; + return widgLMAP; } void SW_LMap::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -1722,7 +1722,7 @@ word SW_Clear::getH() const } byte SW_Clear::getType() const { - return ssoCLEAR; + return widgBGCOLOR; } void SW_Clear::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -1789,7 +1789,7 @@ word SW_CurrentItem::getH() const } byte SW_CurrentItem::getType() const { - return ssoCURRENTITEM; + return widgITEMSLOT; } int32_t SW_CurrentItem::getItemVal(bool display) const { @@ -2024,7 +2024,7 @@ word SW_TriFrame::getH() const } byte SW_TriFrame::getType() const { - return ssoTRIFRAME; + return widgMCGUFF_FRAME; } void SW_TriFrame::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -2114,7 +2114,7 @@ word SW_McGuffin::getH() const } byte SW_McGuffin::getType() const { - return ssoMCGUFFIN; + return widgMCGUFF; } void SW_McGuffin::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -2192,7 +2192,7 @@ word SW_TileBlock::getH() const } byte SW_TileBlock::getType() const { - return ssoTILEBLOCK; + return widgTILEBLOCK; } void SW_TileBlock::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -2275,7 +2275,7 @@ word SW_MiniTile::getH() const } byte SW_MiniTile::getType() const { - return ssoMINITILE; + return widgMINITILE; } int32_t SW_MiniTile::get_tile() const { @@ -2391,7 +2391,7 @@ word SW_Selector::getH() const } byte SW_Selector::getType() const { - return ssoSELECTOR1; + return widgSELECTOR; } void SW_Selector::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -2504,7 +2504,7 @@ word SW_LifeGaugePiece::getH() const } byte SW_LifeGaugePiece::getType() const { - return ssoLIFEGAUGE; + return widgLGAUGE; } void SW_LifeGaugePiece::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -2609,7 +2609,7 @@ word SW_MagicGaugePiece::getH() const } byte SW_MagicGaugePiece::getType() const { - return ssoMAGICGAUGE; + return widgMGAUGE; } void SW_MagicGaugePiece::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -2703,7 +2703,7 @@ bool SW_TextBox::load_old(subscreen_object const& old) } byte SW_TextBox::getType() const { - return ssoTEXTBOX; + return widgTEXTBOX; } void SW_TextBox::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -2798,7 +2798,7 @@ bool SW_SelectedText::load_old(subscreen_object const& old) } byte SW_SelectedText::getType() const { - return ssoSELECTEDITEMNAME; + return widgSELECTEDTEXT; } void SW_SelectedText::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { @@ -2886,42 +2886,6 @@ int32_t SW_SelectedText::write(PACKFILE *f) const } -bool new_widget_type(int ty) -{ - switch(ty) - { - //These have been upgraded - case sso2X2FRAME: - case ssoTEXT: - case ssoLINE: - case ssoRECT: - case ssoBSTIME: - case ssoTIME: - case ssoSSTIME: - case ssoMAGICMETER: - case ssoLIFEMETER: - case ssoBUTTONITEM: - case ssoCOUNTER: - case ssoCOUNTERS: - case ssoMINIMAPTITLE: - case ssoMINIMAP: - case ssoLARGEMAP: - case ssoCLEAR: - case ssoCURRENTITEM: - case ssoTRIFRAME: - case ssoMCGUFFIN: - case ssoTILEBLOCK: - case ssoMINITILE: - return true; - //These ones are just empty - case ssoITEM: - case ssoICON: - case ssoNULL: - case ssoNONE: - return true; - } - return false; -} SubscrWidget* SubscrWidget::fromOld(subscreen_object const& old) { switch(old.type) @@ -3019,130 +2983,79 @@ SubscrWidget* SubscrWidget::newType(byte ty) SubscrWidget* widg = nullptr; switch(ty) { - case sso2X2FRAME: + case widgFRAME: widg = new SW_2x2Frame(); break; - case ssoTEXT: - { - SW_Text* tmp; - widg = tmp = new SW_Text(); - tmp->c_text.type = ssctMISC; + case widgTEXT: + widg = new SW_Text(); break; - } - case ssoLINE: + case widgLINE: widg = new SW_Line(); break; - case ssoRECT: + case widgRECT: widg = new SW_Rect(); break; - case ssoBSTIME: - case ssoTIME: - case ssoSSTIME: - { - SW_Time* tmp; - widg = tmp = new SW_Time(ty); - tmp->c_text.type = ssctMISC; + case widgTIME: + widg = new SW_Time(ty); break; - } - case ssoMAGICMETER: + case widgMMETER: widg = new SW_MagicMeter(); break; - case ssoLIFEMETER: + case widgLMETER: widg = new SW_LifeMeter(); break; - case ssoBUTTONITEM: + case widgBTNITM: widg = new SW_ButtonItem(); break; - case ssoCOUNTER: - { - SW_Counter* tmp; - widg = tmp = new SW_Counter(); - tmp->infitm = -1; //(None) inf item - tmp->c_text.type = ssctMISC; //Default text color + case widgCOUNTER: + widg = new SW_Counter(); break; - } - case ssoCOUNTERS: - { - SW_Counters* tmp; - widg = tmp = new SW_Counters(); - tmp->c_text.type = ssctMISC; + case widgOLDCTR: + widg = new SW_Counters(); break; - } - case ssoMINIMAPTITLE: - { - SW_MMapTitle* tmp; - widg = tmp = new SW_MMapTitle(); - tmp->c_text.type = ssctMISC; + case widgMMAPTITLE: + widg = new SW_MMapTitle(); break; - } - case ssoMINIMAP: + case widgMMAP: widg = new SW_MMap(); break; - case ssoLARGEMAP: + case widgLMAP: widg = new SW_LMap(); break; - case ssoCLEAR: + case widgBGCOLOR: widg = new SW_Clear(); break; - case ssoCURRENTITEM: + case widgITEMSLOT: widg = new SW_CurrentItem(); break; - case ssoTRIFRAME: + case widgMCGUFF_FRAME: widg = new SW_TriFrame(); break; - case ssoMCGUFFIN: + case widgMCGUFF: widg = new SW_McGuffin(); break; - case ssoTILEBLOCK: + case widgTILEBLOCK: widg = new SW_TileBlock(); break; - case ssoMINITILE: + case widgMINITILE: widg = new SW_MiniTile(); break; - case ssoSELECTOR1: - case ssoSELECTOR2: + case widgSELECTOR: widg = new SW_Selector(ty); break; - case ssoLIFEGAUGE: + case widgLGAUGE: widg = new SW_LifeGaugePiece(); break; - case ssoMAGICGAUGE: + case widgMGAUGE: widg = new SW_MagicGaugePiece(); break; - case ssoTEXTBOX: + case widgTEXTBOX: widg = new SW_TextBox(); break; - case ssoSELECTEDITEMNAME: + case widgSELECTEDTEXT: widg = new SW_SelectedText(); break; - case ssoITEM: - { - widg = new SubscrWidget(ty); - widg->w = 16; - widg->h = 16; - break; - } - case ssoICON: - { - widg = new SubscrWidget(ty); - widg->w = 8; - widg->h = 8; - break; - } - case ssoNULL: - case ssoNONE: - case ssoCURRENTITEMTILE: - case ssoSELECTEDITEMTILE: - case ssoCURRENTITEMTEXT: - case ssoCURRENTITEMNAME: - case ssoCURRENTITEMCLASSTEXT: - case ssoCURRENTITEMCLASSNAME: - case ssoSELECTEDITEMCLASSNAME: - widg = new SubscrWidget(ty); //Nothingness - break; } - if(widg && !widg->type) - widg->type = ty; return widg; } @@ -3163,7 +3076,7 @@ void SubscrPage::move_cursor(int dir, bool item_only) if(verify) { SubscrWidget* widg = get_widg_pos(cursor_pos); - if(widg && widg->getType() == ssoCURRENTITEM + if(widg && widg->getType() == widgITEMSLOT && (widg->flags & SUBSCRFLAG_SELECTABLE) && !(widg->flags & SUBSCR_CURITM_NONEQP) && widg->getItemVal() > 0) @@ -3275,7 +3188,7 @@ int32_t SubscrPage::move_legacy(int dir, int startp, int fp, int fp2, int fp3, b SubscrWidget* widg = get_widg_pos(startp); int32_t wpn = widg ? widg->getItemVal() : -1; equip_only = item_only = true; - if(widg->getType() != ssoCURRENTITEM || (widg->flags&SUBSCR_CURITM_NONEQP)) + if(widg->getType() != widgITEMSLOT || (widg->flags&SUBSCR_CURITM_NONEQP)) wpn = -1; if(wpn > 0 && startp != fp && startp != fp2 && startp != fp3) @@ -3290,7 +3203,7 @@ int32_t SubscrPage::move_legacy(int dir, int startp, int fp, int fp2, int fp3, b for(int32_t i=0; i < contents.size(); ++i) { - if(contents[i]->getType()==ssoCURRENTITEM && (contents[i]->flags&SUBSCRFLAG_SELECTABLE)) + if(contents[i]->getType()==widgITEMSLOT && (contents[i]->flags&SUBSCRFLAG_SELECTABLE)) { if(firstValidPos==-1 && contents[i]->pos>=0) firstValidPos=i; @@ -3379,7 +3292,7 @@ SubscrWidget* SubscrPage::get_widg_pos(int32_t pos, bool sel_only) { if(!(contents[q]->flags & SUBSCRFLAG_SELECTABLE)) continue; - if (sel_only && contents[q]->getType() == ssoCURRENTITEM) + if (sel_only && contents[q]->getType() == widgITEMSLOT) if (static_cast(contents[q])->flags & SUBSCR_CURITM_NONEQP) continue; if(contents[q]->pos == pos) @@ -3544,7 +3457,7 @@ void ZCSubscreen::load_old(subscreen_object const* arr) { SubscrWidget* w = SubscrWidget::fromOld(arr[ind]); if(!w) continue; - if(w->getType() == ssoNONE || w->getType() == ssoNULL) + if(arr[ind].type == ssoNONE || arr[ind].type == ssoNULL) { delete w; continue; diff --git a/src/new_subscr.h b/src/new_subscr.h index a7184e0ed7..541ccfd319 100644 --- a/src/new_subscr.h +++ b/src/new_subscr.h @@ -99,6 +99,16 @@ enum //old subscreen object types ssoMAX, ssoTEMPOLD }; +enum +{ + widgNULL, widgFRAME, widgTEXT, widgLINE, widgRECT, + widgTIME, widgMMETER, widgLMETER, widgBTNITM, widgCOUNTER, + widgOLDCTR, widgMMAPTITLE, widgMMAP, widgLMAP, widgBGCOLOR, + widgITEMSLOT, widgMCGUFF_FRAME, widgMCGUFF, widgTILEBLOCK, widgMINITILE, + widgSELECTOR, widgLGAUGE, widgMGAUGE, widgTEXTBOX, widgSELECTEDTEXT, + widgMAX +}; + //Misc constants enum //text styles { @@ -273,7 +283,7 @@ struct SW_Text : public SubscrWidget int32_t fontid; std::string text; byte align, shadtype; - SubscrColorInfo c_text, c_shadow, c_bg; + SubscrColorInfo c_text = {ssctMISC,0}, c_shadow, c_bg; SW_Text() = default; SW_Text(subscreen_object const& old); @@ -334,7 +344,7 @@ struct SW_Time : public SubscrWidget { int32_t fontid; byte align, shadtype; - SubscrColorInfo c_text, c_shadow, c_bg; + SubscrColorInfo c_text = {ssctMISC,0}, c_shadow, c_bg; SW_Time() = default; SW_Time(byte ty); @@ -420,10 +430,10 @@ struct SW_Counter : public SubscrWidget { int32_t fontid; byte align, shadtype; - SubscrColorInfo c_text, c_shadow, c_bg; + SubscrColorInfo c_text = {ssctMISC,0}, c_shadow, c_bg; int32_t ctrs[3]; byte digits; - int32_t infitm; + int32_t infitm = -1; char infchar; SW_Counter() = default; @@ -449,9 +459,9 @@ struct SW_Counters : public SubscrWidget { int32_t fontid; byte shadtype; - SubscrColorInfo c_text, c_shadow, c_bg; + SubscrColorInfo c_text = {ssctMISC,0}, c_shadow, c_bg; byte digits; - int32_t infitm; + int32_t infitm = -1; char infchar; SW_Counters() = default; @@ -476,7 +486,7 @@ struct SW_MMapTitle : public SubscrWidget { int32_t fontid; byte align, shadtype; - SubscrColorInfo c_text, c_shadow, c_bg; + SubscrColorInfo c_text = {ssctMISC,0}, c_shadow, c_bg; SW_MMapTitle() = default; SW_MMapTitle(subscreen_object const& old); @@ -828,7 +838,5 @@ struct ZCSubscreen int32_t read(PACKFILE *f, word s_version); int32_t write(PACKFILE *f) const; }; - -bool new_widget_type(int ty); #endif diff --git a/src/subscr.h b/src/subscr.h index a2ea26f94b..94bc2de1e1 100644 --- a/src/subscr.h +++ b/src/subscr.h @@ -85,7 +85,7 @@ struct sso_struct int32_t i; }; -extern sso_struct bisso[ssoMAX]; +extern sso_struct bisso[widgMAX]; diff --git a/src/zq/zq_subscr.cpp b/src/zq/zq_subscr.cpp index 6e1a899dec..f79b38875e 100644 --- a/src/zq/zq_subscr.cpp +++ b/src/zq/zq_subscr.cpp @@ -291,7 +291,7 @@ int32_t d_subscreen_proc(int32_t msg,DIALOG *d,int32_t) object_message(d,MSG_DRAW,0); // Disable "Paste Properties" if the copy source is invalid - if(!propCopyWidg || propCopyWidg->getType()==ssoNULL) + if(!propCopyWidg || propCopyWidg->getType()==widgNULL) subscreen_rc_menu[2].flags|=D_DISABLED; else subscreen_rc_menu[2].flags&=~D_DISABLED; @@ -990,7 +990,7 @@ static DIALOG sel_options_dlg[] = { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } }; -const char *sso_str[ssoMAX]= +const char *sso_old_str[ssoMAX]= { "NULL", "(None)", "2x2 Frame", "Text", "Line", "Rectangle", "BS-Zelda Time", "Game Time", "Game Time (Quest Rule)", "Magic Meter", "Life Meter", "Button Item", "-Icon (Not Implemented)", "Counter", "Counter Block", "Minimap Title", "Minimap", "Large Map", "Background Color", "Current Item", "-Item (Not Implemented)", @@ -998,13 +998,20 @@ const char *sso_str[ssoMAX]= "-Selected Item -> Tile (Not Implemented)", "-Current Item -> Text (Not Implemented)", "-Current Item Name (Not Implemented)", "Selected Item Name", "-Current Item Class -> Text (Not Implemented)", "-Current Item Class Name (Not Implemented)", "-Selected Item Class Name (Not Implemented)" }; +const char *sso_str[widgMAX]= +{ + "(None)", "2x2 Frame", "Text", "Line", "Rectangle", + "Playtime", "Magic Meter", "Life Meter", "Button Item", "Counter", + "Counter Block", "Minimap Title", "Minimap", "Large Map", "Background Color", + "Item Slot", "McGuffin Frame", "McGuffin Piece", "Tile Block", "Minitile", + "Selector", "Life Gauge Piece", "Magic Gauge Piece", "Text Box", "Selection Text" +}; char *sso_name(int32_t type) { - char *tempname; - tempname=(char*)malloc(255); + static char tempname[256]; - if(type>=0 && type =0 && type