0
|
1 #include "pwpdemo.h"
|
|
2
|
|
3 #include "sprites.h"
|
|
4
|
|
5 /*
|
|
6 void rotozoom(int x0,int y0,
|
|
7 char*map,int dim,int angle,int zoom)
|
|
8 {
|
|
9 int du,dv,u,v,x,y,xdim,ydim;
|
|
10 char*d=pwplib.videobuf.d;
|
|
11
|
|
12 {int xp0,yp0;
|
|
13 dim=(dim*zoom)>>8;
|
|
14
|
|
15 if(x0+dim>pwplib.videobuf.width)
|
|
16 xdim=pwplib.videobuf.width-x0;else xdim=dim;
|
|
17
|
|
18 if(y0+dim>pwplib.videobuf.height)
|
|
19 ydim=pwplib.videobuf.height-y0;else ydim=dim;
|
|
20
|
|
21 if(x0<0){xdim+=x0;xp0=-dim-x0; x0=0;}else xp0=-dim;
|
|
22 if(y0<0){ydim+=y0;yp0=-dim-y0; y0=0;}else yp0=-dim;
|
|
23
|
|
24 if(xdim<=0 || ydim<=0)return;
|
|
25
|
|
26 du=sin(angle/256.0)*zoom;
|
|
27 dv=cos(angle/256.0)*zoom;
|
|
28
|
|
29 u=-du*xp0-dv*yp0;
|
|
30 v=-dv*xp0+du*yp0;
|
|
31 }
|
|
32
|
|
33 {int duo=-dv-du*xdim,
|
|
34 dvo= du-dv*xdim,
|
|
35 mod=pwplib.videobuf.width-xdim;
|
|
36
|
|
37 d+=ydim*pwplib.videobuf.width+xdim;
|
|
38
|
|
39 for(y=ydim;y;y--)
|
|
40 {
|
|
41 for(x=xdim;x;x--)
|
|
42 {
|
|
43 int ptr=(u&~0xff)+(v>>8);
|
|
44
|
|
45 *d=(*d&map[ptr])|map[ptr+128];
|
|
46 d++;
|
|
47 u+=du;
|
|
48 v+=dv;
|
|
49 }
|
|
50
|
|
51 u+=duo;
|
|
52 v+=dvo;
|
|
53 d+=mod;
|
|
54 }
|
|
55 }
|
|
56 }
|
|
57 */
|
|
58
|
|
59 void zoomsprite(int x0,int y0,sprite*sp,int xzoom,int yzoom)
|
|
60 {
|
|
61 int xdim,ydim,
|
65
|
62 xo0=0,yo0=0,x,y;
|
0
|
63
|
|
64 if(xzoom<=32 && yzoom<=32)return;
|
|
65
|
|
66 xdim=(sp->width<<8)/xzoom;
|
|
67 ydim=(sp->height<<8)/yzoom;
|
|
68
|
|
69 x0-=(xdim>>1);
|
|
70 y0-=(ydim>>1);
|
|
71
|
|
72 if(x0<0)
|
|
73 {
|
|
74 xdim+=x0;
|
|
75 xo0=(0-x0)<<8;
|
|
76 x0=0;
|
|
77 }
|
|
78
|
|
79 if(y0<0)
|
|
80 {
|
|
81 ydim+=y0;
|
|
82 yo0=(0-y0)<<8;
|
|
83 y0=0;
|
|
84 }
|
|
85
|
|
86 if(x0+xdim>=pwplib.videobuf.width)
|
|
87 {
|
|
88 xdim=pwplib.videobuf.width-x0;
|
|
89 }
|
|
90
|
|
91 if(y0+ydim>=pwplib.videobuf.height)
|
|
92 {
|
|
93 ydim=pwplib.videobuf.height-y0;
|
|
94 }
|
|
95
|
|
96 if(xdim<=0 || ydim<=0) return;
|
|
97
|
|
98 {u8*d=pwplib.videobuf.d+x0+y0*pwplib.videobuf.width;
|
|
99
|
|
100 for(y=0;y<ydim;y++)
|
|
101 {
|
|
102 int linebase=(yo0>>8)*sp->width;
|
|
103 int xo=xo0;
|
65
|
104 u8*dd=d;
|
0
|
105 for(x=xdim;x;x--)
|
|
106 {
|
|
107 int a=*dd,z=linebase+(xo>>8);
|
|
108 *dd=(a&sp->mask[z])|sp->pict[z];
|
|
109 xo+=xzoom;
|
|
110 dd++;
|
65
|
111 }
|
0
|
112 yo0+=yzoom;
|
|
113 d+=pwplib.videobuf.width;
|
|
114 }}
|
|
115 }
|
|
116
|
|
117 void zoomsprite_gen(int x0,int y0,sprite*sp,int zoom)
|
|
118 {
|
|
119 zoomsprite(((x0+128)*pwplib.videobuf.width)>>8,
|
|
120 ((y0+128)*pwplib.videobuf.height)>>8,
|
|
121 sp,
|
|
122 abs((zoom<<8)/pwplib.videobuf.width),
|
|
123 abs((zoom<<7)/pwplib.videobuf.height)
|
|
124 );
|
|
125 }
|
|
126
|
|
127 void metsae(int t,int mode)
|
|
128 {
|
65
|
129 int i;
|
|
130 sprite*mo[]={&kuusi};
|
0
|
131 const int mosiz[]={128};
|
|
132 const int mostep[]={64};
|
|
133
|
|
134 for(i=0;i<512;i+=mostep[mode])
|
|
135 {
|
|
136 zoomsprite_gen(
|
|
137 ((i-t/3)&511)-256 ,0,mo[mode],mosiz[mode]);
|
|
138 }
|
|
139 }
|
|
140
|
|
141 void drawkiller(int tminus)
|
|
142 {
|
|
143 int ttt=tminus;
|
|
144
|
|
145 if(tminus<-64)tminus=-64;else
|
|
146 if(tminus>0)tminus=0;
|
|
147
|
|
148 zoomsprite_gen(tminus,48,(ttt&16)?&pelustna0:&pelustna1,80);
|
|
149 }
|
|
150
|
|
151 void encounter(int tminus,int kode,int zoom,int speed)
|
|
152 {
|
|
153 int ttt=tminus;
|
|
154 sprite*pum[][2]=
|
|
155 {
|
|
156 &krist0,&krist1,
|
|
157 &pelusieni,&pelusieni,
|
|
158 &pelusieni1,&pelusieni1,
|
|
159 &pelusieni2,&pelusieni2,
|
|
160 &pelux,&pelux,
|
|
161 &pelustna0,&pelustna1,
|
|
162 &ruumis,&ruumis,
|
|
163 &uusmed0,&uusmed1,
|
|
164 &tesno0,&tesno1,
|
|
165 &army0,&army0,
|
|
166 &windows0,&windows1,
|
|
167 &quake0,&quake0
|
|
168 };
|
|
169
|
|
170 if(ttt<0)ttt=0;
|
|
171
|
|
172 zoomsprite_gen(0+ttt,48,(tminus&16)?pum[kode][0]:pum[kode][1],zoom);
|
|
173 }
|
|
174
|
|
175 void pelubounce(int t,int bouncemode)
|
|
176 {
|
65
|
177 /*
|
0
|
178 const unsigned char bfunc[32]={
|
|
179 32,32,32,36,38,40,42,44,50,60,61,62,62,63,63,63,
|
|
180 63,63,63,62,61,60,50,40,32,33,34,35,34,33,32,32
|
|
181 };
|
65
|
182 */
|
|
183 sprite*poo[3]={&peluface0,&peluface1,&peluface2};
|
0
|
184
|
|
185 zoomsprite_gen(0,0,bouncemode?&sieni:poo[(t>>6)%3],40+((t-2560)&63));
|
|
186 }
|
|
187
|
|
188 void blaah(int t)
|
|
189 {
|
|
190 int x0=0,
|
|
191 y0=0,
|
|
192 z0=300+(sin(t/70.8)*300);
|
|
193
|
|
194 zoomsprite_gen(x0,y0,(t&16)?&krist0:&krist1,z0);
|
|
195 }
|
|
196
|
|
197
|
|
198 /*****************************/
|
|
199
|
|
200 /*
|
|
201 for(y=0;y<hg;y++)
|
|
202 {
|
|
203 register int dofz=(hg*64)/(y+3),ofz=t*32-dofz*20-((dofz>>4)*32*256);
|
|
204 {int x=pwplib.videobuf.width;for(;x;x--)*d++=texture1[((ofz+=dofz)>>8)&1023];}
|
|
205 k-=(k>>3);
|
|
206 }
|
|
207 }
|
|
208
|
|
209 */
|