static void order(void) { void *f; char *text; int x, y; int size = 0; SDLTexture *restore = NULL; restore = render.createScreenTexture(); f = loadfile("pic\\order.pcx", &size); text = (char *)loadfile("stuff\\order1.txt", NULL); fadeout(FADE_PALETTE); render.clear(0, 0, 0); showpcx(f, 20, size); blue->print_c(XMAX/2, 0, "ORDER RAVAGE NOW"); x = 0; y = 30; beauty(tiny, x, y, text); unloadfile(text); fadein(NULL); input_wait(); input_fire(); input_wait(); fadeout(FADE_PALETTE); text = (char *)loadfile("stuff\\order2.txt", NULL); render.clear(0, 0, 0); showpcx(f, 20, size); blue->print_c(XMAX/2, 0, "HOW TO ORDER"); x = 0; y = 30; beauty(tiny, x, y, text); unloadfile(text); fadein(NULL); unloadfile(f); input_wait(); input_fire(); input_wait(); fadeout(FADE_PALETTE); render.drawTexture(restore, 0, 0); fadein(level.palette); restore->destroy(); delete restore; }
static void showpicture(char *file) { void *f; int size = 0; SDLTexture *restore; restore = render.createScreenTexture(); f = loadfile(file, &size); fadeout(FADE_PALETTE); render.clear(0, 0, 0); showpcx(f, 0, size); unloadfile(f); fadein(NULL); input_wait(); input_fire(); input_wait(); fadeout(FADE_PALETTE); render.drawTexture(restore, 0, 0); fadein(level.palette); restore->destroy(); delete restore; }
void show_hscore_list(char *name) { fadeout(50, 256); if(!name) { name = malloc(sizeof(char)); strcpy(name, " "); } FONT *fonte = (FONT*)fnt_datafile[COMICSANS].dat; BITMAP *high_score = (BITMAP*)img_datafile[HIGH_SCORE].dat; fadein(high_score, 10, 120); register int i; for(i = 1; i < 10; i++) { char score[5]; itoa(score_table[i-1].player_score, score, 10); if(!strcmp(score_table[i-1].player_name, name)) { char aux[11]; /// shorter variable strcpy(aux, score_table[i-1].player_name); aux[strlen(aux)-1] = '\0'; strcpy(score_table[i-1].player_name, aux); textout_ex(screen, fonte, score_table[i-1].player_name, 240, 50+(48*i), RED, -1); textout_ex(screen, fonte, score, 535, 50+(48*i), RED, -1); } else{ textout_ex(screen, fonte, score_table[i-1].player_name, 240, 50+(48*i), WHITE, -1); textout_ex(screen, fonte, score, 535, 50+(48*i), WHITE, -1); } } textout_ex(screen, font, "Press any key to exit", 320, SCREEN_H-50, WHITE, -1); while(!keypressed()); }
void wait (void) { int x, y; int c,q; clrpal (); setpagemode (1); for (x=0; x<20; x++) { for (y=0; y<12; y++) { drawshape (&mainvp,0x7501+x+y*20,x*16,y*16); }; }; fontcolor (&mainvp,71,-1); wprint (&mainvp,168,8,1,"THE SECRET CHAMBER"); // fontcolor (&mainvp,7,-1); // wprint (&mainvp,79,194,2,"-Press Any Key to Continue-"); pageflip (); setpagemode (0); fadein (); do { gamecount++; checkctrl0(0); for (c=64; c<80; c++) { q=64+((c+gamecount)&15); setcolor (c,vgapal[q*3+0],vgapal[q*3+1],vgapal[q*3+2]); }; } while ((key==0)&&(fire1==0)&&(fire2==0)&&(dx1==0)&&(dy1==0)); };
/*--------------------------------------------------------- Function: Description: Display Intro & Title screen. ---------------------------------------------------------*/ void title(void) { void *f; Font *tiny; char *text; int x, y; int size = 0; // Load needed font & picture. tiny = new Font("fonts\\tiny.fnt"); f = loadfile("pic\\title.pcx", &size); text = (char *) loadfile("stuff\\reg.txt", NULL); // Fade out and draw new screen. fadeout(FADE_PALETTE); showpcx(f, 20, size); // Print text. x = 0; y = 140; beauty(tiny, x, y, text); // Fade in fadein(NULL); //input_wait(); input_fire(); input_wait(); SDL_Delay(1500); fadeout(FADE_PALETTE); //render.clear(0, 0, 0); unloadfile(text); unloadfile(f); delete tiny; }
void frider (int select,int kleur,int tijd) //Select : 1=aan-links,2=uit-links,3=aan-rechts,4=uit-rechts,5=loop-links,6=loop-rechts,7=rider-links,8=rider-rechts Kleur : 1=blauw,2=groen,3=cyaan,4=rood,5=paars,6=geel,7=wit { switch (select) { case 1 : fadein (1,kleur,tijd); fadein (2,kleur,tijd); fadein (3,kleur,tijd); fadein (4,kleur,tijd); break; case 2 : fadeout(1,kleur,tijd); fadeout(2,kleur,tijd); fadeout(3,kleur,tijd); fadeout(4,kleur,tijd); break; case 3 : fadein (4,kleur,tijd); fadein (3,kleur,tijd); fadein (2,kleur,tijd); fadein (1,kleur,tijd); break; case 4 : fadeout(4,kleur,tijd); fadeout(3,kleur,tijd); fadeout(2,kleur,tijd); fadeout(1,kleur,tijd); break; case 5 : fadein (1,kleur,tijd); fadeout(1,kleur,tijd); fadein (2,kleur,tijd); fadeout(2,kleur,tijd); fadein (3,kleur,tijd); fadeout(3,kleur,tijd); fadein (4,kleur,tijd); fadeout(4,kleur,tijd); break; case 6 : fadein (4,kleur,tijd); fadeout(4,kleur,tijd); fadein (3,kleur,tijd); fadeout(3,kleur,tijd); fadein (2,kleur,tijd); fadeout(2,kleur,tijd); fadein (1,kleur,tijd); fadeout(1,kleur,tijd); break; case 7 : fadein (1,kleur,tijd); fadein (2,kleur,tijd); fadein (3,kleur,tijd); fadein (4,kleur,tijd); fadeout(1,kleur,tijd); fadeout(2,kleur,tijd); fadeout(3,kleur,tijd); fadeout(4,kleur,tijd); break; case 8 : fadein (4,kleur,tijd); fadein (3,kleur,tijd); fadein (2,kleur,tijd); fadein (1,kleur,tijd); fadeout(4,kleur,tijd); fadeout(3,kleur,tijd); fadeout(2,kleur,tijd); fadeout(1,kleur,tijd); break; default: return; break; } }
int main(void) { DDRD = 255; DDRB |= (1<<0); DDRB |= (1<<1); DDRB |= (1<<2); DDRB |= (1<<3); DDRB &= ~(1<<4); DDRB &= ~(1<<5); PORTD = 0; PORTB &= ~(1<<0); PORTB &= ~(1<<1); PORTB &= ~(1<<2); PORTB &= ~(1<<3); PORTB &= ~(1<<4); PORTB &= ~(1<<5); int knop1,knop2,select=0,kleur=0,tijd=400,a,b,rgb[3]={1,2,4},c; while(1) { knop1 = PINB&(1<<in1); //==16 is hoog knop2 = PINB&(1<<in2); //==32 is hoog if ((knop1==16)&&(knop2==32)) { for (a=0;a<3;a+=1) { for (b=0;b<10;b+=1) { ledon (7,rgb[a]); waitms (50); dark(); waitms (50); } } for (b=0;b<10;b+=1) { for (a=0;a<3;a+=1) { ledon (7,rgb[a]); waitms (50); dark(); waitms (50); } } for (c=120;c>=0;c-=20) { ledon (1,1); waitms (c); dark(); ledon (2,2); waitms (c); dark(); ledon (3,4); waitms (c); dark(); ledon (4,1); waitms (c); dark(); ledon (1,2); waitms (c); dark(); ledon (2,4); waitms (c); dark(); ledon (3,1); waitms (c); dark(); ledon (4,2); waitms (c); dark(); ledon (1,4); waitms (c); dark(); ledon (2,1); waitms (c); dark(); ledon (3,2); waitms (c); dark(); ledon (4,4); waitms (c); dark(); } for (c=0;c<=120;c+=20) { ledon (1,1); waitms (c); dark(); ledon (2,2); waitms (c); dark(); ledon (3,4); waitms (c); dark(); ledon (4,1); waitms (c); dark(); ledon (1,2); waitms (c); dark(); ledon (2,4); waitms (c); dark(); ledon (3,1); waitms (c); dark(); ledon (4,2); waitms (c); dark(); ledon (1,4); waitms (c); dark(); ledon (2,1); waitms (c); dark(); ledon (3,2); waitms (c); dark(); ledon (4,4); waitms (c); dark(); } fadein (7,7,500); fadeout(7,7,500); dark(); } else if ((knop1==16)&&(knop2!=32)) { ledon (5,1); ledon (6,2); waitms (tijd); dark(); ledon (5,2); ledon (6,4); waitms (tijd); dark(); ledon (5,4); ledon (6,1); waitms (tijd); dark(); ledon (5,1); ledon (6,2); waitms (tijd); dark(); ledon (5,2); ledon (6,4); waitms (tijd); dark(); ledon (5,4); ledon (6,1); waitms (tijd); dark(); dark(); } else if ((knop1!=16)&&(knop2==32)) { for (kleur=1;kleur<8;kleur+=1) { fadein (7,kleur,700); fadeout(7,kleur,700); waitms(600); } dark(); } else { fadein (7,1,700); fadeout(7,1,700); waitms (600); dark(); } } }
int PADnote::noteout(float *outl, float *outr) { computecurrentparameters(); float *smps = pars->sample[nsample].smp; if(smps == NULL) { for(int i = 0; i < synth->buffersize; ++i) { outl[i] = 0.0f; outr[i] = 0.0f; } return 1; } float smpfreq = pars->sample[nsample].basefreq; float freqrap = realfreq / smpfreq; int freqhi = (int) (floor(freqrap)); float freqlo = freqrap - floor(freqrap); if(config.cfg.Interpolation) Compute_Cubic(outl, outr, freqhi, freqlo); else Compute_Linear(outl, outr, freqhi, freqlo); if(firsttime) { fadein(outl); fadein(outr); firsttime = false; } NoteGlobalPar.GlobalFilterL->filterout(outl); NoteGlobalPar.GlobalFilterR->filterout(outr); //Apply the punch if(NoteGlobalPar.Punch.Enabled != 0) for(int i = 0; i < synth->buffersize; ++i) { float punchamp = NoteGlobalPar.Punch.initialvalue * NoteGlobalPar.Punch.t + 1.0f; outl[i] *= punchamp; outr[i] *= punchamp; NoteGlobalPar.Punch.t -= NoteGlobalPar.Punch.dt; if(NoteGlobalPar.Punch.t < 0.0f) { NoteGlobalPar.Punch.Enabled = 0; break; } } if(ABOVE_AMPLITUDE_THRESHOLD(globaloldamplitude, globalnewamplitude)) // Amplitude Interpolation for(int i = 0; i < synth->buffersize; ++i) { float tmpvol = INTERPOLATE_AMPLITUDE(globaloldamplitude, globalnewamplitude, i, synth->buffersize); outl[i] *= tmpvol * NoteGlobalPar.Panning; outr[i] *= tmpvol * (1.0f - NoteGlobalPar.Panning); } else for(int i = 0; i < synth->buffersize; ++i) { outl[i] *= globalnewamplitude * NoteGlobalPar.Panning; outr[i] *= globalnewamplitude * (1.0f - NoteGlobalPar.Panning); } // Apply legato-specific sound signal modifications legato.apply(*this, outl, outr); // Check if the global amplitude is finished. // If it does, disable the note if(NoteGlobalPar.AmpEnvelope->finished() != 0) { for(int i = 0; i < synth->buffersize; ++i) { //fade-out float tmp = 1.0f - (float)i / synth->buffersize_f; outl[i] *= tmp; outr[i] *= tmp; } finished_ = 1; } return 1; }
int main(int argc, char **argv) { u32 cookie; FILE *exeFile = NULL; void *exeBuffer = (void *)EXECUTABLE_MEM_ADDR; u32 exeSize = 0; u32 exeEntryPointAddress = 0; entrypoint exeEntryPoint; __exception_setreload(0); IOS_ReloadIOS(58); /* int videomod */ InitVideo(); /* get imagedata */ u8 * imgdata = GetImageData(); fadein(imgdata); /* check devices */ SDCard_Init(); USBDevice_Init(); char cfgpath[256]; bool result = false; sprintf(cfgpath, "sd:/config/SaveGame_Manager_GX/SaveGame_Manager_GX.cfg"); result = cfg_parsefile(cfgpath, &cfg_set); if(!result) //no cfg-File on SD: try USB: { sprintf(cfgpath, "usb:config/SaveGame_Manager_GX/SaveGame_Manager_GX.cfg"); result = cfg_parsefile(cfgpath, &cfg_set); } if(result) { sprintf(cfgpath, "%sboot.dol", update_path); /* Open dol File and check exist */ exeFile = fopen (cfgpath, "rb"); if (exeFile==NULL) { sprintf(cfgpath, "%sboot.elf", update_path); exeFile = fopen (cfgpath,"rb"); } if (exeFile==NULL) result = false; else result = true; } if(!result) // non cfg-File loaded or update_path not set { /* Open dol File and check exist */ sprintf(cfgpath, "sd:/apps/SaveGame_Manager_GX/boot.dol"); exeFile = fopen (cfgpath ,"rb"); if (exeFile==NULL) { sprintf(cfgpath, "sd:/apps/SaveGame_Manager_GX/boot.elf"); exeFile = fopen (cfgpath ,"rb"); } if (exeFile==NULL) { sprintf(cfgpath, "usb:/apps/SaveGame_Manager_GX/boot.dol"); exeFile = fopen (cfgpath ,"rb"); } if (exeFile==NULL) { sprintf(cfgpath, "usb:/apps/SaveGame_Manager_GX/boot.elf"); exeFile = fopen (cfgpath ,"rb"); } if (exeFile==NULL) { sprintf(cfgpath, "sd:/apps/SaveGameManagerGX/boot.dol"); exeFile = fopen (cfgpath ,"rb"); } if (exeFile==NULL) { sprintf(cfgpath, "sd:/apps/SaveGameManagerGX/boot.elf"); exeFile = fopen (cfgpath ,"rb"); } if (exeFile==NULL) { sprintf(cfgpath, "usb:/apps/SaveGameManagerGX/boot.dol"); exeFile = fopen (cfgpath ,"rb"); } if (exeFile==NULL) { sprintf(cfgpath, "usb:/apps/SaveGameManagerGX/boot.elf"); exeFile = fopen (cfgpath ,"rb"); } // if nothing found exiting if (exeFile==NULL) { fadeout(imgdata); fclose (exeFile); SDCard_deInit(); USBDevice_deInit(); StopGX(); free(imgdata); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } } fseek (exeFile, 0, SEEK_END); exeSize = ftell(exeFile); rewind (exeFile); if(fread (exeBuffer, 1, exeSize, exeFile) != exeSize) { fadeout(imgdata); fclose (exeFile); SDCard_deInit(); USBDevice_deInit(); StopGX(); free(imgdata); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } fclose (exeFile); /* load entry point */ struct __argv args; bzero(&args, sizeof(args)); args.argvMagic = ARGV_MAGIC; args.length = strlen(cfgpath) + 2; args.commandLine = (char*)malloc(args.length); if (!args.commandLine) SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); strcpy(args.commandLine, cfgpath); args.commandLine[args.length - 1] = '\0'; args.argc = 1; args.argv = &args.commandLine; args.endARGV = args.argv + 1; u8 * appboot_buff = (u8 *) malloc(app_booter_dol_size); if(!appboot_buff) { fadeout(imgdata); SDCard_deInit(); USBDevice_deInit(); StopGX(); free(imgdata); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } memcpy(appboot_buff, app_booter_dol, app_booter_dol_size); exeEntryPointAddress = load_dol_image(appboot_buff, &args); if(appboot_buff) free(appboot_buff); fadeout(imgdata); SDCard_deInit(); USBDevice_deInit(); StopGX(); free(imgdata); if (exeEntryPointAddress == 0) { SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } exeEntryPoint = (entrypoint) exeEntryPointAddress; /* cleaning up and load dol */ SYS_ResetSystem(SYS_SHUTDOWN, 0, 0); _CPU_ISR_Disable (cookie); __exception_closeall (); exeEntryPoint (); _CPU_ISR_Restore (cookie); return 0; }
int main(int argc, char** argv) { int c = argc; int i; int j; WaveHeader input; //read header,check header and store header file readHeader(&input); checkHeader(&input); fprintf(stderr,"\nInput Wave Header Information\n\n"); printHeader(&input); short* channel1 = (short*)malloc(sizeof(short)*(input.dataChunk.size/4)); short* channel2 = (short*)malloc(sizeof(short)*(input.dataChunk.size/4)); if(channel1 == NULL || channel2 == NULL) { fprintf(stderr, "Program out of memory."); exit(1); } short* c1 = channel1; short* c2 = channel2; unsigned char a; unsigned char b; for(i = 0;i<input.dataChunk.size/4;i++) { //Checks to see if the file size matches the header's. if((a = getchar()) == EOF ||(b = getchar()) == EOF) { fprintf(stderr,"File size does not match size in header"); exit(1); } //Bit shift operation to convert the data from chars to shorts. c1[i] = (b << 8) | a; if((a = getchar()) == EOF ||(b = getchar()) == EOF) { fprintf(stderr,"File size does not match size in header"); exit(1); } c2[i] = (b << 8) | a; } //Reads in the commandline arguments stored in 'argv' i=1; //Store 'arguments' provided by the user. 'Arguments' are used to prevent using multiple descriptive variables. double arguement1,arguement2; while(i<c) { if(argv[i][0] =='-') { switch(argv[i][1]) { case'r': reverse(channel1, channel2,&input); break; case's': //converts the next thing stored in argv after 's' to an float to be passed as an argument. arguement1= atof(argv[++i]); //Gives an error message if the the speed specified by the user is invalid. if(arguement1<=0) { fprintf( stderr,"A positive number must be supplied for the speed change\n"); exit(1); } speed(&c1,&c2,c1,c2,&input,arguement1); break; case'f': flip(&c1,&c2); break; case'o': //converts the next thing stored in argv after 'o' to an float to be passed as an argument. arguement1 = atof(argv[++i]); if(arguement1<=0) { fprintf( stderr,"A positive number must be supplied for the fade in and fade out time\n"); exit(1); } fadeout(c1,c2,&input,arguement1); break; case'i': //converts the next thing stored in argv after 'i' to an float to be passed as an argument. arguement1 = atof(argv[++i]); //Gives an error message for invalid input. if(arguement1<=0) { fprintf( stderr,"A positive number must be supplied for the fade in and fade out time\n"); exit(1); } fadein(c1,c2,&input,arguement1); break; case'v': //converts the next thing stored in argv after 'v' to an float to be passed as an argument. arguement1 = atof(argv[++i]); //Gives an error message for invalid input. if(arguement1<=0) { fprintf( stderr,"A positive number must be supplied for the volume scale\n"); exit(1); } volume(c1,c2,&input,arguement1); break; case'e': //converts the next two things stored in argv after 'e' to an float to be passed as arguments. arguement1 = atof(argv[++i]); arguement2 = atof(argv[++i]); if(arguement1<=0 || arguement2<=0) { fprintf( stderr,"A positive number must be supplied for the echo delay and scale parameters\n"); exit(1); } echo(&c1,&c2,c1,c2,&input,arguement1,arguement2); break; default: //error message if the command is invalid. fprintf( stderr, "Usage: wave [[-r][-s factor][-f][-o delay][-i delay][-v scale][-e delay scale] < input > output"); exit(1); break; } } i++; } //Function call to write the wav file information. writeHeader(&input); //Converts shorts back into char data type so that the arguments are compatible with the putchar() function used to write the data. for(i=0;i<input.dataChunk.size/4;i++){ putchar((c1[i]) & 255); putchar((c1[i]>>8)); putchar((c2[i]) & 255); putchar((c2[i]>>8)); } fprintf(stderr,"Output Wave Header Information\n\n"); printHeader(&input); //Frees up the allocated memory. free(channel1); free(channel2); }
//================================== // 函数:graphicRender() // 目的:图像渲染 // void graphicRender() { static float echoalpha = 0,backgroundalpha = 0,rolealpha = 0; static int mbi=0; if(moveback) { if(qpass) { mbi = mbcount; qpass = false; } else mbi++; backPic.move(mbxstep,mbystep); if(mbi==(int)mbcount) { mbi=0; moveback=false; } } if(backPicOn) { if(stop==3) //背景淡入状态 { if(qpass) { backgroundalpha = 255; qpass = false; } backPic.draw(backgroundalpha); if(fadein(backgroundalpha,backfadestep)) stop = 0; } else if(stop==-3) //背景淡出状态 { if(qpass) { backgroundalpha = 0; qpass = false; } backPic.draw(backgroundalpha); if(fadeout(backgroundalpha,backfadestep)) { backPicOn = false; echoalpha=0; rolealpha=0; mbi=0; moveback=false; stop = 0; } } else if(stop==4) //背景转换状态 { if(qpass) { backgroundalpha = 0; qpass = false; } backPic.draw(backgroundalpha); if(fadeout(backgroundalpha,backfadestep)) { backgroundalpha = 255; echoalpha=0; stop = 0; } } else backPic.draw(); } //====================================================== if(stop==5) //role淡入状态 { if(qpass) { rolealpha = 255; qpass = false; } if(rolePicOn) rolePic.draw(rolealpha); if(rolePic2On) rolePic2.draw(rolealpha); if(fadein(rolealpha)) stop = 0; //变为读取指令状态 } else if(stop==-5) //role淡出状态 { if(qpass) { rolealpha = 0; qpass = false; } if(rolePicOn) rolePic.draw(rolealpha); else { rolealpha=0; stop=0; } if(rolePic2On) rolePic2.draw(rolealpha); if(fadeout(rolealpha)) { rolePicOn = false; rolePic2On = false; stop = 0; //变为读取指令状态 } } else if(stop==6) //role转换状态 { if(qpass) { rolealpha = 0; qpass = false; } if(rolePicOn) rolePic.draw(rolealpha); if(rolePic2On) rolePic2.draw(rolealpha); if(fadeout(rolealpha)) { rolealpha = 255; stop = 0; } } else if(stop==-7) //role数量减少 { if(qpass) { rolealpha = 0; qpass = false; } roletemp.draw(255-rolealpha); rolePic.draw(rolealpha); rolePic2.draw(rolealpha); if(fadeout(rolealpha)) { changeImg(&rolePic,&roletemp); rolePic2On = false; rolealpha = 255; stop = 0; //变为读取指令状态 } } else if(stop==7) //role数量增多 { if(qpass) { rolealpha = 0; qpass = false; } rolePic.draw(rolealpha); rolePic2.draw(255-rolealpha); roletemp.draw(255-rolealpha); if(fadeout(rolealpha)) { changeImg(&rolePic,&roletemp); rolealpha = 255; stop = 0; //变为读取指令状态 } } else //常规状态 { if(rolePicOn) rolePic.draw(); if(rolePic2On) rolePic2.draw(); } //====================================================== if(stop==2) //echo淡入状态 { if(qpass) { echoalpha = 255; qpass = false; } if(echoOn) { echoPic.draw(echoalpha); if(fadein(echoalpha)) { stop=1; //变为等待按键状态 } } } else if(stop==-2) //echo淡出状态 { if(qpass) { echoalpha = 0; qpass = false; } if(echoOn) { echoPic.draw(echoalpha); if(fadeout(echoalpha)) { echoOn = false; stop=0; //变为读取指令状态 } } else { echoalpha=0; stop=0; } } else { if(echoOn) echoPic.draw(); } if(rolenamePicOn&&(stop!=2&&stop!=-2)) rolenamePic.draw(); }
int PADnote::noteout(REALTYPE *outl, REALTYPE *outr) { computecurrentparameters(); REALTYPE *smps = pars->sample[nsample].smp; if(smps == NULL) { for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { outl[i] = 0.0; outr[i] = 0.0; } return 1; } REALTYPE smpfreq = pars->sample[nsample].basefreq; REALTYPE freqrap = realfreq / smpfreq; int freqhi = (int) (floor(freqrap)); REALTYPE freqlo = freqrap - floor(freqrap); if(config.cfg.Interpolation) Compute_Cubic(outl, outr, freqhi, freqlo); else Compute_Linear(outl, outr, freqhi, freqlo); if(firsttime) { fadein(outl); fadein(outr); firsttime = false; } NoteGlobalPar.GlobalFilterL->filterout(outl); NoteGlobalPar.GlobalFilterR->filterout(outr); //Apply the punch if(NoteGlobalPar.Punch.Enabled != 0) { for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { REALTYPE punchamp = NoteGlobalPar.Punch.initialvalue * NoteGlobalPar.Punch.t + 1.0; outl[i] *= punchamp; outr[i] *= punchamp; NoteGlobalPar.Punch.t -= NoteGlobalPar.Punch.dt; if(NoteGlobalPar.Punch.t < 0.0) { NoteGlobalPar.Punch.Enabled = 0; break; } } } if(ABOVE_AMPLITUDE_THRESHOLD(globaloldamplitude, globalnewamplitude)) { // Amplitude Interpolation for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { REALTYPE tmpvol = INTERPOLATE_AMPLITUDE(globaloldamplitude, globalnewamplitude, i, SOUND_BUFFER_SIZE); outl[i] *= tmpvol * NoteGlobalPar.Panning; outr[i] *= tmpvol * (1.0 - NoteGlobalPar.Panning); } } else { for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { outl[i] *= globalnewamplitude * NoteGlobalPar.Panning; outr[i] *= globalnewamplitude * (1.0 - NoteGlobalPar.Panning); } } // Apply legato-specific sound signal modifications if(Legato.silent) // Silencer if(Legato.msg != LM_FadeIn) for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { outl[i] = 0.0; outr[i] = 0.0; } switch(Legato.msg) { case LM_CatchUp: // Continue the catch-up... if(Legato.decounter == -10) Legato.decounter = Legato.fade.length; for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { //Yea, could be done without the loop... Legato.decounter--; if(Legato.decounter < 1) { // Catching-up done, we can finally set // the note to the actual parameters. Legato.decounter = -10; Legato.msg = LM_ToNorm; PADlegatonote(Legato.param.freq, Legato.param.vel, Legato.param.portamento, Legato.param.midinote, false); break; } } break; case LM_FadeIn: // Fade-in if(Legato.decounter == -10) Legato.decounter = Legato.fade.length; Legato.silent = false; for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { Legato.decounter--; if(Legato.decounter < 1) { Legato.decounter = -10; Legato.msg = LM_Norm; break; } Legato.fade.m += Legato.fade.step; outl[i] *= Legato.fade.m; outr[i] *= Legato.fade.m; } break; case LM_FadeOut: // Fade-out, then set the catch-up if(Legato.decounter == -10) Legato.decounter = Legato.fade.length; for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { Legato.decounter--; if(Legato.decounter < 1) { for(int j = i; j < SOUND_BUFFER_SIZE; j++) { outl[j] = 0.0; outr[j] = 0.0; } Legato.decounter = -10; Legato.silent = true; // Fading-out done, now set the catch-up : Legato.decounter = Legato.fade.length; Legato.msg = LM_CatchUp; REALTYPE catchupfreq = Legato.param.freq * (Legato.param.freq / Legato.lastfreq); //This freq should make this now silent note to catch-up (or should I say resync ?) with the heard note for the same length it stayed at the previous freq during the fadeout. PADlegatonote(catchupfreq, Legato.param.vel, Legato.param.portamento, Legato.param.midinote, false); break; } Legato.fade.m -= Legato.fade.step; outl[i] *= Legato.fade.m; outr[i] *= Legato.fade.m; } break; default: break; } // Check if the global amplitude is finished. // If it does, disable the note if(NoteGlobalPar.AmpEnvelope->finished() != 0) { for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { //fade-out REALTYPE tmp = 1.0 - (REALTYPE)i / (REALTYPE)SOUND_BUFFER_SIZE; outl[i] *= tmp; outr[i] *= tmp; } finished_ = 1; } return 1; }
static void initmenu(void) { // Allocate Menu Background backup. menuback = new Back(MENUXS, MENUYS); // Load menu screen. demoTexture.loadPointer(SDL_CreateTexture(render.getBase(), SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, HWXMAX, YMAX), true); clearmenu(); // Take a snapshot of the plain menu screen. menuback->save(MENUX, MENUY); // .. freeze overlapping part of Title. head = (Sprite *)loadfile("pic\\ravage.spr", NULL); sHead.load(head, false); // Load pointer. pointer = (Sprite *)loadfile("pic\\pointer.spr", NULL); sPointer.load(pointer, false); // Set mouse area. //setmouselimits(MENUX, MENUY, MENUX+MENUXS-pointer->xs, MENUY+MENUYS-pointer->ys); setmouselimits(-BORDER, 0, 320, 240); // Initialize POINTER animation buffer. back = new Back(pointer->xs, pointer->ys); // Set events to initial values. pointer_enabled = 1; keys_enabled = 0; joy_enabled = 0; // Several buttons & fonts. blue = new Font("fonts\\blue.fnt"); tiny = new Font("fonts\\tiny.fnt"); addsub = (Sprite *)loadfile("pic\\addsub.spr", NULL); sAddSub.load(addsub, false); yesno = (Sprite *)loadfile("pic\\yesno.spr", NULL); sYesNo.load(yesno, false); // Write version information. #ifdef SHAREWARE tiny->vanilla(215, 65, "shareware 1.1", 10); #else tiny->vanilla(215, 65, "registered 1.1", 10); #endif // Save current game state in case the menu is in SHOP mode. gsave = gstate; psave = player[nowplayer]; psave2 = player[1-nowplayer]; player[1-nowplayer].active = 0; // Deactivate unused player. // Initialize DEMO GAME. cheatsave = cheatlevel; cheatlevel |= CHEAT_INVUL | CHEAT_NOMONEY; playback_start("demo1\\demo1.rec"); player[nowplayer].control = playback_device; gstate.nplayers = 1; gstate.difficulty = 3; newgame(1); newlevel("demo1\\demo1"); weapon_releaseall(nowplayer, STARTX1, STARTY); // Start playing background music. s_loadmod("mods\\menu.uni"); s_startmod(); // Fade In fadein(level.palette); }