Mercurial > hg > forks > pwpunix
annotate final_isi/wrapper.c @ 83:d419dc43bde4
Implement memfill().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 19 Feb 2013 00:39:41 +0200 |
parents | e76a4e19363d |
children |
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 { | |
75 | 25 char attr=0x07, |
26 *nxtlin = dst + 160; | |
27 | |
28 for(;lgt>0;lgt--) | |
29 { | |
0 | 30 int c=*src++; |
31 if(c>=32){dst[0]=c;dst[1]=attr;dst+=2;}else | |
32 if(c<16)attr=(attr&0xf0)|c;else | |
33 if(c<24)attr=(attr&0x8f)|((c-16)<<4);else | |
34 if(c==24){dst=nxtlin;nxtlin+=160;}else | |
35 if(c==25){int i=1+*src++; | |
36 for(;i;i--){dst[0]=32;dst[1]=attr;dst+=2;}lgt--;}else | |
37 if(c==26){int i=1+src[0],t=src[1];src+=2; | |
38 for(;i;i--){dst[0]=t;dst[1]=attr;dst+=2;}lgt-=2;} | |
39 else if(c==27)attr^=0x80; | |
40 } | |
41 } | |
42 | |
43 int mul32(int a,int b) | |
44 { | |
45 return (a*b)>>16; | |
46 } | |
47 | |
48 int attr2dump(char*s0,char*s1,char*d,int lgt,int ander) /* fisi */ | |
49 { | |
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 int j; |
0 | 51 char tmp[80*50];d=tmp;lgt=80*50; |
52 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
|
53 for(j = lgt;j;j--)*d++=(*s0++&ander)|*s1++; |
0 | 54 pwplib.videobuf.d=tmp; |
55 pwplib.dump_rast(); | |
56 } | |
57 | |
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
|
58 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
|
59 { |
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 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
|
61 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
|
62 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
|
63 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
|
64 } |
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
|
65 |
75 | 66 void attrdump(char*s,char*d,int howmany) /* fisi */ |
0 | 67 { |
68 dumpbuf(s,d,howmany>>1); | |
69 } | |
70 | |
71 int dump16() /* fisi */ | |
72 { | |
73 fprintf(stderr,"dump16\n"); /* fisi */ | |
74 } | |
75 int dump216() | |
76 { | |
77 fprintf(stderr,"dump216\n"); /* fisi */ | |
78 } | |
79 | |
75 | 80 void dumphybrid(uchar*a,uchar*b,uchar*d) /* fisi */ |
0 | 81 { |
82 char tmp[80*50*2];int y=25;d=tmp; | |
83 | |
84 for(;y;y--){int x=80; | |
85 for(;x;x--) | |
86 { | |
87 if(*a!=253){d[0]=*a;d[1]=a[1];}else | |
88 {int z=(b[0]&0xf0)|(b[80]>>4); | |
89 d[0]=z?220:32;d[1]=z;} | |
90 a+=2;d+=2;b++; | |
91 }b+=80;} | |
92 | |
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
|
93 // 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
|
94 // pwplib.dump_ibm(); |
0 | 95 } |
96 | |
75 | 97 void polytxloop(sint h,char*di,uint x1,sint dx0,sint dx1,char*txr, |
0 | 98 sint dv,sint du) /* fisi */ |
99 { | |
100 int x0=0,u=0,tpv=0; | |
101 for(;h>0;h--){ | |
102 {char*d=di+(x0>>8);int c=(x1>>8)&127,tp=(tpv<<4)&0xf000; | |
103 if(c>0)for(;c;c--){*d++=txr[(tp>>8)&0xff];tp+=du;}} | |
104 x0+=dx0;x1+=dx1;di+=80;tpv+=dv;/*dv*/} | |
105 } | |
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
|
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 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
|
108 { |
83 | 109 size_t i; |
110 for (i = 0; i < n; i++) | |
111 ((sint16 *)buf)[i] = c; | |
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
|
112 } |
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 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
|
115 { |
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
|
116 } |
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
|
117 |
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
|
118 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
|
119 { |
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
|
120 } |