Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <genesis.h>
- // resources.h is generated from resources.res
- // Bitmap
- #include "moon.h"
- // Songs
- #include "vgm_drv.h"
- #include "songs.h"
- // Global Variables
- #define TILE1 1
- #define NUM_TRACKS 5
- const u32 tile[8]=
- {
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000
- };
- // Main
- int main( )
- {
- int counter = 0;
- int counter2 = 0;
- int delay = 0;
- // get the image width (in pixel) ==> should be 8pix aligned
- u16 w = moon.w;
- // get the image height (in pixel) ==> should be 8px aligned
- u16 h = moon.h;
- // Get the tile
- VDP_loadTileData( (const u32 *)tile, TILE1, 1, 0);
- // get the palette data of moon
- VDP_setPalette(PAL1, moon.palette->data);
- // load bitmap data of moon in VRAM
- // w/8 = width in tiles we want to load
- // h/8 = height in tile we want to load
- // w/8 = width in tiles of the bitamp
- // the 3rd arg is needed because you could load only a part of the bitmap if you want but SGDK needs the width as reference
- VDP_loadBMPTileData(moon.image, 1, w / 8, h / 8, w / 8);
- // draw the moon at (12,12)
- VDP_fillTileMapRectInc(PLAN_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE1), 12, 12, w / 8, h / 8);
- // Sound stuff.
- waitMs(100);
- Z80_requestBus(1);
- // enable DAC
- YM2612_enableDAC();
- Z80_releaseBus();
- SND_startPlay_VGM(track1_vgm);
- while(1)
- {
- VDP_waitVSync();
- // # Scene #1
- if(counter < 100) {
- VDP_fillTileMapRectInc(PLAN_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE1), counter, 12, w / 8, h / 8);
- waitMs(delay);
- }
- else if(counter == 100) {
- // VDP_fillTileMapRect(PLAN_A, TILE_ATTR_FULL(PAL3, 0, 0, 0, TILE1), 0, 0, 240, 240);
- VDP_drawText("Frame #: 100", 10, 13);
- }
- // Scene #2
- else if(counter < 200) {
- VDP_fillTileMapRectInc(PLAN_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE1), 200-counter, 12, w / 8, h / 8);
- waitMs(delay);
- }
- else if(counter == 200) {
- // VDP_fillTileMapRect(PLAN_A, TILE_ATTR_FULL(PAL3, 0, 0, 0, TILE1), 0, 0, 240, 240);
- VDP_drawText("Frame #: 200", 10, 13);
- }
- // Scene #3
- else if(counter < 300) {
- VDP_fillTileMapRectInc(PLAN_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE1), 12, counter-200, w / 8, h / 8);
- waitMs(delay);
- }
- else if(counter == 300) {
- // VDP_fillTileMapRect(PLAN_A, TILE_ATTR_FULL(PAL3, 0, 0, 0, TILE1), 0, 0, 240, 240);
- VDP_drawText("Frame #: 300", 10, 13);
- }
- // Scene #4
- else if(counter < 400) {
- VDP_fillTileMapRectInc(PLAN_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE1), 12, 400-counter, w / 8, h / 8);
- waitMs(delay);
- }
- else if(counter == 400) {
- // VDP_fillTileMapRect(PLAN_A, TILE_ATTR_FULL(PAL3, 0, 0, 0, TILE1), 0, 0, 240, 240);
- VDP_drawText("Frame #: 400", 10, 13);
- }
- // Scene #5
- else if(counter < 500) {
- VDP_fillTileMapRectInc(PLAN_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE1), counter-400, counter-400, w / 8, h / 8);
- waitMs(delay);
- }
- else if(counter == 500) {
- // VDP_fillTileMapRect(PLAN_A, TILE_ATTR_FULL(PAL3, 0, 0, 0, TILE1), 0, 0, 240, 240);
- VDP_drawText("Frame #: 500", 10, 13);
- }
- // Scene #6
- else if(counter < 600) {
- VDP_fillTileMapRectInc(PLAN_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE1), 600-counter, 600-counter, w / 8, h / 8);
- waitMs(delay);
- }
- else if(counter == 600) {
- // VDP_fillTileMapRect(PLAN_A, TILE_ATTR_FULL(PAL3, 0, 0, 0, TILE1), 0, 0, 240, 240);
- VDP_drawText("Frame #: 600", 10, 13);
- }
- // Scene #7
- else if(counter < 700) {
- VDP_fillTileMapRectInc(PLAN_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE1), 12, 12, w / 8, h / 8);
- waitMs(delay);
- }
- else if(counter == 700) {
- // VDP_fillTileMapRect(PLAN_A, TILE_ATTR_FULL(PAL3, 0, 0, 0, TILE1), 0, 0, 240, 240);
- VDP_drawText("Frame #: 700", 10, 13);
- }
- // Scene #8
- else if(counter < 800) {
- VDP_fillTileMapRectInc(PLAN_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE1), 500 * (counter%2), 12 , w / 8, h / 8);
- waitMs(delay);
- }
- else if(counter == 800) {
- // VDP_fillTileMapRect(PLAN_A, TILE_ATTR_FULL(PAL3, 0, 0, 0, TILE1), 0, 0, 240, 240);
- VDP_drawText("Frame #: 800", 10, counter2/100);
- }
- // Scene #9
- else if(counter < 900) {
- VDP_fillTileMapRectInc(PLAN_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE1), 12, 500 * (counter%2), w / 8, h / 8);
- waitMs(delay);
- }
- else if(counter == 900) {
- // VDP_fillTileMapRect(PLAN_A, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE1), 0, 0, 240, 240);
- VDP_drawText("Frame #: 900", 10, 13);
- }
- // Scene #10
- else if(counter < 1000) {
- VDP_fillTileMapRectInc(PLAN_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE1), 500 * (counter%2), 500 * (counter%2), w / 8, h / 8);
- waitMs(delay);
- }
- counter += 1;
- counter2 += 1;
- // sprintf("%d", counter);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement