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