From 7d54ca59b3e777de1f3681dd5b341a4cfb07ba43 Mon Sep 17 00:00:00 2001 From: EmilyV99 Date: Thu, 17 Aug 2023 18:56:49 -0400 Subject: [PATCH] feat: new subscreen features relating to counters, gauge pieces, and the 'View' menu --- src/dialog/subscr_props.cpp | 388 +++++++++-------- src/dialog/subscr_props.h | 4 +- src/new_subscr.cpp | 814 +++++++++++++++++++++++++++--------- src/new_subscr.h | 136 +++--- src/subscr.cpp | 364 ++-------------- src/subscr.h | 3 - src/zc_list_data.cpp | 52 +-- src/zc_list_data.h | 2 +- src/zq/zq_subscr.cpp | 133 ++++-- src/zq/zquest.cpp | 27 +- 10 files changed, 1083 insertions(+), 840 deletions(-) diff --git a/src/dialog/subscr_props.cpp b/src/dialog/subscr_props.cpp index c27e3aa3dd..7745a8d957 100644 --- a/src/dialog/subscr_props.cpp +++ b/src/dialog/subscr_props.cpp @@ -28,7 +28,8 @@ SubscrPropDialog::SubscrPropDialog(SubscrWidget* widg, int32_t obj_ind) : list_aligns(GUI::ZCListData::alignments()), list_buttons(GUI::ZCListData::buttons()), list_items(GUI::ZCListData::items(true)), - list_counters(GUI::ZCListData::ss_counters()), + list_counters(GUI::ZCListData::ss_counters(true)), //All counters + list_counters2(GUI::ZCListData::ss_counters(true,true)), //All counters, no (None) list_itemclass(GUI::ZCListData::itemclass(true)), list_genscr(GUI::ZCListData::generic_script()) { @@ -153,10 +154,10 @@ DropDownList(data = list_font, \ if(fonttf) fonttf->setFont(get_zc_font(val)); \ } \ ) -#define DDL_MW(var, lister, maxwid) \ +#define DDL_EX(var, lister, ...) \ DropDownList(data = lister, \ fitParent = true, \ - maxwidth = maxwid, \ + __VA_ARGS__, \ selectedValue = var, \ onSelectFunc = [=](int32_t val) \ { \ @@ -297,7 +298,7 @@ std::shared_ptr SubscrPropDialog::GEN_INITD(int ind) ); } -static size_t sprop_tab = 0; +static size_t sprop_tabs[widgMAX] = {0}; static char tbuf[1025] = {0}; std::shared_ptr SubscrPropDialog::view() { @@ -413,8 +414,7 @@ std::shared_ptr SubscrPropDialog::view() } - std::shared_ptr col_grid = Column(); - bool addcolor = true; + std::shared_ptr col_grid; //Generate 'color' grid { switch(local_subref->getType()) @@ -422,155 +422,160 @@ std::shared_ptr SubscrPropDialog::view() case widgFRAME: { SW_2x2Frame* w = dynamic_cast(local_subref); - col_grid->add(MISC_CSET_SEL(w->cs, "CSet", 1)); + col_grid = Column(MISC_CSET_SEL(w->cs, "CSet", 1)); break; } case widgTIME: { SW_Time* w = dynamic_cast(local_subref); - col_grid->add(MISC_COLOR_SEL(w->c_text, "Text Color", 1)); - col_grid->add(MISC_COLOR_SEL(w->c_shadow, "Shadow Color", 2)); - col_grid->add(MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); + col_grid = Column( + MISC_COLOR_SEL(w->c_text, "Text Color", 1), + MISC_COLOR_SEL(w->c_shadow, "Shadow Color", 2), + MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); break; } case widgBTNITM: - addcolor = false; break; case widgCOUNTER: { SW_Counter* w = dynamic_cast(local_subref); - col_grid->add(MISC_COLOR_SEL(w->c_text, "Text Color", 1)); - col_grid->add(MISC_COLOR_SEL(w->c_shadow, "Shadow Color", 2)); - col_grid->add(MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); + col_grid = Column( + MISC_COLOR_SEL(w->c_text, "Text Color", 1), + MISC_COLOR_SEL(w->c_shadow, "Shadow Color", 2), + MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); break; } case widgOLDCTR: { SW_Counters* w = dynamic_cast(local_subref); - col_grid->add(MISC_COLOR_SEL(w->c_text, "Text Color", 1)); - col_grid->add(MISC_COLOR_SEL(w->c_shadow, "Shadow Color", 2)); - col_grid->add(MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); + col_grid = Column( + MISC_COLOR_SEL(w->c_text, "Text Color", 1), + MISC_COLOR_SEL(w->c_shadow, "Shadow Color", 2), + MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); break; } case widgITEMSLOT: - addcolor = false; break; case widgBGCOLOR: { SW_Clear* w = dynamic_cast(local_subref); - col_grid->add(MISC_COLOR_SEL(w->c_bg, "Subscreen Color", 1)); + col_grid = Column(MISC_COLOR_SEL(w->c_bg, "Subscreen Color", 1)); break; } 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)); + col_grid = Column( + MISC_COLOR_SEL(w->c_room, "Room Color", 1), + MISC_COLOR_SEL(w->c_plr, "Player Color", 2)); break; } case widgLGAUGE: - addcolor = false; break; case widgLMETER: - addcolor = false; break; case widgLINE: { SW_Line* w = dynamic_cast(local_subref); - col_grid->add(MISC_COLOR_SEL(w->c_line, "Line Color", 1)); + col_grid = Column(MISC_COLOR_SEL(w->c_line, "Line Color", 1)); break; } case widgMGAUGE: - addcolor = false; break; case widgMMETER: - addcolor = false; break; case widgMMAP: { SW_MMap* w = dynamic_cast(local_subref); - col_grid->add(MISC_COLOR_SEL(w->c_plr, "Player Color", 1)); - col_grid->add(MISC_COLOR_SEL(w->c_cmp_blink, "Compass Blink Color", 2)); - col_grid->add(MISC_COLOR_SEL(w->c_cmp_off, "Compass Const Color", 3)); + col_grid = Column( + MISC_COLOR_SEL(w->c_plr, "Player Color", 1), + MISC_COLOR_SEL(w->c_cmp_blink, "Compass Blink Color", 2), + MISC_COLOR_SEL(w->c_cmp_off, "Compass Const Color", 3)); break; } case widgMMAPTITLE: { SW_MMapTitle* w = dynamic_cast(local_subref); - col_grid->add(MISC_COLOR_SEL(w->c_text, "Text Color", 1)); - col_grid->add(MISC_COLOR_SEL(w->c_shadow, "Shadow Color", 2)); - col_grid->add(MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); + col_grid = Column( + MISC_COLOR_SEL(w->c_text, "Text Color", 1), + MISC_COLOR_SEL(w->c_shadow, "Shadow Color", 2), + MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); break; } case widgMINITILE: { SW_MiniTile* w = dynamic_cast(local_subref); - col_grid->add(MISC_CSET_SEL(w->cs, "CSet", 1)); + col_grid = Column(MISC_CSET_SEL(w->cs, "CSet", 1)); break; } 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)); + col_grid = Column( + MISC_COLOR_SEL(w->c_outline, "Outline Color", 1), + MISC_COLOR_SEL(w->c_fill, "Fill Color", 2)); break; } case widgSELECTEDTEXT: { SW_SelectedText* w = dynamic_cast(local_subref); - col_grid->add(MISC_COLOR_SEL(w->c_text, "Text Color", 1)); - col_grid->add(MISC_COLOR_SEL(w->c_shadow, "Shadow Color", 2)); - col_grid->add(MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); + col_grid = Column( + MISC_COLOR_SEL(w->c_text, "Text Color", 1), + MISC_COLOR_SEL(w->c_shadow, "Shadow Color", 2), + MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); break; } case widgSELECTOR: - addcolor = false; break; case widgTEXT: { SW_Text* w = dynamic_cast(local_subref); - col_grid->add(MISC_COLOR_SEL(w->c_text, "Text Color", 1)); - col_grid->add(MISC_COLOR_SEL(w->c_shadow, "Shadow Color", 2)); - col_grid->add(MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); + col_grid = Column( + MISC_COLOR_SEL(w->c_text, "Text Color", 1), + MISC_COLOR_SEL(w->c_shadow, "Shadow Color", 2), + MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); break; } case widgTEXTBOX: { SW_TextBox* w = dynamic_cast(local_subref); - col_grid->add(MISC_COLOR_SEL(w->c_text, "Text Color", 1)); - col_grid->add(MISC_COLOR_SEL(w->c_shadow, "Shadow Color", 2)); - col_grid->add(MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); + col_grid = Column( + MISC_COLOR_SEL(w->c_text, "Text Color", 1), + MISC_COLOR_SEL(w->c_shadow, "Shadow Color", 2), + MISC_COLOR_SEL(w->c_bg, "Background Color", 3)); break; } case widgTILEBLOCK: { SW_TileBlock* w = dynamic_cast(local_subref); - col_grid->add(MISC_CSET_SEL(w->cs, "CSet", 1)); + col_grid = Column(MISC_CSET_SEL(w->cs, "CSet", 1)); break; } 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)); + col_grid = Column( + MISC_COLOR_SEL(w->c_outline, "Frame Outline Color", 1), + MISC_COLOR_SEL(w->c_number, "Number Color", 2)); break; } case widgMCGUFF: { SW_McGuffin* w = dynamic_cast(local_subref); - col_grid->add(MISC_CSET_SEL(w->cs, "CSet", 1)); + col_grid = Column(MISC_CSET_SEL(w->cs, "CSet", 1)); break; } } } std::shared_ptr attrib_grid; - bool addattrib = true; + std::map> extra_grids; enum { mtNONE, mtFORCE_TAB, mtLOCTOP }; int32_t mergetype = mtNONE; //Generate 'attributes' grid { - switch(local_subref->getType()) + auto widgty = local_subref->getType(); + switch(widgty) { case widgFRAME: { @@ -641,14 +646,15 @@ std::shared_ptr SubscrPropDialog::view() DDL(w->ctrs[0], list_counters), DDL(w->ctrs[1], list_counters), DDL(w->ctrs[2], list_counters), - Label(text = "Digits:", hAlign = 1.0), + Label(text = "Min Digits:", hAlign = 1.0), + Label(text = "Max Digits:", hAlign = 1.0), Label(text = "Infinite:", hAlign = 1.0), Label(text = "Inf Character:", hAlign = 1.0), CBOX(w->flags,SUBSCR_COUNTER_SHOW0,"Show Zero",2), CBOX(w->flags,SUBSCR_COUNTER_ONLYSEL,"Only Selected",2), - DummyWidget(colSpan = 2), - NUM_FIELD(w->digits,0,5), - DDL_MW(w->infitm,list_items,100_px), + NUM_FIELD(w->mindigits,0,5), + NUM_FIELD(w->maxdigits,0,5), + DDL_EX(w->infitm,list_items,maxwidth=100_px), TextField(maxLength = 1, fitParent = true, text = std::string(1,(char)w->infchar), @@ -731,7 +737,6 @@ std::shared_ptr SubscrPropDialog::view() } case widgBGCOLOR: { - addattrib = false; break; } case widgLMAP: @@ -746,34 +751,57 @@ std::shared_ptr SubscrPropDialog::view() break; } case widgLGAUGE: + case widgMGAUGE: + case widgMISCGAUGE: { + std::string ctrname; + switch(widgty) + { + case widgLGAUGE: + ctrname = "HP"; + break; + case widgMGAUGE: + ctrname = "MP"; + break; + case widgMISCGAUGE: + ctrname = "counter"; + break; + } mergetype = mtFORCE_TAB; - SW_LifeGaugePiece* w = dynamic_cast(local_subref); + SW_GaugePiece* w = dynamic_cast(local_subref); int g = 0; - attrib_grid = Row(padding = 0_px, - Rows<2>( - Row(colSpan = 2, - Label(text = "Gauge Tiles"), - INFOBTN("The tiles used by the gauge. Which tile is used depends on the 'Container' value." - "\nThe 'Mod' checkbox determines if the tile should be adjusted based on current HP." - " The tile layout 'Mod' uses is determined by the 'Full Tile' flag and 'Old Gauge Tile Layout'" - " quest rule." - "\nIf 'Full Tile' is checked, the layout is as follows: The selected tile appears if the" - " container has < 'Units per frame' hp, with any animation frames after it. The next tile appears" - " if the container has < 'Units per frame *2' hp, etc. If the container is the last" - " full container, and 'Unique Last' is checked, it uses the tile after the full tile." - "\nIf 'Full Tile' is not checked but 'Old Gauge Tile Layout' is off, it uses the same layout as" - " the 'Full Tile' layout, but uses minitiles in that order instead." - "\nIf 'Full Tile' is not checked and 'Old Gauge Tile Layout' is on, then: The full container uses the" - " first minitile, plus animation frames. The empty container is the top-left minitile of the tile" - " after the end of the full container, and the layout continues in this way until the just-before-full tile." - " The last full container with 'Unique Last' checked uses the bottom-right minitile of the tile after the end of this." - + QRHINT({qr_OLD_GAUGE_TILE_LAYOUT})) + extra_grids["Gauge"] = Row(padding = 0_px, + Column(padding = 0_px, + Rows<2>(padding = 0_px, + Row(colSpan = 2, + Label(text = "Gauge Tiles"), + INFOBTN("The tiles used by the gauge. Which tile is used depends on the 'Container' value." + "\nThe 'Mod' checkbox determines if the tile should be adjusted based on current HP." + " The tile layout 'Mod' uses is determined by the 'Full Tile' flag and 'Old Gauge Tile Layout'" + " quest rule." + "\nIf 'Full Tile' is checked, the layout is as follows: The selected tile appears if the" + " container has < 'Units per frame' hp, with any animation frames after it. The next tile appears" + " if the container has < 'Units per frame *2' hp, etc. If the container is the last" + " full container, and 'Unique Last' is checked, it uses the tile after the full tile." + "\nIf 'Full Tile' is not checked but 'Old Gauge Tile Layout' is off, it uses the same layout as" + " the 'Full Tile' layout, but uses minitiles in that order instead." + "\nIf 'Full Tile' is not checked and 'Old Gauge Tile Layout' is on, then: The full container uses the" + " first minitile, plus animation frames. The empty container is the top-left minitile of the tile" + " after the end of the full container, and the layout continues in this way until the just-before-full tile." + " The last full container with 'Unique Last' checked uses the bottom-right minitile of the tile after the end of this." + + QRHINT({qr_OLD_GAUGE_TILE_LAYOUT})) + ), + GAUGE_MINITILE(0,"Not Last",w->mts[0],w->flags,SUBSCR_GAUGE_MOD1), + GAUGE_MINITILE(1,"Last",w->mts[1],w->flags,SUBSCR_GAUGE_MOD2), + GAUGE_MINITILE(2,"Cap",w->mts[2],w->flags,SUBSCR_GAUGE_MOD3), + GAUGE_MINITILE(3,"After Cap",w->mts[3],w->flags,SUBSCR_GAUGE_MOD4) ), - GAUGE_MINITILE(0,"Not Last",w->mts[0],w->flags,SUBSCR_LGAUGE_MOD1), - GAUGE_MINITILE(1,"Last",w->mts[1],w->flags,SUBSCR_LGAUGE_MOD2), - GAUGE_MINITILE(2,"Cap",w->mts[2],w->flags,SUBSCR_LGAUGE_MOD3), - GAUGE_MINITILE(3,"After Cap",w->mts[3],w->flags,SUBSCR_LGAUGE_MOD4) + Rows<2>(padding = 0_px, + labels[3] = Label(text = "Infinite Item:"), + INFOBTN("Having this item counts as having 'infinite' of this counter," + " as far as the infinite-related flags are concerned."), + ddl = DDL_EX(w->inf_item, list_items, colSpan = 2) + ) ), Column(padding = 0_px, Row(padding = 0_px, @@ -788,8 +816,8 @@ std::shared_ptr SubscrPropDialog::view() w->unit_per_frame = val-1; refr_info(); }), - INFOBTN("How many HP should be allocated to each tile. Ex. If you have 32" - " HP per heart container, but only want to show 1/8 hearts, you can use" + INFOBTN("How many points should be allocated to each tile. Ex. If you have 32" + " HP per container, but only want to show 1/8 hearts, you can use" " 2 units per frame (2 = 16/8) and only set up 1/8 heart tiles."), Label(text = "Container:", hAlign = 1.0), NUM_FIELD(w->container, 0, 9999), @@ -811,14 +839,14 @@ std::shared_ptr SubscrPropDialog::view() refr_info(); }), INFOBTN("Each container tile is an animation of this many frames. 1 = no animation."), - Label(text = "Anim Cond:", hAlign = 1.0), + labels[0] = Label(text = "Anim Cond:", hAlign = 1.0), tfs[0] = NUM_FIELD(w->anim_val, 0, 65535), INFOBTN("Used by flags 'Animate Only Under...', 'Animate Only Over...' below."), // - Label(text = "Speed:", hAlign = 1.0), + labels[1] = Label(text = "Speed:", hAlign = 1.0), tfs[1] = NUM_FIELD(w->speed, 1, 999), INFOBTN("If animated, the speed at which the animation moves."), - Label(text = "Delay:", hAlign = 1.0), + labels[2] = Label(text = "Delay:", hAlign = 1.0), tfs[2] = NUM_FIELD(w->delay, 0, 999), INFOBTN("If animated, the delay at each start of the animation."), // @@ -862,64 +890,124 @@ std::shared_ptr SubscrPropDialog::view() ), Row(padding = 0_px, Rows<2>(vAlign = 0.0, - INFOBTN("Animates only when HP is <= 'Anim Cond'"), + INFOBTN("Animates only when "+ctrname+" is <= 'Anim Cond'"), cbs[0] = Checkbox( text = "Animate Only Under...", hAlign = 0.0, - checked = w->flags & SUBSCR_LGAUGE_ANIM_UNDER, + checked = w->flags & SUBSCR_GAUGE_ANIM_UNDER, onToggleFunc = [&, w](bool state) { - SETFLAG(w->flags, SUBSCR_LGAUGE_ANIM_UNDER, state); + SETFLAG(w->flags, SUBSCR_GAUGE_ANIM_UNDER, state); refr_info(); } ), - INFOBTN("Animates only when HP is >= 'Anim Cond'"), + INFOBTN("Animates only when "+ctrname+" is >= 'Anim Cond'"), cbs[1] = Checkbox( text = "Animate Only Over...", hAlign = 0.0, - checked = w->flags & SUBSCR_LGAUGE_ANIM_OVER, + checked = w->flags & SUBSCR_GAUGE_ANIM_OVER, onToggleFunc = [&, w](bool state) { - SETFLAG(w->flags, SUBSCR_LGAUGE_ANIM_OVER, state); + SETFLAG(w->flags, SUBSCR_GAUGE_ANIM_OVER, state); refr_info(); } ), - INFOBTN("The 'Anim Cond' value is treated as a percentage of max HP."), - cbs[2] = CBOX(w->flags,SUBSCR_LGAUGE_ANIM_PERCENT,"Anim Cond is Percent",1), + INFOBTN("The 'Anim Cond' value is treated as a percentage of max "+ctrname+"."), + cbs[2] = CBOX(w->flags,SUBSCR_GAUGE_ANIM_PERCENT,"Anim Cond is Percent",1), INFOBTN("When animating, skip the first frame."), cbs[3] = Checkbox( text = "Skip First Frame", hAlign = 0.0, - checked = w->flags & SUBSCR_LGAUGE_ANIM_SKIP, + checked = w->flags & SUBSCR_GAUGE_ANIM_SKIP, onToggleFunc = [&, w](bool state) { - SETFLAG(w->flags, SUBSCR_LGAUGE_ANIM_SKIP, state); + SETFLAG(w->flags, SUBSCR_GAUGE_ANIM_SKIP, state); + refr_info(); + } + ), + INFOBTN("Will be invisible if infinite of the counter IS possessed." + " Counts owning the 'Infinite Item', or hardcoded infinities like" + " wallets granting infinite money."), + Checkbox( + text = "No Infinite", hAlign = 0.0, + checked = w->flags & SUBSCR_GAUGE_INFITM_BAN, + onToggleFunc = [&, w](bool state) + { + SETFLAG(w->flags, SUBSCR_GAUGE_INFITM_BAN, state); + refr_info(); + } + ), + INFOBTN("Will be invisible if infinite of the counter IS NOT possessed." + " Counts owning the 'Infinite Item', or hardcoded infinities like" + " wallets granting infinite money."), + Checkbox( + text = "Require Infinite", hAlign = 0.0, + checked = w->flags & SUBSCR_GAUGE_INFITM_REQ, + onToggleFunc = [&, w](bool state) + { + SETFLAG(w->flags, SUBSCR_GAUGE_INFITM_REQ, state); refr_info(); } ) ), Rows<2>(vAlign = 0.0, INFOBTN("If a unique tile should be used for the last container when full."), - CBOX(w->flags,SUBSCR_LGAUGE_UNQLAST,"Unique Last",1), + CBOX(w->flags,SUBSCR_GAUGE_UNQLAST,"Unique Last",1), INFOBTN("Use full tiles instead of mini-tiles"), Checkbox( text = "Full Tile", hAlign = 0.0, - checked = w->flags & SUBSCR_LGAUGE_FULLTILE, + checked = w->flags & SUBSCR_GAUGE_FULLTILE, onToggleFunc = [&, w](bool state) { - SETFLAG(w->flags, SUBSCR_LGAUGE_FULLTILE, state); + SETFLAG(w->flags, SUBSCR_GAUGE_FULLTILE, state); refr_info(); } ), INFOBTN("If the grid order should go right-to-left instead of left-to-right"), - gauge_gw[g++] = CBOX(w->gridflags, LGAUGE_GRID_RTOL, "Grid Right to Left", 1), + gauge_gw[g++] = CBOX(w->gridflags, GAUGE_GRID_RTOL, "Grid Right to Left", 1), INFOBTN("If the grid order should go top-to-bottom instead of bottom-to-top"), - gauge_gw[g++] = CBOX(w->gridflags, LGAUGE_GRID_TTOB, "Grid Top to Bottom", 1), + gauge_gw[g++] = CBOX(w->gridflags, GAUGE_GRID_TTOB, "Grid Top to Bottom", 1), INFOBTN("If the grid should grow in the columns before the rows"), - gauge_gw[g++] = CBOX(w->gridflags, LGAUGE_GRID_COLUMN1ST, "Grid Column First", 1), + gauge_gw[g++] = CBOX(w->gridflags, GAUGE_GRID_COLUMN1ST, "Grid Column First", 1), INFOBTN("If the grid should alternate direction when finishing a row (or column)"), - gauge_gw[g++] = CBOX(w->gridflags, LGAUGE_GRID_SNAKE, "Grid Snake Pattern", 1) + gauge_gw[g++] = CBOX(w->gridflags, GAUGE_GRID_SNAKE, "Grid Snake Pattern", 1) ) ) ) ); + switch(widgty) + { + case widgLGAUGE: + break; //nothing else + case widgMGAUGE: + { + SW_MagicGaugePiece* w = dynamic_cast(local_subref); + attrib_grid = Row( + Label(text = "Show when Magic Drain =", hAlign = 1.0), + NUM_FIELD(w->showdrain, -1, 9999), + INFOBTN("If set to -1, piece shows normally." + "\nIf set to > -1, piece will only be visible when your" + " Magic Drain Rate is equal to the value." + "\nEx. With the default of starting at drain rate 2," + " a show value of '1' would be used for a '1/2 magic' icon." + "\nWith a starting drain rate of 4, you could" + " then have a show value of '2' for a '1/2 magic', and a" + " show value of '1' for a '1/4 magic'.") + ); + break; + } + case widgMISCGAUGE: + { + SW_MiscGaugePiece* w = dynamic_cast(local_subref); + attrib_grid = Row( + Label(text = "Counter", hAlign = 1.0), + DDL(w->counter, list_counters), + INFOBTN("The counter for this gauge."), + Label(text = "Per Container", hAlign = 1.0), + NUM_FIELD(w->per_container, 1, 65535), + INFOBTN("The number of the counter 'per container' of the gauge.") + ); + break; + } + } + break; } case widgLMETER: @@ -940,69 +1028,8 @@ std::shared_ptr SubscrPropDialog::view() ); break; } - case widgMGAUGE: - { - SW_MagicGaugePiece* w = dynamic_cast(local_subref); - attrib_grid = Row(padding = 0_px, - Rows<2>( - Row(colSpan = 2, - Label(text = "Gauge Tiles"), - INFOBTN("The tiles used by the gauge. Which tile is used depends on the 'Container' value." - "\nThe 'Mod' checkbox determines if the tile should be adjusted based on current HP." - " The tile layout 'Mod' uses is determined by the 'Full Tile' flag and 'Old Gauge Tile Layout'" - " quest rule." - "\nIf 'Full Tile' is checked, the layout is as follows: The selected tile appears if the" - " container has < 'Units per frame' mp, with any animation frames after it. The next tile appears" - " if the container has < 'Units per frame *2' mp, etc. If the container is the last container," - " and is full, and 'Unique Last' is checked, it uses the tile after the full tile." - "\nIf 'Full Tile' is not checked but 'Old Gauge Tile Layout' is off, it uses the same layout as" - " the 'Full Tile' layout, but uses minitiles in that order instead." - "\nIf 'Full Tile' is not checked and 'Old Gauge Tile Layout' is on, then: The full container uses the" - " first minitile, plus animation frames. The empty container is the top-left minitile of the tile" - " after the end of the full container, and the layout continues as before from here until the" - " just-before-full tile. The final full container with 'Unique Last' checked uses the" - " bottom-right minitile of the tile after the end of this." - + QRHINT({qr_OLD_GAUGE_TILE_LAYOUT})) - ), - GAUGE_MINITILE(0,"Not Last",w->mts[0],w->flags,SUBSCR_MGAUGE_MOD1), - GAUGE_MINITILE(1,"Last",w->mts[1],w->flags,SUBSCR_MGAUGE_MOD2), - GAUGE_MINITILE(2,"Cap",w->mts[2],w->flags,SUBSCR_MGAUGE_MOD3), - GAUGE_MINITILE(3,"After Cap",w->mts[3],w->flags,SUBSCR_MGAUGE_MOD4) - ), - Columns<6>( - Label(text = "Frames:", hAlign = 1.0), - Label(text = "Speed:", hAlign = 1.0), - Label(text = "Delay:", hAlign = 1.0), - Label(text = "Container:", hAlign = 1.0), - Label(text = "Show:", hAlign = 1.0), - CBOX(w->flags,SUBSCR_MGAUGE_UNQLAST,"Unique Last",2), - NUM_FIELD(w->frames, 1, 999), - NUM_FIELD(w->speed, 1, 999), - NUM_FIELD(w->delay, 0, 999), - NUM_FIELD(w->container, 0, 9999), - NUM_FIELD(w->showdrain, -1, 9999), - DummyWidget(rowSpan=3), - INFOBTN("The container number this piece represents. For a value of n," - "\nIf the Player has exactly n containers, 'Last' displays." - "\nIf the Player has > n containers, 'Not Last' displays." - "\nIf the Player has exactly n-1 containers, 'Cap' displays." - "\nIf the Player has < n-1 containers, 'After Cap' displays." - ), - INFOBTN("If set to -1, piece shows normally." - "\nIf set to > -1, piece will only be visible when your" - " Magic Drain Rate is equal to the value." - "\nEx. With the default of starting at drain rate 2," - " a show value of '1' would be used for a '1/2 magic' icon." - "\nWith a starting drain rate of 4, you could" - " then have a show value of '2' for a '1/2 magic', and a" - " show value of '1' for a '1/4 magic'.") - ) - ); - break; - } case widgMMETER: { - addattrib = false; break; } case widgMMAP: @@ -1355,7 +1382,7 @@ std::shared_ptr SubscrPropDialog::view() } std::shared_ptr g; - std::shared_ptr tpan = TabPanel(ptr = &sprop_tab); + std::shared_ptr tpan = TabPanel(ptr = &sprop_tabs[local_subref->getType()]); switch(mergetype) { default: @@ -1363,34 +1390,39 @@ std::shared_ptr SubscrPropDialog::view() { tpan->add(TabRef(name = "Basic", g = Rows<2>(padding = 0_px))); g->add(Frame(title = "Location", fitParent = true, loc_grid)); - if(addcolor) + if(col_grid) g->add(Frame(title = "Color", fitParent = true, col_grid)); - if(addattrib) + if(attrib_grid) g->add(Frame(title = "Attributes", fitParent = true, attrib_grid)); break; } case mtFORCE_TAB: //3 separate tabs { tpan->add(TabRef(name = "Location", loc_grid)); - if(addcolor) tpan->add(TabRef(name = "Color", col_grid)); - if(addattrib) tpan->add(TabRef(name = "Attributes", attrib_grid)); + if(col_grid) tpan->add(TabRef(name = "Color", col_grid)); + if(attrib_grid) tpan->add(TabRef(name = "Attributes", attrib_grid)); break; } case mtLOCTOP: { tpan->add(TabRef(name = "Basic", g = Row(padding = 0_px))); - if(addcolor) + if(col_grid) { g->add(Column(padding = 0_px, Frame(title = "Location", fitParent = true, loc_grid), Frame(title = "Color", fitParent = true, col_grid))); } else g->add(Frame(title = "Location", fitParent = true, loc_grid)); - if(addattrib) + if(attrib_grid) g->add(Frame(title = "Attributes", fitParent = true, attrib_grid)); break; } } + if(extra_grids.size()) + { + for(auto& ref : extra_grids) + tpan->add(TabRef(name = ref.first, ref.second)); + } tpan->add(TabRef(name = "Selection", Rows<2>( Frame(title = "Cursor Selectable", info = "If the subscreen cursor can select this" " widget, and the selectable position information for selecting it.", @@ -1554,18 +1586,26 @@ void SubscrPropDialog::refr_info() break; } case widgLGAUGE: + case widgMGAUGE: + case widgMISCGAUGE: { - SW_LifeGaugePiece* w = dynamic_cast(local_subref); + SW_GaugePiece* w = dynamic_cast(local_subref); bool frcond = w->frames <= 1; - bool acond = !(frcond || (w->flags & (SUBSCR_LGAUGE_ANIM_UNDER|SUBSCR_LGAUGE_ANIM_OVER))); - bool frcond2 = frcond || (!acond && w->frames <= 2 && (w->flags & SUBSCR_LGAUGE_ANIM_SKIP)); + bool acond = frcond || !(w->flags & (SUBSCR_GAUGE_ANIM_UNDER|SUBSCR_GAUGE_ANIM_OVER)); + bool frcond2 = frcond || (!acond && w->frames <= 2 && (w->flags & SUBSCR_GAUGE_ANIM_SKIP)); + bool infcond = !(w->flags & (SUBSCR_GAUGE_INFITM_REQ|SUBSCR_GAUGE_INFITM_BAN)); for(int q = 0; q < 8; ++q) gauge_gw[q]->setDisabled(!(w->gauge_wid || w->gauge_hei)); for(int q = 0; q < 4; ++q) - gauge_tswatches[q]->setIsMini(!(local_subref->flags & SUBSCR_LGAUGE_FULLTILE)); + gauge_tswatches[q]->setIsMini(!(local_subref->flags & SUBSCR_GAUGE_FULLTILE)); tfs[0]->setDisabled(acond); + labels[0]->setDisabled(acond); tfs[1]->setDisabled(frcond2); + labels[1]->setDisabled(frcond2); tfs[2]->setDisabled(frcond2); + labels[2]->setDisabled(frcond2); + ddl->setDisabled(infcond); + labels[3]->setDisabled(infcond); cbs[0]->setDisabled(frcond); cbs[1]->setDisabled(frcond); cbs[2]->setDisabled(acond); diff --git a/src/dialog/subscr_props.h b/src/dialog/subscr_props.h index dd198b0f33..4e674ec2d4 100644 --- a/src/dialog/subscr_props.h +++ b/src/dialog/subscr_props.h @@ -40,7 +40,7 @@ class SubscrPropDialog: public GUI::Dialog std::shared_ptr tswatches[2]; std::shared_ptr ddl; std::shared_ptr fonttf; - std::shared_ptr labels[2]; + std::shared_ptr labels[5]; std::shared_ptr tfs[3]; std::shared_ptr cbs[4]; @@ -63,7 +63,7 @@ class SubscrPropDialog: public GUI::Dialog zasm_meta local_gen_meta; GUI::ListData list_font, list_shadtype, list_aligns, list_buttons, list_items, - list_counters, list_itemclass, list_genscr; + list_counters, list_counters2, list_itemclass, list_genscr; void updateSelectable(); void updateColors(); diff --git a/src/new_subscr.cpp b/src/new_subscr.cpp index 501d211cc7..a43368bdcc 100644 --- a/src/new_subscr.cpp +++ b/src/new_subscr.cpp @@ -18,16 +18,21 @@ #ifdef IS_PLAYER extern int32_t directItem; extern sprite_list Lwpns; +bool zq_ignore_item_ownership = true, zq_view_fullctr = false, zq_view_maxctr = false, + zq_view_noinf = false, zq_view_allinf = false; #define ALLOW_NULL_WIDGET replay_version_check(0,19) #else #define ALLOW_NULL_WIDGET is_zq_replay_test extern bool is_zq_replay_test; +extern bool zq_ignore_item_ownership, zq_view_fullctr, zq_view_maxctr, + zq_view_noinf, zq_view_allinf; #endif extern gamedata* game; //!TODO ZDEFSCLEAN move to gamedata.h extern zinitdata zinit; //!TODO ZDEFSCLEAN move to zinit.h +extern FFScript FFCore; int32_t get_dlevel(); int32_t get_currdmap(); int32_t get_homescr(); @@ -100,6 +105,184 @@ void kill_subscr_items() } } +bool is_counter_item(int32_t itmid, int32_t ctr) +{ + itemdata const& itm = itemsbuf[itmid]; + if(ctr == crNONE) return false; + if(ctr == itm.cost_counter[0] || + ctr == itm.cost_counter[1]) + return true; + return false; +} + +int old_ssc_to_new_ctr(int ssc) +{ + switch(ssc) + { + case 0: return crMONEY; + case 1: return crBOMBS; + case 2: return crSBOMBS; + case 3: return crARROWS; + case 4: return sscGENKEYMAGIC; + case 5: return sscGENKEYNOMAGIC; + case 6: return sscLEVKEYMAGIC; + case 7: return sscLEVKEYNOMAGIC; + case 8: return sscANYKEYMAGIC; + case 9: return sscANYKEYNOMAGIC; + case 35: return crLIFE; + case 36: return crMAGIC; + case 37: return sscMAXHP; + case 38: return sscMAXMP; + default: + if(ssc < 0) return ssc; + if(ssc >= 10 && ssc <= 34) + return crCUSTOM1+(ssc-10); + if(ssc >= 39 && ssc <= 104) + return crCUSTOM26+(ssc-39); + return crNONE; + } +} +word get_ssc_ctrmax(int ctr) +{ + if(ctr == crNONE) + return 0; + if(zq_view_maxctr) + return 65535; + dword ret = 0; + switch(ctr) + { + case crARROWS: + if(!get_qr(qr_TRUEARROWS)) + ctr = crMONEY; + break; + + case sscMAXHP: + { + ret = game->get_maxlife(); + break; + } + case sscMAXMP: + { + ret = game->get_maxmagic(); + break; + } + case sscGENKEYMAGIC: + case sscLEVKEYMAGIC: + case sscANYKEYMAGIC: + case sscANYKEYNOMAGIC: + case sscLEVKEYNOMAGIC: + case sscGENKEYNOMAGIC: + if(ctr == sscGENKEYNOMAGIC || ctr == sscANYKEYNOMAGIC + || ctr == sscGENKEYMAGIC || ctr == sscANYKEYMAGIC) + ret = game->get_maxcounter(crKEYS); + + if(ctr == sscLEVKEYNOMAGIC || ctr == sscANYKEYNOMAGIC + || ctr == sscLEVKEYMAGIC || ctr == sscANYKEYMAGIC) + ret = 65535; + + break; + } + if(ctr > -1) + return game->get_maxcounter(ctr); + return zc_min(65535,ret); +} +word get_ssc_ctr(int ctr, bool* infptr = nullptr) +{ + if(ctr == crNONE) + return 0; + dword ret = 0; + bool inf = false; + switch(ctr) + { + case crMONEY: + if(current_item_power(itype_wallet)) + inf = true; + break; + case crBOMBS: + if(current_item_power(itype_bombbag)) + inf = true; + break; + case crSBOMBS: + { + int32_t itemid = current_item_id(itype_bombbag); + if(itemid>-1 && itemsbuf[itemid].power>0 && itemsbuf[itemid].flags & ITEM_FLAG1) + inf = true; + break; + } + case crARROWS: + if(current_item_power(itype_quiver)) + inf = true; + if(!get_qr(qr_TRUEARROWS)) + { + if(current_item_power(itype_wallet)) + inf = true; + ctr = crMONEY; + } + break; + + case sscMAXHP: + { + ret = game->get_maxlife(); + break; + } + case sscMAXMP: + { + ret = game->get_maxmagic(); + break; + } + case sscGENKEYMAGIC: + case sscLEVKEYMAGIC: + case sscANYKEYMAGIC: + { + int32_t itemid = current_item_id(itype_magickey); + if(itemid>-1) + { + if(itemsbuf[itemid].flags&ITEM_FLAG1) + inf = itemsbuf[itemid].power>=get_dlevel(); + else + inf = itemsbuf[itemid].power==get_dlevel(); + } + } + [[fallthrough]]; + case sscANYKEYNOMAGIC: + case sscLEVKEYNOMAGIC: + case sscGENKEYNOMAGIC: + if(ctr == sscGENKEYNOMAGIC || ctr == sscANYKEYNOMAGIC + || ctr == sscGENKEYMAGIC || ctr == sscANYKEYMAGIC) + ret += game->get_keys(); + + if(ctr == sscLEVKEYNOMAGIC || ctr == sscANYKEYNOMAGIC + || ctr == sscLEVKEYMAGIC || ctr == sscANYKEYMAGIC) + ret += game->get_lkeys(); + + break; + } + if(infptr) + *infptr = inf; + if(zq_view_fullctr) return get_ssc_ctrmax(ctr); + if(ctr > -1) + return inf ? game->get_maxcounter(ctr) : game->get_counter(ctr); + return inf ? 65535 : zc_min(65535,ret); +} +void add_ssc_ctr(int ctr, bool& infinite, int32_t& value) +{ + bool inf = false; + value += get_ssc_ctr(ctr, &inf); + if(inf) infinite = true; +} +bool can_inf(int ctr, int infitm = -1) +{ + switch(ctr) + { + case crMONEY: + case crBOMBS: + case crSBOMBS: + case crARROWS: + return true; + } + return unsigned(infitm < MAXITEMS); +} + int32_t to_real_font(int32_t ss_font) { switch(ss_font) @@ -522,7 +705,7 @@ SubscrWidget* SubscrWidget::clone() const } bool SubscrWidget::copy_prop(SubscrWidget const* src, bool all) { - if(src->getType() != getType() || src == this) + if((src->getType() == widgNULL && getType() != widgNULL) || src == this) return false; flags = src->flags; posflags &= ~(sspUP|sspDOWN|sspSCROLLING); @@ -684,7 +867,8 @@ bool SW_2x2Frame::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_2x2Frame const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; cs = other->cs; tile = other->tile; return true; @@ -775,7 +959,8 @@ bool SW_Text::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_Text const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; fontid = other->fontid; text = other->text; align = other->align; @@ -862,7 +1047,8 @@ bool SW_Line::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_Line const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; c_line = other->c_line; return true; } @@ -925,7 +1111,8 @@ bool SW_Rect::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_Rect const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; c_fill = other->c_fill; c_outline = other->c_outline; return true; @@ -1034,7 +1221,8 @@ bool SW_Time::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_Time const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; fontid = other->fontid; align = other->align; shadtype = other->shadtype; @@ -1120,7 +1308,8 @@ bool SW_MagicMeter::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_MagicMeter const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; return true; } int32_t SW_MagicMeter::read(PACKFILE *f, word s_version) @@ -1180,7 +1369,8 @@ bool SW_LifeMeter::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_LifeMeter const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; rows = other->rows; return true; } @@ -1274,7 +1464,8 @@ bool SW_ButtonItem::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_ButtonItem const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; btn = other->btn; return true; } @@ -1307,12 +1498,16 @@ bool SW_Counter::load_old(subscreen_object const& old) fontid = to_real_font(old.d1); align = old.d2; shadtype = old.d3; - ctrs[0] = old.d7; - ctrs[1] = old.d8; - ctrs[2] = old.d9; + ctrs[0] = old_ssc_to_new_ctr(old.d7); + ctrs[1] = old_ssc_to_new_ctr(old.d8); + ctrs[2] = old_ssc_to_new_ctr(old.d9); + if(ctrs[1] == crMONEY) + ctrs[1] = crNONE; + if(ctrs[2] == crMONEY) + ctrs[2] = crNONE; SETFLAG(flags,SUBSCR_COUNTER_SHOW0,old.d6&0b01); SETFLAG(flags,SUBSCR_COUNTER_ONLYSEL,old.d6&0b10); - digits = old.d4; + mindigits = old.d4; infitm = old.d10; infchar = old.d5; c_text.load_old(old,1); @@ -1330,7 +1525,7 @@ int16_t SW_Counter::getY() const } word SW_Counter::getW() const { - return text_length(get_zc_font(fontid), "0")*zc_max(1,digits) + shadow_w(shadtype); + return text_length(get_zc_font(fontid), "0")*(maxdigits>0?maxdigits:zc_max(1,mindigits)) + shadow_w(shadtype); } word SW_Counter::getH() const { @@ -1354,10 +1549,85 @@ byte SW_Counter::getType() const void SW_Counter::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { FONT* tempfont = get_zc_font(fontid); - counter(dest, x+xofs,y+yofs, tempfont, c_text.get_color(), - c_shadow.get_color(), c_bg.get_color(),align,shadtype,digits,infchar, - flags&SUBSCR_COUNTER_SHOW0, ctrs[0], ctrs[1], ctrs[2], infitm, - flags&SUBSCR_COUNTER_ONLYSEL); + auto b = zq_ignore_item_ownership; + zq_ignore_item_ownership = false; + + { + int32_t value=0; + bool infinite = false, draw = true; + + if(zq_view_allinf && (can_inf(ctrs[0],infitm)||can_inf(ctrs[1])||can_inf(ctrs[2]))) + infinite = true; + else if(game != NULL && infitm > -1 && game->get_item(infitm) && !item_disabled(infitm)) + infinite = true; + + char valstring[80]; + char formatstring[80]; + sprintf(valstring,"01234567890123456789"); + sprintf(formatstring, "%%0%dd", mindigits); + + if(flags&SUBSCR_COUNTER_ONLYSEL) + { + draw = false; + for(int q = 0; q < 3; ++q) + { + if((Bwpn>-1&&is_counter_item(Bwpn&0xFF,ctrs[q])) + || (Awpn>-1&&is_counter_item(Awpn&0xFF,ctrs[q])) + || (Xwpn>-1&&is_counter_item(Xwpn&0xFF,ctrs[q])) + || (Ywpn>-1&&is_counter_item(Ywpn&0xFF,ctrs[q]))) + { + draw = true; + break; + } + } + } + + if(draw) + { + int maxty = 1; + if (( FFCore.getQuestHeaderInfo(vZelda) == 0x250 && FFCore.getQuestHeaderInfo(vBuild) >= 33 ) + || ( FFCore.getQuestHeaderInfo(vZelda) > 0x250 ) ) + maxty = 3; + + for(int q = 0; q < maxty; ++q) + { + int ty = ctrs[q]; + for(int p = 0; p < q; ++p) //prune duplicates + if(ctrs[p]==ty) + ty = crNONE; + if(q>0 && get_qr(qr_OLD_SUBSCR)) + switch(ctrs[q]) + { + case crMONEY: + case crLIFE: + continue; + } + add_ssc_ctr(ctrs[q],infinite,value); + } + + if(zq_view_noinf) + infinite = false; + + if(!(flags&SUBSCR_COUNTER_SHOW0)&&!value&&!infinite) + return; + + if(infinite) + sprintf(valstring, "%c", infchar); + else + { + if(maxdigits) + { + auto mval = pow(10,maxdigits); + if(value >= mval) + value = mval-1; + } + sprintf(valstring, formatstring, value); + } + textout_styled_aligned_ex(dest,tempfont,valstring,x+xofs,y+yofs,shadtype,align,c_text.get_color(),c_shadow.get_color(),c_bg.get_color()); + } + } + + zq_ignore_item_ownership = b; } SubscrWidget* SW_Counter::clone() const { @@ -1368,7 +1638,8 @@ bool SW_Counter::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_Counter const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; fontid = other->fontid; align = other->align; shadtype = other->shadtype; @@ -1378,7 +1649,8 @@ bool SW_Counter::copy_prop(SubscrWidget const* src, bool all) ctrs[0] = other->ctrs[0]; ctrs[1] = other->ctrs[1]; ctrs[2] = other->ctrs[2]; - digits = other->digits; + mindigits = other->mindigits; + maxdigits = other->maxdigits; infitm = other->infitm; infchar = other->infchar; return true; @@ -1405,7 +1677,9 @@ int32_t SW_Counter::read(PACKFILE *f, word s_version) return qe_invalid; if(!p_igetl(&ctrs[2],f)) return qe_invalid; - if(!p_getc(&digits,f)) + if(!p_getc(&mindigits,f)) + return qe_invalid; + if(!p_getc(&maxdigits,f)) return qe_invalid; if(!p_igetl(&infitm,f)) return qe_invalid; @@ -1435,7 +1709,9 @@ int32_t SW_Counter::write(PACKFILE *f) const new_return(1); if(!p_iputl(ctrs[2],f)) new_return(1); - if(!p_putc(digits,f)) + if(!p_putc(mindigits,f)) + new_return(1); + if(!p_putc(maxdigits,f)) new_return(1); if(!p_iputl(infitm,f)) new_return(1); @@ -1500,7 +1776,8 @@ bool SW_Counters::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_Counters const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; fontid = other->fontid; shadtype = other->shadtype; c_text = other->c_text; @@ -1613,7 +1890,8 @@ bool SW_MMapTitle::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_MMapTitle const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; fontid = other->fontid; align = other->align; shadtype = other->shadtype; @@ -1704,7 +1982,8 @@ bool SW_MMap::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_MMap const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; c_plr = other->c_plr; c_cmp_blink = other->c_cmp_blink; c_cmp_off = other->c_cmp_off; @@ -1779,7 +2058,8 @@ bool SW_LMap::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_LMap const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; c_room = other->c_room; c_plr = other->c_plr; return true; @@ -1842,7 +2122,8 @@ bool SW_Clear::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_Clear const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; c_bg = other->c_bg; return true; } @@ -2272,7 +2553,8 @@ bool SW_ItemSlot::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_ItemSlot const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; iid = other->iid; iclass = other->iclass; return true; @@ -2345,7 +2627,8 @@ bool SW_TriFrame::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_TriFrame const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; frame_tile = other->frame_tile; piece_tile = other->piece_tile; frame_cset = other->frame_cset; @@ -2434,7 +2717,8 @@ bool SW_McGuffin::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_McGuffin const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; tile = other->tile; number = other->number; cset = other->cset; @@ -2512,7 +2796,8 @@ bool SW_TileBlock::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_TileBlock const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; tile = other->tile; flip = other->flip; cs = other->cs; @@ -2626,7 +2911,8 @@ bool SW_MiniTile::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_MiniTile const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; tile = other->tile; special_tile = other->special_tile; crn = other->crn; @@ -2785,7 +3071,8 @@ bool SW_Selector::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_Selector const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; return true; } int32_t SW_Selector::read(PACKFILE *f, word s_version) @@ -2801,65 +3088,36 @@ int32_t SW_Selector::write(PACKFILE *f) const return 0; } -SW_LifeGaugePiece::SW_LifeGaugePiece(subscreen_object const& old) : SW_LifeGaugePiece() -{ - load_old(old); -} -bool SW_LifeGaugePiece::load_old(subscreen_object const& old) +bool SW_GaugePiece::infinite() const { - if(old.type != ssoLIFEGAUGE) - return false; - SubscrWidget::load_old(old); - mts[0].tilecrn = old.d2; - mts[0].cset = old.colortype1; - mts[1].tilecrn = old.d3; - mts[1].cset = old.color1; - mts[2].tilecrn = old.d4; - mts[2].cset = old.colortype2; - mts[3].tilecrn = old.d5; - mts[3].cset = old.color2; - SETFLAG(flags, SUBSCR_LGAUGE_MOD1, old.d10&0x01); - SETFLAG(flags, SUBSCR_LGAUGE_MOD2, old.d10&0x02); - SETFLAG(flags, SUBSCR_LGAUGE_MOD3, old.d10&0x04); - SETFLAG(flags, SUBSCR_LGAUGE_MOD4, old.d10&0x08); - SETFLAG(flags, SUBSCR_LGAUGE_UNQLAST, old.d10&0x10); - frames = 1; - speed = 0; - delay = 0; - container = old.d1; - return true; + return (inf_item > -1 && (!game || (game->get_item(inf_item) && !item_disabled(inf_item)))); } -int16_t SW_LifeGaugePiece::getX() const +int16_t SW_GaugePiece::getX() const { return x + (grid_xoff < 0 ? gauge_hei*grid_xoff : 0); } -int16_t SW_LifeGaugePiece::getY() const +int16_t SW_GaugePiece::getY() const { - auto sz = ((flags&SUBSCR_LGAUGE_FULLTILE)?16:8); + auto sz = ((flags&SUBSCR_GAUGE_FULLTILE)?16:8); return y + (grid_yoff < 0 ? gauge_hei*grid_yoff : 0); } -word SW_LifeGaugePiece::getW() const +word SW_GaugePiece::getW() const { - auto sz = ((flags&SUBSCR_LGAUGE_FULLTILE)?16:8); + auto sz = ((flags&SUBSCR_GAUGE_FULLTILE)?16:8); return (gauge_wid+1) * sz + gauge_wid * hspace + gauge_hei * abs(grid_xoff); } -word SW_LifeGaugePiece::getH() const +word SW_GaugePiece::getH() const { - auto sz = ((flags&SUBSCR_LGAUGE_FULLTILE)?16:8); + auto sz = ((flags&SUBSCR_GAUGE_FULLTILE)?16:8); return (gauge_hei+1) * sz + gauge_hei * vspace + gauge_wid * abs(grid_yoff); } -byte SW_LifeGaugePiece::getType() const -{ - return widgLGAUGE; -} -void SW_LifeGaugePiece::draw_piece(BITMAP* dest, int dx, int dy, SubscrPage& page, int container, int anim_offs) const + +void SW_GaugePiece::draw_piece(BITMAP* dest, int dx, int dy, int container, int anim_offs) const { - int containers=game->get_maxlife()/game->get_hp_per_heart(); + word ctr_cur = get_ctr(), ctr_max = get_ctr_max(), + ctr_per_cont = get_per_container(); + int containers=ctr_max/ctr_per_cont; int fr = frames ? frames : 1; - int spd = speed ? speed : 1; - int tile, cset; - bool mod_value; - bool fulltile = flags&SUBSCR_LGAUGE_FULLTILE; int ind = 3; if(containercontainers+1) - int mtile=mts[ind].tilecrn; - cset=mts[ind].cset; - mod_value=(flags&(SUBSCR_LGAUGE_MOD1<>2; + int mtile = mts[ind].tilecrn; + int cset = mts[ind].cset; + bool mod_value = (flags&(SUBSCR_GAUGE_MOD1<>2; + + bool fulltile = (flags&SUBSCR_GAUGE_FULLTILE); - int hp_ofs = 0; - if(mod_value) //Change the tile based on HP + int ctr_ofs = 0; + if(mod_value) //Change the tile based on ctr { - auto hp = game->get_life(); - auto hpph = game->get_hp_per_heart(); bool full = false; if(!fulltile && get_qr(qr_OLD_GAUGE_TILE_LAYOUT)) { int offs_0 = (fr + (4-(fr%4))); - if(hp>=container*hpph) + if(ctr_cur>=container*ctr_per_cont) full = true; - else if(((container-1)*hpph)>hp) - hp_ofs=0; + else if(((container-1)*ctr_per_cont)>ctr_cur) + ctr_ofs=0; else - hp_ofs=((hp-((container-1)*hpph))%hpph); + ctr_ofs=((ctr_cur-((container-1)*ctr_per_cont))%ctr_per_cont); - hp_ofs /= (unit_per_frame+1); + ctr_ofs /= (unit_per_frame+1); if(full) { - if((flags&SUBSCR_LGAUGE_UNQLAST) && hp==container*hpph) - hp_ofs = hpph / (unit_per_frame+1) + 3 + offs_0; + if((flags&SUBSCR_GAUGE_UNQLAST) && ctr_cur==container*ctr_per_cont) + ctr_ofs = ctr_per_cont / (unit_per_frame+1) + 3 + offs_0; } - else hp_ofs += offs_0; + else ctr_ofs += offs_0; } else { - if(((container-1)*hpph)>hp) - hp_ofs = 0; - else if(full = hp>=container*hpph) - hp_ofs = hpph+unit_per_frame; + if(((container-1)*ctr_per_cont)>ctr_cur) + ctr_ofs = 0; + else if(full = ctr_cur>=container*ctr_per_cont) + ctr_ofs = ctr_per_cont+unit_per_frame; else - hp_ofs = (hp-((container-1)*hpph))%hpph; - hp_ofs /= (unit_per_frame+1); - if(full && (flags&SUBSCR_LGAUGE_UNQLAST) && hp==container*hpph) - ++hp_ofs; + ctr_ofs = (ctr_cur-((container-1)*ctr_per_cont))%ctr_per_cont; + ctr_ofs /= (unit_per_frame+1); + if(full && (flags&SUBSCR_GAUGE_UNQLAST) && ctr_cur==container*ctr_per_cont) + ++ctr_ofs; } } - int offs = (hp_ofs*fr)+anim_offs; + int offs = (ctr_ofs*fr)+anim_offs; if(fulltile) overtile16(dest,tile+offs,dx,dy,cset,0); else overtile8(dest,mtile+offs,dx,dy,cset,0); } -void SW_LifeGaugePiece::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const +void SW_GaugePiece::draw(BITMAP* dest, int xofs, int yofs, SubscrPage& page) const { - if(replay_version_check(0,19)) + auto b = zq_ignore_item_ownership; + zq_ignore_item_ownership = false; + + bool inf = infinite(); + if(flags & (inf ? SUBSCR_GAUGE_INFITM_BAN : SUBSCR_GAUGE_INFITM_REQ)) { - zc_oldrand();zc_oldrand();zc_oldrand(); + zq_ignore_item_ownership = b; + return; } int anim_offs = 0; bool animate = true; - auto hp = game->get_life(); - auto mhp = game->get_maxlife(); - bool skipanim = frames > 1 && (flags&SUBSCR_LGAUGE_ANIM_SKIP); - if(flags&SUBSCR_LGAUGE_ANIM_PERCENT) + auto ctr = get_ctr(); + auto ctr_max = get_ctr_max(); + bool skipanim = frames > 1 && (flags&SUBSCR_GAUGE_ANIM_SKIP); + if(flags&SUBSCR_GAUGE_ANIM_PERCENT) { - if((flags&SUBSCR_LGAUGE_ANIM_UNDER) && ((1000*hp)/mhp) > (10*anim_val)) + if((flags&SUBSCR_GAUGE_ANIM_UNDER) && ((1000*ctr)/ctr_max) > (10*anim_val)) animate = false; - if((flags&SUBSCR_LGAUGE_ANIM_OVER) && ((1000*hp)/mhp) < (10*anim_val)) + if((flags&SUBSCR_GAUGE_ANIM_OVER) && ((1000*ctr)/ctr_max) < (10*anim_val)) animate = false; } else { - if((flags&SUBSCR_LGAUGE_ANIM_UNDER) && hp > anim_val) + if((flags&SUBSCR_GAUGE_ANIM_UNDER) && ctr > anim_val) animate = false; - if((flags&SUBSCR_LGAUGE_ANIM_OVER) && hp < anim_val) + if((flags&SUBSCR_GAUGE_ANIM_OVER) && ctr < anim_val) animate = false; } if(animate) @@ -2962,14 +3225,14 @@ void SW_LifeGaugePiece::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPag if(!gauge_hei && !gauge_wid) //1x1 { - draw_piece(dest, x+xofs, y+yofs, page, container, anim_offs); + draw_piece(dest, x+xofs, y+yofs, container, anim_offs); } else { - bool colbased = (gridflags&LGAUGE_GRID_COLUMN1ST) || !gauge_wid; - bool rtol = (gridflags&LGAUGE_GRID_RTOL), ttob = (gridflags&LGAUGE_GRID_TTOB), - snake = (gridflags&LGAUGE_GRID_SNAKE); - auto sz = (flags&SUBSCR_LGAUGE_FULLTILE)?16:8; + bool colbased = (gridflags&GAUGE_GRID_COLUMN1ST) || !gauge_wid; + bool rtol = (gridflags&GAUGE_GRID_RTOL), ttob = (gridflags&GAUGE_GRID_TTOB), + snake = (gridflags&GAUGE_GRID_SNAKE); + auto sz = (flags&SUBSCR_GAUGE_FULLTILE)?16:8; bool snakeoffs = false; if(colbased) //columns then rows { @@ -2981,7 +3244,7 @@ void SW_LifeGaugePiece::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPag auto curx = (rtol ? gauge_wid-x2 : x2), cury = (ttob ? y2 : gauge_hei-y2); int xo = ((sz+hspace) * curx) + (grid_xoff * cury); int yo = ((sz+vspace) * cury) + (grid_yoff * curx); - draw_piece(dest, x+xofs+xo, y+yofs+yo, page, container+offs, anim_offs); + draw_piece(dest, x+xofs+xo, y+yofs+yo, container+offs, anim_offs); } else for(int y2 = 0; y2 <= gauge_hei; ++y2, ++offs) @@ -2989,7 +3252,7 @@ void SW_LifeGaugePiece::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPag auto curx = (rtol ? gauge_wid-x2 : x2), cury = (ttob ? y2 : gauge_hei-y2); int xo = ((sz+hspace) * curx) + (grid_xoff * cury); int yo = ((sz+vspace) * cury) + (grid_yoff * curx); - draw_piece(dest, x+xofs+xo, y+yofs+yo, page, container+offs, anim_offs); + draw_piece(dest, x+xofs+xo, y+yofs+yo, container+offs, anim_offs); } if(snake) snakeoffs = !snakeoffs; } @@ -3004,7 +3267,7 @@ void SW_LifeGaugePiece::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPag auto curx = (rtol ? gauge_wid-x2 : x2), cury = (ttob ? y2 : gauge_hei-y2); int xo = ((sz+hspace) * curx) + (grid_xoff * cury); int yo = ((sz+vspace) * cury) + (grid_yoff * curx); - draw_piece(dest, x+xofs+xo, y+yofs+yo, page, container+offs, anim_offs); + draw_piece(dest, x+xofs+xo, y+yofs+yo, container+offs, anim_offs); } else for(int x2 = 0; x2 <= gauge_wid; ++x2, ++offs) @@ -3012,23 +3275,30 @@ void SW_LifeGaugePiece::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPag auto curx = (rtol ? gauge_wid-x2 : x2), cury = (ttob ? y2 : gauge_hei-y2); int xo = ((sz+hspace) * curx) + (grid_xoff * cury); int yo = ((sz+vspace) * cury) + (grid_yoff * curx); - draw_piece(dest, x+xofs+xo, y+yofs+yo, page, container+offs, anim_offs); + draw_piece(dest, x+xofs+xo, y+yofs+yo, container+offs, anim_offs); } if(snake) snakeoffs = !snakeoffs; } } } + zq_ignore_item_ownership = b; } -SubscrWidget* SW_LifeGaugePiece::clone() const +bool SW_GaugePiece::copy_prop(SubscrWidget const* src, bool all) { - return new SW_LifeGaugePiece(*this); -} -bool SW_LifeGaugePiece::copy_prop(SubscrWidget const* src, bool all) -{ - if(src->getType() != getType() || src == this) + if(src == this) + return false; + switch(src->getType()) + { + case widgLGAUGE: + case widgMGAUGE: + case widgMISCGAUGE: + break; + default: + return false; + } + SW_GaugePiece const* other = dynamic_cast(src); + if(!SubscrWidget::copy_prop(other,all)) return false; - SW_LifeGaugePiece const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); mts[0] = other->mts[0]; mts[1] = other->mts[1]; mts[2] = other->mts[2]; @@ -3039,25 +3309,27 @@ bool SW_LifeGaugePiece::copy_prop(SubscrWidget const* src, bool all) unit_per_frame = other->unit_per_frame; gauge_wid = other->gauge_wid; gauge_hei = other->gauge_hei; - hspace = other->hspace; - vspace = other->vspace; - grid_xoff = other->grid_xoff; - grid_yoff = other->grid_yoff; anim_val = other->anim_val; + inf_item = other->inf_item; if(all) { container = other->container; + hspace = other->hspace; + vspace = other->vspace; + grid_xoff = other->grid_xoff; + grid_yoff = other->grid_yoff; gridflags = other->gridflags; } bool frcond = frames <= 1; - bool acond = !(frcond || (flags & (SUBSCR_LGAUGE_ANIM_UNDER|SUBSCR_LGAUGE_ANIM_OVER))); - bool frcond2 = frcond || (!acond && frames <= 2 && (flags & SUBSCR_LGAUGE_ANIM_SKIP)); + bool acond = frcond || !(flags & (SUBSCR_GAUGE_ANIM_UNDER|SUBSCR_GAUGE_ANIM_OVER)); + bool frcond2 = frcond || (!acond && frames <= 2 && (flags & SUBSCR_GAUGE_ANIM_SKIP)); + bool infcond = !(flags & (SUBSCR_GAUGE_INFITM_REQ|SUBSCR_GAUGE_INFITM_BAN)); if(frcond) { - SETFLAG(flags, SUBSCR_LGAUGE_ANIM_UNDER, false); - SETFLAG(flags, SUBSCR_LGAUGE_ANIM_OVER, false); - SETFLAG(flags, SUBSCR_LGAUGE_ANIM_PERCENT, false); - SETFLAG(flags, SUBSCR_LGAUGE_ANIM_SKIP, false); + SETFLAG(flags, SUBSCR_GAUGE_ANIM_UNDER, false); + SETFLAG(flags, SUBSCR_GAUGE_ANIM_OVER, false); + SETFLAG(flags, SUBSCR_GAUGE_ANIM_PERCENT, false); + SETFLAG(flags, SUBSCR_GAUGE_ANIM_SKIP, false); } if(acond) { @@ -3068,9 +3340,11 @@ bool SW_LifeGaugePiece::copy_prop(SubscrWidget const* src, bool all) speed = 1; delay = 0; } + if(infcond) + inf_item = -1; return true; } -int32_t SW_LifeGaugePiece::read(PACKFILE *f, word s_version) +int32_t SW_GaugePiece::read(PACKFILE* f, word s_version) { if(auto ret = SubscrWidget::read(f,s_version)) return ret; @@ -3080,8 +3354,9 @@ int32_t SW_LifeGaugePiece::read(PACKFILE *f, word s_version) if(!p_igetw(&frames, f)) return qe_invalid; bool frcond = frames <= 1; - bool acond = !(frcond || (flags & (SUBSCR_LGAUGE_ANIM_UNDER|SUBSCR_LGAUGE_ANIM_OVER))); - bool frcond2 = frcond || (!acond && frames <= 2 && (flags & SUBSCR_LGAUGE_ANIM_SKIP)); + bool acond = frcond || !(flags & (SUBSCR_GAUGE_ANIM_UNDER|SUBSCR_GAUGE_ANIM_OVER)); + bool frcond2 = frcond || (!acond && frames <= 2 && (flags & SUBSCR_GAUGE_ANIM_SKIP)); + bool infcond = !(flags & (SUBSCR_GAUGE_INFITM_REQ|SUBSCR_GAUGE_INFITM_BAN)); if(!frcond2) { if(!p_igetw(&speed, f)) @@ -3115,13 +3390,19 @@ int32_t SW_LifeGaugePiece::read(PACKFILE *f, word s_version) if(!p_igetw(&anim_val, f)) return qe_invalid; } + if(!infcond) + { + if(!p_igetw(&inf_item, f)) + return qe_invalid; + } return 0; } -int32_t SW_LifeGaugePiece::write(PACKFILE *f) const +int32_t SW_GaugePiece::write(PACKFILE* f) const { bool frcond = frames <= 1; - bool acond = !(frcond || (flags & (SUBSCR_LGAUGE_ANIM_UNDER|SUBSCR_LGAUGE_ANIM_OVER))); - bool frcond2 = frcond || (!acond && frames <= 2 && (flags & SUBSCR_LGAUGE_ANIM_SKIP)); + bool acond = frcond || !(flags & (SUBSCR_GAUGE_ANIM_UNDER|SUBSCR_GAUGE_ANIM_OVER)); + bool frcond2 = frcond || (!acond && frames <= 2 && (flags & SUBSCR_GAUGE_ANIM_SKIP)); + bool infcond = !(flags & (SUBSCR_GAUGE_INFITM_REQ|SUBSCR_GAUGE_INFITM_BAN)); if(auto ret = SubscrWidget::write(f)) return ret; for(auto q = 0; q < 4; ++q) @@ -3162,9 +3443,91 @@ int32_t SW_LifeGaugePiece::write(PACKFILE *f) const if(!p_iputw(anim_val, f)) new_return(1); } + if(!infcond) + { + if(!p_iputw(inf_item, f)) + new_return(1); + } return 0; } +SW_LifeGaugePiece::SW_LifeGaugePiece(subscreen_object const& old) : SW_LifeGaugePiece() +{ + load_old(old); +} +bool SW_LifeGaugePiece::load_old(subscreen_object const& old) +{ + if(old.type != ssoLIFEGAUGE) + return false; + SubscrWidget::load_old(old); + mts[0].tilecrn = old.d2; + mts[0].cset = old.colortype1; + mts[1].tilecrn = old.d3; + mts[1].cset = old.color1; + mts[2].tilecrn = old.d4; + mts[2].cset = old.colortype2; + mts[3].tilecrn = old.d5; + mts[3].cset = old.color2; + SETFLAG(flags, SUBSCR_GAUGE_MOD1, old.d10&0x01); + SETFLAG(flags, SUBSCR_GAUGE_MOD2, old.d10&0x02); + SETFLAG(flags, SUBSCR_GAUGE_MOD3, old.d10&0x04); + SETFLAG(flags, SUBSCR_GAUGE_MOD4, old.d10&0x08); + SETFLAG(flags, SUBSCR_GAUGE_UNQLAST, old.d10&0x10); + frames = 1; + speed = 0; + delay = 0; + container = old.d1; + return true; +} +byte SW_LifeGaugePiece::getType() const +{ + return widgLGAUGE; +} + +word SW_LifeGaugePiece::get_ctr() const +{ + return get_ssc_ctr(crLIFE); +} +word SW_LifeGaugePiece::get_ctr_max() const +{ + return get_ssc_ctrmax(crLIFE); +} +bool SW_LifeGaugePiece::infinite() const +{ + if(zq_view_allinf && can_inf(crLIFE,inf_item)) return true; + if(zq_view_noinf) return false; + return SW_GaugePiece::infinite(); +} +word SW_LifeGaugePiece::get_per_container() const +{ + return game->get_hp_per_heart(); +} +void SW_LifeGaugePiece::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const +{ + if(replay_version_check(0,19)) + { + zc_oldrand();zc_oldrand();zc_oldrand(); + } + + SW_GaugePiece::draw(dest, xofs, yofs, page); +} +SubscrWidget* SW_LifeGaugePiece::clone() const +{ + return new SW_LifeGaugePiece(*this); +} +bool SW_LifeGaugePiece::copy_prop(SubscrWidget const* src, bool all) +{ + return SW_GaugePiece::copy_prop(src,all); +} +int32_t SW_LifeGaugePiece::read(PACKFILE *f, word s_version) +{ + return SW_GaugePiece::read(f, s_version); +} +int32_t SW_LifeGaugePiece::write(PACKFILE *f) const +{ + return SW_GaugePiece::write(f); +} + SW_MagicGaugePiece::SW_MagicGaugePiece(subscreen_object const& old) : SW_MagicGaugePiece() { load_old(old); @@ -3182,11 +3545,11 @@ bool SW_MagicGaugePiece::load_old(subscreen_object const& old) mts[2].cset = old.colortype2; mts[3].tilecrn = old.d5; mts[3].cset = old.color2; - SETFLAG(flags, SUBSCR_MGAUGE_MOD1, old.d10&0x01); - SETFLAG(flags, SUBSCR_MGAUGE_MOD2, old.d10&0x02); - SETFLAG(flags, SUBSCR_MGAUGE_MOD3, old.d10&0x04); - SETFLAG(flags, SUBSCR_MGAUGE_MOD4, old.d10&0x08); - SETFLAG(flags, SUBSCR_MGAUGE_UNQLAST, old.d10&0x10); + SETFLAG(flags, SUBSCR_GAUGE_MOD1, old.d10&0x01); + SETFLAG(flags, SUBSCR_GAUGE_MOD2, old.d10&0x02); + SETFLAG(flags, SUBSCR_GAUGE_MOD3, old.d10&0x04); + SETFLAG(flags, SUBSCR_GAUGE_MOD4, old.d10&0x08); + SETFLAG(flags, SUBSCR_GAUGE_UNQLAST, old.d10&0x10); frames = old.d6; speed = old.d7; delay = old.d8; @@ -3194,26 +3557,42 @@ bool SW_MagicGaugePiece::load_old(subscreen_object const& old) showdrain = old.d9; return true; } -word SW_MagicGaugePiece::getW() const +byte SW_MagicGaugePiece::getType() const { - return 8; + return widgMGAUGE; } -word SW_MagicGaugePiece::getH() const + +word SW_MagicGaugePiece::get_ctr() const { - return 8; + return get_ssc_ctr(crMAGIC); } -byte SW_MagicGaugePiece::getType() const +word SW_MagicGaugePiece::get_ctr_max() const { - return widgMGAUGE; + return get_ssc_ctrmax(crMAGIC); +} +bool SW_MagicGaugePiece::infinite() const +{ + if(zq_view_allinf && can_inf(crMAGIC,inf_item)) return true; + if(zq_view_noinf) return false; + bool b = false; + get_ssc_ctr(crMAGIC, &b); + return b || SW_GaugePiece::infinite(); +} +word SW_MagicGaugePiece::get_per_container() const +{ + return game->get_mp_per_block(); } void SW_MagicGaugePiece::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const { - magicgauge(dest, x, y, container, - mts[0].tilecrn, mts[0].cset, flags&SUBSCR_MGAUGE_MOD1, - mts[1].tilecrn, mts[1].cset, flags&SUBSCR_MGAUGE_MOD2, - mts[2].tilecrn, mts[2].cset, flags&SUBSCR_MGAUGE_MOD3, - mts[3].tilecrn, mts[3].cset, flags&SUBSCR_MGAUGE_MOD4, - frames, speed, delay, flags&SUBSCR_MGAUGE_UNQLAST, showdrain); + if(showdrain > -1 && showdrain != game->get_magicdrainrate()) + return; + + if(replay_version_check(0,19)) + { + zc_oldrand();zc_oldrand();zc_oldrand(); + } + + SW_GaugePiece::draw(dest, xofs, yofs, page); } SubscrWidget* SW_MagicGaugePiece::clone() const { @@ -3221,60 +3600,96 @@ SubscrWidget* SW_MagicGaugePiece::clone() const } bool SW_MagicGaugePiece::copy_prop(SubscrWidget const* src, bool all) { + if(!SW_GaugePiece::copy_prop(src,all)) + return false; if(src->getType() != getType() || src == this) return false; SW_MagicGaugePiece const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); - mts[0] = other->mts[0]; - mts[1] = other->mts[1]; - mts[2] = other->mts[2]; - mts[3] = other->mts[3]; - frames = other->frames; - speed = other->speed; - delay = other->delay; - if(all) container = other->container; + showdrain = other->showdrain; return true; } int32_t SW_MagicGaugePiece::read(PACKFILE *f, word s_version) { - if(auto ret = SubscrWidget::read(f,s_version)) + if(auto ret = SW_GaugePiece::read(f, s_version)) return ret; - for(auto q = 0; q < 4; ++q) - if(auto ret = mts[q].read(f,s_version)) - return ret; - if(!p_igetw(&frames, f)) - return qe_invalid; - if(!p_igetw(&speed, f)) - return qe_invalid; - if(!p_igetw(&delay, f)) - return qe_invalid; - if(!p_igetw(&container, f)) - return qe_invalid; if(!p_igetw(&showdrain, f)) return qe_invalid; return 0; } int32_t SW_MagicGaugePiece::write(PACKFILE *f) const { - if(auto ret = SubscrWidget::write(f)) + if(auto ret = SW_GaugePiece::write(f)) return ret; - for(auto q = 0; q < 4; ++q) - if(auto ret = mts[q].write(f)) - return ret; - if(!p_iputw(frames, f)) - new_return(1); - if(!p_iputw(speed, f)) + if(!p_iputw(showdrain,f)) new_return(1); - if(!p_iputw(delay, f)) - new_return(1); - if(!p_iputw(container, f)) + return 0; +} + +byte SW_MiscGaugePiece::getType() const +{ + return widgMISCGAUGE; +} + +word SW_MiscGaugePiece::get_ctr() const +{ + return get_ssc_ctr(counter); +} +word SW_MiscGaugePiece::get_ctr_max() const +{ + return get_ssc_ctrmax(counter); +} +bool SW_MiscGaugePiece::infinite() const +{ + if(zq_view_allinf && can_inf(counter,inf_item)) return true; + if(zq_view_noinf) return false; + bool b = false; + get_ssc_ctr(counter, &b); + return b || SW_GaugePiece::infinite(); +} +word SW_MiscGaugePiece::get_per_container() const +{ + return per_container; +} +void SW_MiscGaugePiece::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const +{ + SW_GaugePiece::draw(dest, xofs, yofs, page); +} +SubscrWidget* SW_MiscGaugePiece::clone() const +{ + return new SW_MiscGaugePiece(*this); +} +bool SW_MiscGaugePiece::copy_prop(SubscrWidget const* src, bool all) +{ + if(!SW_GaugePiece::copy_prop(src,all)) + return false; + if(src->getType() != getType() || src == this) + return false; + SW_MiscGaugePiece const* other = dynamic_cast(src); + counter = other->counter; + per_container = other->per_container; + return true; +} +int32_t SW_MiscGaugePiece::read(PACKFILE *f, word s_version) +{ + if(auto ret = SW_GaugePiece::read(f, s_version)) + return ret; + if(!p_getc(&counter, f)) + return qe_invalid; + if(!p_igetw(&per_container,f)) + return qe_invalid; + return 0; +} +int32_t SW_MiscGaugePiece::write(PACKFILE *f) const +{ + if(auto ret = SW_GaugePiece::write(f)) + return ret; + if(!p_putc(counter, f)) new_return(1); - if(!p_iputw(showdrain, f)) + if(!p_iputw(per_container,f)) new_return(1); return 0; } - SW_TextBox::SW_TextBox(subscreen_object const& old) : SW_TextBox() { load_old(old); @@ -3316,7 +3731,8 @@ bool SW_TextBox::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_TextBox const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; fontid = other->fontid; if(all) text = other->text; align = other->align; @@ -3446,7 +3862,8 @@ bool SW_SelectedText::copy_prop(SubscrWidget const* src, bool all) if(src->getType() != getType() || src == this) return false; SW_SelectedText const* other = dynamic_cast(src); - SubscrWidget::copy_prop(other,all); + if(!SubscrWidget::copy_prop(other,all)) + return false; fontid = other->fontid; align = other->align; shadtype = other->shadtype; @@ -3663,6 +4080,9 @@ SubscrWidget* SubscrWidget::newType(byte ty) case widgMGAUGE: widg = new SW_MagicGaugePiece(); break; + case widgMISCGAUGE: + widg = new SW_MiscGaugePiece(); + break; case widgTEXTBOX: widg = new SW_TextBox(); break; diff --git a/src/new_subscr.h b/src/new_subscr.h index 9cf063c7f3..58a21ca74e 100644 --- a/src/new_subscr.h +++ b/src/new_subscr.h @@ -111,6 +111,7 @@ enum widgOLDCTR, widgMMAPTITLE, widgMMAP, widgLMAP, widgBGCOLOR, widgITEMSLOT, widgMCGUFF_FRAME, widgMCGUFF, widgTILEBLOCK, widgMINITILE, widgSELECTOR, widgLGAUGE, widgMGAUGE, widgTEXTBOX, widgSELECTEDTEXT, + widgMISCGAUGE, widgMAX }; @@ -154,33 +155,12 @@ enum // special tiles { ssmstSSVINETILE, ssmstMAGICMETER, ssmstMAX }; -enum // counter objects +int old_ssc_to_new_ctr(int ssc); +enum // custom negative counters { - sscRUPEES, sscBOMBS, sscSBOMBS, sscARROWS, + sscMIN = -10, sscGENKEYMAGIC, sscGENKEYNOMAGIC, sscLEVKEYMAGIC, sscLEVKEYNOMAGIC, - sscANYKEYMAGIC, sscANYKEYNOMAGIC, sscSCRIPT1, sscSCRIPT2, - sscSCRIPT3, sscSCRIPT4, sscSCRIPT5, sscSCRIPT6, - sscSCRIPT7, sscSCRIPT8, sscSCRIPT9, sscSCRIPT10, - sscSCRIPT11, sscSCRIPT12, sscSCRIPT13, sscSCRIPT14, - sscSCRIPT15, sscSCRIPT16, sscSCRIPT17, sscSCRIPT18, - sscSCRIPT19, sscSCRIPT20, sscSCRIPT21, sscSCRIPT22, - sscSCRIPT23, sscSCRIPT24, sscSCRIPT25, sscLIFE, sscMAGIC, sscMAXHP, sscMAXMP, - sscSCRIPT26, sscSCRIPT27, sscSCRIPT28, sscSCRIPT29, sscSCRIPT30, - sscSCRIPT31, sscSCRIPT32, sscSCRIPT33, sscSCRIPT34, sscSCRIPT35, - sscSCRIPT36, sscSCRIPT37, sscSCRIPT38, sscSCRIPT39, sscSCRIPT40, - sscSCRIPT41, sscSCRIPT42, sscSCRIPT43, sscSCRIPT44, sscSCRIPT45, - sscSCRIPT46, sscSCRIPT47, sscSCRIPT48, sscSCRIPT49, sscSCRIPT50, - sscSCRIPT51, sscSCRIPT52, sscSCRIPT53, sscSCRIPT54, sscSCRIPT55, - sscSCRIPT56, sscSCRIPT57, sscSCRIPT58, sscSCRIPT59, sscSCRIPT60, - sscSCRIPT61, sscSCRIPT62, sscSCRIPT63, sscSCRIPT64, sscSCRIPT65, - sscSCRIPT66, sscSCRIPT67, sscSCRIPT68, sscSCRIPT69, sscSCRIPT70, - sscSCRIPT71, sscSCRIPT72, sscSCRIPT73, sscSCRIPT74, sscSCRIPT75, - sscSCRIPT76, sscSCRIPT77, sscSCRIPT78, sscSCRIPT79, sscSCRIPT80, - sscSCRIPT81, sscSCRIPT82, sscSCRIPT83, sscSCRIPT84, sscSCRIPT85, - sscSCRIPT86, sscSCRIPT87, sscSCRIPT88, sscSCRIPT89, sscSCRIPT90, - sscSCRIPT91, sscSCRIPT92, sscSCRIPT93, sscSCRIPT94, sscSCRIPT95, - sscSCRIPT96, sscSCRIPT97, sscSCRIPT98, sscSCRIPT99, sscSCRIPT100, - sscMAX + sscANYKEYMAGIC, sscANYKEYNOMAGIC, sscMAXHP, sscMAXMP, sscNONE = -1 }; enum //subscreen text alignment { @@ -441,7 +421,7 @@ struct SW_Counter : public SubscrWidget byte align, shadtype; SubscrColorInfo c_text = {ssctMISC,0}, c_shadow, c_bg; int32_t ctrs[3]; - byte digits; + byte mindigits, maxdigits; int32_t infitm = -1; char infchar; @@ -717,67 +697,105 @@ struct SW_Selector : public SubscrWidget virtual int32_t read(PACKFILE *f, word s_version) override; }; -#define SUBSCR_LGAUGE_MOD1 SUBSCRFLAG_SPEC_01 -#define SUBSCR_LGAUGE_MOD2 SUBSCRFLAG_SPEC_02 -#define SUBSCR_LGAUGE_MOD3 SUBSCRFLAG_SPEC_03 -#define SUBSCR_LGAUGE_MOD4 SUBSCRFLAG_SPEC_04 -#define SUBSCR_LGAUGE_UNQLAST SUBSCRFLAG_SPEC_05 -#define SUBSCR_LGAUGE_FULLTILE SUBSCRFLAG_SPEC_06 -#define SUBSCR_LGAUGE_ANIM_UNDER SUBSCRFLAG_SPEC_07 -#define SUBSCR_LGAUGE_ANIM_OVER SUBSCRFLAG_SPEC_08 -#define SUBSCR_LGAUGE_ANIM_PERCENT SUBSCRFLAG_SPEC_09 -#define SUBSCR_LGAUGE_ANIM_SKIP SUBSCRFLAG_SPEC_10 - -#define LGAUGE_GRID_RTOL 0x01 -#define LGAUGE_GRID_TTOB 0x02 -#define LGAUGE_GRID_COLUMN1ST 0x04 -#define LGAUGE_GRID_SNAKE 0x08 -struct SW_LifeGaugePiece : public SubscrWidget +#define SUBSCR_GAUGE_MOD1 SUBSCRFLAG_SPEC_01 +#define SUBSCR_GAUGE_MOD2 SUBSCRFLAG_SPEC_02 +#define SUBSCR_GAUGE_MOD3 SUBSCRFLAG_SPEC_03 +#define SUBSCR_GAUGE_MOD4 SUBSCRFLAG_SPEC_04 +#define SUBSCR_GAUGE_UNQLAST SUBSCRFLAG_SPEC_05 +#define SUBSCR_GAUGE_FULLTILE SUBSCRFLAG_SPEC_06 +#define SUBSCR_GAUGE_ANIM_UNDER SUBSCRFLAG_SPEC_07 +#define SUBSCR_GAUGE_ANIM_OVER SUBSCRFLAG_SPEC_08 +#define SUBSCR_GAUGE_ANIM_PERCENT SUBSCRFLAG_SPEC_09 +#define SUBSCR_GAUGE_ANIM_SKIP SUBSCRFLAG_SPEC_10 +#define SUBSCR_GAUGE_INFITM_REQ SUBSCRFLAG_SPEC_11 +#define SUBSCR_GAUGE_INFITM_BAN SUBSCRFLAG_SPEC_12 + +#define GAUGE_GRID_RTOL 0x01 +#define GAUGE_GRID_TTOB 0x02 +#define GAUGE_GRID_COLUMN1ST 0x04 +#define GAUGE_GRID_SNAKE 0x08 +struct SW_GaugePiece : public SubscrWidget { SubscrMTInfo mts[4]; - word frames, speed, delay, container; + word frames = 1, speed = 1, delay, container; byte gauge_wid, gauge_hei, gridflags; byte hspace, vspace, unit_per_frame; int16_t grid_xoff, grid_yoff; word anim_val; + int16_t inf_item = -1; + + SW_GaugePiece() = default; + + virtual word get_ctr() const = 0; + virtual word get_ctr_max() const = 0; + virtual word get_per_container() const = 0; + virtual bool infinite() const; - SW_LifeGaugePiece() = default; - SW_LifeGaugePiece(subscreen_object const& old); - - virtual bool load_old(subscreen_object const& old) override; virtual int16_t getX() const override; //Returns x in pixels virtual int16_t getY() const override; //Returns y in pixels virtual word getW() const override; //Returns width in pixels virtual word getH() const override; //Returns height in pixels + virtual void draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const override; + virtual bool copy_prop(SubscrWidget const* src, bool all = false) override; + virtual int32_t write(PACKFILE *f) const override; +protected: + virtual int32_t read(PACKFILE *f, word s_version) override; + virtual void draw_piece(BITMAP* dest, int dx, int dy, int container, int anim_offs) const; +}; + +struct SW_LifeGaugePiece : public SW_GaugePiece +{ + SW_LifeGaugePiece() = default; + SW_LifeGaugePiece(subscreen_object const& old); + + virtual bool load_old(subscreen_object const& old) override; virtual byte getType() const override; + virtual word get_ctr() const override; + virtual word get_ctr_max() const override; + virtual word get_per_container() const override; + virtual bool infinite() const override; virtual void draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const override; virtual SubscrWidget* clone() const override; virtual bool copy_prop(SubscrWidget const* src, bool all = false) override; virtual int32_t write(PACKFILE *f) const override; protected: virtual int32_t read(PACKFILE *f, word s_version) override; -private: - virtual void draw_piece(BITMAP* dest, int dx, int dy, SubscrPage& page, int container, int anim_offs) const; }; -#define SUBSCR_MGAUGE_MOD1 SUBSCRFLAG_SPEC_01 -#define SUBSCR_MGAUGE_MOD2 SUBSCRFLAG_SPEC_02 -#define SUBSCR_MGAUGE_MOD3 SUBSCRFLAG_SPEC_03 -#define SUBSCR_MGAUGE_MOD4 SUBSCRFLAG_SPEC_04 -#define SUBSCR_MGAUGE_UNQLAST SUBSCRFLAG_SPEC_05 -struct SW_MagicGaugePiece : public SubscrWidget +struct SW_MagicGaugePiece : public SW_GaugePiece { - SubscrMTInfo mts[4]; - word frames, speed, delay, container; int16_t showdrain = -1; SW_MagicGaugePiece() = default; SW_MagicGaugePiece(subscreen_object const& old); virtual bool load_old(subscreen_object const& old) override; - virtual word getW() const override; //Returns width in pixels - virtual word getH() const override; //Returns height in pixels virtual byte getType() const override; + virtual word get_ctr() const override; + virtual word get_ctr_max() const override; + virtual word get_per_container() const override; + virtual bool infinite() const override; + virtual void draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const override; + virtual SubscrWidget* clone() const override; + virtual bool copy_prop(SubscrWidget const* src, bool all = false) override; + virtual int32_t write(PACKFILE *f) const override; +protected: + virtual int32_t read(PACKFILE *f, word s_version) override; +}; + +struct SW_MiscGaugePiece : public SW_GaugePiece +{ + byte counter; + word per_container = 1; + + SW_MiscGaugePiece() = default; + + virtual bool load_old(subscreen_object const& old) override {return false;}; + virtual byte getType() const override; + virtual word get_ctr() const override; + virtual word get_ctr_max() const override; + virtual word get_per_container() const override; + virtual bool infinite() const override; virtual void draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& page) const override; virtual SubscrWidget* clone() const override; virtual bool copy_prop(SubscrWidget const* src, bool all = false) override; diff --git a/src/subscr.cpp b/src/subscr.cpp index b037d3b944..23852cbf05 100644 --- a/src/subscr.cpp +++ b/src/subscr.cpp @@ -72,15 +72,15 @@ subscreen_object z3_active_a[80]= { ssoCURRENTITEM, pos, 124, 144, 0, 0, 0, 0, 0, 0, 0, 0, itype_quiver, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoSELECTOR2, pos, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 32, 16, 0, 0, 0, 0, 0, 0, 0, 0, itype_bowandarrow, 1, 0, 10, 5, 14, 1, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 44, 26, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 0, sscARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 44, 26, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 0, crARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 56, 16, 0, 0, 0, 0, 0, 0, 0, 0, itype_brang, 1, 1, 11, 6, 0, 2, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 80, 16, 0, 0, 0, 0, 0, 0, 0, 0, itype_hookshot, 1, 2, 12, 7, 1, 3, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 104, 16, 0, 0, 0, 0, 0, 0, 0, 0, itype_bomb, 1, 3, 13, 8, 2, 4, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 116, 26, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 0, sscBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 116, 26, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 0, crBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 128, 16, 0, 0, 0, 0, 0, 0, 0, 0, itype_letterpotion, 1, 4, 14, 9, 3, 5, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 32, 40, 0, 0, 0, 0, 0, 0, 0, 0, itype_wand, 1, 5, 0, 10, 4, 6, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 56, 40, 0, 0, 0, 0, 0, 0, 0, 0, itype_sbomb, 1, 6, 1, 11, 5, 7, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 68, 50, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 0, sscSBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 68, 50, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 0, crSBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 80, 40, 0, 0, 0, 0, 0, 0, 0, 0, itype_divinefire, 1, 7, 2, 12, 6, 8, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 104, 40, 0, 0, 0, 0, 0, 0, 0, 0, itype_divineprotection, 1, 8, 3, 13, 7, 9, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 128, 40, 0, 0, 0, 0, 0, 0, 0, 0, itype_divineescape, 1, 9, 4, 14, 8, 10, 0, 0, 0, 0, 0, 0, 0, NULL }, @@ -106,9 +106,9 @@ subscreen_object z3_active_a[80]= { ssoLINE, pos, 233, 139, 2, 1, ssctMISC, ssctTEXT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoLINE, pos, 237, 139, 2, 1, ssctMISC, ssctTEXT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoBUTTONITEM, pos, 200, 8, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 212, 18, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 212, 18, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 212, 18, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscSBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 212, 18, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 212, 18, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 212, 18, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crSBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoSELECTEDITEMNAME, pos, 173, 24, 70, 16, ssctMISC, ssctTEXT, ssctMISC, ssctSUBSCRSHADOW, ssctSYSTEM, -1, ssfPROP, sstaCENTER, sstsSHADOWED, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoRECT, pos, 24, 1, 16, 6, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoTEXT, pos, 24, 1, 0, 0, ssctMISC, ssctTEXT, ssctMISC, ssctSUBSCRSHADOW, ssctSYSTEM, -1, ssfZ3SMALL, sstaLEFT, sstsSHADOWED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (void *)"ITEM" }, @@ -156,18 +156,18 @@ subscreen_object z3_active_ab[82]= { ssoCURRENTITEM, pos, 124, 144, 0, 0, 0, 0, 0, 0, 0, 0, itype_quiver, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoSELECTOR2, pos, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 32, 16, 0, 0, 0, 0, 0, 0, 0, 0, itype_bowandarrow, 1, 0, 10, 5, 15, 1, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 44, 26, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 0, sscARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 44, 26, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 0, crARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 56, 16, 0, 0, 0, 0, 0, 0, 0, 0, itype_brang, 1, 1, 11, 6, 0, 2, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 80, 16, 0, 0, 0, 0, 0, 0, 0, 0, itype_hookshot, 1, 2, 12, 7, 1, 3, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 104, 16, 0, 0, 0, 0, 0, 0, 0, 0, itype_bomb, 1, 3, 13, 8, 2, 4, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 116, 26, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 0, sscBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 116, 26, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 0, crBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 128, 16, 0, 0, 0, 0, 0, 0, 0, 0, itype_letterpotion, 1, 4, 14, 9, 3, 5, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 32, 40, 0, 0, 0, 0, 0, 0, 0, 0, itype_wand, 1, 5, 0, 10, 4, 6, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 56, 40, 0, 0, 0, 0, 0, 0, 0, 0, itype_sbomb, 1, 6, 1, 11, 5, 7, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 68, 50, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 0, sscSBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCURRENTITEM, pos, 80, 40, 0, 0, 0, 0, 0, 0, 0, 0, itype_divinefire, 1, 7, 2, 12, 6, 8, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCURRENTITEM, pos, 104, 40, 0, 0, 0, 0, 0, 0, 0, 0, itype_divineprotection, 1, 8, 3, 13, 7, 9, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCURRENTITEM, pos, 128, 40, 0, 0, 0, 0, 0, 0, 0, 0, itype_divineescape, 1, 9, 4, 14, 8, 10, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 68, 50, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 0, crSBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCURRENTITEM, pos, 80, 40, 0, 0, 0, 0, 0, 0, 0, 0, itype_divinefire, 1, 7, 2, 12, 6, 8, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCURRENTITEM, pos, 104, 40, 0, 0, 0, 0, 0, 0, 0, 0, itype_divineprotection, 1, 8, 3, 13, 7, 9, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCURRENTITEM, pos, 128, 40, 0, 0, 0, 0, 0, 0, 0, 0, itype_divineescape, 1, 9, 4, 14, 8, 10, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 32, 64, 0, 0, 0, 0, 0, 0, 0, 0, itype_candle, 1, 10, 5, 0, 9, 11, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 56, 64, 0, 0, 0, 0, 0, 0, 0, 0, itype_hammer, 1, 11, 6, 1, 10, 12, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCURRENTITEM, pos, 80, 64, 0, 0, 0, 0, 0, 0, 0, 0, itype_whistle, 1, 12, 7, 2, 11, 13, 0, 0, 0, 0, 0, 0, 0, NULL }, @@ -191,9 +191,9 @@ subscreen_object z3_active_ab[82]= { ssoLINE, pos, 233, 139, 2, 1, ssctMISC, ssctTEXT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoLINE, pos, 237, 139, 2, 1, ssctMISC, ssctTEXT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoBUTTONITEM, pos, 200, 8, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 212, 18, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 212, 18, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 212, 18, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscSBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 212, 18, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 212, 18, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 212, 18, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crSBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoSELECTEDITEMNAME, pos, 173, 24, 70, 16, ssctMISC, ssctTEXT, ssctMISC, ssctSUBSCRSHADOW, ssctSYSTEM, -1, ssfPROP, sstaCENTER, sstsSHADOWED, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoRECT, pos, 24, 1, 16, 6, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoTEXT, pos, 24, 1, 0, 0, ssctMISC, ssctTEXT, ssctMISC, ssctSUBSCRSHADOW, ssctSYSTEM, -1, ssfZ3SMALL, sstaLEFT, sstsSHADOWED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (void *)"ITEM" }, @@ -244,9 +244,9 @@ subscreen_object z3_passive_a[66]= { ssoMAGICGAUGE, pos, 24, 44, 8, 8, 5, 5, 5, 0, 0, 0, 0, 100403, 100260, 100262, 100263, 1, 0, 0, 1, 0, 0, 0, 0, 0, NULL }, { sso2X2FRAME, pos, 32, 4, 4, 4, 7, 0, 0, 0, 0, 0, 20040, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoBUTTONITEM, pos, 40, 12, 16, 16, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 52, 22, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 52, 22, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 52, 22, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscSBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 52, 22, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 52, 22, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 52, 22, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crSBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoTEXT, pos, 200, 6, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (void *)"LIFE" }, { ssoRECT, pos, 178, 8, 12, 2, 0, 15, 0, 15, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoLINE, pos, 179, 8, 10, 1, ssctMISC, ssctTEXT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, @@ -276,9 +276,9 @@ subscreen_object z3_passive_a[66]= { ssoLIFEGAUGE, pos, 209, 31, 8, 8, 1, 1, 1, 1, 0, 0, 22, 100240, 100240, 100261, 100261, 1, 0, 0, 0, 3, 0, 0, 0, 0, NULL }, { ssoLIFEGAUGE, pos, 217, 31, 8, 8, 1, 1, 1, 1, 0, 0, 23, 100240, 100240, 100261, 100261, 1, 0, 0, 0, 3, 0, 0, 0, 0, NULL }, { ssoLIFEGAUGE, pos, 225, 31, 8, 8, 1, 1, 1, 1, 0, 0, 24, 100240, 100240, 100261, 100261, 1, 0, 0, 0, 3, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 77, 15, 25, 9, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 3, '~', 1, sscRUPEES, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 105, 15, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 2, '~', 1, sscBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 129, 15, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 2, '~', 1, sscARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 77, 15, 25, 9, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 3, '~', 1, crMONEY, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 105, 15, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 2, '~', 1, crBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 129, 15, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 2, '~', 1, crARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCOUNTER, pos, 148, 15, 9, 9, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 1, '~', 1, sscGENKEYMAGIC, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoNULL, pos, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL } }; @@ -315,13 +315,13 @@ subscreen_object z3_passive_ab[75]= { sso2X2FRAME, pos, 32, 26, 4, 4, 8, 0, 0, 0, 0, 0, 20040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { sso2X2FRAME, pos, 32, 0, 4, 4, 7, 0, 0, 0, 0, 0, 20040, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoBUTTONITEM, pos, 40, 8, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 52, 18, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 52, 18, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 52, 18, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscSBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 52, 18, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 52, 18, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 52, 18, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crSBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoBUTTONITEM, pos, 40, 34, 16, 16, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 52, 44, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 52, 44, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 52, 44, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, sscSBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 52, 44, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 52, 44, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 52, 44, 9, 7, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfZ3SMALL, sstaCENTER, sstsOUTLINEDPLUS, 2, '~', 2, crSBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoTEXT, pos, 200, 6, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (void *)"LIFE" }, { ssoRECT, pos, 178, 8, 12, 2, 0, 15, 0, 15, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoLINE, pos, 179, 8, 10, 1, ssctMISC, ssctTEXT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, @@ -351,9 +351,9 @@ subscreen_object z3_passive_ab[75]= { ssoLIFEGAUGE, pos, 209, 31, 8, 8, 1, 1, 1, 1, 0, 0, 22, 100240, 100240, 100261, 100261, 1, 0, 0, 0, 3, 0, 0, 0, 0, NULL }, { ssoLIFEGAUGE, pos, 217, 31, 8, 8, 1, 1, 1, 1, 0, 0, 23, 100240, 100240, 100261, 100261, 1, 0, 0, 0, 3, 0, 0, 0, 0, NULL }, { ssoLIFEGAUGE, pos, 225, 31, 8, 8, 1, 1, 1, 1, 0, 0, 24, 100240, 100240, 100261, 100261, 1, 0, 0, 0, 3, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 83, 15, 25, 9, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 3, '~', 1, sscRUPEES, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 111, 15, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 2, '~', 1, sscBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, - { ssoCOUNTER, pos, 135, 15, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 2, '~', 1, sscARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 83, 15, 25, 9, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 3, '~', 1, crMONEY, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 111, 15, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 2, '~', 1, crBOMBS, 0, 0, 0, 0, 0, 0, 0, NULL }, + { ssoCOUNTER, pos, 135, 15, 0, 0, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 2, '~', 1, crARROWS, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoCOUNTER, pos, 154, 15, 9, 9, ssctMISC, ssctTEXT, 0, 15, ssctSYSTEM, -1, ssfSS4, sstaCENTER, sstsSHADOWED, 1, '~', 1, sscGENKEYMAGIC, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoRECT, pos, 59, 11, 4, 10, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, { ssoRECT, pos, 59, 37, 4, 10, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, @@ -3097,270 +3097,6 @@ void defaultcounters(BITMAP *dest, int32_t x, int32_t y, FONT *tempfont, int32_t } } -bool is_counter_item(int32_t itemtype, int32_t countertype) -{ - itemdata const& itm = itemsbuf[itemtype]; - int32_t ctr = scounter_to_ctr(countertype); - if(ctr == crNONE) return false; - if(ctr == itm.cost_counter[0] || - ctr == itm.cost_counter[1]) - return true; - return false; -} - -void add_ssc_ctr(int itemtype, bool& infinite, int32_t& value, bool alt) -{ - switch(itemtype) - { - case -3: - case -2: - break; - case sscRUPEES: - if(alt) break; - if(current_item_power(itype_wallet)) - infinite=true; - - value+=game->get_rupies(); - break; - - case sscBOMBS: - if(current_item_power(itype_bombbag)) - infinite=true; - - value+=game->get_bombs(); - break; - - case sscSBOMBS: - { - int32_t itemid = current_item_id(itype_bombbag); - - if(itemid>-1 && itemsbuf[itemid].power>0 && itemsbuf[itemid].flags & ITEM_FLAG1) - infinite=true; - - value+=game->get_sbombs(); - break; - } - - case sscLIFE: - { - if(alt) break; - value+=game->get_life(); - break; - } - case sscMAGIC: - { - value+=game->get_magic(); - break; - } - - case sscMAXHP: - { - value+=game->get_maxlife(); - break; - } - case sscMAXMP: - { - value+=game->get_maxmagic(); - break; - } - - case sscARROWS: - if((!get_qr(qr_TRUEARROWS) && current_item_power(itype_wallet)) || current_item_power(itype_quiver)) - infinite=true; - - // If Hero somehow got ammunition before getting the arrow, - // or if the arrow was disabled in a DMap, - // we shouldn't put the value as zero. - // if(/*current_item_id(itype_arrow)>-1*/ true) - { - if(get_qr(qr_TRUEARROWS)) - { - value+=game->get_arrows(); - } - else - { - value+=game->get_rupies(); - } - } - break; - - case sscGENKEYMAGIC: - case sscLEVKEYMAGIC: - case sscANYKEYMAGIC: - { - int32_t itemid = current_item_id(itype_magickey); - - if(itemid>-1 && !infinite) - { - if(itemsbuf[itemid].flags&ITEM_FLAG1) - infinite = itemsbuf[itemid].power>=get_dlevel(); - else - infinite = itemsbuf[itemid].power==get_dlevel(); - } - } - - //fall through - case sscANYKEYNOMAGIC: - case sscLEVKEYNOMAGIC: - case sscGENKEYNOMAGIC: - if(itemtype == sscGENKEYNOMAGIC || itemtype == sscANYKEYNOMAGIC - || itemtype == sscGENKEYMAGIC || itemtype == sscANYKEYMAGIC) - value += game->get_keys(); - - if(itemtype == sscLEVKEYNOMAGIC || itemtype == sscANYKEYNOMAGIC - || itemtype == sscLEVKEYMAGIC || itemtype == sscANYKEYMAGIC) - value += game->get_lkeys(); - - break; - - case sscSCRIPT1: case sscSCRIPT2: case sscSCRIPT3: case sscSCRIPT4: case sscSCRIPT5: - case sscSCRIPT6: case sscSCRIPT7: case sscSCRIPT8: case sscSCRIPT9: case sscSCRIPT10: - case sscSCRIPT11: case sscSCRIPT12: case sscSCRIPT13: case sscSCRIPT14: case sscSCRIPT15: - case sscSCRIPT16: case sscSCRIPT17: case sscSCRIPT18: case sscSCRIPT19: case sscSCRIPT20: - case sscSCRIPT21: case sscSCRIPT22: case sscSCRIPT23: case sscSCRIPT24: case sscSCRIPT25: - value += game->get_counter(itemtype-3); - break; - case sscSCRIPT26: case sscSCRIPT27: case sscSCRIPT28: case sscSCRIPT29: case sscSCRIPT30: - case sscSCRIPT31: case sscSCRIPT32: case sscSCRIPT33: case sscSCRIPT34: case sscSCRIPT35: - case sscSCRIPT36: case sscSCRIPT37: case sscSCRIPT38: case sscSCRIPT39: case sscSCRIPT40: - case sscSCRIPT41: case sscSCRIPT42: case sscSCRIPT43: case sscSCRIPT44: case sscSCRIPT45: - case sscSCRIPT46: case sscSCRIPT47: case sscSCRIPT48: case sscSCRIPT49: case sscSCRIPT50: - case sscSCRIPT51: case sscSCRIPT52: case sscSCRIPT53: case sscSCRIPT54: case sscSCRIPT55: - case sscSCRIPT56: case sscSCRIPT57: case sscSCRIPT58: case sscSCRIPT59: case sscSCRIPT60: - case sscSCRIPT61: case sscSCRIPT62: case sscSCRIPT63: case sscSCRIPT64: case sscSCRIPT65: - case sscSCRIPT66: case sscSCRIPT67: case sscSCRIPT68: case sscSCRIPT69: case sscSCRIPT70: - case sscSCRIPT71: case sscSCRIPT72: case sscSCRIPT73: case sscSCRIPT74: case sscSCRIPT75: - case sscSCRIPT76: case sscSCRIPT77: case sscSCRIPT78: case sscSCRIPT79: case sscSCRIPT80: - case sscSCRIPT81: case sscSCRIPT82: case sscSCRIPT83: case sscSCRIPT84: case sscSCRIPT85: - case sscSCRIPT86: case sscSCRIPT87: case sscSCRIPT88: case sscSCRIPT89: case sscSCRIPT90: - case sscSCRIPT91: case sscSCRIPT92: case sscSCRIPT93: case sscSCRIPT94: case sscSCRIPT95: - case sscSCRIPT96: case sscSCRIPT97: case sscSCRIPT98: case sscSCRIPT99: case sscSCRIPT100: - value += game->get_counter(itemtype-7); - break; - - default: - break; - } -} -// itemtype1, itemtype2, itemtype3: Only itemtype1 is used. I'm unsure who made these, who disabled the code -// for them, and when each occurred. They should probably be hidden, but some very old 2.11/2.50b quests -// may have used this and we'd need to edit the uest to fix it as-is, so perrhaps hide them only conditionally? -// or make them flipping work? -// It seems that the original intent was to be able to display a sum of multipe counters as one value. -Z (26th Jan, 2020). -void counter(BITMAP *dest, int32_t x, int32_t y, FONT *tempfont, int32_t color, int32_t shadowcolor, int32_t bgcolor, int32_t alignment, int32_t textstyle, int32_t digits, char idigit, bool showzero, int32_t itemtype1, int32_t itemtype2, int32_t itemtype3, int32_t infiniteitem, bool onlyselected) -{ - int32_t value=0; - bool infinite=false; - int32_t itemtypes[3]={itemtype1, itemtype2, itemtype3}; - - if(game != NULL && game->get_item(infiniteitem) && !item_disabled(infiniteitem)) - { - infinite=true; - } - - char valstring[80]; - char formatstring[80]; - sprintf(valstring,"01234567890123456789"); - sprintf(formatstring, "%%0%dd", digits); - - if(onlyselected && !( - (Bwpn>-1&&(is_counter_item(Bwpn&0xFF,itemtype1)||is_counter_item(Bwpn&0xFF,itemtype2)||is_counter_item(Bwpn&0xFF,itemtype3))) - || (Awpn>-1&&(is_counter_item(Awpn&0xFF,itemtype1)||is_counter_item(Awpn&0xFF,itemtype2)||is_counter_item(Awpn&0xFF,itemtype3))) - || (Xwpn>-1&&(is_counter_item(Xwpn&0xFF,itemtype1)||is_counter_item(Xwpn&0xFF,itemtype2)||is_counter_item(Xwpn&0xFF,itemtype3))) - || (Ywpn>-1&&(is_counter_item(Ywpn&0xFF,itemtype1)||is_counter_item(Ywpn&0xFF,itemtype2)||is_counter_item(Ywpn&0xFF,itemtype3))) - )) - return; - - int32_t itemtype; - /* - for (int32_t i=0; i<3; ++i) - { - switch (i) - { - case 0: - itemtype=itemtype1; - break; - case 1: - itemtype=itemtype2; - break; - case 2: - itemtype=itemtype3; - break; - } - */ - itemtype=itemtype1; - /* commented out until I find out what it does - it's messing up custom subscreens now as - itemtype2 and 3 are zero - so hero's life gets added to the counters */ - - /* - Not sure who did that, but I implemented it in its own section, ignoring counter0] for now. - It will need a format change to counter lists in order to allow stacking LIFE on other counters. - For the present, counter 0 for item2 and item3 is NULL. -Z (26-Jan-2020) - */ - - - add_ssc_ctr(itemtype1,infinite,value,false); - //Re-implement item2 and item3 stacking counters. -Z 26-Jan-2020 - if ( /*get_qr(qrSTACKSUBSCREENCOUNTERS) || (*/( FFCore.getQuestHeaderInfo(vZelda) == 0x250 && FFCore.getQuestHeaderInfo(vBuild) >= 33 ) //this ishowit looks in 2.53.1, Beta 25 - || ( FFCore.getQuestHeaderInfo(vZelda) > 0x250 ) ) /*)*/ - { - //add item2 and item3 values to item1 values - for (int32_t i=1; i<3; ++i) - { - switch (i) - { - case 1: - { - if ( itemtypes[i] == itemtypes[i-1] ) - { - itemtype = -2; - break; - } - else - { - itemtype=itemtype2; - break; - } - } - case 2: - { - if ( ( itemtypes[i] == itemtypes[i-1] ) || ( itemtypes[i] == itemtypes[i-2] ) ) - { - itemtype = -3; - break; - } - else - { - itemtype=itemtype3; - break; - } - - } - } - add_ssc_ctr(itemtype,infinite,value,true); - } - } - - // (for loop) } - if(!showzero&&!value&&!infinite) - { - return; - } - - if(infinite) - { - sprintf(valstring, "%c", idigit); - } - else - { - sprintf(valstring, formatstring, value); - } - - textout_styled_aligned_ex(dest,tempfont,valstring,x,y,textstyle,alignment,color,shadowcolor,bgcolor); - - // putxnum(dest,x+8,y,game->get_rupies(),tempfont,color,shadowcolor,bgcolor,shadowed,usex,digits,0,idigit); -} - void minimaptitle(BITMAP *dest, int32_t x, int32_t y, FONT *tempfont, int32_t color, int32_t shadowcolor, int32_t bgcolor, int32_t alignment, int32_t textstyle) { char dmaptitlesource[2][11]; @@ -3875,43 +3611,3 @@ void sso_bounding_box(BITMAP *bmp, SubscrWidget* widg, int32_t color) } } - -int32_t scounter_to_ctr(int32_t ssc) -{ - switch(ssc) - { - case sscRUPEES: return crMONEY; - case sscBOMBS: return crBOMBS; - case sscSBOMBS: return crSBOMBS; - case sscARROWS: return crARROWS; - case sscLIFE: return crLIFE; - case sscMAGIC: return crMAGIC; - case sscGENKEYMAGIC: case sscGENKEYNOMAGIC: - case sscANYKEYMAGIC: case sscANYKEYNOMAGIC: - return crKEYS; - case sscSCRIPT1: case sscSCRIPT2: case sscSCRIPT3: case sscSCRIPT4: case sscSCRIPT5: - case sscSCRIPT6: case sscSCRIPT7: case sscSCRIPT8: case sscSCRIPT9: case sscSCRIPT10: - case sscSCRIPT11: case sscSCRIPT12: case sscSCRIPT13: case sscSCRIPT14: case sscSCRIPT15: - case sscSCRIPT16: case sscSCRIPT17: case sscSCRIPT18: case sscSCRIPT19: case sscSCRIPT20: - case sscSCRIPT21: case sscSCRIPT22: case sscSCRIPT23: case sscSCRIPT24: case sscSCRIPT25: - return ssc-3; - case sscSCRIPT26: case sscSCRIPT27: case sscSCRIPT28: case sscSCRIPT29: case sscSCRIPT30: - case sscSCRIPT31: case sscSCRIPT32: case sscSCRIPT33: case sscSCRIPT34: case sscSCRIPT35: - case sscSCRIPT36: case sscSCRIPT37: case sscSCRIPT38: case sscSCRIPT39: case sscSCRIPT40: - case sscSCRIPT41: case sscSCRIPT42: case sscSCRIPT43: case sscSCRIPT44: case sscSCRIPT45: - case sscSCRIPT46: case sscSCRIPT47: case sscSCRIPT48: case sscSCRIPT49: case sscSCRIPT50: - case sscSCRIPT51: case sscSCRIPT52: case sscSCRIPT53: case sscSCRIPT54: case sscSCRIPT55: - case sscSCRIPT56: case sscSCRIPT57: case sscSCRIPT58: case sscSCRIPT59: case sscSCRIPT60: - case sscSCRIPT61: case sscSCRIPT62: case sscSCRIPT63: case sscSCRIPT64: case sscSCRIPT65: - case sscSCRIPT66: case sscSCRIPT67: case sscSCRIPT68: case sscSCRIPT69: case sscSCRIPT70: - case sscSCRIPT71: case sscSCRIPT72: case sscSCRIPT73: case sscSCRIPT74: case sscSCRIPT75: - case sscSCRIPT76: case sscSCRIPT77: case sscSCRIPT78: case sscSCRIPT79: case sscSCRIPT80: - case sscSCRIPT81: case sscSCRIPT82: case sscSCRIPT83: case sscSCRIPT84: case sscSCRIPT85: - case sscSCRIPT86: case sscSCRIPT87: case sscSCRIPT88: case sscSCRIPT89: case sscSCRIPT90: - case sscSCRIPT91: case sscSCRIPT92: case sscSCRIPT93: case sscSCRIPT94: case sscSCRIPT95: - case sscSCRIPT96: case sscSCRIPT97: case sscSCRIPT98: case sscSCRIPT99: case sscSCRIPT100: - return ssc-7; - } - return crNONE; -} - diff --git a/src/subscr.h b/src/subscr.h index 64dc4bf875..41cf1d766a 100644 --- a/src/subscr.h +++ b/src/subscr.h @@ -61,9 +61,6 @@ enum { sssFULLPUSH, sssFULLSLIDEDOWN, sssMAX }; //ssoCURRENTITEMCLASSNAME shows the name of an item if you have the item requested. if itemtype is set to boomerang and you have a wooden boomerang, it will show the name of the item "Wooden Boomerang" //ssoSELECTEDITEMCLASSNAME shows the name of of the item class that the selection cursor is on. -int32_t scounter_to_ctr(int32_t ssc); - - //subscreen items /*enum { ssiBOMB, ssiSWORD, ssiSHIELD, ssiCANDLE, ssiLETTER, ssiPOTION, ssiLETTERPOTION, ssiBOW, ssiARROW, ssiBOWANDARROW, ssiBAIT, ssiRING, ssiBRACELET, ssiMAP, ssiCOMPASS, ssiBOSSKEY, ssiMAGICKEY, ssiBRANG, ssiWAND, ssiRAFT, ssiLADDER, ssiWHISTLE, ssiBOOK, ssiWALLET, ssiSBOMB, ssiHCPIECE, ssiAMULET, ssiFLIPPERS, diff --git a/src/zc_list_data.cpp b/src/zc_list_data.cpp index 68eb83e7e0..1011c96594 100644 --- a/src/zc_list_data.cpp +++ b/src/zc_list_data.cpp @@ -37,28 +37,11 @@ const char *ssfont2_str[] = "Mr. Saturn", "Sci-Fi", "Sherwood", "Sinclair QL", "Spectrum", "Spectrum Large", "TI99", "TRS", "Zelda 2", "ZX", "Lisa", "" }; -const char *icounter_str2[sscMAX]= -{ - "Rupees", "Bombs", "Super Bombs", "Arrows", "Gen. Keys w/Magic", "Gen. Keys w/o Magic", "Level Keys w/Magic", - "Level Keys w/o Magic", "Any Keys w/Magic", "Any Keys w/o Magic", "Custom 1", "Custom 2", "Custom 3", "Custom 4", - "Custom 5", "Custom 6", "Custom 7", "Custom 8", "Custom 9", "Custom 10", "Custom 11", "Custom 12", "Custom 13", - "Custom 14", "Custom 15", "Custom 16", "Custom 17", "Custom 18", "Custom 19", "Custom 20", "Custom 21", - "Custom 22", "Custom 23", "Custom 24", "Custom 25", "Life", "Magic", "Max Life", "Max Magic", - "Custom 26", "Custom 27", "Custom 28", "Custom 29", "Custom 30", - "Custom 31", "Custom 32", "Custom 33", "Custom 34", "Custom 35", - "Custom 36", "Custom 37", "Custom 38", "Custom 39", "Custom 40", - "Custom 41", "Custom 42", "Custom 43", "Custom 44", "Custom 45", - "Custom 46", "Custom 47", "Custom 48", "Custom 49", "Custom 50", - "Custom 51", "Custom 52", "Custom 53", "Custom 54", "Custom 55", - "Custom 56", "Custom 57", "Custom 58", "Custom 59", "Custom 60", - "Custom 61", "Custom 62", "Custom 63", "Custom 64", "Custom 65", - "Custom 66", "Custom 67", "Custom 68", "Custom 69", "Custom 70", - "Custom 71", "Custom 72", "Custom 73", "Custom 74", "Custom 75", - "Custom 76", "Custom 77", "Custom 78", "Custom 79", "Custom 80", - "Custom 81", "Custom 82", "Custom 83", "Custom 84", "Custom 85", - "Custom 86", "Custom 87", "Custom 88", "Custom 89", "Custom 90", - "Custom 91", "Custom 92", "Custom 93", "Custom 94", "Custom 95", - "Custom 96", "Custom 97", "Custom 98", "Custom 99", "Custom 100" +const char *icounter_str2[-(sscMIN+1)]= +{ + "Gen. Keys w/Magic", "Gen. Keys w/o Magic", "Level Keys w/Magic", + "Level Keys w/o Magic", "Any Keys w/Magic", "Any Keys w/o Magic", + "Max Life", "Max Magic" }; @@ -161,15 +144,27 @@ GUI::ListData GUI::ZCListData::strings(bool combostr, bool respect_order, bool n return ls; } -GUI::ListData GUI::ZCListData::ss_counters() +GUI::ListData GUI::ZCListData::ss_counters(bool numbered, bool skipNone) { GUI::ListData ls; - ls.add("(None)", -1); - for(int32_t q = 0; q < sscMAX; ++q) + if(!skipNone) ls.add("(None)", -1); + auto sscstr_sz = -(sscMIN+1); + for(int32_t q = sscMIN+1; q < MAX_COUNTERS; ++q) { - char const* module_str = icounter_str2[q]; - std::string name(module_str); + if(q == crNONE) continue; + char const* str; + if(q > crNONE) + { + if(!ZI.isUsableCtr(q)) + continue; //Hidden + str = ZI.getCtrName(q); + } + else str = icounter_str2[sscstr_sz + q]; + std::string name; + if(numbered) + name = fmt::format("{} ({:03})", str, q); + else name = str; ls.add(name, q); } @@ -450,10 +445,9 @@ GUI::ListData GUI::ZCListData::counters(bool numbered, bool skipNone) char const* module_str = ZI.getCtrName(q); std::string sname; if(numbered) - sname = fmt::format("{} ({:02})", module_str, q); + sname = fmt::format("{} ({:03})", module_str, q); else sname = module_str; - // vals[sname] = q; // names.insert(sname); ls.add(sname, q); diff --git a/src/zc_list_data.h b/src/zc_list_data.h index 96603d02ee..6468e527e4 100644 --- a/src/zc_list_data.h +++ b/src/zc_list_data.h @@ -8,7 +8,7 @@ namespace GUI::ZCListData GUI::ListData fonts(bool ss_fonts, bool numbered = true, bool sorted = true); GUI::ListData shadow_types(); GUI::ListData strings(bool combostr = false, bool respect_order = true, bool numbered = true); - GUI::ListData ss_counters(); + GUI::ListData ss_counters(bool numbered = false, bool skipNone = false); GUI::ListData const& alignments(); GUI::ListData const& buttons(); GUI::ListData enemies(bool numbered = false, bool defaultFilter = true); diff --git a/src/zq/zq_subscr.cpp b/src/zq/zq_subscr.cpp index 87f542745b..a5e7d5444a 100644 --- a/src/zq/zq_subscr.cpp +++ b/src/zq/zq_subscr.cpp @@ -37,6 +37,9 @@ extern void large_dialog(DIALOG *d); extern void large_dialog(DIALOG *d, float RESIZE_AMT); +extern bool zq_ignore_item_ownership; +bool zq_view_fullctr = false, zq_view_maxctr = false, + zq_view_noinf = false, zq_view_allinf = false; int32_t curr_subscreen_object; char str_oname[512]; @@ -94,7 +97,6 @@ int32_t onGridSnapRight(); int32_t onGridSnapTop(); int32_t onGridSnapMiddle(); int32_t onGridSnapBottom(); -void copySSOProperties(SubscrWidget const* src, SubscrWidget* dest); void subscr_properties(int indx) { @@ -109,7 +111,7 @@ void subscr_properties(int indx) if(!sso_selection[i] || i==indx) continue; - copySSOProperties(widg, pg.contents[i]); + pg.contents[i]->copy_prop(widg); } } } @@ -145,7 +147,7 @@ void paste_properties(int indx) for(int32_t i=0; icopy_prop(propCopyWidg); } } } @@ -310,6 +312,11 @@ int32_t onClearSelection() } static int32_t onToggleInvis(); +static int32_t onToggleShowUnowned(); +static int32_t onToggleMaxCtr(); +static int32_t onToggleMaxMaxCtr(); +static int32_t onToggleNoInf(); +static int32_t onToggleAllInf(); static int32_t onEditGrid(); static int32_t onSelectionOptions(); static int32_t onShowHideGrid(); @@ -967,13 +974,6 @@ const char *sso_specialtile[ssmstMAX]= "ssmstSSVINETILE", "ssmstMAGICMETER" }; -const char *sso_counterobject[sscMAX]= -{ - "sscRUPEES", "sscBOMBS", "sscSBOMBS", "sscARROWS", "sscGENKEYMAGIC", "sscGENKEYNOMAGIC", "sscLEVKEYMAGIC", - "sscLEVKEYNOMAGIC", "sscANYKEYMAGIC", "sscANYKEYNOMAGIC", "sscSCRIPT1", "sscSCRIPT2", "sscSCRIPT3", "sscSCRIPT4", - "sscSCRIPT5", "sscSCRIPT6", "sscSCRIPT7", "sscSCRIPT8", "sscSCRIPT9", "sscSCRIPT10" -}; - const char *sso_alignment[3]= { "sstaLEFT", "sstaCENTER", "sstaRIGHT" @@ -1055,12 +1055,34 @@ static MENU ss_edit_menu[] = { NULL, NULL, NULL, 0, NULL } }; +int32_t onSubscrViewInfo() +{ + InfoDialog("Subscreen Editor View Menu", + "\"Edit/Show Grid\" affects the background/placement grid." + "\n\"Show Invisible Items\" makes items with the 'Invisible' flag checked show up." + "\n\"Show Unowned Items\" views the subscreen with every item marked 'owned'." + " This does NOT cause counters to show as infinite, even if it normally would." + "\n\"Max Out Counters\" views the subscreen with every counter set to its' max." + "\n\"Max Out Max Counters\" additionally sets every max counter to 65535." + "\n\"Don't Show 'Infinite's\" makes all counter-related 'Infinite' checks show false." + "\n\"Show Everything 'Infinite'\" makes all counter-related 'Infinite' checks show true.").show(); + return D_O_K; +} static MENU ss_view_menu[] = { - { (char *)"Show in&visible items", onToggleInvis, NULL, 0, NULL }, - { (char *)"&Edit grid", onEditGrid, NULL, 0, NULL }, - { (char *)"&Show grid", onShowHideGrid, NULL, 0, NULL }, - { NULL, NULL, NULL, 0, NULL } + { (char *)"&Edit Grid", onEditGrid, NULL, 0, NULL }, + { (char *)"&Show Grid", onShowHideGrid, NULL, 0, NULL }, + { (char *)"", NULL, NULL, 0, NULL }, + { (char *)"Show In&visible Items", onToggleInvis, NULL, 0, NULL }, + { (char *)"Show Unowned Items", onToggleShowUnowned, NULL, 0, NULL }, + { (char *)"", NULL, NULL, 0, NULL }, + { (char *)"Max Out Counters", onToggleMaxCtr, NULL, 0, NULL }, + { (char *)"Max Out Max Counters", onToggleMaxMaxCtr, NULL, 0, NULL }, + { (char *)"Don't Show 'Infinite's", onToggleNoInf, NULL, 0, NULL }, + { (char *)"Show Everything 'Infinite'", onToggleAllInf, NULL, 0, NULL }, + { (char *)"", NULL, NULL, 0, NULL }, + { (char *)"&Help", onSubscrViewInfo, NULL, 0, NULL }, + { NULL, NULL, NULL, 0, NULL } }; static MENU ss_selection_menu[] = @@ -1322,7 +1344,8 @@ const char *sso_str[widgMAX]= "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" + "Selector", "Gauge Piece: Life", "Gauge Piece: Magic", "Text Box", "Selection Text", + "Gauge Piece: Counter" }; char *sso_name(int32_t type) @@ -1888,10 +1911,48 @@ int32_t onGridSnapBottom() static int32_t onToggleInvis() { - bool show=!(zinit.ss_flags&ssflagSHOWINVIS); - zinit.ss_flags&=~ssflagSHOWINVIS; - zinit.ss_flags|=(show?ssflagSHOWINVIS:0); - ss_view_menu[0].flags=zinit.ss_flags&ssflagSHOWINVIS?D_SELECTED:0; + bool show=!(zinit.ss_flags&ssflagSHOWINVIS); + SETFLAG(zinit.ss_flags,ssflagSHOWINVIS,show); + SETFLAG(ss_view_menu[3].flags,D_SELECTED,show); + return D_O_K; +} +static int32_t onToggleShowUnowned() +{ + zq_ignore_item_ownership = !zq_ignore_item_ownership; + SETFLAG(ss_view_menu[4].flags, D_SELECTED, zq_ignore_item_ownership); + zc_set_config("editsubscr","show_all_items",zq_ignore_item_ownership?1:0); + return D_O_K; +} +static int32_t onToggleMaxCtr() +{ + zq_view_fullctr = !zq_view_fullctr; + SETFLAG(ss_view_menu[6].flags, D_SELECTED, zq_view_fullctr); + zc_set_config("editsubscr","show_full_counters",zq_view_fullctr?1:0); + return D_O_K; +} +static int32_t onToggleMaxMaxCtr() +{ + zq_view_maxctr = !zq_view_maxctr; + SETFLAG(ss_view_menu[7].flags, D_SELECTED, zq_view_maxctr); + zc_set_config("editsubscr","show_maxed_maxcounters",zq_view_maxctr?1:0); + return D_O_K; +} +static int32_t onToggleNoInf() +{ + if(zq_view_allinf) + onToggleAllInf(); + zq_view_noinf = !zq_view_noinf; + SETFLAG(ss_view_menu[8].flags, D_SELECTED, zq_view_noinf); + zc_set_config("editsubscr","show_no_infinites",zq_view_noinf?1:0); + return D_O_K; +} +static int32_t onToggleAllInf() +{ + if(zq_view_noinf) + onToggleNoInf(); + zq_view_allinf = !zq_view_allinf; + SETFLAG(ss_view_menu[9].flags, D_SELECTED, zq_view_allinf); + zc_set_config("editsubscr","show_all_infinites",zq_view_allinf?1:0); return D_O_K; } @@ -1933,7 +1994,7 @@ static int32_t onShowHideGrid() bool show=!(zinit.ss_flags&ssflagSHOWGRID); zinit.ss_flags&=~ssflagSHOWGRID; zinit.ss_flags|=(show?ssflagSHOWGRID:0); - ss_view_menu[2].flags=zinit.ss_flags&ssflagSHOWGRID?D_SELECTED:0; + ss_view_menu[1].flags=zinit.ss_flags&ssflagSHOWGRID?D_SELECTED:0; return D_O_K; } @@ -2163,8 +2224,8 @@ void update_subscr_dlg(bool start) } onClearSelection(); - ss_view_menu[0].flags=zinit.ss_flags&ssflagSHOWINVIS?D_SELECTED:0; - ss_view_menu[2].flags=zinit.ss_flags&ssflagSHOWGRID?D_SELECTED:0; + ss_view_menu[3].flags=zinit.ss_flags&ssflagSHOWINVIS?D_SELECTED:0; + ss_view_menu[1].flags=zinit.ss_flags&ssflagSHOWGRID?D_SELECTED:0; subscreen_dlg[4].dp=(void *)&subscr_edit; subscreen_dlg[5].fg=jwin_pal[jcBOX]; @@ -2310,19 +2371,21 @@ void update_subscr_dlg(bool start) void broadcast_dialog_message(DIALOG* dialog, int32_t msg, int32_t c); bool edit_subscreen() { + bool b = zq_ignore_item_ownership; + zq_ignore_item_ownership = zc_get_config("editsubscr","show_all_items_edit_subscr",1); + zq_view_fullctr = zc_get_config("editsubscr","show_full_counters",0); + zq_view_maxctr = zc_get_config("editsubscr","show_maxed_maxcounters",0); + zq_view_noinf = zc_get_config("editsubscr","show_no_infinites",0); + zq_view_allinf = zc_get_config("editsubscr","show_all_infinites",0); game = new gamedata(); game->set_time(0); resetItems(game,&zinit,true); - //so that these will show up on the subscreen -DD - if(game->get_bombs() == 0) - game->set_bombs(1); - - if(game->get_sbombs() == 0) - game->set_sbombs(1); - - if(game->get_arrows() == 0) - game->set_arrows(1); + SETFLAG(ss_view_menu[4].flags, D_SELECTED, zq_ignore_item_ownership); + SETFLAG(ss_view_menu[6].flags, D_SELECTED, zq_view_fullctr); + SETFLAG(ss_view_menu[7].flags, D_SELECTED, zq_view_maxctr); + SETFLAG(ss_view_menu[8].flags, D_SELECTED, zq_view_noinf); + SETFLAG(ss_view_menu[9].flags, D_SELECTED, zq_view_allinf); update_subscr_dlg(true); int dlg_ret = do_zqdialog_custom(subscreen_dlg,2,[&](int ret) @@ -2387,6 +2450,7 @@ bool edit_subscreen() delete game; game=NULL; + zq_ignore_item_ownership = b; return dlg_ret == 1; } @@ -2775,10 +2839,3 @@ void delete_subscreen(int32_t subscreenidx) DMaps[i].passive_subscreen--; } } - -void copySSOProperties(SubscrWidget const* src, SubscrWidget* dest) -{ - if(src->getType()!=dest->getType() || src==dest) - return; - dest->copy_prop(src); -} diff --git a/src/zq/zquest.cpp b/src/zq/zquest.cpp index e423ae98d8..e5e53fa9c5 100644 --- a/src/zq/zquest.cpp +++ b/src/zq/zquest.cpp @@ -215,6 +215,7 @@ bool disable_saving=false, OverwriteProtection; bool halt=false; bool show_sprites=true; bool show_hitboxes = false; +bool zq_ignore_item_ownership = true; // Used to find FFC script names vector asffcscripts; @@ -26556,14 +26557,34 @@ int32_t current_item(int32_t item_type) int32_t current_item_power(int32_t itemtype) { - itemtype=itemtype; + if (game) + { + int32_t result = current_item_id(itemtype, true); + return (result < 0) ? 0 : itemsbuf[result].power; + } return 1; } int32_t current_item_id(int32_t itemtype, bool checkmagic, bool smart_jinx) { - checkmagic=checkmagic; - + if (game) + { + int32_t result = -1; + int32_t highestlevel = -1; + + for (int32_t i = 0; i < MAXITEMS; i++) + { + if ((zq_ignore_item_ownership || game->get_item(i)) && itemsbuf[i].family == itemtype) + { + if (itemsbuf[i].fam_type >= highestlevel) + { + highestlevel = itemsbuf[i].fam_type; + result = i; + } + } + } + return result; + } for(int32_t i=0; i