Mercurial > hg > forks > pwpunix
annotate final_isi/wrapper.c @ 69:c13a2f8c5b10
Rename files and some minor cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 01 Jun 2012 17:41:15 +0300 |
parents | 53676367d46f |
children | e76a4e19363d |
rev | line source |
---|---|
0 | 1 #include "wrapper.h" |
2 | |
3 /** conio stuff **/ | |
4 | |
5 void gbsound(int ch,int freq) | |
6 { | |
51
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
7 if(freq)pwplib_sound_nv(ch,freq<<8,pwplib.setup[SETUP_VOLUME]); |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
8 else pwplib_sound_off(ch); |
0 | 9 } |
10 | |
11 /** fx stuff **/ | |
12 | |
51
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
13 void fillbuf(char*d,short w16,int lgt) /* iku */ |
0 | 14 { |
15 short*dd=(short*)d; | |
16 for(;lgt;lgt--)*dd++=w16; | |
17 } | |
18 | |
19 /** uncrunch **/ | |
20 | |
21 /* thedraw uncrunch */ | |
22 | |
23 void uncrunch(unsigned char*src,char*dst,int lgt) | |
24 { | |
25 char attr=0x07,*nxtlin=dst+160; | |
26 for(;lgt>0;lgt--){ | |
27 int c=*src++; | |
28 if(c>=32){dst[0]=c;dst[1]=attr;dst+=2;}else | |
29 if(c<16)attr=(attr&0xf0)|c;else | |
30 if(c<24)attr=(attr&0x8f)|((c-16)<<4);else | |
31 if(c==24){dst=nxtlin;nxtlin+=160;}else | |
32 if(c==25){int i=1+*src++; | |
33 for(;i;i--){dst[0]=32;dst[1]=attr;dst+=2;}lgt--;}else | |
34 if(c==26){int i=1+src[0],t=src[1];src+=2; | |
35 for(;i;i--){dst[0]=t;dst[1]=attr;dst+=2;}lgt-=2;} | |
36 else if(c==27)attr^=0x80; | |
37 } | |
38 } | |
39 | |
40 int mul32(int a,int b) | |
41 { | |
42 return (a*b)>>16; | |
43 } | |
44 | |
45 int attr2dump(char*s0,char*s1,char*d,int lgt,int ander) /* fisi */ | |
46 { | |
51
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
47 int j; |
0 | 48 char tmp[80*50];d=tmp;lgt=80*50; |
49 tmp[0]=tmp[1]=tmp[2]=tmp[3]=0; | |
51
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
50 for(j = lgt;j;j--)*d++=(*s0++&ander)|*s1++; |
0 | 51 pwplib.videobuf.d=tmp; |
52 pwplib.dump_rast(); | |
53 } | |
54 | |
51
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
55 void dumpbuf(char*s,char*d,int lgt) /* iku */ |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
56 { |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
57 char*tmp=pwplib.videobuf.d; |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
58 pwplib.videobuf.d=s; |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
59 pwplib.dump_rast(); |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
60 pwplib.videobuf.d=tmp; |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
61 } |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
62 |
0 | 63 int attrdump(char*s,char*d,int howmany) /* fisi */ |
64 { | |
65 dumpbuf(s,d,howmany>>1); | |
66 } | |
67 | |
68 int dump16() /* fisi */ | |
69 { | |
70 fprintf(stderr,"dump16\n"); /* fisi */ | |
71 } | |
72 int dump216() | |
73 { | |
74 fprintf(stderr,"dump216\n"); /* fisi */ | |
75 } | |
76 | |
77 int dumphybrid(uchar*a,uchar*b,uchar*d) /* fisi */ | |
78 { | |
79 char tmp[80*50*2];int y=25;d=tmp; | |
80 | |
81 for(;y;y--){int x=80; | |
82 for(;x;x--) | |
83 { | |
84 if(*a!=253){d[0]=*a;d[1]=a[1];}else | |
85 {int z=(b[0]&0xf0)|(b[80]>>4); | |
86 d[0]=z?220:32;d[1]=z;} | |
87 a+=2;d+=2;b++; | |
88 }b+=80;} | |
89 | |
51
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
90 // pwplib.videobuf.d=tmp; |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
91 // pwplib.dump_ibm(); |
0 | 92 } |
93 | |
94 int polytxloop(sint h,char*di,uint x1,sint dx0,sint dx1,char*txr, | |
95 sint dv,sint du) /* fisi */ | |
96 { | |
97 int x0=0,u=0,tpv=0; | |
98 for(;h>0;h--){ | |
99 {char*d=di+(x0>>8);int c=(x1>>8)&127,tp=(tpv<<4)&0xf000; | |
100 if(c>0)for(;c;c--){*d++=txr[(tp>>8)&0xff];tp+=du;}} | |
101 x0+=dx0;x1+=dx1;di+=80;tpv+=dv;/*dv*/} | |
102 } | |
51
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
103 |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
104 void memfill(void *buf, int c, size_t n) |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
105 { |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
106 } |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
107 |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
108 void txtmode(int mode) |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
109 { |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
110 } |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
111 |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
112 void picmov(char *a, char *b, int xsize, int xclip, int yclip, int method) |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
113 { |
53676367d46f
Hack Final Isi to "work", kind of. Requires a nasty hack in pwplib to actually run (without it, it quits abruptly .. not yet sure why.)
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
114 } |