]> 4ch.mooo.com Git - 16.git/blobdiff - 16/dos_gfx.cpp
wwww
[16.git] / 16 / dos_gfx.cpp
index cbfa2d61702ef04eaa5aeb1dee463d8cdd7a205a..268b99ae5f9393febd76d0e967ba3a385450f477 100644 (file)
@@ -1,7 +1,8 @@
 //DOS Graphics thingy by sparky4 licence GPL v2\r
 //a special thanks to everyone to release source code for mode X\r
 /*src\lib\*/\r
-#include "dos_gfx.h"\r
+#include "dos_gfx.h"
+//#include "lib\modex16.h" //____\r
 \r
 int old_mode;\r
 //color \82Ä\82·\82Æ\r
@@ -9,7 +10,7 @@ short gq = LGQ;
 \r
 //\82Ä\82·\82Æ\r
 short bakax = 0, bakay = 0;\r
-syte xx = rand()&0%SW, yy = rand()&0%SH, sx = 0, sy = 0;\r
+word xx = rand()&0%SW, yy = rand()&0%SH, sx = 0, sy = 0;\r
 byte coor;\r
 \r
 byte *vga = (byte *) MK_FP(0xA000, 0);\r
@@ -19,7 +20,7 @@ byte *vga = (byte *) MK_FP(0xA000, 0);
  * to be included.\r
  */\r
 #define TESTING\r
-#define TILE\r
+//#define TILE\r
 \r
 /////////////////////////////////////////////////////////////////////////////\r
 //                                                                         //\r
@@ -51,12 +52,24 @@ void setvideo(/*byte mode, */short vq){
                                mxSetVirtualScreen(VW,BH);\r
 //                             mxSetVirtualScreen((640-(TILEWH*4)),(480-(TILEWH*4)));\r
                                mxSetClip(true);\r
-                               mxSetClipRegion(0, 0, VW, BH);
+                               mxSetClipRegion(0, 0, VW, BH);\r
                                mxPan(TILEWH*2,TILEWH*2);\r
                                //mxSetClipRegion(0, VH+1, VW, (TILEWH*BUFFMX));\r
                }\r
 }\r
 \r
+void pdump(){\r
+       int mult=(QUADWH)/2;\r
+       int palq=(mult)*16;\r
+       int palcol=0;\r
+       for(int paly=0; paly<palq; paly+=mult){\r
+               for(int palx=0; palx<palq; palx+=mult){\r
+                               mxFillBox((SW-palq)+palx+32, paly+32, TILEWH, TILEWH, palcol, OP_SET);\r
+                       palcol++;\r
+               }\r
+       }\r
+}\r
+\r
 /////////////////////////////////////////////////////////////////////////////\r
 //                                                                                                                                              //\r
 // cls() - This clears the screen to the specified color, on the VGA or on //\r
@@ -78,7 +91,7 @@ short colortest(){
 \r
 //color \82Ä\82·\82Æ\r
 short colorz(){\r
-               if(gq < HGQ){\r
+               if(gq <= HGQ){\r
 //----           cls(gq, vaddr);\r
                                cls(gq, vga);\r
                                gq++;\r
@@ -115,7 +128,7 @@ short ding(int q){
                ||q==16\r
                ) && gq == BONK){\r
                                                if(coor < HGQ && coor < LGQ) coor = LGQ;\r
-                                               if(coor < HGQ-1){\r
+                                               if(coor < HGQ){\r
                                                                coor++;\r
                                }else{ coor = LGQ;\r
                                                bakax = rand()%3; bakay = rand()%3;\r
@@ -133,7 +146,7 @@ short ding(int q){
                }\r
 \r
                if(q==7||q==9){\r
-                               if(gq < HGQ){\r
+                               if(gq <= HGQ){\r
                                                if(q == 7) ssd(q);\r
                                                if(q == 9){ ssd(q); coor++; }\r
                                                gq++;\r
@@ -245,11 +258,11 @@ short ding(int q){
                                        #endif\r
                                } \r
 \r
-                               if(q==2)
-                               #ifdef TILE
-                                       mxFillBox((rand()*TILEWH)%VW, (rand()*TILEWH)%(VH), TILEWH, TILEWH, 0, OP_SET);
-                               #else
-                                       mxPutPixel(rand()%VW, rand()%(VH), 0);
+                               if(q==2)\r
+                               #ifdef TILE\r
+                                       mxFillBox((rand()*TILEWH)%VW, (rand()*TILEWH)%(VH), TILEWH, TILEWH, 0, OP_SET);\r
+                               #else\r
+                                       mxPutPixel(rand()%VW, rand()%(VH), 0);\r
                                #endif\r
                                if(q==16) mxPutPixel(rand()%VW, rand()%(VH), 0);\r
                                if(q==2||q==4||q==16){ bakax = rand()%3; bakay = rand()%3; }  //random 3 switch\r
@@ -272,7 +285,9 @@ short ding(int q){
  */\r
 \r
 int main(void)\r
-               {\r
+               {
+               //bitmap_t bmp; //____
+               //bmp = modexLoadPcx("chikyuu.pcx"); //____\r
                short key,d,xpos,ypos,xdir,ydir;\r
                int ch=0x0;\r
                // main variables\r
@@ -282,7 +297,10 @@ int main(void)
                ypos=TILEWH*2;\r
                xdir=1;\r
                ydir=1;\r
-               setvideo(1);\r
+               setvideo(1);
+               //modexPalUpdate(bmp.palette); //____
+               //modexDrawBmp(VGA, 0, 0, &bmp, 0); //____
+               //getch(); //____\r
 // screen savers\r
 \r
 /*while(d!=0){ // on!\r
@@ -298,6 +316,7 @@ int main(void)
                                                setvideo(1);\r
                                }\r
                }*/ // else off\r
+               //mxFillBox(0, 0, VW, BH, 10, OP_SET);\r
                while(1){ // conditions of screen saver\r
                while(!kbhit()){\r
                        ding(key);\r
@@ -324,8 +343,9 @@ int main(void)
                                mxPutPixel(0, y, 15);\r
                                mxPutPixel(VW-1, y, 15);\r
                        }\r
-                       \r
-                       getch();*/\r
+                       */\r
+                       pdump();\r
+                       getch();\r
                        //text box\r
                        mxSetTextColor(10, OP_TRANS); //set font\r
                        mxBitBlt(xpos, ypos+(TILEWH*12), SW, TILEWH*BUFFMX, 0, BS); //copy background\r
@@ -340,38 +360,38 @@ int main(void)
                        mxFillBox(xpos+QUADWH, ypos+QUADWH+(TILEWH*12), TILEWH*2, TILEWH*2, 9, OP_SET); //portriat~\r
                        getch();\r
                        mxBitBlt(0, BS, SW, TILEWH*BUFFMX, xpos, ypos+(TILEWH*12)); //copy background\r
-                       //mxBitBlt(0, (TILEWH*12)+1, 320, TILEWH*3, 0, 0);\r
                        getch();\r
                while(!kbhit()){\r
-//                     hScroll(1);\r
-//                     scrolly(1);\r
-//                     vScroll(1);\r
-//                     delay(100);\r
                        //for(int i=0;i<TILEWH;i++){\r
                                \r
                                ding(key);\r
-                               mxPan(xpos,ypos);
-                               mxBitBlt(xpos, ypos, SW, SH, 0, SH);\r
+                               mxPan(xpos,ypos);\r
+mxFillBox(384, 304, 384, 304, 10, OP_SET);\r
+//mxBitBlt(xpos, ypos, SW, SH, 32, (SH+64+32));\r
+mxBitBlt(TILEWH*2, TILEWH*2, SW, SH, 32, (SH+64+32));\r
                                //for(short o = 0; o<TILEWH; o++){\r
                                        xpos+=xdir;\r
                                        ypos+=ydir;\r
-                                       //if(ypos==1 || (ypos==(BH-SH-1)))delay(500);
+                                       //if(ypos==1 || (ypos==(BH-SH-1)))delay(500);\r
                                        //if((xpos>(VW-SW-1)) || (xpos<1))delay(500);\r
-                                       //mxWaitRetrace();
-                                       mxPan(TILEWH*2,TILEWH*2);
-                                       mxBitBlt(0, SH, SW, SH, xpos, ypos);\r
+                                       //mxWaitRetrace();\r
+//mxBitBlt(32, (SH+32), SW, SH, xpos, ypos);\r
+mxBitBlt(TILEWH*2, (SH+64+32), SW, SH, TILEWH*2, TILEWH*2);\r
+//xpos=ypos=TILEWH*2;\r
+mxPan(32,32);\r
                                //}\r
                                if( (xpos>(VW-SW-1))  || (xpos<1)){xdir=-xdir;}\r
                                if( (ypos>(BH-SH-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change\r
-                       //    direction! }
-                       \r
+                       //    direction! }\r
+//mxBitBlt(32, (SH+64+32), SW, SH, xpos, ypos);\r
+//mxBitBlt(TILEWH*2, (SH+64+32), SW, SH, TILEWH*2, TILEWH*2);\r
                        }\r
                        ch=getch();\r
                        if(ch==0x71)break; // 'q'\r
                        if(ch==0x1b)break; // 'ESC'\r
                }\r
                setvideo(0);\r
-               printf("wwww\nFull Buffer Virtual Resolution: %dx%d\n", VW,BH);
+               printf("wwww\nFull Buffer Virtual Resolution: %dx%d\n", VW,BH);\r
                printf("Virtual Resolution: %dx%d\n", VW,VH);\r
                printf("Resolution: %dx%d\n", SW,SH);\r
                printf("Mode X Library Version: %d\n", mxGetVersion());\r