//Processes Options Menu void OptionsMenu() { DrawBG(0); //cls echo_play_bgm(BGM_03); //Play Nes_Mes2 DrawBG(9); //Init text plane (Plane, text prio, text colors) VDP_setTextPlan(PLAN_B); VDP_setTextPriority(PTRUE); VDP_setPaletteColor((OBJPAL * 16)+15,0xE); //Non higlited color VDP_setPaletteColor((PWRPAL * 16)+15,0xEE); //Hilited color VDP_setTextPalette(OBJPAL); InitMenu(1,0,0,7,_FALSE); //Init a 6 item menu S_ID=0; M_ID=0; //Set joy handler to Options type JOY_setEventHandler( &BtnOptions ); while (SItem==0) { VDP_waitVSync(); } DrawBG(0); //cls }
_voidCallback *h_int_scroll(void) { if (scroll_off > 200) { VDP_setPaletteColor(14, 0); } scroll_off += dscroll; VDP_setVerticalScroll(PLAN_A, scroll_off); return NULL; }
_voidCallback *h_int(void) { VDP_setPaletteColor(14,palette[col]); col++; while (col >= PAL_LEN) { col -= PAL_LEN; } return NULL; }
void startup_stretch(void) { SYS_setHIntCallback((_voidCallback *)h_int_scroll); VDP_setHIntCounter(3); VDP_setHInterrupt(1); u16 counter = 240; while (counter--) { while (vbl_wait) { __asm__("nop"); } VDP_setHInterrupt(0); VDP_setPaletteColor(14,palette[counter % 32]); vbl_wait = 1; counter--; scroll_off = 0; dscroll = counter / 4; VDP_setHInterrupt(1); } VDP_setHInterrupt(0); }
int main() { u16 i, j; const driver_def *cur_driver; const cmd_def *cur_cmd; JOY_setEventHandler(joyEvent); VDP_setScreenWidth320(); VDP_setHInterrupt(0); VDP_setHilightShadow(0); SYS_setVIntCallback(vintEvent); // point to first driver driver = &drivers[0]; cmd = NULL; dmaMethod = 0; for(i = 0, cur_driver = drivers; i < NUM_DRIVER; i++, cur_driver++) for(j = 0, cur_cmd = cur_driver->cmds; j < MAX_CMD; j++, cur_cmd++) params_value[i][j] = cur_cmd->params; VDP_setPalette(PAL0, font_pal_lib.data); VDP_setPaletteColor((PAL1 * 16) + 15, 0x0888); VDP_setTextPalette(PAL0); VDP_drawText("Current Z80 driver", 10, 1); VDP_drawText("DMA Method:", 1, 26); refreshDriverInfos(); while(1) { VDP_waitVSync(); } }
//Processes Credits screen void Credits() { JOY_setEventHandler( &BtnNada ); //Set Event handler to nothing const u8 x=1; //Constant column value for text disp u8 y=1; //Variable row ~ const wait=3000; //Time in MS to wait echo_play_bgm(BGM_14); //Play IceHockey2 DrawBG(0); //cls DrawBG(10); //Draw Hockey rink //Setup text planes and colors VDP_setTextPlan(PLAN_B); VDP_setTextPriority(PTRUE); VDP_setPaletteColor((OBJPAL * 16)+15,0xEE); //Yellow VDP_setTextPalette(OBJPAL); //Draw a line, increment row, draw next line, repeat in screen chunks // 1234567890123456789012345678901234567 VDP_drawText("+-----------------------------------+",x,y);y++; VDP_drawText("| ULTRA AIR HOCKEY (Genesis), V1.0 |",x,y);y++; VDP_drawText("| Credits |",x,y);y++; VDP_drawText("+-----------------------------------+",x,y);y++; VDP_drawText("|Producer Tamkis|",x,y);y++; VDP_drawText("|Art creator Tamkis|",x,y);y++; VDP_drawText("+-----------------------------------+",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("| Music |",x,y);y++; VDP_drawText("|All songs were converted to the |",x,y);y++; VDP_drawText("|Echo sound engine |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("| Various module music artists |",x,y);y++; VDP_drawText("|Unless otherwise noted, all modules|",x,y);y++; VDP_drawText("|are from modarchive.org/ |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|http://modarchive.org/index.php?req|",x,y);y++; VDP_drawText("|uest=view_by_moduleid&query=NUMBER |",x,y);y++; VDP_drawText("v v",x,y);y++; //wait MS, clear the text plane, repeat for next screen chunk waitMs(wait); VDP_clearPlan(BPLAN,0); y=1; VDP_drawText("| |",x,y);y++; VDP_drawText("|hockey_fever.xm The Einstein Crew |",x,y);y++; VDP_drawText("|144817 |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|nes_mes2.mod Goto80 |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|PITTITLE.mod (Unknown) |",x,y);y++; VDP_drawText("|112082 |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|ice-hockey_94theme.mod Subtance/ |",x,y);y++; VDP_drawText("|inflow 121145 |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|organmaster.mod Gamma7 |",x,y);y++; VDP_drawText("|169287 |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|intro101.mod w.o.t.w of |",x,y);y++; VDP_drawText("|supplex |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|hurry_up.mod reflex/rebels |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("v v",x,y);y++; waitMs(wait); VDP_clearPlan(BPLAN,0); y=1; VDP_drawText("|slowmotion.mod tobbx/Tobbe Lars|",x,y);y++; VDP_drawText("|157022 |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|Castle_load.mod Exodus |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|complexity.mod (Unknown) |",x,y);y++; VDP_drawText("|92979 |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|Reflexity_music.mod (subsong #3) |",x,y);y++; VDP_drawText("|Unknown 109459 |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|chipmunks.mod Jester/Sanity |",x,y);y++; VDP_drawText("|36792 |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|icehockey2.mod Subversion |",x,y);y++; VDP_drawText("|123683 |",x,y);y++; VDP_drawText("+-----------------------------------+",x,y);y++; VDP_drawText("v v",x,y);y++; waitMs(wait); VDP_clearPlan(BPLAN,0); y=1; VDP_drawText("| Sound effects |",x,y);y++; VDP_drawText("|Unless otherwise noted, all sfx are|",x,y);y++; VDP_drawText("|from Freesound.org |",x,y);y++; VDP_drawText("|http://www.freesound.org/people/ |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|ID(+16) Name URL |",x,y);y++; VDP_drawText("|01 Menu highlight |",x,y);y++; VDP_drawText("|broumbroum/sounds/50561/ |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|02 Menu select |",x,y);y++; VDP_drawText("|Bertrof/sounds/131658/ |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|03 Puck hit |",x,y);y++; VDP_drawText("|krb21/sounds/118604/ |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|04/30 Puck deflect |",x,y);y++; VDP_drawText("|BranRainey/sounds/108737/ |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("v v",x,y);y++; waitMs(wait); VDP_clearPlan(BPLAN,0); y=1; VDP_drawText("|05 Bumper hit |",x,y);y++; VDP_drawText("|timgormly/sounds/170140/ |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|06 Powerup get |",x,y);y++; VDP_drawText("|RandomationPictures/sounds/138491/ |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|07 Powerup use |",x,y);y++; VDP_drawText("|jobro/sounds/35464/ |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|08 Goal siren |",x,y);y++; VDP_drawText("|UncleSigmund/sounds/117122/ |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|09-29 Announcer guy stuff |",x,y);y++; VDP_drawText("|All generated w Acapela Box using |",x,y);y++; VDP_drawText("|the English (UK) Peter voice |",x,y);y++; VDP_drawText("|https://acapela-box.com/AcaBox/ |",x,y);y++; VDP_drawText("|index.php |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("v v",x,y);y++; waitMs(wait); VDP_clearPlan(BPLAN,0); y=1; VDP_drawText("|31 Buzzer |",x,y);y++; VDP_drawText("|cognito%20perceptu/sounds/17468/ |",x,y);y++; VDP_drawText("+-----------------------------------+",x,y);y++; VDP_drawText("| Beta testers |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|DUDE #1 - Stuff |",x,y);y++; VDP_drawText("|DUDE #2 - Stuff |",x,y);y++; VDP_drawText("|DUDE #3 - Stuff |",x,y);y++; VDP_drawText("+-----------------------------------+",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("| Special Thanks |",x,y);y++; VDP_drawText("|Oerg866 and SiktheHedgehog |",x,y);y++; VDP_drawText("|Echo Sound Engine and related tools|",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("|Stephane Help, SGDK |",x,y);y++; VDP_drawText("|Nemesis Exodus emulator (debuging)|",x,y);y++; VDP_drawText("v v",x,y);y++; waitMs(wait); VDP_clearPlan(BPLAN,0); y=1; VDP_drawText("| |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("+===================================+",x,y);y++; VDP_drawText("| YOU |",x,y);y++; VDP_drawText("| FOR PLAYING! |",x,y);y++; VDP_drawText("| Ultra Air Hockey (Genesis) V1.0 |",x,y);y++; VDP_drawText("| EagleSoft Ltd 2015 |",x,y);y++; VDP_drawText("| www.eaglesoftltd.com |",x,y);y++; VDP_drawText("+===================================+",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("| |",x,y);y++; VDP_drawText("| |",x,y);y++; waitMs(wait); echo_wait_sfx(SFX_02); //Play select sfx VDP_fadeOutAll(100,_FALSE); DrawBG(0); //cls }
int main(void) { music_init(); music_play(3); u16 delay_mod = 4; u16 col_inc_cnt = 0; setup(); reset_demo: hint_val = 3; col = 0; col_off = 0; phrase_num = 0; scroll_off = 0; dscroll = 0; term_pos = 0; term_scrolling = 0; sprites_dma_simple(); term_pos = 0; VDP_setHInterrupt(0); VDP_clearPlan(VDP_PLAN_A, 0); VDP_clearPlan(VDP_PLAN_B, 0); // Greyscale palette for text VDP_setPaletteColor(0,0x000); VDP_setPaletteColor(1,0x444); VDP_setPaletteColor(2,0x888); VDP_setPaletteColor(3,0xEEE); VDP_setScreenWidth256(); bios_boot_demo(); VDP_setScreenWidth320(); VDP_clearPlan(VDP_PLAN_A, 0); VDP_clearPlan(VDP_PLAN_B, 0); awful_put_logo(8, 2); startup_stretch(); VDP_setVerticalScroll(PLAN_A, 252); VDP_setVerticalScroll(PLAN_B, 252); VDP_setHIntCounter(hint_val); SYS_setHIntCallback((_voidCallback *)h_int); volatile u8 p1 = pad_read(0); sprites_init(); col_puts40(8,0,"Computer Science House"); // Initialize background stars star stars[NUM_STARS]; u16 i = 0; for (i = 0; i < NUM_STARS; i++) { stars[i].x = i * 5; stars[i].y = 128 + i * 8; stars[i].speed = (i % 7) + 1; stars[i].offset = (3 * i) % 4; stars[i].size = (i % 4 == 0) ? ('.' + COL_FONT_VRAM_OFFSET) : (128 + '.' + COL_FONT_VRAM_OFFSET); } print_phrase(8); u16 delay = 0; u8 dir = 0; VDP_setHInterrupt(1); for (;;) { delay++; if (col_inc_cnt == 0) { col_inc_cnt = hint_val; col_off += 0x002; } else { col_inc_cnt--; } if (delay == 512) { if (phrase_num == 8) { phrase_num = 0; VDP_setHInterrupt(0); sprite_set(0, 0, 0, 0, 0, 0); sprites_dma_simple(); while (vbl_wait) { __asm__("nop"); } vbl_wait = 1; goto reset_demo; } hint_val++; if (hint_val == 10) { hint_val = 3; } delay_mod = delay_mod >> 1; if (delay_mod == 0) { delay_mod = delay_mod = 4; } VDP_setHIntCounter(hint_val); VDP_setHInterrupt(0); print_phrase(phrase_num); VDP_setHInterrupt(1); phrase_num++; delay = 0; } process_stars(&stars); while (vbl_wait) { __asm__("nop"); } VDP_setHInterrupt(0); VDP_setPaletteColor(14,palette[col]); col = col_off; vbl_wait = 1; sprites_dma_simple(); VDP_setHInterrupt(1); } return 0; }