]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_vl_1.c
updated the copyleft wwww i am not deAD! i just been 2 busy last 6 monthes
[16.git] / src / lib / 16_vl_1.c
index 0ad220640793ede6f0f82d8b36b2caf91db3086b..df4e1cbc9e6632781642cadec3a94a5bf4b35bb5 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
+ * Copyright (C) 2012-2018 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
  *\r
  * This file is part of Project 16.\r
  *\r
@@ -26,6 +26,8 @@
 #include "src/lib/16_vl.h"\r
 \r
 static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */\r
+//#define VGASTRIDEVARIABLE    vga_state.vga_stride\r
+#define VGASTRIDEVARIABLE      gvar->video.page[0].stridew\r
 \r
 //===========================================================================\r
 \r
@@ -483,6 +485,25 @@ void VL_TestPaletteSet (video_t *v)
                v->fastpalette = false;\r
 }\r
 \r
+/*\r
+==================\r
+=\r
+= VL_ColorBorder\r
+=\r
+==================\r
+*/\r
+\r
+void VL_ColorBorder (int color, video_t *v)\r
+{\r
+       union REGS in, out;\r
+\r
+       in.h.ah = 0x10;\r
+       in.h.al = 0x01;\r
+       in.h.bh = color;\r
+       int86(0x10, &in, &out);\r
+       v->bordercolor = color;\r
+}\r
+\r
 \r
 /*\r
 =============================================================================\r
@@ -507,10 +528,13 @@ void VL_Plot (int x, int y, int color, global_game_variables_t *gvar)
        byte mask;\r
        VCLIPDEF\r
 \r
+       if(!gvar->video.VL_Started) return;\r
+\r
        mask = pclip[x&3];\r
        VGAMAPMASK(mask);\r
        //*(byte far *)MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+(gvar->video.ofs.ylookup[y]+(x>>2))) = color;\r
-       *(byte far *)MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+((y*gvar->video.page[0].stridew)+(x>>2))) = color;\r
+       //*(byte far *)MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+((y*VGASTRIDEVARIABLE)+(x>>2))) = color;\r
+       *(byte far *)MK_FP(SCREENSEG,BDOFSCONV gvar->video.BOFS+((y*VGASTRIDEVARIABLE)+(x>>2))) = color;\r
        VGAMAPMASK(15);\r
 }\r
 \r
@@ -532,13 +556,15 @@ void VL_Hlin      (unsigned x, unsigned y, unsigned width, unsigned color, global_gam
 \r
        LRCLIPDEF\r
 \r
+       if(!gvar->video.VL_Started) return;\r
+\r
        xbyte = x>>2;\r
        leftmask = lclip[x&3];\r
        rightmask = rclip[(x+width-1)&3];\r
        midbytes = ((x+width+3)>>2) - xbyte - 2;\r
 \r
        //dest = MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+gvar->video.ofs.ylookup[y]+xbyte);\r
-       dest = MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+(y*gvar->video.page[0].stridew)+xbyte);\r
+       dest = MK_FP(SCREENSEG,BDOFSCONV gvar->video.BOFS+(y*VGASTRIDEVARIABLE)+xbyte);\r
 \r
        if (midbytes<0)\r
        {\r
@@ -576,16 +602,19 @@ void VL_Vlin      (int x, int y, int height, int color, global_game_variables_t *gvar
        byte    far *dest,mask;\r
        VCLIPDEF\r
 \r
+       if(!gvar->video.VL_Started) return;\r
+\r
        mask = pclip[x&3];\r
        VGAMAPMASK(mask);\r
 \r
        //dest = MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+gvar->video.ofs.ylookup[y]+(x>>2));\r
-       dest = MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+(y*gvar->video.page[0].stridew)+(x>>2));\r
+       dest = MK_FP(SCREENSEG,BDOFSCONV gvar->video.BOFS+(y*VGASTRIDEVARIABLE)+(x>>2));\r
 \r
        while (height--)\r
        {\r
                *dest = color;\r
-               dest += gvar->video.ofs.linewidth;\r
+               //dest += gvar->video.ofs.linewidth;\r
+               dest += VGASTRIDEVARIABLE;\r
        }\r
 \r
        VGAMAPMASK(15);\r
@@ -608,13 +637,16 @@ void VL_Bar (int x, int y, int width, int height, int color, global_game_variabl
 \r
        LRCLIPDEF\r
 \r
+       if(!gvar->video.VL_Started) return;\r
+\r
        leftmask = lclip[x&3];\r
        rightmask = rclip[(x+width-1)&3];\r
        midbytes = ((x+width+3)>>2) - (x>>2) - 2;\r
-       linedelta = gvar->video.ofs.linewidth-(midbytes+1);\r
+       //linedelta = gvar->video.ofs.linewidth-(midbytes+1);\r
+       linedelta = VGASTRIDEVARIABLE-(midbytes+1);\r
 \r
        //dest = MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+gvar->video.ofs.ylookup[y]+(x>>2));\r
-       dest = MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+(y*gvar->video.page[0].stridew)+(x>>2));\r
+       dest = MK_FP(SCREENSEG,BDOFSCONV gvar->video.BOFS+(y*VGASTRIDEVARIABLE)+(x>>2));\r
 \r
        if (midbytes<0)\r
        {\r
@@ -623,7 +655,8 @@ void VL_Bar (int x, int y, int width, int height, int color, global_game_variabl
                while (height--)\r
                {\r
                        *dest = color;\r
-                       dest += gvar->video.ofs.linewidth;\r
+                       //dest += gvar->video.ofs.linewidth;\r
+                       dest += VGASTRIDEVARIABLE;\r
                }\r
                VGAMAPMASK(15);\r
                return;\r
@@ -666,7 +699,7 @@ void VL_MemToScreen (byte far *source, int width, int height, int x, int y, glob
 \r
        width>>=2;\r
        //dest = MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+gvar->video.ofs.ylookup[y]+(x>>2));\r
-       dest = MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+(y*gvar->video.page[0].stridew)+(x>>2));\r
+       dest = MK_FP(SCREENSEG,BDOFSCONV gvar->video.BOFS+(y*VGASTRIDEVARIABLE)+(x>>2));\r
        mask = 1 << (x&3);\r
 \r
        for     (plane = 0; plane<4; plane++)\r
@@ -677,7 +710,8 @@ void VL_MemToScreen (byte far *source, int width, int height, int x, int y, glob
                        mask = 1;\r
 \r
                screen = dest;\r
-               for     (y=0;y<height;y++,screen+=gvar->video.ofs.linewidth,source+=width)\r
+               //for   (y=0;y<height;y++,screen+=gvar->video.ofs.linewidth,source+=width)\r
+               for     (y=0;y<height;y++,screen+=VGASTRIDEVARIABLE,source+=width)\r
                        _fmemcpy (screen,source,width);\r
        }\r
 }\r