void ALSoftwareGraphicsDriver::__fade_from_range(PALLETE source, PALLETE dest, int speed, int from, int to) { PALLETE temp; int c; for (c=0; c<PAL_SIZE; c++) temp[c] = source[c]; for (c=0; c<64; c+=speed) { fade_interpolate(source, dest, temp, c, from, to); set_pallete_range(temp, from, to, TRUE); if (_callback) _callback(); set_pallete_range(temp, from, to, TRUE); } set_pallete_range(dest, from, to, TRUE); }
void GetTriforce::update() { if(counter==40) { actiontype oldaction = (actiontype)link.getAction(); ALLOFF(true, false); link.setAction(oldaction); // have to reset this } if(counter>=40 && counter<88) { if(get_bit(quest_rules,qr_FADE)) { if((counter&3)==0) { fade_interpolate(RAMpal,flash_pal,RAMpal,42,0,CSET(6)-1); refreshpal=true; } if((counter&3)==2) { loadpalset(0,0); loadpalset(1,1); loadpalset(5,5); if(currscr<128) loadlvlpal(DMaps[currdmap].color); else loadlvlpal(0xB); // TODO: Cave/Item Cellar distinction? } } else { if((counter&7)==0) { for(int cs2=2; cs2<5; cs2++) { for(int i=1; i<16; i++) { RAMpal[CSET(cs2)+i]=flash_pal[CSET(cs2)+i]; } } refreshpal=true; } if((counter&7)==4) { if(currscr<128) loadlvlpal(DMaps[currdmap].color); else loadlvlpal(0xB); loadpalset(5,5); } } } if(itemsbuf[triforceID].flags & ITEM_GAMEDATA) { if(counter==88) { refill_what=REFILL_ALL; refill_why=triforceID; link.StartRefill(REFILL_ALL); link.refill(); } if(counter==89) { if(link.refill()) counter--; } } if(itemsbuf[triforceID].flags & ITEM_FLAG1) // Warp out flag { if(counter>=208 && counter<288) { x2++; counter2++; switch(counter2) { case 5: counter2=0; case 0: case 2: case 3: x2++; break; } } do_dcounters(); if(counter<288) { int curtain_x=x2&0xF8; draw_screen_clip_rect_x1=curtain_x; draw_screen_clip_rect_x2=255-curtain_x; } } counter++; if(counter<408) return; if(midi_pos > 0 || (zcmusic && zcmusic->position<800)) // 800 may not be just right, but it works return; finish(); draw_screen_clip_rect_x1=0; draw_screen_clip_rect_x2=255; show_subscreen_items=true; if(itemsbuf[triforceID].flags & ITEM_FLAG1 && currscr < 128) { link.setScrollDir(link.dir); link.dowarp(1,0); //side warp } else playLevelMusic(); }
void GameOver::update() { if(counter<254) { if(counter<=32) link.setHitTimer(32-counter); if(counter>=62 && counter<138) { switch((counter-62)%20) { case 0: link.dir=right; break; case 5: link.dir=up; break; case 10: link.dir=left; break; case 15: link.dir=down; break; } link.linkstep(); } if(counter>=194 && counter<208) { if(counter==194) link.setAction(dying); link.extend = 0; link.cs = wpnsbuf[iwDeath].csets&15; link.tile = wpnsbuf[iwDeath].tile; if(BSZ) link.tile+=(counter-194)/3; else if(counter>=204) link.tile++; } if(counter==208) link.setDontDraw(true); if(get_bit(quest_rules,qr_FADE)) { if(counter < 170) { if(counter<60) { draw_screen(tmpscr); //reuse our static subscreen set_clip_rect(framebuf, 0, 0, framebuf->w, framebuf->h); blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); } if(counter==60) { red_shift(); create_rgb_table_range(&rgb_table, RAMpal, 208, 239, NULL); create_zc_trans_table(&trans_table, RAMpal, 128, 128, 128); memcpy(&trans_table2, &trans_table, sizeof(COLOR_MAP)); for(int q=0; q<PAL_SIZE; q++) { trans_table2.data[0][q] = q; trans_table2.data[q][q] = q; } } if(counter>=60 && counter<=169) { draw_screen(tmpscr); //reuse our static subscreen blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); red_shift(); } if(counter>=139 && counter<=169)//fade from red to black { fade_interpolate(RAMpal,black_palette,RAMpal, (counter-138)<<1, 224, 255); create_rgb_table_range(&rgb_table, RAMpal, 208, 239, NULL); create_zc_trans_table(&trans_table, RAMpal, 128, 128, 128); memcpy(&trans_table2, &trans_table, sizeof(COLOR_MAP)); for(int q=0; q<PAL_SIZE; q++) { trans_table2.data[0][q] = q; trans_table2.data[q][q] = q; } refreshpal=true; } } else //counter>=170 { if(counter==170)//make Link grayish { fade_interpolate(RAMpal,black_palette,RAMpal,64, 224, 255); for(int i=CSET(6); i < CSET(7); i++) { int g = (RAMpal[i].r + RAMpal[i].g + RAMpal[i].b)/3; RAMpal[i] = _RGB(g,g,g); } refreshpal = true; } //draw only link. otherwise black layers might cover him. rectfill(framebuf,0,playing_field_offset,255,167+playing_field_offset,0); link.draw(framebuf); blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); } } else //!qr_FADE { if(counter==58) { for(int i = 0; i < 96; i++) tmpscr->cset[i] = 3; for(int j=0; j<6; j++) if(tmpscr->layermap[j]>0) for(int i=0; i<96; i++) tmpscr2[j].cset[i] = 3; } if(counter==59) { for(int i = 96; i < 176; i++) tmpscr->cset[i] = 3; for(int j=0; j<6; j++) if(tmpscr->layermap[j]>0) for(int i=96; i<176; i++) tmpscr2[j].cset[i] = 3; } if(counter==60) { for(int i=0; i<176; i++) { tmpscr->cset[i] = 2; } for(int j=0; j<6; j++) if(tmpscr->layermap[j]>0) for(int i=0; i<176; i++) tmpscr2[j].cset[i] = 2; for(int i=1; i<16; i+=3) { RAMpal[CSET(2)+i] = NESpal(0x17); RAMpal[CSET(2)+i+1] = NESpal(0x16); RAMpal[CSET(2)+i+2] = NESpal(0x26); } refreshpal=true; } if(counter==139) slide_in_color(0x06); if(counter==149) slide_in_color(0x07); if(counter==159) slide_in_color(0x0F); if(counter==169) { slide_in_color(0x0F); slide_in_color(0x0F); } if(counter==170) { for(int i=1; i<16; i+=3) { RAMpal[CSET(6)+i] = NESpal(0x10); RAMpal[CSET(6)+i+1] = NESpal(0x30); RAMpal[CSET(6)+i+2] = NESpal(0x00); refreshpal = true; } } if(counter < 169) { draw_screen(tmpscr); //reuse our static subscreen blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); } else { //draw only link. otherwise black layers might cover him. rectfill(framebuf,0,playing_field_offset,255,167+playing_field_offset,0); link.draw(framebuf); blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); } } } else if(counter<350)//draw 'GAME OVER' text { clear_bitmap(framebuf); blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); textout_ex(framebuf,zfont,"GAME OVER",96,playing_field_offset+80,1,-1); } else { clear_bitmap(framebuf); } //SFX... put them all here switch(counter) { case 0: sfx(WAV_OUCH,pan(int(link.x))); break; case 60: sfx(WAV_SPIRAL); break; case 194: sfx(WAV_MSG); break; } //advanceframe(true); counter++; if(counter<353) return; finish(); destroy_bitmap(subscrbmp); link.setAction(none); link.setDontDraw(false); }