X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_vl_1.c;h=df4e1cbc9e6632781642cadec3a94a5bf4b35bb5;hb=6021fc3f27b895d382fbd30488ead35657e39196;hp=7332d5fb5d10795c7a7cb265d50c1036573daba3;hpb=23c4d02d9d36e5c5aa030fa5d1413d1558fc8af0;p=16.git diff --git a/src/lib/16_vl_1.c b/src/lib/16_vl_1.c index 7332d5fb..df4e1cbc 100755 --- a/src/lib/16_vl_1.c +++ b/src/lib/16_vl_1.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover + * Copyright (C) 2012-2018 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover * * This file is part of Project 16. * @@ -26,6 +26,8 @@ #include "src/lib/16_vl.h" static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ +//#define VGASTRIDEVARIABLE vga_state.vga_stride +#define VGASTRIDEVARIABLE gvar->video.page[0].stridew //=========================================================================== @@ -168,8 +170,8 @@ SetScreen_done: = ==================== */ - -void VL_SetLineWidth (unsigned width, ofs_t *ofs) +#if 0 +void VL_SetLineWidth (unsigned width, global_game_variables_t *gvar) { int i,offset; @@ -181,17 +183,17 @@ void VL_SetLineWidth (unsigned width, ofs_t *ofs) // // set up lookup tables // - ofs->linewidth = width*2; + gvar->video.ofs.linewidth = width*2; offset = 0; for (i=0;iylookup[i]=offset; - offset += ofs->linewidth; + gvar->video.ofs.ylookup[i]=offset; + offset += gvar->video.ofs.linewidth; } } - +#endif /* ============================================================================= @@ -483,6 +485,25 @@ void VL_TestPaletteSet (video_t *v) v->fastpalette = false; } +/* +================== += += VL_ColorBorder += +================== +*/ + +void VL_ColorBorder (int color, video_t *v) +{ + union REGS in, out; + + in.h.ah = 0x10; + in.h.al = 0x01; + in.h.bh = color; + int86(0x10, &in, &out); + v->bordercolor = color; +} + /* ============================================================================= @@ -502,14 +523,18 @@ void VL_TestPaletteSet (video_t *v) ================= */ -void VL_Plot (int x, int y, int color, ofs_t *ofs) +void VL_Plot (int x, int y, int color, global_game_variables_t *gvar) { byte mask; VCLIPDEF + if(!gvar->video.VL_Started) return; + mask = pclip[x&3]; VGAMAPMASK(mask); - *(byte far *)MK_FP(SCREENSEG,ofs->bufferofs+(ofs->ylookup[y]+(x>>2))) = color; + //*(byte far *)MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+(gvar->video.ofs.ylookup[y]+(x>>2))) = color; + //*(byte far *)MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+((y*VGASTRIDEVARIABLE)+(x>>2))) = color; + *(byte far *)MK_FP(SCREENSEG,BDOFSCONV gvar->video.BOFS+((y*VGASTRIDEVARIABLE)+(x>>2))) = color; VGAMAPMASK(15); } @@ -522,7 +547,7 @@ void VL_Plot (int x, int y, int color, ofs_t *ofs) ================= */ -void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color, ofs_t *ofs) +void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color, global_game_variables_t *gvar) { unsigned xbyte; byte far *dest; @@ -531,12 +556,15 @@ void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color, ofs_t *ofs LRCLIPDEF + if(!gvar->video.VL_Started) return; + xbyte = x>>2; leftmask = lclip[x&3]; rightmask = rclip[(x+width-1)&3]; midbytes = ((x+width+3)>>2) - xbyte - 2; - dest = MK_FP(SCREENSEG,ofs->bufferofs+ofs->ylookup[y]+xbyte); + //dest = MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+gvar->video.ofs.ylookup[y]+xbyte); + dest = MK_FP(SCREENSEG,BDOFSCONV gvar->video.BOFS+(y*VGASTRIDEVARIABLE)+xbyte); if (midbytes<0) { @@ -569,20 +597,24 @@ void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color, ofs_t *ofs ================= */ -void VL_Vlin (int x, int y, int height, int color, ofs_t *ofs) +void VL_Vlin (int x, int y, int height, int color, global_game_variables_t *gvar) { byte far *dest,mask; VCLIPDEF + if(!gvar->video.VL_Started) return; + mask = pclip[x&3]; VGAMAPMASK(mask); - dest = MK_FP(SCREENSEG,ofs->bufferofs+ofs->ylookup[y]+(x>>2)); + //dest = MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+gvar->video.ofs.ylookup[y]+(x>>2)); + dest = MK_FP(SCREENSEG,BDOFSCONV gvar->video.BOFS+(y*VGASTRIDEVARIABLE)+(x>>2)); while (height--) { *dest = color; - dest += ofs->linewidth; + //dest += gvar->video.ofs.linewidth; + dest += VGASTRIDEVARIABLE; } VGAMAPMASK(15); @@ -597,7 +629,7 @@ void VL_Vlin (int x, int y, int height, int color, ofs_t *ofs) ================= */ -void VL_Bar (int x, int y, int width, int height, int color, ofs_t *ofs) +void VL_Bar (int x, int y, int width, int height, int color, global_game_variables_t *gvar) { byte far *dest; byte leftmask,rightmask; @@ -605,12 +637,16 @@ void VL_Bar (int x, int y, int width, int height, int color, ofs_t *ofs) LRCLIPDEF + if(!gvar->video.VL_Started) return; + leftmask = lclip[x&3]; rightmask = rclip[(x+width-1)&3]; midbytes = ((x+width+3)>>2) - (x>>2) - 2; - linedelta = ofs->linewidth-(midbytes+1); + //linedelta = gvar->video.ofs.linewidth-(midbytes+1); + linedelta = VGASTRIDEVARIABLE-(midbytes+1); - dest = MK_FP(SCREENSEG,ofs->bufferofs+ofs->ylookup[y]+(x>>2)); + //dest = MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+gvar->video.ofs.ylookup[y]+(x>>2)); + dest = MK_FP(SCREENSEG,BDOFSCONV gvar->video.BOFS+(y*VGASTRIDEVARIABLE)+(x>>2)); if (midbytes<0) { @@ -619,7 +655,8 @@ void VL_Bar (int x, int y, int width, int height, int color, ofs_t *ofs) while (height--) { *dest = color; - dest += ofs->linewidth; + //dest += gvar->video.ofs.linewidth; + dest += VGASTRIDEVARIABLE; } VGAMAPMASK(15); return; @@ -655,13 +692,14 @@ void VL_Bar (int x, int y, int width, int height, int color, ofs_t *ofs) ================= */ -void VL_MemToScreen (byte far *source, int width, int height, int x, int y, ofs_t *ofs) +void VL_MemToScreen (byte far *source, int width, int height, int x, int y, global_game_variables_t *gvar) { byte far *screen,far *dest,mask; int plane; width>>=2; - dest = MK_FP(SCREENSEG,ofs->bufferofs+ofs->ylookup[y]+(x>>2) ); + //dest = MK_FP(SCREENSEG,gvar->video.ofs.bufferofs+gvar->video.ofs.ylookup[y]+(x>>2)); + dest = MK_FP(SCREENSEG,BDOFSCONV gvar->video.BOFS+(y*VGASTRIDEVARIABLE)+(x>>2)); mask = 1 << (x&3); for (plane = 0; plane<4; plane++) @@ -672,7 +710,8 @@ void VL_MemToScreen (byte far *source, int width, int height, int x, int y, ofs_ mask = 1; screen = dest; - for (y=0;ylinewidth,source+=width) + //for (y=0;yvideo.ofs.linewidth,source+=width) + for (y=0;y