X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_vl_1.c;h=b92bdd14cebc255a279a648e7d182b3c43ca8650;hb=a565be31ce92d6168ae6983042da75b0b683e52b;hp=6956717e946b6deb06efcbfd67f4676a53c6f6e6;hpb=320be82ab5e414d1b771b295403218b614ed9d13;p=16.git diff --git a/src/lib/16_vl_1.c b/src/lib/16_vl_1.c index 6956717e..b92bdd14 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-2019 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,7 +170,7 @@ SetScreen_done: = ==================== */ - +#if 0 void VL_SetLineWidth (unsigned width, global_game_variables_t *gvar) { int i,offset; @@ -190,10 +192,8 @@ void VL_SetLineWidth (unsigned width, global_game_variables_t *gvar) gvar->video.ofs.ylookup[i]=offset; offset += gvar->video.ofs.linewidth; } - gvar->video.ofs.displayofs = 0; - gvar->video.ofs.bufferofs = gvar->video.page[0].width*gvar->video.page[0].height;//gvar->video.page[0].pagesize; } - +#endif /* ============================================================================= @@ -485,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; +} + /* ============================================================================= @@ -504,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); } @@ -524,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; @@ -533,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) { @@ -571,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); @@ -599,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; @@ -607,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) { @@ -621,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; @@ -657,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++) @@ -674,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