Skip to content

Commit 07f8fe6

Browse files
committed
stop loading quest template to reset items
`reset_items` it called on start up, and it loads the quest template file to initialize the items to whatever is in there. Except there is no item section in the classic module's template file, and the module system is dead weight at this point, so let's stop loading this thing for no reason. Benchmarks: hyperfine './zelda -test modules/classic/classic_1st.qst 0 119' Baseline (classic_1st.qst): Time (mean ± σ): 4.239 s ± 0.145 s [User: 0.926 s, System: 0.410 s] Range (min … max): 4.133 s … 4.638 s 10 runs Don't load quest template (classic_1st.qst): Time (mean ± σ): 3.852 s ± 0.094 s [User: 0.710 s, System: 0.403 s] Range (min … max): 3.776 s … 4.107 s 10 runs
1 parent 8dab8c8 commit 07f8fe6

File tree

2 files changed

+6
-21
lines changed

2 files changed

+6
-21
lines changed

src/qst.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,16 +1148,12 @@ void init_spritelists()
11481148

11491149
bool reset_items(bool validate, zquestheader *Header)
11501150
{
1151-
bool ret = init_section(Header, ID_ITEMS, NULL, NULL, validate);
1151+
// qst_dat (classic_qst.dat) has no ID_ITEMS, and the quest template file is a somewhat expensive thing to load
1152+
// for no reason, so let's stop doing that.
1153+
// https://discord.com/channels/876899628556091432/876908472728453161/1111405574899376239
1154+
// bool ret = init_section(Header, ID_ITEMS, NULL, NULL, validate);
1155+
bool ret = true;
11521156

1153-
//Ignore this, but don't remove it
1154-
/*
1155-
if (ret)
1156-
for(int32_t i=0; i<MAXITEMS; i++)
1157-
{
1158-
reset_itembuf(&itemsbuf[i], i);
1159-
}
1160-
*/
11611157
for(int32_t i=0; i<MAXITEMS; i++) reset_itemname(i);
11621158

11631159
return ret;

src/zc/zc_sys.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -829,20 +829,9 @@ void null_quest()
829829
loadquest(qstdat_string,&QHeader,&QMisc,tunes+ZC_MIDI_COUNT,false,true,true,true,skip_flags,0,false);
830830
}
831831

832+
// TODO remove
832833
void init_NES_mode()
833834
{
834-
/*
835-
// qst.dat may not load correctly without this...
836-
QHeader.templatepath[0]='\0';
837-
838-
if(!init_colordata(true, &QHeader, &QMisc))
839-
{
840-
return;
841-
}
842-
843-
loadfullpal();
844-
init_tiles(false, &QHeader);
845-
*/
846835
null_quest();
847836
}
848837

0 commit comments

Comments
 (0)