1 //DOS Graphics thingy by sparky4 licence GPL v2
\r
2 //a special thanks to everyone to release source code for mode X
\r
5 //#include "lib\modex16.h" //____
\r
12 short bakax = 0, bakay = 0;
\r
13 word xx = rand()&0%SW, yy = rand()&0%SH, sx = 0, sy = 0;
\r
16 byte *vga = (byte *) MK_FP(0xA000, 0);
\r
19 * Comment out the following #define if you don't want the testing main()
\r
25 /////////////////////////////////////////////////////////////////////////////
\r
27 // setvideo() - This function Manages the video modes //
\r
29 /////////////////////////////////////////////////////////////////////////////
\r
30 void setvideo(/*byte mode, */short vq){
\r
33 if(!vq){ // deinit the video
\r
34 // change to the video mode we were in before we switched to mode 13h
\r
35 //mxSetMode( MX_TEXT );
\r
39 int86(0x10, &in, &out);
\r
41 }else if(vq==1){ // init the video
\r
42 // get old video mode
\r
44 int86(0x10, &in, &out);
\r
45 old_mode = out.h.al;
\r
49 mxSetMode( MX_320x240 );
\r
50 // mxSetVirtualScreen(SW+(SW/4), SH+(SH/4));
\r
51 // mxSetVirtualScreen(SW*2, SH*2);
\r
52 mxSetVirtualScreen(VW,BH);
\r
53 // mxSetVirtualScreen((640-(TILEWH*4)),(480-(TILEWH*4)));
\r
55 mxSetClipRegion(0, 0, VW, BH);
\r
56 mxPan(TILEWH*2,TILEWH*2);
\r
57 //mxSetClipRegion(0, VH+1, VW, (TILEWH*BUFFMX));
\r
62 int mult=(QUADWH)/2;
\r
65 for(int paly=0; paly<palq; paly+=mult){
\r
66 for(int palx=0; palx<palq; palx+=mult){
\r
67 mxFillBox((SW-palq)+palx+32, paly+32, TILEWH, TILEWH, palcol, OP_SET);
\r
73 /////////////////////////////////////////////////////////////////////////////
\r
75 // cls() - This clears the screen to the specified color, on the VGA or on //
\r
76 // the Virtual screen. //
\r
78 /////////////////////////////////////////////////////////////////////////////
\r
79 void cls(byte color, byte *Where){
\r
80 _fmemset(Where, color, VW*(VH*2));
\r
83 //color
\82Ä
\82·
\82Æ
\r
85 if(gq < NUM_COLORS){
\r
92 //color
\82Ä
\82·
\82Æ
\r
95 //---- cls(gq, vaddr);
\r
102 //slow spectrum down
\r
103 void ssd(short svq){
\r
106 //plotpixel(xx, yy, coor, vga);
\r
107 //ppf(sx, sy, coor, vga);
\r
108 mxPutPixel(sx, sy, coor);
\r
109 //printf("%d %d %d %d\n", sx, sy, svq, coor);
\r
114 if(svq == 7) coor++;
\r
115 if(sy == SH && svq == 8) coor = rand()%NUM_COLORS;
\r
120 /*-----------ding-------------*/
\r
125 //++++ if(q <= 4 && q!=2 && gq == BONK-1) coor = rand()%HGQ;
\r
130 if(coor < HGQ && coor < LGQ) coor = LGQ;
\r
134 bakax = rand()%3; bakay = rand()%3;
\r
138 if(q==8){ colorz(); return gq; mxOutText(SW/2, SH/2, "bakapi"); }else
\r
139 if(q==10){ ssd(q); /*printf("%d\n", coor);*/ }else
\r
140 if(q==5){ colortest(); return gq; }else
\r
141 if(q==11){ colorz(); delay(100); return gq; }
\r
143 coor = rand()%NUM_COLORS;
\r
151 if(q == 9){ ssd(q); coor++; }
\r
155 if((q<5 && gq<BONK) || (q==16 && gq<BONK)){ // the number variable make the colors more noticable
\r
157 if(xx==VW){bakax=0;}
\r
158 if(xx==0){bakax=1;}
\r
159 if(yy==VH){bakay=0;}
\r
160 if(yy==0){bakay=1;}
\r
162 if(xx!=VW||yy!=VH){
\r
163 if(xx==0){bakax=1;bakay=-1;d3y=1;}
\r
164 if(yy==0){bakax=1;bakay=0;d3y=1;}
\r
165 if(xx==VW){bakax=-1;bakay=-1;d3y=1;}
\r
166 if(yy==VH){bakax=1;bakay=0;d3y=1;}
\r
167 }else if(xx==VW&&yy==VH) xx=yy=0;
\r
231 if(xx<0) xx=(VW-TILEWH);
\r
232 if(yy<0) yy=(VH-TILEWH);
\r
233 if(xx>(VW-TILEWH)) xx=0;
\r
234 if(yy>(VH-TILEWH)/*+(TILEWH*BUFFMX)*/) yy=0;
\r
243 //interesting effects
\r
249 mxPutPixel(tx, ty, coor);
\r
250 //printf("%d %d %d %d %d %d\n", xx, yy, tx, ty, TILEWH);
\r
255 mxFillBox(xx, yy, TILEWH, TILEWH, coor, OP_SET);
\r
257 mxPutPixel(xx, yy, coor);
\r
263 mxFillBox((rand()*TILEWH)%VW, (rand()*TILEWH)%(VH), TILEWH, TILEWH, 0, OP_SET);
\r
265 mxPutPixel(rand()%VW, rand()%(VH), 0);
\r
267 if(q==16) mxPutPixel(rand()%VW, rand()%(VH), 0);
\r
268 if(q==2||q==4||q==16){ bakax = rand()%3; bakay = rand()%3; } //random 3 switch
\r
270 //if(xx<0||xx>320||yy<0||yy>(SH*3))
\r
271 // printf("%d %d %d %d %d\n", xx, yy, coor, bakax, bakay);
\r
278 * The library testing routines follows below.
\r
284 * Library test (program) entry point.
\r
289 //bitmap_t bmp; //____
290 //bmp = modexLoadPcx("chikyuu.pcx"); //____
\r
291 short key,d,xpos,ypos,xdir,ydir;
\r
294 d=4; // switch variable
\r
295 key=2; // default screensaver number
\r
301 //modexPalUpdate(bmp.palette); //____
302 //modexDrawBmp(VGA, 0, 0, &bmp, 0); //____
306 /*while(d!=0){ // on!
\r
307 if(!kbhit()){ // conditions of screen saver
\r
311 // user imput switch
\r
312 printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 5 to quit.\n", getch()); // prompt the user
\r
314 //if(key==3){xx=yy=0;} // crazy screen saver wwww
\r
319 //mxFillBox(0, 0, VW, BH, 10, OP_SET);
\r
320 while(1){ // conditions of screen saver
\r
324 //end of screen savers
\r
326 /* for (int x = 0; x < VW; ++x)
\r
328 mxPutPixel(x, 0, 15);
\r
329 mxPutPixel(x, SH-1, 15);
\r
331 for (int y = 0; y < VH; ++y)
\r
333 mxPutPixel(0, y, 15);
\r
334 mxPutPixel(SW-1, y, 15);
\r
336 for (int x = 0; x < VW; ++x)
\r
338 mxPutPixel(x, 0, 15);
\r
339 mxPutPixel(x, VH-1, 15);
\r
341 for (int y = 240; y < VH; ++y)
\r
343 mxPutPixel(0, y, 15);
\r
344 mxPutPixel(VW-1, y, 15);
\r
350 mxSetTextColor(10, OP_TRANS); //set font
\r
351 mxBitBlt(xpos, ypos+(TILEWH*12), SW, TILEWH*BUFFMX, 0, BS); //copy background
\r
352 mxFillBox(xpos, ypos+(TILEWH*12), SW, TILEWH*BUFFMX, 0, OP_SET); // background for text box
\r
354 mxOutText(xpos+1, ypos+SH-48, "========================================");
\r
355 mxOutText(xpos+1, ypos+SH-40, "| |Chikyuu:$line1");
\r
356 mxOutText(xpos+1, ypos+SH-32, "| |$line2");
\r
357 mxOutText(xpos+1, ypos+SH-24, "| |$line3");
\r
358 mxOutText(xpos+1, ypos+SH-16, "| |$line4");
\r
359 mxOutText(xpos+1, ypos+SH-8, "========================================");
\r
360 mxFillBox(xpos+QUADWH, ypos+QUADWH+(TILEWH*12), TILEWH*2, TILEWH*2, 9, OP_SET); //portriat~
\r
362 mxBitBlt(0, BS, SW, TILEWH*BUFFMX, xpos, ypos+(TILEWH*12)); //copy background
\r
365 //for(int i=0;i<TILEWH;i++){
\r
369 mxFillBox(384, 304, 384, 304, 10, OP_SET);
\r
370 //mxBitBlt(xpos, ypos, SW, SH, 32, (SH+64+32));
\r
371 mxBitBlt(TILEWH*2, TILEWH*2, SW, SH, 32, (SH+64+32));
\r
372 //for(short o = 0; o<TILEWH; o++){
\r
375 //if(ypos==1 || (ypos==(BH-SH-1)))delay(500);
\r
376 //if((xpos>(VW-SW-1)) || (xpos<1))delay(500);
\r
378 //mxBitBlt(32, (SH+32), SW, SH, xpos, ypos);
\r
379 mxBitBlt(TILEWH*2, (SH+64+32), SW, SH, TILEWH*2, TILEWH*2);
\r
380 //xpos=ypos=TILEWH*2;
\r
383 if( (xpos>(VW-SW-1)) || (xpos<1)){xdir=-xdir;}
\r
384 if( (ypos>(BH-SH-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change
\r
386 //mxBitBlt(32, (SH+64+32), SW, SH, xpos, ypos);
\r
387 //mxBitBlt(TILEWH*2, (SH+64+32), SW, SH, TILEWH*2, TILEWH*2);
\r
390 if(ch==0x71)break; // 'q'
\r
391 if(ch==0x1b)break; // 'ESC'
\r
394 printf("wwww\nFull Buffer Virtual Resolution: %dx%d\n", VW,BH);
\r
395 printf("Virtual Resolution: %dx%d\n", VW,VH);
\r
396 printf("Resolution: %dx%d\n", SW,SH);
\r
397 printf("Mode X Library Version: %d\n", mxGetVersion());
\r
398 printf("bakapi ver. 1.04.09.04\nis made by sparky4
\81i
\81\86\83Ö
\81\85\81j feel free to use it ^^\nLicence: GPL v2\n");
\r