comparison 3x666.c @ 3:4dd2b0c81ad2

Cleanups, removing cruft, re-indent.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 15 Mar 2013 05:01:13 +0200
parents 0e4f2da58161
children 4c1d187d0cf6
comparison
equal deleted inserted replaced
2:9d245230df76 3:4dd2b0c81ad2
1 #include "math.h" 1 #include <math.h>
2 #include "stdio.h" 2 #include <stdio.h>
3 #include "stdlib.h" 3 #include <stdlib.h>
4 #include "fcntl.h" 4 #include <unistd.h>
5 #include "unistd.h" 5 #include <string.h>
6 #include "malloc.h"
7 #include "time.h"
8 #include "sys/time.h"
9
10 #include "config.h" 6 #include "config.h"
11 #include "oxl.h"
12 #include "3xfont.h" 7 #include "3xfont.h"
13 8
14 #ifdef __linux__
15 #include "linux/string.h"
16 #else
17 #include "string.h"
18 #endif
19
20 extern int TIKLGT; 9 extern int TIKLGT;
21 10
22 /** typedefs **/ 11 /** typedefs **/
23 12
24 typedef struct { signed int x,y,z; } vec3d; 13 typedef struct
25 14 {
26 /**/ 15 signed int x, y, z;
16 } vec3d;
27 17
28 char *ruutu; 18 char *ruutu;
29 int *mxbuf; 19 int *mxbuf;
30 20
31 int *ballz; 21 int *ballz;
34 24
35 bitmaps are for lamers :) let's use a little 12-segment calculator font... 25 bitmaps are for lamers :) let's use a little 12-segment calculator font...
36 ascii chars 32..90, 16 bits per char unpacked -> 114 bytes for the whole 26 ascii chars 32..90, 16 bits per char unpacked -> 114 bytes for the whole
37 font ;) let's credit karl/nooon for the original idea. */ 27 font ;) let's credit karl/nooon for the original idea. */
38 28
39 void drawseg(int y,int x,int w,int h) 29 void drawseg(int y, int x, int w, int h)
40 { 30 {
41 /* clip clip clip */ 31 /* clip clip clip */
42 if(x+w>BUFW)w=BUFW-x; 32 if (x + w > BUFW)
43 if(x<0){w+=x;x=0;} 33 w = BUFW - x;
44 if(y+h>BUFH)h=BUFH-y; 34 if (x < 0)
45 if(y<0){h+=y;y=0;} 35 {
46 if(w>0)if(h>0){ 36 w += x;
47 char *b=ruutu+y*BUFW+x; 37 x = 0;
48 for(;h;h--){memset(b,122,w);b+=BUFW;} 38 }
49 } } 39 if (y + h > BUFH)
50 40 h = BUFH - y;
51 void drawchar(int x,int y,int c,int xunit,int yunit) 41 if (y < 0)
52 { x-=xunit*2; 42 {
53 y-=yunit*3; 43 h += y;
54 for(;;){ 44 y = 0;
55 if(!c)break; 45 }
56 46 if (w > 0 && h > 0)
57 if(c&1)drawseg(y,x+1, xunit*2-2,yunit); 47 {
58 if(c&2)drawseg(y,x+1+xunit*2,xunit*2-2,yunit); 48 char *b = ruutu + y * BUFW + x;
59 y++; 49 for (; h; h--)
60 50 {
61 c>>=2; 51 memset(b, 122, w);
62 if(!c)break; 52 b += BUFW;
63 53 }
64 if(c&1)drawseg(y,x, xunit,yunit*3-2); 54 }
65 if(c&2)drawseg(y,x+((xunit*3)>>1),xunit,yunit*3-2); 55 }
66 if(c&4)drawseg(y,x+xunit*3,xunit,yunit*3-2); 56
67 57 void drawchar(int x, int y, int c, int xunit, int yunit)
68 y+=yunit*2; 58 {
69 c>>=3; 59 x -= xunit * 2;
70 }} 60 y -= yunit * 3;
71 61 for (;;)
72 void drawtxtscr(char*z) 62 {
73 { 63 if (!c)
74 int x=BUFW>>4,y=BUFH>>3; 64 break;
75 while(*z){ 65
76 if(*z>=32){ 66 if (c & 1)
77 drawchar(x,y,phont[*z-32],BUFW/50,BUFW/80); 67 drawseg(y, x + 1, xunit * 2 - 2, yunit);
78 x+=BUFW/10; 68 if (c & 2)
79 }else{x=BUFW>>4;y+=BUFW/10;} 69 drawseg(y, x + 1 + xunit * 2, xunit * 2 - 2, yunit);
80 z++; 70 y++;
81 } } 71
82 72 c >>= 2;
83 73 if (!c)
84 void flashtxt(char*txt) 74 break;
85 { 75
86 int x=(BUFW>>1)-(strlen(txt)+1)*3*BUFW/80; 76 if (c & 1)
87 while(*txt){ 77 drawseg(y, x, xunit, yunit * 3 - 2);
88 drawchar(x,BUFH>>1,phont[*txt++-32],BUFW/50,BUFW/80); 78 if (c & 2)
89 x+=BUFW/10;} 79 drawseg(y, x + ((xunit * 3) >> 1), xunit, yunit * 3 - 2);
80 if (c & 4)
81 drawseg(y, x + xunit * 3, xunit, yunit * 3 - 2);
82
83 y += yunit * 2;
84 c >>= 3;
85 }
86 }
87
88 void drawtxtscr(char *z)
89 {
90 int x = BUFW >> 4, y = BUFH >> 3;
91 while (*z)
92 {
93 if (*z >= 32)
94 {
95 drawchar(x, y, phont[*z - 32], BUFW / 50, BUFW / 80);
96 x += BUFW / 10;
97 }
98 else
99 {
100 x = BUFW >> 4;
101 y += BUFW / 10;
102 }
103 z++;
104 }
105 }
106
107
108 void flashtxt(char *txt)
109 {
110 int x = (BUFW >> 1) - (strlen(txt) + 1) * 3 * BUFW / 80;
111 while (*txt)
112 {
113 drawchar(x, BUFH >> 1, phont[*txt++ - 32], BUFW / 50, BUFW / 80);
114 x += BUFW / 10;
115 }
90 } 116 }
91 117
92 /*************************** DA PHONGBALL HEAVEN ************** 118 /*************************** DA PHONGBALL HEAVEN **************
93 119
94 A short course on phongball theory! 120 A short course on phongball theory!
111 The first two muls can be eliminated easily. (and will be eliminated by 137 The first two muls can be eliminated easily. (and will be eliminated by
112 a good compiler even if you are lazy) 138 a good compiler even if you are lazy)
113 139
114 The third mul can be eliminated by approximating l.z*z with a function 140 The third mul can be eliminated by approximating l.z*z with a function
115 of the form f(x)=a*x^2+c. This approximation makes the ball look a bit 141 of the form f(x)=a*x^2+c. This approximation makes the ball look a bit
116 "twisty" but who cares, it just looks damn cool ;) 142 "twisty" but who cares, it just looks damn cool ;)
117 143
118 ***/ 144 ***/
119 145
120 #if BUFH<BUFW 146 #if (BUFH < BUFW)
121 #define maxR (BUFH>>1) 147 #define maxR (BUFH>>1)
122 #else 148 #else
123 #define maxR (BUFW>>1) 149 #define maxR (BUFW>>1)
124 #endif 150 #endif
125 151
126 struct{int *tab;signed int R;}balltab[50]; 152 struct
153 {
154 int *tab;
155 signed int R;
156 } balltab[50];
127 157
128 void preball() 158 void preball()
129 { 159 {
130 unsigned int rR; signed int R; 160 unsigned int rR;
131 161 signed int R;
132 for(rR=0;rR<48;rR++){ 162
133 int R2,*d;signed int y; 163 for (rR = 0; rR < 48; rR++)
134 R=(maxR*(rR+4))/52; 164 {
135 if(R<2)R=2; 165 int R2, *d;
136 R2=R*R; 166 signed int y;
137 balltab[rR].R=R; 167 R = (maxR * (rR + 4)) / 52;
138 d=balltab[rR].tab=malloc(R*2*sizeof(int)); 168 if (R < 2)
139 for(y=-R+1;y<R-1;y++)*d++=sqrt(R2-y*y); 169 R = 2;
140 } 170 R2 = R * R;
141 171 balltab[rR].R = R;
142 balltab[49].R=balltab[48].R=balltab[47].R; 172 d = balltab[rR].tab = malloc(R * 2 * sizeof(int));
143 balltab[49].tab=balltab[48].tab=balltab[47].tab; 173 for (y = -R + 1; y < R - 1; y++)
174 *d++ = sqrt(R2 - y * y);
175 }
176
177 balltab[49].R = balltab[48].R = balltab[47].R;
178 balltab[49].tab = balltab[48].tab = balltab[47].tab;
144 } 179 }
145 180
146 /** 181 /**
147 The i386 innerloop compiled by gcc sucked a bit so here's another 182 The i386 innerloop compiled by gcc sucked a bit so here's another
148 one. Hope it runs faster :) I tried to optimize it for the 386, 183 one. Hope it runs faster :) I tried to optimize it for the 386,
149 maybe 486 (not pentium kos it suxx) 184 maybe 486 (not pentium kos it suxx)
150 185
151 **/ 186 **/
152 187
153 inline void drawball_inloop 188 inline void drawball_inloop(char *d, int dotxyz, int ddot, int dddot, int x)
154 (char *d,int dotxyz,int ddot,int dddot,int x) 189 {
155 { 190 for (; x; x--)
156 #if ASMLOOPS==386 191 {
157 192 dotxyz += ddot;
158 __asm__(" 193 ddot += dddot;
159 194 *d++ = dotxyz >> 16;
160 movl %%edx,%%ebp 195 }
161 196 }
162 movl %%ecx,%%eax 197
163 andb $3,%%al 198 void drawball(char *d, vec3d * l, int relR)
164 je 1f 199 {
165 cmpb $1,%%al 200 int R = balltab[relR].R, *s = balltab[relR].tab;
166 je 2f 201
167 cmpb $2,%%al 202 signed int doty = (-(R - 1) * l->y);
168 je 3f 203 signed int y = R * 2 - 2;
169 204
170 4: addl %%ebx,%%ebp 205 d += (BUFW >> 1) - R + ((BUFH >> 1) - R) * BUFW;
171 addl %%ebp,%%esi 206
172 shldl $16,%%esi,%%eax 207 if (y)
173 stosb 208 for (; y; y--)
174 209 {
175 3: addl %%ebx,%%ebp 210 int halfw = *s++;
176 addl %%ebp,%%esi 211 if (halfw)
177 shldl $16,%%esi,%%eax 212 drawball_inloop(d + R - halfw,
178 stosb 213 (doty - (l->x * halfw)) << 8,
179 214 (l->x + l->z) << 8,
180 2: addl %%ebx,%%ebp 215 0 - ((l->z << 8) / halfw), halfw << 1);
181 addl %%ebp,%%esi 216 d += BUFW;
182 shldl $16,%%esi,%%eax 217 doty += l->y;
183 stosb 218 }
184 219 }
185 1: shrl $2,%%ecx
186 je 9f
187 jne 8f
188
189 .align 4
190
191 8: addl %%ebx,%%ebp
192 addl %%ebp,%%esi
193
194 addl %%ebx,%%ebp
195 shldl $24,%%esi,%%edx
196 addl %%ebp,%%esi
197 shldl $24,%%esi,%%eax
198
199 addl %%ebx,%%ebp
200 movb %%dh,%%al
201 addl %%ebp,%%esi
202 stosw
203 shldl $24,%%esi,%%edx
204
205 addl %%ebx,%%ebp
206 addl %%ebp,%%esi
207 shldl $24,%%esi,%%eax
208 movb %%dh,%%al
209
210 decl %%ecx
211 stosw
212 jne 8b
213
214 9:
215 "
216 :: "c"(x),
217 "D"(d),
218
219 "S"(dotxyz),
220 "d"(ddot),
221 "b"(dddot)
222
223 : "ax","bx","cx","dx","si","di","bp");
224
225 #else
226
227 for(;x;x--){
228 dotxyz+=ddot;
229 ddot+=dddot;
230 *d++=dotxyz>>16;}
231
232 #endif
233 }
234
235 void drawball(char *d,vec3d *l,int relR)
236 {
237 int R=balltab[relR].R,*s=balltab[relR].tab;
238
239 signed int doty=(-(R-1)*l->y);
240 signed int y=R*2-2;
241
242 d+=(BUFW>>1)-R+((BUFH>>1)-R)*BUFW;
243
244 if(y)for(;y;y--){
245 int halfw=*s++;
246 if(halfw)
247 drawball_inloop(
248 d+R-halfw,
249 (doty-(l->x*halfw))<<8,
250 (l->x+l->z)<<8,
251 0-((l->z<<8)/halfw),
252 halfw<<1);
253 d+=BUFW;
254 doty+=l->y;
255 } }
256 220
257 /* some extra for freaks: a plasma made with the phongball innerloop :) 221 /* some extra for freaks: a plasma made with the phongball innerloop :)
258 looks ugly. 222 looks ugly.
259 223
260 void drawplasma(char *d,float t) 224 void drawplasma(char *d,float t)
272 } 236 }
273 */ 237 */
274 238
275 /************************ oTHA FX ***************/ 239 /************************ oTHA FX ***************/
276 240
277 void rotochess(char *d,int du,int dv,int iu,int iv) 241 void rotochess(char *d, int du, int dv, int iu, int iv)
278 { 242 {
279 int hu=iu-(dv*(BUFH>>1))-(du*(BUFW>>1)), 243 int hu = iu - (dv * (BUFH >> 1)) - (du * (BUFW >> 1)),
280 hv=iv+(du*(BUFH>>1))-(dv*(BUFW>>1)); 244 hv = iv + (du * (BUFH >> 1)) - (dv * (BUFW >> 1));
281 245
282 #if (ASMLOOPS==386) && (!(BUFW&3)) 246 int y;
283 247 for (y = BUFH; y; y--)
284 __asm__(" 248 {
285 249 {
286 movl %%eax,%%ebp 250 register int u = hu, v = hv, x = BUFW;
287 251 for (; x; x--)
288 1: pushl %%ecx 252 {
289 pushl %%ebx 253 u += du;
290 pushl %%edx 254 v += dv;
291 255 *d++ = ((u ^ v) >> 8) & 0xb1;
292 movl %0,%%ecx 256 }
293 jmp 0f 257 }
294 258 hu += dv;
295 .align 4 259 hv -= du;
296 260 }
297 0: addl %%ebp,%%ebx
298 movb %%bh,%%al
299 addl %%esi,%%edx
300 xorb %%dh,%%al
301
302 addl %%ebp,%%ebx
303 movb %%bh,%%ah
304 addl %%esi,%%edx
305 xorb %%dh,%%ah
306
307 addl %%ebp,%%ebx
308 andl $0xb1b1,%%eax
309 stosw
310 movb %%bh,%%al
311 addl %%esi,%%edx
312 xorb %%dh,%%al
313
314 addl %%ebp,%%ebx
315 movb %%bh,%%ah
316 addl %%esi,%%edx
317 xorb %%dh,%%ah
318 andl $0xb1b1,%%eax
319
320 decl %%ecx
321 stosw
322 jne 0b
323
324 popl %%edx
325 popl %%ebx
326 popl %%ecx
327
328 subl %%ebp,%%edx
329 addl %%esi,%%ebx
330
331 decl %%ecx
332 jne 1b
333 "
334 :: "m"(BUFW/4),
335
336 "c"(BUFH), // ecx == x
337 "D"(d), // edi == *d
338
339 "b"(hu),"a"(du),
340 "d"(hv),"S"(dv)
341
342 : "ax","bx","cx","dx","si","di","bp");
343 d+=BUFW;
344 #else
345 int y;
346 for(y=BUFH;y;y--){
347 {register int u=hu,v=hv,x=BUFW;
348 for(;x;x--){
349 u+=du;v+=dv;*d++=((u^v)>>8)&0xb1;}}
350 hu+=dv;hv-=du;}
351 #endif
352 } 261 }
353 262
354 /***************************************************************/ 263 /***************************************************************/
355 264
356 rgb pal[256],pal2[256]; 265 rgb pal[256], pal2[256];
357 void setpal() 266 void setpal()
358 { 267 {
359 int i,a=3,b=0; 268 int i, a = 3, b = 0;
360 for(i=255;i;i--){ 269 for (i = 255; i; i--)
361 rgb*d=&pal[(i+128)&255]; 270 {
362 d->r=(abs(i-140)>>a)&255; 271 rgb *d = &pal[(i + 128) & 255];
363 d->g=((abs(i-128)>>b)&255)^1; 272 d->r = (abs(i - 140) >> a) & 255;
364 d->b=(abs(i-96)>>b)&255; 273 d->g = ((abs(i - 128) >> b) & 255) ^ 1;
365 if(i==128){a=0;b=1;} 274 d->b = (abs(i - 96) >> b) & 255;
366 } 275 if (i == 128)
367 oxl_setpalette(pal); 276 {
368 } 277 a = 0;
369 278 b = 1;
370 void unitvec(vec3d *v,float a,float b,float c,float m) 279 }
371 { 280 }
372 float cam=cos(a)*m,sam=sin(a)*m,sbcam=sin(b)*cam; 281 oxl_setpalette(pal);
373 282 }
374 v->x=cos(b)*cam; 283
375 v->y=cos(c)*sam-sin(c)*sbcam; 284 void unitvec(vec3d * v, float a, float b, float c, float m)
376 v->z=cos(c)*sbcam+sin(c)*sam; 285 {
286 float cam = cos(a) * m, sam = sin(a) * m, sbcam = sin(b) * cam;
287
288 v->x = cos(b) * cam;
289 v->y = cos(c) * sam - sin(c) * sbcam;
290 v->z = cos(c) * sbcam + sin(c) * sam;
377 } 291 }
378 292
379 /************************* MUSiC cODE **************************/ 293 /************************* MUSiC cODE **************************/
380
381 #if AUDIO
382 294
383 /* This table was ripped (and reduced and rudely integerized) from the 295 /* This table was ripped (and reduced and rudely integerized) from the
384 Maube tracker by K .. keep on the good work man! ;) */ 296 Maube tracker by K .. keep on the good work man! ;) */
385 297
386 const int noterate[3*12] = { 298 const int noterate[3 * 12] = {
387 1000, 1059, 1122, 1189, 1259, 1334, 299 1000, 1059, 1122, 1189, 1259, 1334,
388 1414, 1498, 1587, 1681, 1781, 1887, 300 1414, 1498, 1587, 1681, 1781, 1887,
389 301
390 2000, 2118, 2244, 2378, 2519, 2669, 302 2000, 2118, 2244, 2378, 2519, 2669,
391 2828, 2996, 3174, 3363, 3563, 3775, 303 2828, 2996, 3174, 3363, 3563, 3775,
392 304
393 4000, 4237, 4489, 4756, 5039, 5339, 305 4000, 4237, 4489, 4756, 5039, 5339,
394 5656, 5993, 6349, 6727, 7127, 7550 306 5656, 5993, 6349, 6727, 7127, 7550
395 }; 307 };
396 308
397 /* 64 bytes of pure musical power ;) 309 /* 64 bytes of pure musical power ;)
398 Originally composed with Scream Tracker. */ 310 Originally composed with Scream Tracker. */
399 311
400 const char basstrak[32]={ 312 const char basstrak[32] = {
401 12,0, 24,12, 313 12, 0, 24, 12,
402 12,24,12,24, 314 12, 24, 12, 24,
403 12,0, 24,12, 315 12, 0, 24, 12,
404 12,24,12,24, 316 12, 24, 12, 24,
405 15,0, 27,15, 317 15, 0, 27, 15,
406 15,27,15,27, 318 15, 27, 15, 27,
407 14,0, 26,14, 319 14, 0, 26, 14,
408 15,27,17,29}; 320 15, 27, 17, 29
409 321 };
410 const char melody[32]={ 322
411 24,12,19,15, 323 const char melody[32] = {
412 24,0, 19,0, 324 24, 12, 19, 15,
413 24,12,19,15, 325 24, 0, 19, 0,
414 24,0, 15,19, 326 24, 12, 19, 15,
415 15,19,15,19, 327 24, 0, 15, 19,
416 22,0, 15,19, 328 15, 19, 15, 19,
417 14,17,21,14, 329 22, 0, 15, 19,
418 22,17,17,22}; 330 14, 17, 21, 14,
419 331 22, 17, 17, 22
420 signed int*drum0,*drum1; 332 };
421 333
334 signed int *drum0, *drum1;
335
336 /* sampling sucks! */
422 void audio_precalcs() 337 void audio_precalcs()
423 /* sampling sucks! */ 338 {
424 { 339 int drumlgt = TIKLGT * ROWTIX * 4;
425 int drumlgt=TIKLGT*ROWTIX*4; 340 int *d = drum0 = malloc(drumlgt * sizeof(int)),
426 int *d=drum0=malloc(drumlgt*sizeof(int)), 341 *e = drum1 = malloc(drumlgt * sizeof(int)), i,
427 *e=drum1=malloc(drumlgt*sizeof(int)),i, 342 vol = 24680, dvol = 35000 / (float) drumlgt;
428 vol=24680,dvol=35000/(float)drumlgt; 343 int o = 0, oo = 0;
429 int o=0,oo=0;float a=0,da=386/(float)drumlgt,dda=da/(float)drumlgt; 344 float a = 0, da = 386 / (float) drumlgt, dda = da / (float) drumlgt;
430 345
431 printf("aCtIvATiNg 303 eMuLAtOR\n"); 346 printf("aCtIvATiNg 303 eMuLAtOR\n");
432 347
433 for(i=drumlgt;i;i--){ 348 for (i = drumlgt; i; i--)
434 int u; 349 {
435 350 int u;
436 o=(o>>1)+(rand()%vol)-(rand()%vol); 351
437 oo=(oo*2+((rand()%vol)-(rand()%vol)))/3; 352 o = (o >> 1) + (rand() % vol) - (rand() % vol);
438 353 oo = (oo * 2 + ((rand() % vol) - (rand() % vol))) / 3;
439 o*=sin(a);oo*=sin(a); 354
440 355 o *= sin(a);
441 u=o*2;if(u<-65535)u=-65535;if(u>65535)u=65535; 356 oo *= sin(a);
442 *d++=(vol*sin((a/2)+((float)u)/80000)); 357
443 *e++=(vol*sin(a+((float)oo)/60000)); 358 u = o * 2;
444 359 if (u < -65535)
445 a+=da;da-=dda;vol-=dvol; 360 u = -65535;
446 } } 361 if (u > 65535)
447 362 u = 65535;
448 int*audio_mix(void) 363 *d++ = (vol * sin((a / 2) + ((float) u) / 80000));
364 *e++ = (vol * sin(a + ((float) oo) / 60000));
365
366 a += da;
367 da -= dda;
368 vol -= dvol;
369 }}
370
371
449 /* mixes the next row of music into b */ 372 /* mixes the next row of music into b */
450 { 373 int *audio_mix(void)
451 static int rowno=0; 374 {
452 static signed int delta=-5; 375 static int rowno = 0;
453 static char ismelody=0,silend=0; 376 static signed int delta = -5;
454 377 static char ismelody = 0, silend = 0;
455 int rowlgt=TIKLGT*ROWTIX,i; 378
456 int *d=mxbuf,note; 379 int rowlgt = TIKLGT * ROWTIX, i;
457 380 int *d = mxbuf, note;
458 /* BASS (sawtooth ofcoz) */ 381
459 382 /* BASS (sawtooth ofcoz) */
460 *d++=rowlgt; 383
461 384 *d++ = rowlgt;
462 note=basstrak[(rowno>>1)&31]; 385
463 386 note = basstrak[(rowno >> 1) & 31];
464 if(!note)note=basstrak[((rowno>>1)&31)-1]; 387
465 else if(rowno&1)note=0; 388 if (!note)
466 if((rowno&3)==3)note=0; 389 note = basstrak[((rowno >> 1) & 31) - 1];
467 if(note){ 390 else if (rowno & 1)
468 int ps=16384,dps; 391 note = 0;
469 note+=delta; 392 if ((rowno & 3) == 3)
470 dps=((noterate[note]<<10)/AUFREQ); 393 note = 0;
471 for(i=rowlgt;i;i--){ 394 if (note)
472 *d++=ps;ps=(ps+dps)&32767; } 395 {
473 }else 396 int ps = 16384, dps;
474 for(i=rowlgt;i;i--)*d++=16384; 397 note += delta;
475 398 dps = ((noterate[note] << 10) / AUFREQ);
476 /* MELODY (sawtooth as well :) */ 399 for (i = rowlgt; i; i--)
477 400 {
478 if(!(silend&&((rowno&63)>47))){ 401 *d++ = ps;
479 402 ps = (ps + dps) & 32767;
480 if(ismelody){ 403 }
481 d=mxbuf+1; 404 }
482 if(rowno&1)note=0;else note=melody[(rowno>>1)&31]; 405 else
483 if(note){ 406 for (i = rowlgt; i; i--)
484 int ps=16384,dps; /* this loop is different */ 407 *d++ = 16384;
485 note+=delta; 408
486 dps=((noterate[note]<<12)/AUFREQ); 409 /* MELODY (sawtooth as well :) */
487 for(i=rowlgt;i;i--){ 410
488 *d+++=ps;ps=(ps+dps)&32767;} 411 if (!(silend && ((rowno & 63) > 47)))
489 }} 412 {
490 /* DRUMS (rave on!!!) */ 413 if (ismelody)
491 414 {
492 { 415 d = mxbuf + 1;
493 int *s=drum1;d=mxbuf+1; 416 if (rowno & 1)
494 if(rowno&4)s=drum0; 417 note = 0;
495 s+=(rowno&3)*rowlgt; 418 else
496 419 note = melody[(rowno >> 1) & 31];
497 for(i=rowlgt;i;i--)*d+++=*s++; 420 if (note)
498 } 421 {
499 } 422 int ps = 16384, dps; /* this loop is different */
500 /* PATTERN SHIFT */ 423 note += delta;
501 424 dps = ((noterate[note] << 12) / AUFREQ);
502 rowno++; 425 for (i = rowlgt; i; i--)
503 426 {
504 /* no switch+case? just check out how gcc handles them! 427 *d++ += ps;
505 it's 1024+ bytes for every phukken switch statement! 428 ps = (ps + dps) & 32767;
506 in this case we can prefer size to speed, can't we? */ 429 }
507 430 }
508 if(!(rowno&63)){ 431 }
509 int r=rowno>>6; 432 /* DRUMS (rave on!!!) */
510 if(r==2)delta=0; 433
511 if(r==4)ismelody=1; 434 {
512 if((r==6)||(r==10))delta=5; 435 int *s = drum1;
513 if((r==7)||(r==11))silend=1; 436 d = mxbuf + 1;
514 if(r==8)delta=silend=0; 437 if (rowno & 4)
515 if(r==12){rowno=ismelody=silend=0;delta=-5;} 438 s = drum0;
516 } 439 s += (rowno & 3) * rowlgt;
517 return mxbuf; 440
518 } 441 for (i = rowlgt; i; i--)
519 442 *d++ += *s++;
520 #endif 443 }
444 }
445 /* PATTERN SHIFT */
446
447 rowno++;
448
449 /* no switch+case? just check out how gcc handles them!
450 it's 1024+ bytes for every phukken switch statement!
451 in this case we can prefer size to speed, can't we? */
452
453 if (!(rowno & 63))
454 {
455 int r = rowno >> 6;
456 if (r == 2)
457 delta = 0;
458 if (r == 4)
459 ismelody = 1;
460 if ((r == 6) || (r == 10))
461 delta = 5;
462 if ((r == 7) || (r == 11))
463 silend = 1;
464 if (r == 8)
465 delta = silend = 0;
466 if (r == 12)
467 {
468 rowno = ismelody = silend = 0;
469 delta = -5;
470 }
471 }
472 return mxbuf;
473 }
474
521 475
522 /**************** tEXT gENERATORS eTC ***************/ 476 /**************** tEXT gENERATORS eTC ***************/
523 477
524 char skrtxt[]={ 478 char skrtxt[] = {
525 " HI THERE ! THIS IS THE FIRST OCSA RELEASE FOR LINUX ! " 479 " HI THERE ! THIS IS THE FIRST OCSA RELEASE FOR LINUX ! "
526 "IT'S A STUPID INTRO CALLED 3X666 ! " }; 480 "IT'S A STUPID INTRO CALLED 3X666 ! "
527 481 };
528 void plainscroll(int t) 482
483
529 #define CHTIME 16 484 #define CHTIME 16
530 #define CHPSCR 8 485 #define CHPSCR 8
531 { 486
532 int chno=t/CHTIME; 487 void plainscroll(int t)
533 int x=0-((t%CHTIME)*(BUFW/CHPSCR))/CHTIME; 488 {
534 int h=(abs((t%48)-24)*BUFH)/256,i; 489 int chno = t / CHTIME;
535 char*c=skrtxt+chno; 490 int x = 0 - ((t % CHTIME) * (BUFW / CHPSCR)) / CHTIME;
536 491 int h = (abs((t % 48) - 24) * BUFH) / 256, i;
537 for(i=0;i<CHPSCR+1;i++){ 492 char *c = skrtxt + chno;
538 drawchar(x,(BUFH*3)/4,phont[*c++-32],BUFW/(6*CHPSCR),h); 493
539 x+=BUFW/CHPSCR; 494 for (i = 0; i < CHPSCR + 1; i++)
540 } } 495 {
541 496 drawchar(x, (BUFH * 3) / 4, phont[*c++ - 32], BUFW / (6 * CHPSCR), h);
542 char*lyrix(void) 497 x += BUFW / CHPSCR;
543 { 498 }
544 static int phinext=0,philast; 499 }
545 int phiwsty; 500
546 char*phiword; 501 char *lyrix(void)
547 502 {
548 phiwsty=phinext; 503 static int phinext = 0, philast;
549 504 int phiwsty;
550 if(!phiwsty){ 505 char *phiword;
551 if(!(rand()&3))phiwsty=13; 506
552 else phiwsty=1+(rand()&1); 507 phiwsty = phinext;
553 } 508
554 if(phiwsty==1){ 509 if (!phiwsty)
555 char *w[]={"HERE","THERE","NOW","TOMORROW","TODAY","NEVER"}; 510 {
556 phiword=w[rand()%6]; 511 if (!(rand() & 3))
557 if(rand()&1)phinext=2;else phinext=12; 512 phiwsty = 13;
558 }else 513 else
559 if(phiwsty==2){ 514 phiwsty = 1 + (rand() & 1);
560 char nx[]={5,10,7,3,11}; 515 }
561 philast=rand()&1; 516 if (phiwsty == 1)
562 if(!philast)phiword="YOU";else phiword="I"; 517 {
563 phinext=nx[rand()%5]; 518 char *w[] = { "HERE", "THERE", "NOW", "TOMORROW", "TODAY", "NEVER" };
564 }else 519 phiword = w[rand() % 6];
565 if(phiwsty==3){ 520 if (rand() & 1)
566 char *w[]={"DON'T","CAN'T","WON'T","COULDN'T"}; 521 phinext = 2;
567 phiword=w[rand()%4];phinext=7+(rand()&4); 522 else
568 }else 523 phinext = 12;
569 if(phiwsty==4){ 524 }
570 if(rand()&1)phiword="YOU";else phiword="ME"; 525 else if (phiwsty == 2)
571 if(rand()&1)phinext=6;else if(rand()&1)phinext=0;else phinext=11; 526 {
572 }else 527 char nx[] = { 5, 10, 7, 3, 11 };
573 if(phiwsty==5){ 528 philast = rand() & 1;
574 if(philast)phiword="AM";else phiword="ARE"; 529 if (!philast)
575 if(rand()&1)phinext=6;else phinext=12+(rand()&1); 530 phiword = "YOU";
576 }else 531 else
577 if(phiwsty==6){ 532 phiword = "I";
578 char *w[]={"FALLING","THINKING","DREAMING","CRYING", 533 phinext = nx[rand() % 5];
579 "LYING","REACHING","BREATHING","BURNING","RUNNING"}; 534 }
580 phiword=w[rand()%9]; 535 else if (phiwsty == 3)
581 if(rand()&1)phinext=9;else if(rand()&1)phinext=0;else phinext=13; 536 {
582 }else 537 char *w[] = { "DON'T", "CAN'T", "WON'T", "COULDN'T" };
583 if(phiwsty==7){ 538 phiword = w[rand() % 4];
584 char nx[]={8,4,12}; 539 phinext = 7 + (rand() & 4);
585 if(rand()&1)phiword="NEED";else phiword="WANT"; 540 }
586 phinext=nx[rand()%3]; 541 else if (phiwsty == 4)
587 }else 542 {
588 if(phiwsty==8){phiword="TO";phinext=11; 543 if (rand() & 1)
589 }else 544 phiword = "YOU";
590 if(phiwsty==9){ 545 else
591 char *w[]={"DOWN","OFF","OUT","UP","ABOUT"}; 546 phiword = "ME";
592 phiword=w[rand()%5]; 547 if (rand() & 1)
593 if(rand()&1)phinext=rand()&4;else phinext=12+(rand()&1); 548 phinext = 6;
594 }else 549 else if (rand() & 1)
595 if(phiwsty==10){ 550 phinext = 0;
596 char *w[]={"CAN","COULD","WOULD","MAY","MIGHT"}; 551 else
597 phiword=w[rand()%5]; 552 phinext = 11;
598 if(rand()&1)phinext=11;else phinext=12; 553 }
599 }else 554 else if (phiwsty == 5)
600 if(phiwsty==11){ 555 {
601 char *w[]={"SEE","HEAR","FEEL","THINK"}; 556 if (philast)
602 phiword=w[rand()%4]; 557 phiword = "AM";
603 if(rand()&1)phinext=12;else phinext=rand()&4; 558 else
604 }else 559 phiword = "ARE";
605 if(phiwsty==12){ 560 if (rand() & 1)
606 char *w[]={"WHAT","SOMETHING","NOTHING","THINGS","WHATEVER"}; 561 phinext = 6;
607 phiword=w[rand()%5];phinext=2; 562 else
608 }else 563 phinext = 12 + (rand() & 1);
609 if(phiwsty==13){ 564 }
610 phiword="THE";phinext=14; 565 else if (phiwsty == 6)
611 }else{ 566 {
612 char*w[]={"WAY","EYES","WORLD","ROBOT","FREEDOM","HATE"}; 567 char *w[] = { "FALLING", "THINKING", "DREAMING", "CRYING",
613 phiword=w[rand()%6];phinext=0; 568 "LYING", "REACHING", "BREATHING", "BURNING", "RUNNING"
614 } 569 };
615 return phiword; 570 phiword = w[rand() % 9];
616 } 571 if (rand() & 1)
617 572 phinext = 9;
618 char*dotxtscr(void) 573 else if (rand() & 1)
619 { 574 phinext = 0;
620 static int cnt=0; 575 else
621 cnt++; 576 phinext = 13;
622 if(cnt==1) 577 }
623 return 578 else if (phiwsty == 7)
624 "WHERES THE\n" 579 {
625 "DESIGN?\n\n" 580 char nx[] = { 8, 4, 12 };
626 "WHERES THE\n" 581 if (rand() & 1)
627 "ATTITUDE?!"; 582 phiword = "NEED";
628 583 else
629 if(cnt==2) 584 phiword = "WANT";
630 return 585 phinext = nx[rand() % 3];
631 "NOTHING\n" 586 }
632 "HAPPENED\n" 587 else if (phiwsty == 8)
633 "IN 1997"; 588 {
634 589 phiword = "TO";
635 if(cnt==3) 590 phinext = 11;
636 return 591 }
637 "PERHAPS\n" 592 else if (phiwsty == 9)
638 "IT IS TIME\n" 593 {
639 "FOR A NEW\n" 594 char *w[] = { "DOWN", "OFF", "OUT", "UP", "ABOUT" };
640 "PROPHECY?"; 595 phiword = w[rand() % 5];
641 596 if (rand() & 1)
642 if(cnt==4) 597 phinext = rand() & 4;
643 return 598 else
644 "IN 1998,\n" 599 phinext = 12 + (rand() & 1);
645 "SCENE WILL\n" 600 }
646 "DIE !!!!!"; 601 else if (phiwsty == 10)
647 602 {
648 if(cnt==5) 603 char *w[] = { "CAN", "COULD", "WOULD", "MAY", "MIGHT" };
649 return 604 phiword = w[rand() % 5];
650 "PHONGBALLS\n" 605 if (rand() & 1)
651 "WILL\n" 606 phinext = 11;
652 "INVADE\n" 607 else
653 "THE WORLD"; 608 phinext = 12;
654 609 }
655 if((cnt==6)||(cnt==7)) 610 else if (phiwsty == 11)
656 return 611 {
657 "HALUU OLLA\n" 612 char *w[] = { "SEE", "HEAR", "FEEL", "THINK" };
658 "APPELSIINI"; 613 phiword = w[rand() % 4];
659 614 if (rand() & 1)
660 return NULL; 615 phinext = 12;
661 } 616 else
662 617 phinext = rand() & 4;
663 const char*endscroll= 618 }
664 "THAT'S ALL 619 else if (phiwsty == 12)
665 FOLKS ! 620 {
666 621 char *w[] = { "WHAT", "SOMETHING", "NOTHING", "THINGS", "WHATEVER" };
667 ALL CODING + 622 phiword = w[rand() % 5];
668 COMPOSING 623 phinext = 2;
669 BY VIZNUT ! 624 }
670 625 else if (phiwsty == 13)
671 WHAT A 626 {
672 MARVELOUS 627 phiword = "THE";
673 PALETTE ! 628 phinext = 14;
674 WHAT A 629 }
675 SUPERB TUNE ! 630 else
676 631 {
677 BUT IT'S ALL 632 char *w[] = { "WAY", "EYES", "WORLD", "ROBOT", "FREEDOM", "HATE" };
678 BELOW 10 KB 633 phiword = w[rand() % 6];
679 AND RUNS 634 phinext = 0;
680 SMOOTHLY ON 635 }
681 A 386 636 return phiword;
682 637 }
683 GREETINGS TO 638
684 ALL THE 639 char *dotxtscr(void)
685 LINUX SCENE ! 640 {
686 641 static int cnt = 0;
687 LET'S MAKE 642 cnt++;
688 THIS WORLD A 643 if (cnt == 1)
689 BETTER PLACE 644 return "WHERES THE\n" "DESIGN?\n\n" "WHERES THE\n" "ATTITUDE?!";
690 TO LIVE IN ! 645
691 646 if (cnt == 2)
692 THIS IS JUST 647 return "NOTHING\n" "HAPPENED\n" "IN 1997";
693 A PIECE OF 648
694 SHITTY CODE 649 if (cnt == 3)
695 BUT IT'S ALL 650 return "PERHAPS\n" "IT IS TIME\n" "FOR A NEW\n" "PROPHECY?";
696 YOURS ! 651
697 652 if (cnt == 4)
698 RIP OFF 653 return "IN 1998,\n" "SCENE WILL\n" "DIE !!!!!";
699 EVERYTHING ! 654
700 USE IT FOR 655 if (cnt == 5)
701 SOMETHING 656 return "PHONGBALLS\n" "WILL\n" "INVADE\n" "THE WORLD";
702 CREATIVE ! 657
703 " 658 if ((cnt == 6) || (cnt == 7))
704 659 return "HALUU OLLA\n" "APPELSIINI";
705 "\n\n\nOCSA 1998"; 660
661 return NULL;
662 }
663
664 const char *endscroll =
665 "THAT'S ALL\n"
666 "FOLKS !\n"
667 "\n"
668 "ALL CODING +\n"
669 "COMPOSING\n"
670 "BY VIZNUT !\n"
671 "\n"
672 "WHAT A\n"
673 "MARVELOUS\n"
674 "PALETTE !\n"
675 "WHAT A\n"
676 "SUPERB TUNE !\n"
677 "\n"
678 "BUT IT'S ALL\n"
679 "BELOW 10 KB\n"
680 "AND RUNS\n"
681 "SMOOTHLY ON\n"
682 "A 386\n"
683 "\n"
684 "GREETINGS TO\n"
685 "ALL THE\n"
686 "LINUX SCENE !\n"
687 "\n"
688 "LET'S MAKE\n"
689 "THIS WORLD A\n"
690 "BETTER PLACE\n"
691 "TO LIVE IN !\n"
692 "\n"
693 "THIS IS JUST\n"
694 "A PIECE OF\n"
695 "SHITTY CODE\n"
696 "BUT IT'S ALL\n"
697 "YOURS !\n"
698 "\n"
699 "RIP OFF\n"
700 "EVERYTHING !\n"
701 "USE IT FOR\n"
702 "SOMETHING\n"
703 "CREATIVE !\n"
704 "\n"
705 "\n\n\nOCSA 1998";
706
706 707
707 void doendscroll(int t) 708 void doendscroll(int t)
708 { 709 {
709 const char *s=endscroll; 710 const char *s = endscroll;
710 int y=BUFH-(BUFH*t/512),x=BUFW/24; 711 int y = BUFH - (BUFH * t / 512), x = BUFW / 24;
711 712
712 while(*s){ 713 while (*s)
713 if(*s<32){x=BUFW/24;y+=BUFH/8;}else{ 714 {
714 if(y>=0-(BUFH/8))if(y<BUFH){ 715 if (*s < 32)
715 drawchar(x,y,phont[*s-32],BUFW/60,BUFH/60); 716 {
716 x+=BUFW/13;} 717 x = BUFW / 24;
717 } 718 y += BUFH / 8;
718 s++;} 719 }
720 else
721 if (y >= 0 - (BUFH / 8) && y < BUFH)
722 {
723 drawchar(x, y, phont[*s - 32], BUFW / 60, BUFH / 60);
724 x += BUFW / 13;
725 }
726 s++;
727 }
719 } 728 }
720 729
721 /********************** tHA kORE bEGiNS *********************/ 730 /********************** tHA kORE bEGiNS *********************/
722 731
723 #define BLACKBG 1 732 #define BLACKBG 0x0001
724 #define FLASHBG 2 733 #define FLASHBG 0x0002
725 #define OCSALOGO 4 734 #define OCSALOGO 0x0004
726 #define SCROLL0 8 735 #define SCROLL0 0x0008
727 #define BALLIE 16 736 #define BALLIE 0x0010
728 #define BALLJUMPS 32 737 #define BALLJUMPS 0x0020
729 #define COUNTAH 64 738 #define COUNTAH 0x0040
730 #define CHESSBG 128 739 #define CHESSBG 0x0080
731 #define PLASMABG 256 740 #define PLASMABG 0x0100
732 #define FLASHTXT 512 741 #define FLASHTXT 0x0200
733 #define TXTSCR 1024 742 #define TXTSCR 0x0400
734 #define ENDSCR 2048 743 #define ENDSCR 0x0800
735 #define DEMOEND 4096 744 #define DEMOEND 0x1000
736 745
737 const short dezign[]={ 746 const short dezign[] = {
738 0, BLACKBG|OCSALOGO|SCROLL0, 747 0, BLACKBG | OCSALOGO | SCROLL0,
739 256,FLASHBG|BALLIE|BALLJUMPS|COUNTAH, 748 256, FLASHBG | BALLIE | BALLJUMPS | COUNTAH,
740 384,BLACKBG|BALLIE|BALLJUMPS|COUNTAH|OCSALOGO, 749 384, BLACKBG | BALLIE | BALLJUMPS | COUNTAH | OCSALOGO,
741 400,BLACKBG|BALLIE|COUNTAH|OCSALOGO, 750 400, BLACKBG | BALLIE | COUNTAH | OCSALOGO,
742 416,BLACKBG|BALLIE, 751 416, BLACKBG | BALLIE,
743 448,BLACKBG|BALLIE|TXTSCR, 752 448, BLACKBG | BALLIE | TXTSCR,
744 512,CHESSBG|BALLIE|BALLJUMPS|TXTSCR, 753 512, CHESSBG | BALLIE | BALLJUMPS | TXTSCR,
745 576,CHESSBG|BALLIE|BALLJUMPS|TXTSCR, 754 576, CHESSBG | BALLIE | BALLJUMPS | TXTSCR,
746 640,CHESSBG|BALLIE|BALLJUMPS|TXTSCR, 755 640, CHESSBG | BALLIE | BALLJUMPS | TXTSCR,
747 704,CHESSBG|BALLIE|BALLJUMPS|TXTSCR, 756 704, CHESSBG | BALLIE | BALLJUMPS | TXTSCR,
748 768,FLASHBG|FLASHTXT, 757 768, FLASHBG | FLASHTXT,
749 896,FLASHBG|FLASHTXT|TXTSCR, 758 896, FLASHBG | FLASHTXT | TXTSCR,
750 962,FLASHBG|FLASHTXT|TXTSCR|BALLIE|BALLJUMPS, 759 962, FLASHBG | FLASHTXT | TXTSCR | BALLIE | BALLJUMPS,
751 1024,BLACKBG|BALLIE|ENDSCR, 760 1024, BLACKBG | BALLIE | ENDSCR,
752 1152,CHESSBG|BALLIE|BALLJUMPS|ENDSCR, 761 1152, CHESSBG | BALLIE | BALLJUMPS | ENDSCR,
753 1344,FLASHBG|BALLIE|BALLJUMPS|ENDSCR, 762 1344, FLASHBG | BALLIE | BALLJUMPS | ENDSCR,
754 1536,DEMOEND 763 1536, DEMOEND
755 }; 764 };
756 765
757 766
758 /* don't look at the rest of the code, it just sucks :) */ 767 /* don't look at the rest of the code, it just sucks :) */
759 768
760 void main(void) 769 int main(int argc, char *argv[])
761 { 770 {
762 vec3d joo; 771 vec3d joo;
763 772 const int U = BUFW / 40;
764 int flagz=0;const short*dez=dezign; 773
765 char *phiword=NULL,*dizainword=NULL;int flixtim=0; 774 int flagz = 0;
766 775 const short *dez = dezign;
767 ruutu=malloc(BUFH*BUFW*sizeof(char)); 776 char *phiword = NULL, *dizainword = NULL;
768 preball(); 777 int flixtim = 0;
769 778
770 srand((int)time(NULL)); 779 ruutu = malloc(BUFH * BUFW * sizeof(char));
780 preball();
781
782 srand((int) time(NULL));
771 783
772 #define MAXROWLGT TIKLGT*ROWTIX 784 #define MAXROWLGT TIKLGT*ROWTIX
773 785
774 #if AUDIO!=0 786 oxl_init_audio(ROWTIX);
775 oxl_init_audio(ROWTIX); 787 TIKLGT = AUFREQ / DEMOHZ;
776 TIKLGT=AUFREQ/DEMOHZ; 788 mxbuf = malloc(MAXROWLGT * sizeof(int));
777 mxbuf=malloc(MAXROWLGT*sizeof(int)); 789 audio_precalcs();
778 audio_precalcs(); 790
779 #endif 791 oxl_init_video();
780 792 oxl_init_timer();
781 oxl_init_video(); 793
782 oxl_init_timer(); 794 setpal();
783 795
784 setpal(); 796 for (;;)
785 797 {
786 for(;;){ 798 int t = oxl_timer();
787 int t=oxl_timer(); 799
788 800 while ((t / ROWTIX >= *dez) && (flagz & DEMOEND) == 0)
789 while((t/ROWTIX>=*dez)&&(!(flagz&DEMOEND))) 801 {
790 {dez++;flagz=*dez++; 802 dez++;
791 if(flagz&FLASHTXT)flixtim=*(dez-2); 803 flagz = *dez++;
792 if(flagz&TXTSCR)dizainword=dotxtscr(); 804 if (flagz & FLASHTXT)
793 } 805 flixtim = *(dez - 2);
794 if(flagz&FLASHTXT) 806 if (flagz & TXTSCR)
795 while((t/ROWTIX)>=flixtim){phiword=lyrix();flixtim+=4;} 807 dizainword = dotxtscr();
796 808 }
797 if(flagz&DEMOEND)break; 809
798 810 if (flagz & FLASHTXT)
799 if(flagz&BLACKBG)memset(ruutu,0,BUFH*BUFW);else 811 {
800 if(flagz&FLASHBG) 812 while ((t / ROWTIX) >= flixtim)
801 { unsigned char col=130+(t%48)*2; 813 {
802 #if ASMLOOPS==386 814 phiword = lyrix();
803 /* the original asm/string.h by linus does this with stosb, so */ 815 flixtim += 4;
804 __asm__("rep;stosl"::"D"(ruutu),"c"((BUFH*BUFW)>>2), 816 }
805 "a"(col|(col<<8)|(col<<16)|(col<<24)):"ax","cx","di"); 817 }
806 #else 818
807 memset(ruutu,col,BUFH*BUFW); 819 if (flagz & DEMOEND)
808 #endif 820 break;
809 } 821
810 822 if (flagz & BLACKBG)
811 if(flagz&CHESSBG){int zoom=((10+abs(((t>>1)%96)-48))*4096/BUFW); 823 {
812 rotochess(ruutu, 824 memset(ruutu, 0, BUFH * BUFW);
813 sin(t*0.03)*zoom,cos(t*0.03)*zoom,0,0);} 825 }
826 else
827 if (flagz & FLASHBG)
828 {
829 unsigned char col = 130 + (t % 48) * 2;
830 memset(ruutu, col, BUFH * BUFW);
831 }
832
833 if (flagz & CHESSBG)
834 {
835 int zoom = ((10 + abs(((t >> 1) % 96) - 48)) * 4096 / BUFW);
836 rotochess(ruutu,
837 sin(t * 0.03) * zoom, cos(t * 0.03) * zoom, 0, 0);
838 }
814 839
815 /* if(flagz&PLASMABG) drawplasma(ruutu,t); */ 840 /* if(flagz&PLASMABG) drawplasma(ruutu,t); */
816 841
817 if(flagz&OCSALOGO){ 842 if (flagz & OCSALOGO)
818 #define U (BUFW/40) 843 {
819 drawchar(U*6,U*4,phont['O'-32],U+U*sin(t*0.10+3),U); 844 drawchar(U * 6, U * 4, phont['O' - 32], U + U * sin(t * 0.10 + 3),
820 drawchar(U*14,U*4,phont['C'-32],U,U+U*sin(t*0.11+3)); 845 U);
821 drawchar(U*22,U*4,phont['S'-32],U,U+U*sin(t*0.12+3)); 846 drawchar(U * 14, U * 4, phont['C' - 32], U,
822 drawchar(U*30,U*4,phont['A'-32],U+U*sin(t*0.13+3),U); 847 U + U * sin(t * 0.11 + 3));
823 #undef U 848 drawchar(U * 22, U * 4, phont['S' - 32], U,
824 } 849 U + U * sin(t * 0.12 + 3));
825 850 drawchar(U * 30, U * 4, phont['A' - 32],
826 if(flagz&SCROLL0)plainscroll(t); 851 U + U * sin(t * 0.13 + 3), U);
827 852 }
828 if(flagz&BALLIE){ 853
829 int zoom; 854 if (flagz & SCROLL0)
830 if(flagz&BALLJUMPS)zoom=abs((t%96)-48);else zoom=47; 855 plainscroll(t);
831 if(zoom<0)zoom=0;else if(zoom>47)zoom=47; 856
832 857 if (flagz & BALLIE)
833 unitvec(&joo,0.038*t,0.023*t,0.011*t,32000/balltab[zoom].R); 858 {
834 joo.z<<=1; 859 int zoom;
835 860 if (flagz & BALLJUMPS)
836 drawball(ruutu,&joo,zoom); 861 zoom = abs((t % 96) - 48);
837 } 862 else
838 863 zoom = 47;
839 if(flagz&FLASHTXT)flashtxt(phiword); 864 if (zoom < 0)
840 if(flagz&TXTSCR)if((t/ROWTIX)&2)drawtxtscr(dizainword); 865 zoom = 0;
841 866 else if (zoom > 47)
842 if(flagz&ENDSCR)doendscroll(t-1024*ROWTIX); 867 zoom = 47;
843 868
844 #define U (BUFW/40) 869 unitvec(&joo, 0.038 * t, 0.023 * t, 0.011 * t,
845 if(flagz&COUNTAH) 870 32000 / balltab[zoom].R);
846 {int n=((t*50/48)-256*6); 871 joo.z <<= 1;
847 int dis=(rand()%U)>>1; 872
848 if(n>666)n=666; 873 drawball(ruutu, &joo, zoom);
849 if(n>600){ 874 }
850 drawchar(U*12+dis,(BUFH>>1)+dis+U*6,phont['X'-32],U,U); 875
851 drawchar(U*22+dis,(BUFH>>1)+dis+U*6,phont['3'-32],U,U);} 876 if (flagz & FLASHTXT)
852 drawchar(U*28+dis,BUFH>>1,phont[16+(n%10)],U,U);n/=10; 877 flashtxt(phiword);
853 drawchar(U*18+dis,BUFH>>1,phont[16+(n%10)],U,U);n/=10; 878 if (flagz & TXTSCR)
854 drawchar(U*8+dis,BUFH>>1,phont[16+(n%10)],U,U);n/=10; 879 if ((t / ROWTIX) & 2)
855 } 880 drawtxtscr(dizainword);
856 #undef U 881
857 882 if (flagz & ENDSCR)
858 /* blitzz */ 883 doendscroll(t - 1024 * ROWTIX);
859 884
860 oxl_doframe(ruutu); 885 if (flagz & COUNTAH)
861 #if AUDIO!=0 886 {
862 oxl_doaudio(audio_mix); 887 int n = ((t * 50 / 48) - 256 * 6);
863 #endif 888 int dis = (rand() % U) >> 1;
864 while(t==oxl_timer()){ 889 if (n > 666)
865 #if SLEEPY 890 n = 666;
866 usleep(250000/DEMOHZ); 891 if (n > 600)
867 #endif 892 {
868 } 893 drawchar(U * 12 + dis, (BUFH >> 1) + dis + U * 6,
869 } 894 phont['X' - 32], U, U);
870 oxl_end(); 895 drawchar(U * 22 + dis, (BUFH >> 1) + dis + U * 6,
871 } 896 phont['3' - 32], U, U);
897 }
898 drawchar(U * 28 + dis, BUFH >> 1, phont[16 + (n % 10)], U, U);
899 n /= 10;
900 drawchar(U * 18 + dis, BUFH >> 1, phont[16 + (n % 10)], U, U);
901 n /= 10;
902 drawchar(U * 8 + dis, BUFH >> 1, phont[16 + (n % 10)], U, U);
903 n /= 10;
904 }
905
906 /* blitzz */
907
908 oxl_doframe(ruutu);
909 oxl_doaudio(audio_mix);
910 while (t == oxl_timer())
911 {
912 usleep(250000 / DEMOHZ);
913 }
914 }
915 oxl_end();
916 }