Mercurial > hg > forks > 3x666-SDL
annotate 3x666.c @ 8:bbc901af24fb
More cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 15 Mar 2013 05:12:26 +0200 |
parents | 4c1d187d0cf6 |
children | 84d7bc7dfaeb |
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 | 6 #include "config.h" |
7 #include "3xfont.h" | |
8 | |
9 /** typedefs **/ | |
10 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
11 typedef struct |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
12 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
13 signed int x, y, z; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
14 } vec3d; |
0 | 15 |
7 | 16 int TIKLGT; |
17 | |
0 | 18 char *ruutu; |
19 int *mxbuf; | |
20 | |
21 int *ballz; | |
22 | |
23 /**************** tEXT dRAWiNG rOUTiNES ********** | |
24 | |
25 bitmaps are for lamers :) let's use a little 12-segment calculator font... | |
26 ascii chars 32..90, 16 bits per char unpacked -> 114 bytes for the whole | |
27 font ;) let's credit karl/nooon for the original idea. */ | |
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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 106 |
107 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
108 void flashtxt(char *txt) |
0 | 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 | 116 } |
117 | |
118 /*************************** DA PHONGBALL HEAVEN ************** | |
119 | |
120 A short course on phongball theory! | |
121 | |
122 A sphere: x^2+y^2+z^2=R^2 | |
123 | |
124 Diffuse shading: intensity = dotproduct(surfacenormal,lightvector) | |
125 | |
126 (doing this for every drawn point of the surface is sometimes called | |
127 phong shading even if the normals aren't actually interpolated) | |
128 | |
129 For a sphere, a normal vector at a point of the surface == constant * | |
130 the coordinates of the point (if center == origo). | |
131 | |
132 Thus, the function for the intensity of a 2d-projected phongball can be | |
133 stated as | |
134 | |
135 intensity(x,y) = l.x*x + l.y*y + l.z*z, z = sqrt(R^2-x^2-y^2) | |
136 | |
137 The first two muls can be eliminated easily. (and will be eliminated by | |
138 a good compiler even if you are lazy) | |
139 | |
140 The third mul can be eliminated by approximating l.z*z with a function | |
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 | 143 |
144 ***/ | |
145 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
146 #if (BUFH < BUFW) |
8 | 147 # define maxR (BUFH>>1) |
0 | 148 #else |
8 | 149 # define maxR (BUFW>>1) |
0 | 150 #endif |
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 | 157 |
158 void preball() | |
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 | 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 | 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 | 179 } |
180 | |
181 /** | |
182 The i386 innerloop compiled by gcc sucked a bit so here's another | |
183 one. Hope it runs faster :) I tried to optimize it for the 386, | |
184 maybe 486 (not pentium kos it suxx) | |
185 | |
186 **/ | |
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 | 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 | 196 } |
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 | 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 | 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 | 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 | 220 |
221 /* some extra for freaks: a plasma made with the phongball innerloop :) | |
222 looks ugly. | |
223 | |
224 void drawplasma(char *d,float t) | |
225 { | |
226 int y=BUFH; float u=0,du=500/BUFH; | |
227 | |
228 for(;y;y--){ | |
229 drawball_inloop(d, | |
230 sin(t*0.02+0+u*0.033)*65536*256, | |
231 cos(t*0.04+1+u*0.022)*65536*4096/BUFW, | |
232 -2*cos(t*0.04+1+u*0.022)*65536*4096/(BUFW*BUFW), BUFW); | |
233 d+=BUFW; | |
234 u+=du; | |
235 } | |
236 } | |
237 */ | |
238 | |
239 /************************ oTHA FX ***************/ | |
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 | 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 | 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 | 261 } |
262 | |
263 /***************************************************************/ | |
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 | 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 | 282 } |
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 | 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 | 291 } |
292 | |
293 /************************* MUSiC cODE **************************/ | |
294 | |
295 /* This table was ripped (and reduced and rudely integerized) from the | |
296 Maube tracker by K .. keep on the good work man! ;) */ | |
297 | |
8 | 298 const int noterate[3 * 12] = |
299 { | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
300 1000, 1059, 1122, 1189, 1259, 1334, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
301 1414, 1498, 1587, 1681, 1781, 1887, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
302 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
303 2000, 2118, 2244, 2378, 2519, 2669, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
304 2828, 2996, 3174, 3363, 3563, 3775, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
305 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
306 4000, 4237, 4489, 4756, 5039, 5339, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
307 5656, 5993, 6349, 6727, 7127, 7550 |
0 | 308 }; |
309 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
310 /* 64 bytes of pure musical power ;) |
0 | 311 Originally composed with Scream Tracker. */ |
312 | |
8 | 313 const char basstrak[32] = |
314 { | |
3
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 12, 0, 24, 12, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
318 12, 24, 12, 24, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
319 15, 0, 27, 15, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
320 15, 27, 15, 27, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
321 14, 0, 26, 14, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
322 15, 27, 17, 29 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
323 }; |
0 | 324 |
8 | 325 const char melody[32] = |
326 { | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
327 24, 12, 19, 15, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
328 24, 0, 19, 0, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
329 24, 12, 19, 15, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
330 24, 0, 15, 19, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
331 15, 19, 15, 19, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
332 22, 0, 15, 19, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
333 14, 17, 21, 14, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
334 22, 17, 17, 22 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
335 }; |
0 | 336 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
337 signed int *drum0, *drum1; |
0 | 338 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
339 /* sampling sucks! */ |
0 | 340 void audio_precalcs() |
341 { | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
342 int drumlgt = TIKLGT * ROWTIX * 4; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
343 int *d = drum0 = malloc(drumlgt * sizeof(int)), |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
344 *e = drum1 = malloc(drumlgt * sizeof(int)), i, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
345 vol = 24680, dvol = 35000 / (float) drumlgt; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
346 int o = 0, oo = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
347 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
|
348 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
349 printf("aCtIvATiNg 303 eMuLAtOR\n"); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
350 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
351 for (i = drumlgt; i; i--) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
352 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
353 int u; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
354 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
355 o = (o >> 1) + (rand() % vol) - (rand() % vol); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
356 oo = (oo * 2 + ((rand() % vol) - (rand() % vol))) / 3; |
0 | 357 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
358 o *= sin(a); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
359 oo *= sin(a); |
0 | 360 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
361 u = o * 2; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
362 if (u < -65535) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
363 u = -65535; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
364 if (u > 65535) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
365 u = 65535; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
366 *d++ = (vol * sin((a / 2) + ((float) u) / 80000)); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
367 *e++ = (vol * sin(a + ((float) oo) / 60000)); |
0 | 368 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
369 a += da; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
370 da -= dda; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
371 vol -= dvol; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
372 }} |
0 | 373 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
374 |
0 | 375 /* mixes the next row of music into b */ |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
376 int *audio_mix(void) |
0 | 377 { |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
378 static int rowno = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
379 static signed int delta = -5; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
380 static char ismelody = 0, silend = 0; |
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 int rowlgt = TIKLGT * ROWTIX, i; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
383 int *d = mxbuf, note; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
384 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
385 /* BASS (sawtooth ofcoz) */ |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
386 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
387 *d++ = rowlgt; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
388 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
389 note = basstrak[(rowno >> 1) & 31]; |
0 | 390 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
391 if (!note) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
392 note = basstrak[((rowno >> 1) & 31) - 1]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
393 else if (rowno & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
394 note = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
395 if ((rowno & 3) == 3) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
396 note = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
397 if (note) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
398 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
399 int ps = 16384, dps; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
400 note += delta; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
401 dps = ((noterate[note] << 10) / AUFREQ); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
402 for (i = rowlgt; i; i--) |
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 *d++ = ps; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
405 ps = (ps + dps) & 32767; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
406 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
407 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
408 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
409 for (i = rowlgt; i; i--) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
410 *d++ = 16384; |
0 | 411 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
412 /* MELODY (sawtooth as well :) */ |
0 | 413 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
414 if (!(silend && ((rowno & 63) > 47))) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
415 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
416 if (ismelody) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
417 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
418 d = mxbuf + 1; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
419 if (rowno & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
420 note = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
421 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
422 note = melody[(rowno >> 1) & 31]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
423 if (note) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
424 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
425 int ps = 16384, dps; /* this loop is different */ |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
426 note += delta; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
427 dps = ((noterate[note] << 12) / AUFREQ); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
428 for (i = rowlgt; i; i--) |
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 *d++ += ps; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
431 ps = (ps + dps) & 32767; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
432 } |
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 /* DRUMS (rave on!!!) */ |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
436 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
437 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
438 int *s = drum1; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
439 d = mxbuf + 1; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
440 if (rowno & 4) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
441 s = drum0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
442 s += (rowno & 3) * rowlgt; |
0 | 443 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
444 for (i = rowlgt; i; i--) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
445 *d++ += *s++; |
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 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
448 /* PATTERN SHIFT */ |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
449 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
450 rowno++; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
451 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
452 /* 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
|
453 it's 1024+ bytes for every phukken switch statement! |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
454 in this case we can prefer size to speed, can't we? */ |
0 | 455 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
456 if (!(rowno & 63)) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
457 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
458 int r = rowno >> 6; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
459 if (r == 2) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
460 delta = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
461 if (r == 4) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
462 ismelody = 1; |
8 | 463 if (r == 6 || r == 10) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
464 delta = 5; |
8 | 465 if (r == 7 || r == 11) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
466 silend = 1; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
467 if (r == 8) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
468 delta = silend = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
469 if (r == 12) |
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 rowno = ismelody = silend = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
472 delta = -5; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
473 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
474 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
475 return mxbuf; |
0 | 476 } |
477 | |
478 | |
479 /**************** tEXT gENERATORS eTC ***************/ | |
480 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
481 char skrtxt[] = { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
482 " 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
|
483 "IT'S A STUPID INTRO CALLED 3X666 ! " |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
484 }; |
0 | 485 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
486 |
0 | 487 #define CHTIME 16 |
488 #define CHPSCR 8 | |
489 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
490 void plainscroll(int t) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
491 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
492 int chno = t / CHTIME; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
493 int x = 0 - ((t % CHTIME) * (BUFW / CHPSCR)) / CHTIME; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
494 int h = (abs((t % 48) - 24) * BUFH) / 256, i; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
495 char *c = skrtxt + chno; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
496 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
497 for (i = 0; i < CHPSCR + 1; i++) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
498 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
499 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
|
500 x += BUFW / CHPSCR; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
501 } |
0 | 502 } |
503 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
504 char *lyrix(void) |
0 | 505 { |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
506 static int phinext = 0, philast; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
507 int phiwsty; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
508 char *phiword; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
509 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
510 phiwsty = phinext; |
0 | 511 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
512 if (!phiwsty) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
513 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
514 if (!(rand() & 3)) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
515 phiwsty = 13; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
516 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
517 phiwsty = 1 + (rand() & 1); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
518 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
519 if (phiwsty == 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
520 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
521 char *w[] = { "HERE", "THERE", "NOW", "TOMORROW", "TODAY", "NEVER" }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
522 phiword = w[rand() % 6]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
523 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
524 phinext = 2; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
525 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
526 phinext = 12; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
527 } |
8 | 528 else |
529 if (phiwsty == 2) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
530 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
531 char nx[] = { 5, 10, 7, 3, 11 }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
532 philast = rand() & 1; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
533 if (!philast) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
534 phiword = "YOU"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
535 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
536 phiword = "I"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
537 phinext = nx[rand() % 5]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
538 } |
8 | 539 else |
540 if (phiwsty == 3) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
541 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
542 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
|
543 phiword = w[rand() % 4]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
544 phinext = 7 + (rand() & 4); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
545 } |
8 | 546 else |
547 if (phiwsty == 4) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
548 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
549 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
550 phiword = "YOU"; |
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 phiword = "ME"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
553 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
554 phinext = 6; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
555 else if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
556 phinext = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
557 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
558 phinext = 11; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
559 } |
8 | 560 else |
561 if (phiwsty == 5) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
562 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
563 if (philast) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
564 phiword = "AM"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
565 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
566 phiword = "ARE"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
567 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
568 phinext = 6; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
569 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
570 phinext = 12 + (rand() & 1); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
571 } |
8 | 572 else |
573 if (phiwsty == 6) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
574 { |
8 | 575 char *w[] = { |
576 "FALLING", "THINKING", "DREAMING", "CRYING", | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
577 "LYING", "REACHING", "BREATHING", "BURNING", "RUNNING" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
578 }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
579 phiword = w[rand() % 9]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
580 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
581 phinext = 9; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
582 else if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
583 phinext = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
584 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
585 phinext = 13; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
586 } |
8 | 587 else |
588 if (phiwsty == 7) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
589 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
590 char nx[] = { 8, 4, 12 }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
591 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
592 phiword = "NEED"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
593 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
594 phiword = "WANT"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
595 phinext = nx[rand() % 3]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
596 } |
8 | 597 else |
598 if (phiwsty == 8) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
599 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
600 phiword = "TO"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
601 phinext = 11; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
602 } |
8 | 603 else |
604 if (phiwsty == 9) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
605 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
606 char *w[] = { "DOWN", "OFF", "OUT", "UP", "ABOUT" }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
607 phiword = w[rand() % 5]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
608 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
609 phinext = rand() & 4; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
610 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
611 phinext = 12 + (rand() & 1); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
612 } |
8 | 613 else |
614 if (phiwsty == 10) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
615 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
616 char *w[] = { "CAN", "COULD", "WOULD", "MAY", "MIGHT" }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
617 phiword = w[rand() % 5]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
618 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
619 phinext = 11; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
620 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
621 phinext = 12; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
622 } |
8 | 623 else |
624 if (phiwsty == 11) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
625 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
626 char *w[] = { "SEE", "HEAR", "FEEL", "THINK" }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
627 phiword = w[rand() % 4]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
628 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
629 phinext = 12; |
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 phinext = rand() & 4; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
632 } |
8 | 633 else |
634 if (phiwsty == 12) | |
3
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 char *w[] = { "WHAT", "SOMETHING", "NOTHING", "THINGS", "WHATEVER" }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
637 phiword = w[rand() % 5]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
638 phinext = 2; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
639 } |
8 | 640 else |
641 if (phiwsty == 13) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
642 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
643 phiword = "THE"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
644 phinext = 14; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
645 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
646 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
647 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
648 char *w[] = { "WAY", "EYES", "WORLD", "ROBOT", "FREEDOM", "HATE" }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
649 phiword = w[rand() % 6]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
650 phinext = 0; |
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 return phiword; |
0 | 653 } |
654 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
655 char *dotxtscr(void) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
656 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
657 static int cnt = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
658 cnt++; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
659 if (cnt == 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
660 return "WHERES THE\n" "DESIGN?\n\n" "WHERES THE\n" "ATTITUDE?!"; |
0 | 661 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
662 if (cnt == 2) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
663 return "NOTHING\n" "HAPPENED\n" "IN 1997"; |
0 | 664 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
665 if (cnt == 3) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
666 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
|
667 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
668 if (cnt == 4) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
669 return "IN 1998,\n" "SCENE WILL\n" "DIE !!!!!"; |
0 | 670 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
671 if (cnt == 5) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
672 return "PHONGBALLS\n" "WILL\n" "INVADE\n" "THE WORLD"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
673 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
674 if ((cnt == 6) || (cnt == 7)) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
675 return "HALUU OLLA\n" "APPELSIINI"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
676 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
677 return NULL; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
678 } |
0 | 679 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
680 const char *endscroll = |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
681 "THAT'S ALL\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
682 "FOLKS !\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 "ALL CODING +\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
685 "COMPOSING\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
686 "BY VIZNUT !\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 "WHAT A\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
689 "MARVELOUS\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
690 "PALETTE !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
691 "WHAT A\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
692 "SUPERB TUNE !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
693 "\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
694 "BUT IT'S ALL\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
695 "BELOW 10 KB\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
696 "AND RUNS\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
697 "SMOOTHLY ON\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
698 "A 386\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
699 "\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
700 "GREETINGS TO\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
701 "ALL THE\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
702 "LINUX SCENE !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
703 "\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
704 "LET'S MAKE\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
705 "THIS WORLD A\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
706 "BETTER PLACE\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
707 "TO LIVE IN !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
708 "\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
709 "THIS IS JUST\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
710 "A PIECE OF\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
711 "SHITTY CODE\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
712 "BUT IT'S ALL\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
713 "YOURS !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
714 "\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
715 "RIP OFF\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
716 "EVERYTHING !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
717 "USE IT FOR\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
718 "SOMETHING\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
719 "CREATIVE !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
720 "\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
721 "\n\n\nOCSA 1998"; |
0 | 722 |
723 | |
724 void doendscroll(int t) | |
725 { | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
726 const char *s = endscroll; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
727 int y = BUFH - (BUFH * t / 512), x = BUFW / 24; |
0 | 728 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
729 while (*s) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
730 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
731 if (*s < 32) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
732 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
733 x = BUFW / 24; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
734 y += BUFH / 8; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
735 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
736 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
737 if (y >= 0 - (BUFH / 8) && y < BUFH) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
738 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
739 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
|
740 x += BUFW / 13; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
741 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
742 s++; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
743 } |
0 | 744 } |
745 | |
746 /********************** tHA kORE bEGiNS *********************/ | |
747 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
748 #define BLACKBG 0x0001 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
749 #define FLASHBG 0x0002 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
750 #define OCSALOGO 0x0004 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
751 #define SCROLL0 0x0008 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
752 #define BALLIE 0x0010 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
753 #define BALLJUMPS 0x0020 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
754 #define COUNTAH 0x0040 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
755 #define CHESSBG 0x0080 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
756 #define PLASMABG 0x0100 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
757 #define FLASHTXT 0x0200 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
758 #define TXTSCR 0x0400 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
759 #define ENDSCR 0x0800 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
760 #define DEMOEND 0x1000 |
0 | 761 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
762 const short dezign[] = { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
763 0, BLACKBG | OCSALOGO | SCROLL0, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
764 256, FLASHBG | BALLIE | BALLJUMPS | COUNTAH, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
765 384, BLACKBG | BALLIE | BALLJUMPS | COUNTAH | OCSALOGO, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
766 400, BLACKBG | BALLIE | COUNTAH | OCSALOGO, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
767 416, BLACKBG | BALLIE, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
768 448, BLACKBG | BALLIE | TXTSCR, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
769 512, CHESSBG | BALLIE | BALLJUMPS | TXTSCR, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
770 576, CHESSBG | BALLIE | BALLJUMPS | TXTSCR, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
771 640, CHESSBG | BALLIE | BALLJUMPS | TXTSCR, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
772 704, CHESSBG | BALLIE | BALLJUMPS | TXTSCR, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
773 768, FLASHBG | FLASHTXT, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
774 896, FLASHBG | FLASHTXT | TXTSCR, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
775 962, FLASHBG | FLASHTXT | TXTSCR | BALLIE | BALLJUMPS, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
776 1024, BLACKBG | BALLIE | ENDSCR, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
777 1152, CHESSBG | BALLIE | BALLJUMPS | ENDSCR, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
778 1344, FLASHBG | BALLIE | BALLJUMPS | ENDSCR, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
779 1536, DEMOEND |
0 | 780 }; |
781 | |
782 | |
783 /* don't look at the rest of the code, it just sucks :) */ | |
784 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
785 int main(int argc, char *argv[]) |
0 | 786 { |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
787 vec3d joo; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
788 const int U = BUFW / 40; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
789 int flagz = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
790 const short *dez = dezign; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
791 char *phiword = NULL, *dizainword = NULL; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
792 int flixtim = 0; |
0 | 793 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
794 ruutu = malloc(BUFH * BUFW * sizeof(char)); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
795 preball(); |
0 | 796 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
797 srand((int) time(NULL)); |
0 | 798 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
799 oxl_init_audio(ROWTIX); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
800 TIKLGT = AUFREQ / DEMOHZ; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
801 mxbuf = malloc(MAXROWLGT * sizeof(int)); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
802 audio_precalcs(); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
803 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
804 oxl_init_video(); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
805 oxl_init_timer(); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
806 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
807 setpal(); |
0 | 808 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
809 for (;;) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
810 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
811 int t = oxl_timer(); |
0 | 812 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
813 while ((t / ROWTIX >= *dez) && (flagz & DEMOEND) == 0) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
814 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
815 dez++; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
816 flagz = *dez++; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
817 if (flagz & FLASHTXT) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
818 flixtim = *(dez - 2); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
819 if (flagz & TXTSCR) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
820 dizainword = dotxtscr(); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
821 } |
0 | 822 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
823 if (flagz & FLASHTXT) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
824 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
825 while ((t / ROWTIX) >= flixtim) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
826 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
827 phiword = lyrix(); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
828 flixtim += 4; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
829 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
830 } |
0 | 831 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
832 if (flagz & DEMOEND) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
833 break; |
0 | 834 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
835 if (flagz & BLACKBG) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
836 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
837 memset(ruutu, 0, BUFH * BUFW); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
838 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
839 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
840 if (flagz & FLASHBG) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
841 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
842 unsigned char col = 130 + (t % 48) * 2; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
843 memset(ruutu, col, BUFH * BUFW); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
844 } |
0 | 845 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
846 if (flagz & CHESSBG) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
847 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
848 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
|
849 rotochess(ruutu, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
850 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
|
851 } |
0 | 852 |
853 /* if(flagz&PLASMABG) drawplasma(ruutu,t); */ | |
854 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
855 if (flagz & OCSALOGO) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
856 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
857 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
|
858 U); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
859 drawchar(U * 14, U * 4, phont['C' - 32], U, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
860 U + U * sin(t * 0.11 + 3)); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
861 drawchar(U * 22, U * 4, phont['S' - 32], U, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
862 U + U * sin(t * 0.12 + 3)); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
863 drawchar(U * 30, U * 4, phont['A' - 32], |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
864 U + U * sin(t * 0.13 + 3), U); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
865 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
866 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
867 if (flagz & SCROLL0) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
868 plainscroll(t); |
0 | 869 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
870 if (flagz & BALLIE) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
871 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
872 int zoom; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
873 if (flagz & BALLJUMPS) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
874 zoom = abs((t % 96) - 48); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
875 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
876 zoom = 47; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
877 if (zoom < 0) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
878 zoom = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
879 else if (zoom > 47) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
880 zoom = 47; |
0 | 881 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
882 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
|
883 32000 / balltab[zoom].R); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
884 joo.z <<= 1; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
885 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
886 drawball(ruutu, &joo, zoom); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
887 } |
0 | 888 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
889 if (flagz & FLASHTXT) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
890 flashtxt(phiword); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
891 if (flagz & TXTSCR) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
892 if ((t / ROWTIX) & 2) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
893 drawtxtscr(dizainword); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
894 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
895 if (flagz & ENDSCR) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
896 doendscroll(t - 1024 * ROWTIX); |
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 if (flagz & COUNTAH) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
899 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
900 int n = ((t * 50 / 48) - 256 * 6); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
901 int dis = (rand() % U) >> 1; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
902 if (n > 666) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
903 n = 666; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
904 if (n > 600) |
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 drawchar(U * 12 + dis, (BUFH >> 1) + dis + U * 6, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
907 phont['X' - 32], U, U); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
908 drawchar(U * 22 + dis, (BUFH >> 1) + dis + U * 6, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
909 phont['3' - 32], U, U); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
910 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
911 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
|
912 n /= 10; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
913 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
|
914 n /= 10; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
915 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
|
916 n /= 10; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
917 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
918 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
919 /* blitzz */ |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
920 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
921 oxl_doframe(ruutu); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
922 oxl_doaudio(audio_mix); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
923 while (t == oxl_timer()) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
924 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
925 usleep(250000 / DEMOHZ); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
926 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
927 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
928 oxl_end(); |
0 | 929 } |