/* Copyright (C) 1998 BJ Eirich (aka vecna) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Lic See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include "mode13h.h" #include "vdriver.h" // ================================= Data ==================================== char *screenr; // realscr char startline=16; // virtual scroll around 240 vert. pixels extern unsigned char* translucency_table; //zero extern void *valloc(int amount, char*, int); extern int vfree(void *); extern void CheckTimerStuff(); // in maped.c // ================================= Code ==================================== void SetMode(int mode) { REGISTERS r; SET_AX(r, mode); INTERRUPT(0x10, r); } int Mode13hShutdown() { SetMode(0x3); vfree(screen); screen=0; return 0; } int Mode13hShowPage() { int rows; char *s,*d; CheckTimerStuff(); s=screen+(16*tsx)+16; d=screenr; rows=sy; for (; rows; rows--) { memcpy(d,s,sx); s+=tsx; d+=sx; } return 0; } int Mode13hCopySprite(int x, int y, int width, int height, char *src) { char *d; d=screen+(y*tsx)+x; for (; height; height--) { memcpy(d,src,width); src+=width; d+=tsx; } return 0; } int Mode13hCCopySprite(int x,int y,int width,int height,char *src) { int cx1,cy1,cx2,cy2; char *s,*d; int xl,yl,xs,ys; xl=width; yl=height; xs=ys=0; cx1=0; cy1=0; cx2=tsx-1; cy2=tsy-1; if (x>cx2 || y>cy2 || x+xl cx2) xl=cx2-x+1; if (y+yl > cy2) yl=cy2-y+1; if (xcx2 || y>cy2 || x+xl cx2) xl=cx2-x+1; if (y+yl > cy2) yl=cy2-y+1; if (xcx2 || y>cy2 || x cy2) length=cy2-y+1; if (ycx2 || y>cy2 || x+width cx2) width=cx2-x+1; if (x336 || y<0 || y>256) return 0; d=screen+(y*tsx)+x; for (y=0; y<8; y++) { d[0]=c; d[2]=c; d[4]=c; d[6]=c; d[8]=c; d[10]=c; d[12]=c; d[14]=c; d+=(tsx+1); d[0]=c; d[2]=c; d[4]=c; d[6]=c; d[8]=c; d[10]=c; d[12]=c; d[14]=c; d+=(tsx-1); } return 0; } int Mode13hClearScreen() { memset(screen,0,76032); return 0; } int Mode13hCopySpriteLucentClip(int x, int y, int width, int height, unsigned char *src) { int cx1,cy1,cx2,cy2; unsigned char *s,*d,c; int xl,yl,xs,ys; cx1=0; cy1=0; cx2=tsx-1; cy2=tsy-1; xl=width; yl=height; xs=ys=0; if (x>cx2 || y>cy2 || x+xl cx2) xl=cx2-x+1; if (y+yl > cy2) yl=cy2-y+1; if (x