Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <fxlib.h>
- #include "gray.h"
- #include "grayscreenshotlib.h"
- void draw_bmp_or_cl(unsigned char *bmp, int x, int y, int width, int height, char* buffer)
- {
- unsigned short line;
- char shift, *screen, *p;
- int i, j, real_width, begin_x, end_x, begin_y, end_y;
- char bool1=1, bool2=1, bool3;
- if(!bmp || x<1-width || x>127 || y<1-height || y>63 || height<1 || width<1) return;
- p = (char*)&line;
- real_width = (width-1>>3<<3)+8;
- if(y < 0) begin_y = -y;
- else begin_y = 0;
- if(y+height > 64) end_y = 64-y;
- else end_y = height;
- shift = 8-(x&7);
- if(x<0)
- {
- begin_x = -x>>3;
- if(shift != 8) bool1 = 0;
- } else begin_x = 0;
- if(x+real_width > 128) end_x = 15-(x>>3), bool2 = 0;
- else end_x = real_width-1>>3;
- bool3 = (end_x == real_width-1>>3);
- screen = buffer+(y+begin_y<<4)+(x>>3);
- for(i=begin_y ; i<end_y ; i++)
- {
- if(begin_x < end_x)
- {
- line = bmp[i*(real_width>>3)+begin_x] << shift;
- if(bool1) screen[begin_x] |= *p;
- if(shift!=8) screen[begin_x+1] |= *(p+1);
- for(j=begin_x+1 ; j<end_x ; j++)
- {
- line = bmp[i*(real_width>>3)+j] << shift;
- screen[j] |= *p;
- if(shift!=8) screen[j+1] |= *(p+1);
- }
- }
- line = bmp[i*(real_width>>3)+end_x];
- if(bool3) line &= -1<<real_width-width;
- line <<= shift;
- if(begin_x < end_x || bool1) screen[end_x] |= *p;
- if(bool2) screen[end_x+1] |= *(p+1);
- screen += 16;
- }
- }
- void intro()
- {
- char buffer1[] = {3,128,0,15,224,0,63,248,0,255,254,0,255,250,0,255,226,0,255,130,0,255,2,0,255,2,0,255,3,128,255,3,224,255,3,248,255,3,254,255,3,250,255,3,226,255,3,130,255,2,2,255,0,2,255,0,6,255,0,24,255,0,96,255,1,128,255,6,0,63,24,0,15,96,0,3,128,0,0,0,0,0,0,0,0,0,0,0,0,0};
- char buffer2[] = {3,128,0,12,96,0,48,24,0,192,6,0,240,30,0,252,126,0,255,254,0,255,254,0,255,254,0,255,255,128,255,254,96,255,254,24,255,254,6,255,254,30,255,254,126,255,255,254,255,255,254,255,255,254,255,255,254,255,255,248,255,255,224,255,255,128,255,254,0,63,248,0,15,224,0,3,128,0,0,0,0,0,0,0,0,0,0,0,0,0};
- char image[5][2][90] = {
- {
- {3,128,0,15,224,0,63,248,0,255,254,0,255,250,0,255,226,0,255,130,0,255,2,0,255,2,0,255,3,128,255,3,224,255,3,248,255,3,254,255,3,250,255,3,226,255,3,130,255,2,2,255,0,2,255,0,6,255,0,24,255,0,96,255,1,128,255,6,0,63,24,0,15,96,0,3,128,0,0,0,0,0,0,0,0,0,0,0,0,0},
- {3,128,0,12,96,0,48,24,0,192,6,0,240,30,0,252,126,0,255,254,0,255,254,0,255,254,0,255,255,128,255,254,96,255,254,24,255,254,6,255,254,30,255,254,126,255,255,254,255,255,254,255,255,254,255,255,254,255,255,248,255,255,224,255,255,128,255,254,0,63,248,0,15,224,0,3,128,0,0,0,0,0,0,0,0,0,0,0,0,0}
- },
- {
- {0,3,128,0,15,224,0,63,248,0,63,254,0,63,250,14,63,226,63,191,194,255,255,194,255,255,194,255,239,194,255,143,194,255,15,194,255,15,194,255,15,194,255,15,194,255,15,194,255,15,194,255,15,194,255,15,194,255,15,2,255,12,2,255,0,2,255,0,6,255,0,24,255,0,96,255,1,128,255,6,0,63,24,0,15,96,0,3,128,0},
- {0,3,128,0,12,96,0,48,24,0,60,6,0,63,30,14,63,254,49,191,254,192,127,254,240,31,254,252,127,254,255,255,254,255,255,254,255,255,254,255,255,254,255,255,254,255,255,254,255,255,254,255,255,254,255,255,254,255,255,254,255,255,254,255,255,254,255,255,254,255,255,248,255,255,224,255,255,128,255,254,0,63,248,0,15,224,0,3,128,0}
- },
- {
- {0,3,0,0,15,192,0,63,240,0,255,252,3,255,244,15,255,196,63,255,4,255,252,4,255,240,4,255,192,4,255,0,4,254,1,132,254,7,132,254,31,132,254,31,132,254,31,132,254,30,4,254,24,4,254,0,4,254,1,132,254,7,132,254,31,132,254,31,140,254,23,176,254,17,192,254,16,0,254,16,0,62,48,0,14,192,0,3,0,0},
- {0,3,0,0,12,192,0,48,48,0,192,12,3,0,60,12,0,252,48,3,252,192,15,252,240,63,252,252,255,252,255,255,252,255,255,252,255,255,252,255,255,252,255,255,252,255,255,252,255,255,252,255,255,252,255,255,252,255,255,252,255,255,252,255,255,252,255,255,252,255,247,240,255,241,192,255,240,0,255,240,0,63,240,0,15,192,0,3,0,0}
- },
- {
- {0,3,0,0,15,192,0,63,240,0,255,252,3,255,252,15,255,228,63,255,132,255,254,4,255,248,4,255,224,24,255,128,96,255,1,128,255,7,0,255,7,192,255,7,240,255,7,208,255,7,16,255,4,16,255,0,16,255,0,96,255,1,128,255,6,0,255,4,0,255,4,0,255,4,0,255,4,0,255,4,0,63,24,0,15,96,0,3,128,0},
- {0,3,0,0,12,192,0,48,48,0,192,12,3,0,28,12,0,124,48,1,252,192,7,252,240,31,252,252,127,248,255,255,224,255,255,128,255,255,0,255,252,192,255,252,48,255,252,240,255,255,240,255,255,240,255,255,240,255,255,224,255,255,128,255,254,0,255,252,0,255,252,0,255,252,0,255,252,0,255,252,0,63,248,0,15,224,0,3,128,0}
- },
- {
- {0,3,128,0,15,224,0,63,248,0,63,254,0,63,250,14,63,226,63,191,194,255,255,194,255,255,194,255,239,194,255,143,196,255,15,196,255,15,196,127,15,196,127,15,132,127,6,4,127,128,2,127,128,2,127,129,130,127,135,194,127,143,194,255,143,194,255,143,198,255,11,216,255,8,224,255,8,0,255,8,0,63,24,0,15,96,0,3,128,0},
- {0,3,128,0,12,96,0,48,24,0,60,6,0,63,30,14,63,254,49,191,254,192,127,254,240,31,254,252,127,254,255,255,252,255,255,252,255,255,252,127,255,252,127,255,252,127,255,252,127,255,254,127,255,254,127,255,254,127,255,254,127,255,254,255,255,254,255,255,254,255,251,248,255,248,224,255,248,0,255,248,0,63,248,0,15,224,0,3,128,0}
- }
- };
- int coord[5][4] = {{5,11,-20,0}, {30,19,-18,0}, {54,31,-16,0}, {77,19,-14,0}, {99,8,-12,0}};
- int i, j, dy, y;
- for(dy=-20 ; dy<20 ; dy++) {
- gray_clearVRAM();
- for(i=0 ; i<5 ; i++) {
- y = 0;
- if(coord[i][2] < 0) {
- for(j=-1 ; j>= coord[i][2] ; j--) y += j;
- } else if(coord[i][2] > 0) {
- for(j=1 ; j<= coord[i][2] ; j++) y += j;
- } else {
- coord[i][3]++;
- if(coord[i][3] > 10) coord[i][2] = 1;
- }
- if(coord[i][2]) coord[i][2]++;
- draw_bmp_or_cl(image[i][0], coord[i][0], coord[i][1]+y, 23, 30, gray_getScreen()->VRAM1);
- draw_bmp_or_cl(image[i][1], coord[i][0], coord[i][1]+y, 23, 30, gray_getScreen()->VRAM2);
- }
- gray_swapBuffers();
- gsl_screenshot(gray_getScreen()->DD1, gray_getScreen()->DD2);
- for(i=0 ; i<300000 ; i++);
- }
- }
- int AddIn_main(int isAppli,unsigned short OptionNum)
- {
- gray_init();
- gsl_init(100);
- intro();
- gsl_quit();
- gray_quit();
- reset_calc();
- return 1;
- }
- #pragma section _BR_Size
- unsigned long BR_Size;
- #pragma section
- #pragma section _TOP
- int InitializeSystem(int isAppli,unsigned short OptionNum)
- {
- return INIT_ADDIN_APPLICATION(isAppli,OptionNum);
- }
- #pragma section
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement