Mercurial > hg > forks > pwpunix
view final_isi/wrapper.c @ 71:a87eb778f225
Improvements to the MinGW crossbuild. Should now build with default tools
from Debian mingw packages, though you need Win32 version of libSDL with the
necessary headers and so on in addition. 64-bit builds not tested and
probably won't work. Tested on Debian 7.0, earlier won't work.
binutils-mingw-w64-i686 gcc-mingw-w64-i686 mingw-w64-i686-dev
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 14 Aug 2012 03:08:10 +0300 |
parents | c13a2f8c5b10 |
children | e76a4e19363d |
line wrap: on
line source
#include "wrapper.h" /** conio stuff **/ void gbsound(int ch,int freq) { if(freq)pwplib_sound_nv(ch,freq<<8,pwplib.setup[SETUP_VOLUME]); else pwplib_sound_off(ch); } /** fx stuff **/ void fillbuf(char*d,short w16,int lgt) /* iku */ { short*dd=(short*)d; for(;lgt;lgt--)*dd++=w16; } /** uncrunch **/ /* thedraw uncrunch */ void uncrunch(unsigned char*src,char*dst,int lgt) { char attr=0x07,*nxtlin=dst+160; for(;lgt>0;lgt--){ int c=*src++; if(c>=32){dst[0]=c;dst[1]=attr;dst+=2;}else if(c<16)attr=(attr&0xf0)|c;else if(c<24)attr=(attr&0x8f)|((c-16)<<4);else if(c==24){dst=nxtlin;nxtlin+=160;}else if(c==25){int i=1+*src++; for(;i;i--){dst[0]=32;dst[1]=attr;dst+=2;}lgt--;}else if(c==26){int i=1+src[0],t=src[1];src+=2; for(;i;i--){dst[0]=t;dst[1]=attr;dst+=2;}lgt-=2;} else if(c==27)attr^=0x80; } } int mul32(int a,int b) { return (a*b)>>16; } int attr2dump(char*s0,char*s1,char*d,int lgt,int ander) /* fisi */ { int j; char tmp[80*50];d=tmp;lgt=80*50; tmp[0]=tmp[1]=tmp[2]=tmp[3]=0; for(j = lgt;j;j--)*d++=(*s0++&ander)|*s1++; pwplib.videobuf.d=tmp; pwplib.dump_rast(); } void dumpbuf(char*s,char*d,int lgt) /* iku */ { char*tmp=pwplib.videobuf.d; pwplib.videobuf.d=s; pwplib.dump_rast(); pwplib.videobuf.d=tmp; } int attrdump(char*s,char*d,int howmany) /* fisi */ { dumpbuf(s,d,howmany>>1); } int dump16() /* fisi */ { fprintf(stderr,"dump16\n"); /* fisi */ } int dump216() { fprintf(stderr,"dump216\n"); /* fisi */ } int dumphybrid(uchar*a,uchar*b,uchar*d) /* fisi */ { char tmp[80*50*2];int y=25;d=tmp; for(;y;y--){int x=80; for(;x;x--) { if(*a!=253){d[0]=*a;d[1]=a[1];}else {int z=(b[0]&0xf0)|(b[80]>>4); d[0]=z?220:32;d[1]=z;} a+=2;d+=2;b++; }b+=80;} // pwplib.videobuf.d=tmp; // pwplib.dump_ibm(); } int polytxloop(sint h,char*di,uint x1,sint dx0,sint dx1,char*txr, sint dv,sint du) /* fisi */ { int x0=0,u=0,tpv=0; for(;h>0;h--){ {char*d=di+(x0>>8);int c=(x1>>8)&127,tp=(tpv<<4)&0xf000; if(c>0)for(;c;c--){*d++=txr[(tp>>8)&0xff];tp+=du;}} x0+=dx0;x1+=dx1;di+=80;tpv+=dv;/*dv*/} } void memfill(void *buf, int c, size_t n) { } void txtmode(int mode) { } void picmov(char *a, char *b, int xsize, int xclip, int yclip, int method) { }