Skip to content

Commit

Permalink
refactor(zc): remove extra draws to scrollbuf in draw_screen
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Jan 23, 2024
1 parent 07dddb5 commit d57d031
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 46 deletions.
4 changes: 0 additions & 4 deletions src/zc/combos.cpp
Expand Up @@ -614,8 +614,6 @@ void trigger_cuttable(int32_t lyr, int32_t pos)
}
}

//putcombo(scrollbuf,(i&15)<<4,i&0xF0,s->data[i],s->cset[i]);

if(get_qr(qr_MORESOUNDS))
{
if (cmb.usrflags&cflag3)
Expand Down Expand Up @@ -715,8 +713,6 @@ void trigger_cuttable_ffc(int32_t pos)
}
}

//putcombo(scrollbuf,(i&15)<<4,i&0xF0,s->data[i],s->cset[i]);

if(get_qr(qr_MORESOUNDS))
{
if (cmb.usrflags&cflag3)
Expand Down
4 changes: 0 additions & 4 deletions src/zc/guys.cpp
Expand Up @@ -20148,17 +20148,13 @@ void loadenemies()
void moneysign()
{
additem(48,108,iRupy,ipDUMMY);
// textout(scrollbuf,get_zc_font(font_zfont),"X",64,112,CSET(0)+1);
set_clip_state(pricesdisplaybuf, 0);
textout_ex(pricesdisplaybuf,get_zc_font(font_zfont),"X",64,112,CSET(0)+1,-1);
}

void putprices(bool sign)
{
if(fadeclk > 0) return;
// refresh what's under the prices
// for(int32_t i=5; i<12; i++)
// putcombo(scrollbuf,i<<4,112,tmpscr->data[112+i],tmpscr->cpage);

rectfill(pricesdisplaybuf, 72, 112, pricesdisplaybuf->w-1, pricesdisplaybuf->h-1, 0);
int32_t step=32;
Expand Down
4 changes: 0 additions & 4 deletions src/zc/hero.cpp
Expand Up @@ -12233,7 +12233,6 @@ bool HeroClass::startwpn(int32_t itemid)
dismissmsg();
clear_bitmap(pricesdisplaybuf);
set_clip_state(pricesdisplaybuf, 1);
// putscr(scrollbuf,0,0,tmpscr);
setmapflag((currscr < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM);
if(!(itm.flags & ITEM_FLAG3)) //"Don't remove when feeding" flag
{
Expand Down Expand Up @@ -29540,7 +29539,6 @@ void dospecialmoney(int32_t index)
dismissmsg();
clear_bitmap(pricesdisplaybuf);
set_clip_state(pricesdisplaybuf, 1);
// putscr(scrollbuf,0,0,tmpscr);
verifyBothWeapons();
break;
}
Expand Down Expand Up @@ -29573,7 +29571,6 @@ void dospecialmoney(int32_t index)
dismissmsg();
clear_bitmap(pricesdisplaybuf);
set_clip_state(pricesdisplaybuf, 1);
// putscr(scrollbuf,0,0,tmpscr);
verifyBothWeapons();
break;
}
Expand Down Expand Up @@ -29604,7 +29601,6 @@ void dospecialmoney(int32_t index)
dismissmsg();
clear_bitmap(pricesdisplaybuf);
set_clip_state(pricesdisplaybuf, 1);
// putscr(scrollbuf,0,0,tmpscr);
break;
}
}
Expand Down
35 changes: 9 additions & 26 deletions src/zc/maps.cpp
Expand Up @@ -2659,11 +2659,6 @@ void hidden_entrance2(mapscr *s, mapscr *t, bool high16only,int32_t single) //Pe
}
}
}

/*
if(putit && refresh)
putcombo(scrollbuf,(i&15)<<4,i&0xF0,s->data[i],s->cset[i]);
*/
}

for(word i=0; i<c; i++) // FFCs
Expand Down Expand Up @@ -3987,19 +3982,16 @@ void draw_msgstr(byte layer)
if(!(msg_bg_display_buf->clip))
{
blit_msgstr_bg(framebuf,0,0,0,playing_field_offset,256,168);
blit_msgstr_bg(scrollbuf,0,0,0,playing_field_offset,256,168);
}

if(!(msg_portrait_display_buf->clip))
{
blit_msgstr_prt(framebuf,0,0,0,playing_field_offset,256,168);
blit_msgstr_prt(scrollbuf,0,0,0,playing_field_offset,256,168);
}

if(!(msg_txt_display_buf->clip))
{
blit_msgstr_fg(framebuf,0,0,0,playing_field_offset,256,168);
blit_msgstr_fg(scrollbuf,0,0,0,playing_field_offset,256,168);
}
}

Expand All @@ -4017,17 +4009,17 @@ void draw_screen(mapscr* this_screen, bool showhero, bool runGeneric)
//The Plan:
//1. Draw some background layers
//2. Blit scrollbuf onto framebuf
//3. Draw some sprites onto framebuf
//3. Draw some sprites
//4. -----
//5. Draw some layers onto framebuf and scrollbuf
//5. Draw some layers
//6. -----
//6b. Draw the subscreen onto frame_buf, without clipping
//7. Draw some flying sprites onto framebuf
//6b. Draw the subscreen, without clipping
//7. Draw some flying sprites
//8. -----
//9. Draw some layers onto frame_buf and scrollbuf
//9. Draw some layers
//10. ----
//11. Draw some text on framebuf and scrollbuf
//12. Draw the subscreen onto framebuf, without clipping
//11. Draw some text
//12. Draw the subscreen, without clipping
clear_bitmap(framebuf);
clear_clip_rect(framebuf);

Expand Down Expand Up @@ -4366,32 +4358,27 @@ void draw_screen(mapscr* this_screen, bool showhero, bool runGeneric)
do_primitives(framebuf, SPLAYER_NPC_ABOVEPLAYER_DRAW, this_screen, 0, playing_field_offset);
}

//5. Draw some layers onto framebuf and scrollbuf
//5. Draw some layers onto framebuf
set_clip_rect(framebuf,draw_screen_clip_rect_x1,draw_screen_clip_rect_y1,draw_screen_clip_rect_x2,draw_screen_clip_rect_y2);

if(!XOR(this_screen->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG))
{
do_layer(framebuf, 0, 3, this_screen, 0, 0, 2, false, true);
do_layer(scrollbuf, 0, 3, this_screen, 0, 0, 2);

particles.draw(framebuf, true, 2);
draw_msgstr(3);
}

do_layer(framebuf, 0, 4, this_screen, 0, 0, 2, false, true);
do_layer(scrollbuf, 0, 4, this_screen, 0, 0, 2);

particles.draw(framebuf, true, 3);
draw_msgstr(4);

do_layer(framebuf, -1, 0, this_screen, 0, 0, 2);
do_layer(scrollbuf, -1, 0, this_screen, 0, 0, 2);
if(get_qr(qr_OVERHEAD_COMBOS_L1_L2))
{
do_layer(framebuf, -1, 1, this_screen, 0, 0, 2);
do_layer(scrollbuf, -1, 1, this_screen, 0, 0, 2);
do_layer(framebuf, -1, 2, this_screen, 0, 0, 2);
do_layer(scrollbuf, -1, 2, this_screen, 0, 0, 2);
}
do_primitives(framebuf, SPLAYER_OVERHEAD_CMB, this_screen, 0, playing_field_offset);

Expand Down Expand Up @@ -4455,7 +4442,7 @@ void draw_screen(mapscr* this_screen, bool showhero, bool runGeneric)
items.spr(i)->draw(framebuf);
do_primitives(framebuf, SPLAYER_FAIRYITEM_DRAW, this_screen, 0, playing_field_offset);

//9. Draw some layers onto framebuf and scrollbuf
//9. Draw some layers onto framebuf

set_clip_rect(framebuf,draw_screen_clip_rect_x1,draw_screen_clip_rect_y1,draw_screen_clip_rect_x2,draw_screen_clip_rect_y2);

Expand All @@ -4470,17 +4457,14 @@ void draw_screen(mapscr* this_screen, bool showhero, bool runGeneric)
}

do_layer(framebuf, 0, 5, this_screen, 0, 0, 2, false, true);
do_layer(scrollbuf, 0, 5, this_screen, 0, 0, 2);

particles.draw(framebuf, true, 4);
draw_msgstr(5);

do_layer(framebuf, -4, 0, this_screen, 0, 0, 2); // overhead freeform combos!
do_layer(scrollbuf, -4, 0, this_screen, 0, 0, 2);
do_primitives(framebuf, SPLAYER_OVERHEAD_FFC, this_screen, 0, playing_field_offset);

do_layer(framebuf, 0, 6, this_screen, 0, 0, 2, false, true);
do_layer(scrollbuf, 0, 6, this_screen, 0, 0, 2);

particles.draw(framebuf, true, 5);

Expand Down Expand Up @@ -4518,7 +4502,6 @@ void draw_screen(mapscr* this_screen, bool showhero, bool runGeneric)
//12. Draw some text on framebuf

set_clip_rect(framebuf,0,0,256,224);
set_clip_rect(scrollbuf,0,0,256,224);

draw_msgstr(6);

Expand Down
8 changes: 0 additions & 8 deletions src/zq/zq_class.cpp
Expand Up @@ -14059,19 +14059,11 @@ void zmap::prv_secrets(bool high16only)
t[j].data[i] = t[j].secretcombo[(checkflag)-16+4];
t[j].cset[i] = t[j].secretcset[(checkflag)-16+4];
newflag2 = t[j].secretflag[(checkflag)-16+4];
// putit = true;
}
}

if(newflag2 >-1) t[j].sflag[i] = newflag2;
}

//} //if(true)

/*
if(putit && refresh)
putcombo(scrollbuf,(i&15)<<4,i&0xF0,s->data[i],s->cset[i]);
*/
}

//FFCs
Expand Down

0 comments on commit d57d031

Please sign in to comment.