Mercurial > hg > forks > 3x666-SDL
annotate 3x666.c @ 16:e846eda89058
(Re)Set palette when (re)initializing video - aka fs/window.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 15 Mar 2013 18:27:49 +0200 |
parents | e5603b03732b |
children | 972054c118f9 |
rev | line source |
---|---|
9 | 1 #include <SDL.h> |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
2 #include <math.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> |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
6 #include <stdarg.h> |
0 | 7 #include "config.h" |
8 #include "3xfont.h" | |
9 | |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
10 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
11 #if !defined(FALSE) && !defined(TRUE) && !defined(BOOL) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
12 typedef enum { FALSE = 0, TRUE = 1 } BOOL; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
13 #endif |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
14 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
15 #ifndef BOOL |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
16 # ifdef bool |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
17 # define BOOL bool |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
18 # else |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
19 # define BOOL int |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
20 # endif |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
21 #endif |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
22 |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
23 |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
24 struct |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
25 { |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
26 int tickLen; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
27 int frameTime, frameCount, |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
28 startTime, endTime; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
29 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
30 BOOL exitFlag; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
31 |
15 | 32 Sint16 *mixBuf; |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
33 int optVFlags; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
34 SDL_Surface *screen; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
35 SDL_Event event; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
36 SDL_AudioSpec optAfmt; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
37 } engine; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
38 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
39 |
0 | 40 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
41 typedef struct |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
42 { |
9 | 43 int x, y, z; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
44 } vec3d; |
0 | 45 |
7 | 46 |
0 | 47 int *ballz; |
48 | |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
49 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
50 static inline int dmClamp(const int v, const int min, const int max) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
51 { |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
52 return (v < min ? min : (v > max ? max : v)); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
53 } |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
54 |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
55 |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
56 static int engineGetTick() |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
57 { |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
58 return ((engine.frameTime - engine.startTime) * SET_DEMOHZ) / 1000; |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
59 } |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
60 |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
61 |
14 | 62 void dmPrintVA(const char *fmt, va_list ap) |
63 { | |
64 #ifndef __WIN32 | |
65 vfprintf(stderr, fmt, ap); | |
66 #endif | |
67 } | |
68 | |
69 | |
70 void dmPrint(const char *fmt, ...) | |
71 { | |
72 #ifndef __WIN32 | |
73 va_list ap; | |
74 | |
75 va_start(ap, fmt); | |
76 dmPrintVA(fmt, ap); | |
77 va_end(ap); | |
78 #endif | |
79 } | |
80 | |
81 | |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
82 void dmErrorVA(const char *fmt, va_list ap) |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
83 { |
14 | 84 fprintf(stderr, SET_PROG_NAME ": "); |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
85 vfprintf(stderr, fmt, ap); |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
86 } |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
87 |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
88 |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
89 void dmError(const char *fmt, ...) |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
90 { |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
91 va_list ap; |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
92 |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
93 va_start(ap, fmt); |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
94 dmErrorVA(fmt, ap); |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
95 va_end(ap); |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
96 } |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
97 |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
98 |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
99 static BOOL engineInitializeVideo() |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
100 { |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
101 SDL_FreeSurface(engine.screen); |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
102 |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
103 engine.screen = SDL_SetVideoMode(SET_VID_BUFW, SET_VID_BUFH, 8, engine.optVFlags); |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
104 if (engine.screen == NULL) |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
105 { |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
106 dmError("Can't SDL_SetVideoMode(): %s\n", SDL_GetError()); |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
107 return FALSE; |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
108 } |
16
e846eda89058
(Re)Set palette when (re)initializing video - aka fs/window.
Matti Hamalainen <ccr@tnsp.org>
parents:
15
diff
changeset
|
109 |
e846eda89058
(Re)Set palette when (re)initializing video - aka fs/window.
Matti Hamalainen <ccr@tnsp.org>
parents:
15
diff
changeset
|
110 setpal(); |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
111 return TRUE; |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
112 } |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
113 |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
114 |
0 | 115 /**************** tEXT dRAWiNG rOUTiNES ********** |
116 | |
117 bitmaps are for lamers :) let's use a little 12-segment calculator font... | |
118 ascii chars 32..90, 16 bits per char unpacked -> 114 bytes for the whole | |
119 font ;) let's credit karl/nooon for the original idea. */ | |
120 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
121 void drawseg(int y, int x, int w, int h) |
0 | 122 { |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
123 /* clip clip clip */ |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
124 if (x + w > SET_VID_BUFW) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
125 w = SET_VID_BUFW - x; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
126 if (x < 0) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
127 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
128 w += x; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
129 x = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
130 } |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
131 if (y + h > SET_VID_BUFH) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
132 h = SET_VID_BUFH - y; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
133 if (y < 0) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
134 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
135 h += y; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
136 y = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
137 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
138 if (w > 0 && h > 0) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
139 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
140 Uint8 *b = engine.screen->pixels + (y * engine.screen->pitch) + x; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
141 for (; h; h--) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
142 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
143 memset(b, 122, w); |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
144 b += engine.screen->pitch; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
145 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
146 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
147 } |
0 | 148 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
149 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
|
150 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
151 x -= xunit * 2; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
152 y -= yunit * 3; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
153 for (;;) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
154 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
155 if (!c) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
156 break; |
0 | 157 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
158 if (c & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
159 drawseg(y, x + 1, xunit * 2 - 2, yunit); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
160 if (c & 2) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
161 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
|
162 y++; |
0 | 163 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
164 c >>= 2; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
165 if (!c) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
166 break; |
0 | 167 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
168 if (c & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
169 drawseg(y, x, xunit, yunit * 3 - 2); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
170 if (c & 2) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
171 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
|
172 if (c & 4) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
173 drawseg(y, x + xunit * 3, xunit, yunit * 3 - 2); |
0 | 174 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
175 y += yunit * 2; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
176 c >>= 3; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
177 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
178 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
179 |
9 | 180 void drawtxtscr(char *str) |
0 | 181 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
182 int x = SET_VID_BUFW >> 4, y = SET_VID_BUFH >> 3; |
9 | 183 while (*str) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
184 { |
9 | 185 if (*str >= 32) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
186 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
187 drawchar(x, y, phont[*str - 32], SET_VID_BUFW / 50, SET_VID_BUFW / 80); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
188 x += SET_VID_BUFW / 10; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
189 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
190 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
191 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
192 x = SET_VID_BUFW >> 4; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
193 y += SET_VID_BUFW / 10; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
194 } |
9 | 195 str++; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
196 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
197 } |
0 | 198 |
199 | |
9 | 200 void flashtxt(char *str) |
0 | 201 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
202 int x = (SET_VID_BUFW >> 1) - (strlen(str) + 1) * 3 * SET_VID_BUFW / 80; |
9 | 203 while (*str) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
204 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
205 drawchar(x, SET_VID_BUFH >> 1, phont[*str++ - 32], SET_VID_BUFW / 50, SET_VID_BUFW / 80); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
206 x += SET_VID_BUFW / 10; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
207 } |
0 | 208 } |
209 | |
210 /*************************** DA PHONGBALL HEAVEN ************** | |
211 | |
212 A short course on phongball theory! | |
213 | |
214 A sphere: x^2+y^2+z^2=R^2 | |
215 | |
216 Diffuse shading: intensity = dotproduct(surfacenormal,lightvector) | |
217 | |
218 (doing this for every drawn point of the surface is sometimes called | |
219 phong shading even if the normals aren't actually interpolated) | |
220 | |
221 For a sphere, a normal vector at a point of the surface == constant * | |
222 the coordinates of the point (if center == origo). | |
223 | |
224 Thus, the function for the intensity of a 2d-projected phongball can be | |
225 stated as | |
226 | |
227 intensity(x,y) = l.x*x + l.y*y + l.z*z, z = sqrt(R^2-x^2-y^2) | |
228 | |
229 The first two muls can be eliminated easily. (and will be eliminated by | |
230 a good compiler even if you are lazy) | |
231 | |
232 The third mul can be eliminated by approximating l.z*z with a function | |
233 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
|
234 "twisty" but who cares, it just looks damn cool ;) |
0 | 235 |
236 ***/ | |
237 | |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
238 #if (SET_VID_BUFH < SET_VID_BUFW) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
239 # define maxR (SET_VID_BUFH >> 1) |
0 | 240 #else |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
241 # define maxR (SET_VID_BUFW >> 1) |
0 | 242 #endif |
243 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
244 struct |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
245 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
246 int *tab; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
247 signed int R; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
248 } balltab[50]; |
0 | 249 |
250 void preball() | |
251 { | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
252 unsigned int rR; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
253 signed int R; |
0 | 254 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
255 for (rR = 0; rR < 48; rR++) |
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 int R2, *d; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
258 signed int y; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
259 R = (maxR * (rR + 4)) / 52; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
260 if (R < 2) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
261 R = 2; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
262 R2 = R * R; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
263 balltab[rR].R = R; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
264 d = balltab[rR].tab = malloc(R * 2 * sizeof(int)); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
265 for (y = -R + 1; y < R - 1; y++) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
266 *d++ = sqrt(R2 - y * y); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
267 } |
0 | 268 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
269 balltab[49].R = balltab[48].R = balltab[47].R; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
270 balltab[49].tab = balltab[48].tab = balltab[47].tab; |
0 | 271 } |
272 | |
273 | |
9 | 274 void drawball_inloop(Uint8 *d, int dotxyz, int ddot, int dddot, int x) |
0 | 275 { |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
276 for (; x; x--) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
277 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
278 dotxyz += ddot; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
279 ddot += dddot; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
280 *d++ = dotxyz >> 16; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
281 } |
0 | 282 } |
283 | |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
284 void drawball(SDL_Surface *screen, vec3d * l, int relR) |
0 | 285 { |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
286 int R = balltab[relR].R, *s = balltab[relR].tab; |
0 | 287 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
288 signed int doty = (-(R - 1) * l->y); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
289 signed int y = R * 2 - 2; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
290 |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
291 Uint8 *dp = screen->pixels + (SET_VID_BUFW >> 1) - R + ((SET_VID_BUFH >> 1) - R) * screen->pitch; |
0 | 292 |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
293 for (; y; y--) |
9 | 294 { |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
295 int halfw = *s++; |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
296 if (halfw) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
297 { |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
298 drawball_inloop(dp + R - halfw, |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
299 (doty - (l->x * halfw)) << 8, |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
300 (l->x + l->z) << 8, |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
301 0 - ((l->z << 8) / halfw), halfw << 1); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
302 } |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
303 dp += screen->pitch; |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
304 doty += l->y; |
9 | 305 } |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
306 } |
0 | 307 |
308 /* some extra for freaks: a plasma made with the phongball innerloop :) | |
309 looks ugly. | |
310 | |
311 void drawplasma(char *d,float t) | |
312 { | |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
313 int y=SET_VID_BUFH; float u=0,du=500/SET_VID_BUFH; |
0 | 314 |
315 for(;y;y--){ | |
316 drawball_inloop(d, | |
317 sin(t*0.02+0+u*0.033)*65536*256, | |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
318 cos(t*0.04+1+u*0.022)*65536*4096/SET_VID_BUFW, |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
319 -2*cos(t*0.04+1+u*0.022)*65536*4096/(SET_VID_BUFW*SET_VID_BUFW), SET_VID_BUFW); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
320 d+=SET_VID_BUFW; |
0 | 321 u+=du; |
322 } | |
323 } | |
324 */ | |
325 | |
326 /************************ oTHA FX ***************/ | |
327 | |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
328 void rotochess(SDL_Surface *screen, int du, int dv, int iu, int iv) |
0 | 329 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
330 int hu = iu - (dv * (SET_VID_BUFH >> 1)) - (du * (SET_VID_BUFW >> 1)), |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
331 hv = iv + (du * (SET_VID_BUFH >> 1)) - (dv * (SET_VID_BUFW >> 1)); |
0 | 332 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
333 int y; |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
334 Uint8 *dp = screen->pixels; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
335 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
336 for (y = SET_VID_BUFH; y; y--) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
337 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
338 Uint8 *d = dp; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
339 int u = hu, v = hv, x; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
340 for (x = SET_VID_BUFW; x; x--) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
341 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
342 u += du; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
343 v += dv; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
344 *d++ = ((u ^ v) >> 8) & 0xb1; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
345 } |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
346 dp += screen->pitch; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
347 hu += dv; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
348 hv -= du; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
349 } |
0 | 350 } |
351 | |
352 /***************************************************************/ | |
353 | |
9 | 354 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
355 void setpal() |
0 | 356 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
357 SDL_Color pal[SET_VID_COLORS]; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
358 int i, a = 3, b = 0; |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
359 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
360 for (i = 255; i; i--) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
361 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
362 int n = (i + 128) & 255; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
363 pal[n].r = (abs(i - 140) >> a) & 255; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
364 pal[n].g = ((abs(i - 128) >> b) & 255) ^ 1; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
365 pal[n].b = (abs(i - 96) >> b) & 255; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
366 if (i == 128) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
367 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
368 a = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
369 b = 1; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
370 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
371 } |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
372 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
373 SDL_SetColors(engine.screen, pal, 0, SET_VID_COLORS); |
0 | 374 } |
375 | |
9 | 376 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
377 void unitvec(vec3d * v, float a, float b, float c, float m) |
0 | 378 { |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
379 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
|
380 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
381 v->x = cos(b) * cam; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
382 v->y = cos(c) * sam - sin(c) * sbcam; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
383 v->z = cos(c) * sbcam + sin(c) * sam; |
0 | 384 } |
385 | |
386 /************************* MUSiC cODE **************************/ | |
387 | |
388 /* This table was ripped (and reduced and rudely integerized) from the | |
389 Maube tracker by K .. keep on the good work man! ;) */ | |
390 | |
9 | 391 const Sint16 noterate[3 * 12] = |
8 | 392 { |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
393 1000, 1059, 1122, 1189, 1259, 1334, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
394 1414, 1498, 1587, 1681, 1781, 1887, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
395 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
396 2000, 2118, 2244, 2378, 2519, 2669, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
397 2828, 2996, 3174, 3363, 3563, 3775, |
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 4000, 4237, 4489, 4756, 5039, 5339, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
400 5656, 5993, 6349, 6727, 7127, 7550 |
0 | 401 }; |
402 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
403 /* 64 bytes of pure musical power ;) |
0 | 404 Originally composed with Scream Tracker. */ |
405 | |
8 | 406 const char basstrak[32] = |
407 { | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
408 12, 0, 24, 12, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
409 12, 24, 12, 24, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
410 12, 0, 24, 12, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
411 12, 24, 12, 24, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
412 15, 0, 27, 15, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
413 15, 27, 15, 27, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
414 14, 0, 26, 14, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
415 15, 27, 17, 29 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
416 }; |
0 | 417 |
8 | 418 const char melody[32] = |
419 { | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
420 24, 12, 19, 15, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
421 24, 0, 19, 0, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
422 24, 12, 19, 15, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
423 24, 0, 15, 19, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
424 15, 19, 15, 19, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
425 22, 0, 15, 19, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
426 14, 17, 21, 14, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
427 22, 17, 17, 22 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
428 }; |
0 | 429 |
15 | 430 int *drum0, *drum1; |
0 | 431 |
9 | 432 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
433 /* sampling sucks! */ |
0 | 434 void audio_precalcs() |
435 { | |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
436 int drumlgt = engine.tickLen * SET_ROWTIX * 4; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
437 int *d = drum0 = malloc(drumlgt * sizeof(int)), |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
438 *e = drum1 = malloc(drumlgt * sizeof(int)), i, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
439 vol = 24680, dvol = 35000 / (float) drumlgt; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
440 int o = 0, oo = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
441 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
|
442 |
14 | 443 dmPrint("aCtIvATiNg 303 eMuLAtOR\n"); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
444 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
445 for (i = drumlgt; i; i--) |
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 o = (o >> 1) + (rand() % vol) - (rand() % vol); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
448 oo = (oo * 2 + ((rand() % vol) - (rand() % vol))) / 3; |
0 | 449 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
450 o *= sin(a); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
451 oo *= sin(a); |
0 | 452 |
15 | 453 *d++ = (vol * sin((a / 2) + ((float) dmClamp(o * 2, -65535, 65535)) / 80000)); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
454 *e++ = (vol * sin(a + ((float) oo) / 60000)); |
0 | 455 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
456 a += da; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
457 da -= dda; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
458 vol -= dvol; |
9 | 459 } |
460 } | |
0 | 461 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
462 |
15 | 463 static int engineRenderAudio(Sint16 *stream) |
0 | 464 { |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
465 static int rowno = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
466 static signed int delta = -5; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
467 static char ismelody = 0, silend = 0; |
15 | 468 int i, rowlgt = engine.tickLen * SET_ROWTIX; |
469 Sint16 *d = stream, note; | |
3
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 /* BASS (sawtooth ofcoz) */ |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
472 note = basstrak[(rowno >> 1) & 31]; |
0 | 473 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
474 if (!note) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
475 note = basstrak[((rowno >> 1) & 31) - 1]; |
9 | 476 else |
477 if (rowno & 1) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
478 note = 0; |
9 | 479 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
480 if ((rowno & 3) == 3) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
481 note = 0; |
9 | 482 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
483 if (note) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
484 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
485 int ps = 16384, dps; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
486 note += delta; |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
487 dps = ((noterate[note] << 10) / SET_AUDIO_FREQ); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
488 for (i = rowlgt; i; i--) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
489 { |
15 | 490 *d++ = dmClamp(ps, -32767, 32767); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
491 ps = (ps + dps) & 32767; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
492 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
493 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
494 else |
9 | 495 { |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
496 for (i = rowlgt; i; i--) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
497 *d++ = 16384; |
9 | 498 } |
0 | 499 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
500 /* MELODY (sawtooth as well :) */ |
0 | 501 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
502 if (!(silend && ((rowno & 63) > 47))) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
503 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
504 if (ismelody) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
505 { |
15 | 506 d = (Sint16 *) stream; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
507 if (rowno & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
508 note = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
509 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
510 note = melody[(rowno >> 1) & 31]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
511 if (note) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
512 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
513 int ps = 16384, dps; /* this loop is different */ |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
514 note += delta; |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
515 dps = ((noterate[note] << 12) / engine.optAfmt.freq); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
516 for (i = rowlgt; i; i--) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
517 { |
15 | 518 *d++ = dmClamp(ps, -32767, 32767); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
519 ps = (ps + dps) & 32767; |
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 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
522 } |
9 | 523 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
524 /* DRUMS (rave on!!!) */ |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
525 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
526 int *s = drum1; |
15 | 527 d = (Sint16 *) stream; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
528 if (rowno & 4) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
529 s = drum0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
530 s += (rowno & 3) * rowlgt; |
0 | 531 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
532 for (i = rowlgt; i; i--) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
533 *d++ += *s++; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
534 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
535 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
536 /* PATTERN SHIFT */ |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
537 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
538 rowno++; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
539 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
540 /* 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
|
541 it's 1024+ bytes for every phukken switch statement! |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
542 in this case we can prefer size to speed, can't we? */ |
0 | 543 |
9 | 544 if ((rowno & 63) == 0) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
545 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
546 int r = rowno >> 6; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
547 if (r == 2) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
548 delta = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
549 if (r == 4) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
550 ismelody = 1; |
8 | 551 if (r == 6 || r == 10) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
552 delta = 5; |
8 | 553 if (r == 7 || r == 11) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
554 silend = 1; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
555 if (r == 8) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
556 delta = silend = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
557 if (r == 12) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
558 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
559 rowno = ismelody = silend = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
560 delta = -5; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
561 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
562 } |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
563 |
15 | 564 return rowlgt; |
565 } | |
566 | |
567 | |
568 | |
569 static void engineAudioCallback(void *userdata, Uint8 *stream, int len) | |
570 { | |
571 (void) userdata; | |
572 int slen = len / sizeof(Sint16); | |
573 | |
0 | 574 } |
575 | |
576 | |
577 /**************** tEXT gENERATORS eTC ***************/ | |
578 | |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
579 char skrtxt[] = |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
580 { |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
581 " 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
|
582 "IT'S A STUPID INTRO CALLED 3X666 ! " |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
583 }; |
0 | 584 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
585 |
0 | 586 #define CHTIME 16 |
587 #define CHPSCR 8 | |
588 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
589 void plainscroll(int t) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
590 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
591 int chno = t / CHTIME; |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
592 int x = 0 - ((t % CHTIME) * (SET_VID_BUFW / CHPSCR)) / CHTIME; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
593 int h = (abs((t % 48) - 24) * SET_VID_BUFH) / 256, i; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
594 char *c = skrtxt + chno; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
595 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
596 for (i = 0; i < CHPSCR + 1; i++) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
597 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
598 drawchar(x, (SET_VID_BUFH * 3) / 4, phont[*c++ - 32], SET_VID_BUFW / (6 * CHPSCR), h); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
599 x += SET_VID_BUFW / CHPSCR; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
600 } |
0 | 601 } |
602 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
603 char *lyrix(void) |
0 | 604 { |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
605 static int phinext = 0, philast; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
606 int phiwsty; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
607 char *phiword; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
608 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
609 phiwsty = phinext; |
0 | 610 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
611 if (!phiwsty) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
612 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
613 if (!(rand() & 3)) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
614 phiwsty = 13; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
615 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
616 phiwsty = 1 + (rand() & 1); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
617 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
618 if (phiwsty == 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
619 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
620 char *w[] = { "HERE", "THERE", "NOW", "TOMORROW", "TODAY", "NEVER" }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
621 phiword = w[rand() % 6]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
622 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
623 phinext = 2; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
624 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
625 phinext = 12; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
626 } |
8 | 627 else |
628 if (phiwsty == 2) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
629 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
630 char nx[] = { 5, 10, 7, 3, 11 }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
631 philast = rand() & 1; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
632 if (!philast) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
633 phiword = "YOU"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
634 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
635 phiword = "I"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
636 phinext = nx[rand() % 5]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
637 } |
8 | 638 else |
639 if (phiwsty == 3) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
640 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
641 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
|
642 phiword = w[rand() % 4]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
643 phinext = 7 + (rand() & 4); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
644 } |
8 | 645 else |
646 if (phiwsty == 4) | |
3
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 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
649 phiword = "YOU"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
650 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
651 phiword = "ME"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
652 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
653 phinext = 6; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
654 else if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
655 phinext = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
656 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
657 phinext = 11; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
658 } |
8 | 659 else |
660 if (phiwsty == 5) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
661 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
662 if (philast) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
663 phiword = "AM"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
664 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
665 phiword = "ARE"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
666 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
667 phinext = 6; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
668 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
669 phinext = 12 + (rand() & 1); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
670 } |
8 | 671 else |
672 if (phiwsty == 6) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
673 { |
8 | 674 char *w[] = { |
675 "FALLING", "THINKING", "DREAMING", "CRYING", | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
676 "LYING", "REACHING", "BREATHING", "BURNING", "RUNNING" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
677 }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
678 phiword = w[rand() % 9]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
679 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
680 phinext = 9; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
681 else if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
682 phinext = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
683 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
684 phinext = 13; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
685 } |
8 | 686 else |
687 if (phiwsty == 7) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
688 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
689 char nx[] = { 8, 4, 12 }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
690 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
691 phiword = "NEED"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
692 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
693 phiword = "WANT"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
694 phinext = nx[rand() % 3]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
695 } |
8 | 696 else |
697 if (phiwsty == 8) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
698 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
699 phiword = "TO"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
700 phinext = 11; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
701 } |
8 | 702 else |
703 if (phiwsty == 9) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
704 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
705 char *w[] = { "DOWN", "OFF", "OUT", "UP", "ABOUT" }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
706 phiword = w[rand() % 5]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
707 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
708 phinext = rand() & 4; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
709 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
710 phinext = 12 + (rand() & 1); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
711 } |
8 | 712 else |
713 if (phiwsty == 10) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
714 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
715 char *w[] = { "CAN", "COULD", "WOULD", "MAY", "MIGHT" }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
716 phiword = w[rand() % 5]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
717 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
718 phinext = 11; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
719 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
720 phinext = 12; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
721 } |
8 | 722 else |
723 if (phiwsty == 11) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
724 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
725 char *w[] = { "SEE", "HEAR", "FEEL", "THINK" }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
726 phiword = w[rand() % 4]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
727 if (rand() & 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
728 phinext = 12; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
729 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
730 phinext = rand() & 4; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
731 } |
8 | 732 else |
733 if (phiwsty == 12) | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
734 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
735 char *w[] = { "WHAT", "SOMETHING", "NOTHING", "THINGS", "WHATEVER" }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
736 phiword = w[rand() % 5]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
737 phinext = 2; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
738 } |
8 | 739 else |
740 if (phiwsty == 13) | |
3
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 phiword = "THE"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
743 phinext = 14; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
744 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
745 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
746 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
747 char *w[] = { "WAY", "EYES", "WORLD", "ROBOT", "FREEDOM", "HATE" }; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
748 phiword = w[rand() % 6]; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
749 phinext = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
750 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
751 return phiword; |
0 | 752 } |
753 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
754 char *dotxtscr(void) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
755 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
756 static int cnt = 0; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
757 cnt++; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
758 if (cnt == 1) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
759 return "WHERES THE\n" "DESIGN?\n\n" "WHERES THE\n" "ATTITUDE?!"; |
0 | 760 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
761 if (cnt == 2) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
762 return "NOTHING\n" "HAPPENED\n" "IN 1997"; |
0 | 763 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
764 if (cnt == 3) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
765 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
|
766 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
767 if (cnt == 4) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
768 return "IN 1998,\n" "SCENE WILL\n" "DIE !!!!!"; |
0 | 769 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
770 if (cnt == 5) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
771 return "PHONGBALLS\n" "WILL\n" "INVADE\n" "THE WORLD"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
772 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
773 if ((cnt == 6) || (cnt == 7)) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
774 return "HALUU OLLA\n" "APPELSIINI"; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
775 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
776 return NULL; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
777 } |
0 | 778 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
779 const char *endscroll = |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
780 "THAT'S ALL\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
781 "FOLKS !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
782 "\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
783 "ALL CODING +\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
784 "COMPOSING\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
785 "BY VIZNUT !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
786 "\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
787 "WHAT A\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
788 "MARVELOUS\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
789 "PALETTE !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
790 "WHAT A\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
791 "SUPERB TUNE !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
792 "\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
793 "BUT IT'S ALL\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
794 "BELOW 10 KB\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
795 "AND RUNS\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
796 "SMOOTHLY ON\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
797 "A 386\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
798 "\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
799 "GREETINGS TO\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
800 "ALL THE\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
801 "LINUX SCENE !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
802 "\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
803 "LET'S MAKE\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
804 "THIS WORLD A\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
805 "BETTER PLACE\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
806 "TO LIVE IN !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
807 "\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
808 "THIS IS JUST\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
809 "A PIECE OF\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
810 "SHITTY CODE\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
811 "BUT IT'S ALL\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
812 "YOURS !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
813 "\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
814 "RIP OFF\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
815 "EVERYTHING !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
816 "USE IT FOR\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
817 "SOMETHING\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
818 "CREATIVE !\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
819 "\n" |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
820 "\n\n\nOCSA 1998"; |
0 | 821 |
822 | |
823 void doendscroll(int t) | |
824 { | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
825 const char *s = endscroll; |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
826 int y = SET_VID_BUFH - (SET_VID_BUFH * t / 512), x = SET_VID_BUFW / 24; |
0 | 827 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
828 while (*s) |
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 if (*s < 32) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
831 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
832 x = SET_VID_BUFW / 24; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
833 y += SET_VID_BUFH / 8; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
834 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
835 else |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
836 if (y >= 0 - (SET_VID_BUFH / 8) && y < SET_VID_BUFH) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
837 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
838 drawchar(x, y, phont[*s - 32], SET_VID_BUFW / 60, SET_VID_BUFH / 60); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
839 x += SET_VID_BUFW / 13; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
840 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
841 s++; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
842 } |
0 | 843 } |
844 | |
845 /********************** tHA kORE bEGiNS *********************/ | |
846 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
847 #define BLACKBG 0x0001 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
848 #define FLASHBG 0x0002 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
849 #define OCSALOGO 0x0004 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
850 #define SCROLL0 0x0008 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
851 #define BALLIE 0x0010 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
852 #define BALLJUMPS 0x0020 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
853 #define COUNTAH 0x0040 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
854 #define CHESSBG 0x0080 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
855 #define PLASMABG 0x0100 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
856 #define FLASHTXT 0x0200 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
857 #define TXTSCR 0x0400 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
858 #define ENDSCR 0x0800 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
859 #define DEMOEND 0x1000 |
0 | 860 |
14 | 861 const Uint16 dezign[] = { |
9 | 862 0 , BLACKBG | OCSALOGO | SCROLL0, |
863 256 , FLASHBG | BALLIE | BALLJUMPS | COUNTAH, | |
864 384 , BLACKBG | BALLIE | BALLJUMPS | COUNTAH | OCSALOGO, | |
865 400 , BLACKBG | BALLIE | COUNTAH | OCSALOGO, | |
866 416 , BLACKBG | BALLIE, | |
867 448 , BLACKBG | BALLIE | TXTSCR, | |
868 512 , CHESSBG | BALLIE | BALLJUMPS | TXTSCR, | |
869 576 , CHESSBG | BALLIE | BALLJUMPS | TXTSCR, | |
870 640 , CHESSBG | BALLIE | BALLJUMPS | TXTSCR, | |
871 704 , CHESSBG | BALLIE | BALLJUMPS | TXTSCR, | |
872 768 , FLASHBG | FLASHTXT, | |
873 896 , FLASHBG | FLASHTXT | TXTSCR, | |
874 962 , FLASHBG | FLASHTXT | TXTSCR | BALLIE | BALLJUMPS, | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
875 1024, BLACKBG | BALLIE | ENDSCR, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
876 1152, CHESSBG | BALLIE | BALLJUMPS | ENDSCR, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
877 1344, FLASHBG | BALLIE | BALLJUMPS | ENDSCR, |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
878 1536, DEMOEND |
0 | 879 }; |
880 | |
881 | |
882 /* don't look at the rest of the code, it just sucks :) */ | |
883 | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
884 int main(int argc, char *argv[]) |
0 | 885 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
886 BOOL initSDL = FALSE; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
887 const int U = SET_VID_BUFW / 40; |
14 | 888 const Uint16 *dez = dezign; |
889 int flagz = 0, flixtim = 0; | |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
890 char *phiword = NULL, *dizainword = NULL; |
0 | 891 |
14 | 892 dmPrint( |
893 SET_PROG_NAME " by Ocsa (PWP) (c) 1998\n" | |
894 "libSDL port by ccr/TNSP^PWP (c) 2013\n"); | |
895 | |
896 // Parse commandline options | |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
897 // engine.optVFlags |= SDL_FULLSCREEN; |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
898 |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
899 |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
900 // Initialize SDL components |
14 | 901 dmPrint("Engine initializing ..\n"); |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
902 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) != 0) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
903 { |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
904 dmError("Could not initialize SDL: %s\n", SDL_GetError()); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
905 goto error_exit; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
906 } |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
907 initSDL = TRUE; |
0 | 908 |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
909 // Initialize audio parts |
15 | 910 engine.mixBuf = malloc((1 + SET_MAXROWLGT) * sizeof(Sint16)); |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
911 engine.optAfmt.freq = SET_AUDIO_FREQ; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
912 engine.optAfmt.format = AUDIO_S16SYS; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
913 engine.optAfmt.channels = SET_AUDIO_CHN; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
914 engine.optAfmt.samples = engine.optAfmt.freq / 16; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
915 engine.optAfmt.callback = engineAudioCallback; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
916 |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
917 // Initialize SDL audio |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
918 if (SDL_OpenAudio(&engine.optAfmt, NULL) < 0) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
919 { |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
920 dmError("Couldn't open SDL audio: %s\n", SDL_GetError()); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
921 } |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
922 |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
923 // Initialize SDL video |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
924 if (!engineInitializeVideo()) |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
925 goto error_exit; |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
926 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
927 SDL_ShowCursor(SDL_DISABLE); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
928 SDL_WM_SetCaption(SET_WIN_NAME, SET_WIN_NAME); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
929 |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
930 // Initialize effects |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
931 preball(); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
932 srand(0); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
933 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
934 engine.tickLen = engine.optAfmt.freq / SET_DEMOHZ; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
935 audio_precalcs(); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
936 setpal(); |
0 | 937 |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
938 // Start audio, enter main loop |
14 | 939 dmPrint("We are go.\n"); |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
940 SDL_LockAudio(); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
941 SDL_PauseAudio(0); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
942 SDL_UnlockAudio(); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
943 engine.startTime = SDL_GetTicks(); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
944 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
945 while (!engine.exitFlag) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
946 { |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
947 // Handle SDL events |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
948 while (SDL_PollEvent(&engine.event)) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
949 switch (engine.event.type) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
950 { |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
951 case SDL_KEYDOWN: |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
952 switch (engine.event.key.keysym.sym) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
953 { |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
954 case SDLK_ESCAPE: |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
955 engine.exitFlag = TRUE; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
956 break; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
957 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
958 case SDLK_f: |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
959 engine.optVFlags ^= SDL_FULLSCREEN; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
960 if (!engineInitializeVideo()) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
961 goto error_exit; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
962 break; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
963 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
964 case SDLK_RETURN: |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
965 if (engine.event.key.keysym.mod & KMOD_ALT) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
966 { |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
967 engine.optVFlags ^= SDL_FULLSCREEN; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
968 if (!engineInitializeVideo()) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
969 goto error_exit; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
970 } |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
971 break; |
0 | 972 |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
973 default: |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
974 break; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
975 } |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
976 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
977 break; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
978 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
979 case SDL_VIDEOEXPOSE: |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
980 break; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
981 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
982 case SDL_QUIT: |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
983 engine.exitFlag = TRUE; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
984 break; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
985 } |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
986 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
987 // Draw frame |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
988 engine.frameTime = SDL_GetTicks(); |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
989 int qt = engineGetTick(&engine); |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
990 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
991 if (SDL_MUSTLOCK(engine.screen) != 0 && SDL_LockSurface(engine.screen) != 0) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
992 { |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
993 dmError("Can't lock surface.\n"); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
994 goto error_exit; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
995 } |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
996 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
997 // Main rendering code |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
998 while ((qt / SET_ROWTIX >= *dez) && (flagz & DEMOEND) == 0) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
999 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1000 dez++; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1001 flagz = *dez++; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1002 if (flagz & FLASHTXT) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1003 flixtim = *(dez - 2); |
14 | 1004 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1005 if (flagz & TXTSCR) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1006 dizainword = dotxtscr(); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1007 } |
0 | 1008 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1009 if (flagz & FLASHTXT) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1010 { |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1011 while ((qt / SET_ROWTIX) >= flixtim) |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1012 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1013 phiword = lyrix(); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1014 flixtim += 4; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1015 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1016 } |
0 | 1017 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1018 if (flagz & DEMOEND) |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1019 engine.exitFlag = TRUE; |
0 | 1020 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1021 if (flagz & BLACKBG) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1022 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1023 SDL_FillRect(engine.screen, NULL, 0); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1024 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1025 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1026 if (flagz & FLASHBG) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1027 { |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1028 unsigned char col = 130 + (qt % 48) * 2; |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1029 SDL_FillRect(engine.screen, NULL, col); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1030 } |
0 | 1031 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1032 if (flagz & CHESSBG) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1033 { |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1034 int zoom = (10 + abs(((qt >> 1) % 96) - 48)) * 4096 / SET_VID_BUFW; |
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1035 rotochess(engine.screen, sin(qt * 0.03) * zoom, cos(qt * 0.03) * zoom, 0, 0); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1036 } |
0 | 1037 |
14 | 1038 //if(flagz&PLASMABG) drawplasma(ruutu, qt); |
0 | 1039 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1040 if (flagz & OCSALOGO) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1041 { |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1042 drawchar(U * 6, U * 4, phont['O' - 32], U + U * sin(qt * 0.10 + 3), |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1043 U); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1044 drawchar(U * 14, U * 4, phont['C' - 32], U, |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1045 U + U * sin(qt * 0.11 + 3)); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1046 drawchar(U * 22, U * 4, phont['S' - 32], U, |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1047 U + U * sin(qt * 0.12 + 3)); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1048 drawchar(U * 30, U * 4, phont['A' - 32], |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1049 U + U * sin(qt * 0.13 + 3), U); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1050 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1051 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1052 if (flagz & SCROLL0) |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1053 plainscroll(qt); |
0 | 1054 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1055 if (flagz & BALLIE) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1056 { |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1057 int zoom; |
14 | 1058 vec3d joo; |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1059 if (flagz & BALLJUMPS) |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1060 zoom = abs((qt % 96) - 48); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1061 else |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1062 zoom = 47; |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1063 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1064 zoom = dmClamp(zoom, 0, 47); |
0 | 1065 |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1066 unitvec(&joo, 0.038 * qt, 0.023 * qt, 0.011 * qt, |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1067 32000 / balltab[zoom].R); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1068 joo.z <<= 1; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1069 |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1070 drawball(engine.screen, &joo, zoom); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1071 } |
0 | 1072 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1073 if (flagz & FLASHTXT) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1074 flashtxt(phiword); |
9 | 1075 |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1076 if ((flagz & TXTSCR) && ((qt / SET_ROWTIX) & 2)) |
9 | 1077 drawtxtscr(dizainword); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1078 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1079 if (flagz & ENDSCR) |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1080 doendscroll(qt - 1024 * SET_ROWTIX); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1081 |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1082 if (flagz & COUNTAH) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1083 { |
13
3a358d053ffc
Runs now, audio does not work yet and the pace seems slightly too fast (not
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1084 int n = ((qt * 50 / 48) - 256 * 6); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1085 int dis = (rand() % U) >> 1; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1086 if (n > 666) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1087 n = 666; |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1088 |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1089 if (n > 600) |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1090 { |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1091 drawchar(U * 12 + dis, (SET_VID_BUFH >> 1) + dis + U * 6, |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1092 phont['X' - 32], U, U); |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1093 drawchar(U * 22 + dis, (SET_VID_BUFH >> 1) + dis + U * 6, |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1094 phont['3' - 32], U, U); |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1095 } |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1096 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1097 drawchar(U * 28 + dis, SET_VID_BUFH >> 1, phont[16 + (n % 10)], U, U); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1098 n /= 10; |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1099 drawchar(U * 18 + dis, SET_VID_BUFH >> 1, phont[16 + (n % 10)], U, U); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1100 n /= 10; |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1101 drawchar(U * 8 + dis, SET_VID_BUFH >> 1, phont[16 + (n % 10)], U, U); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1102 n /= 10; |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1103 } |
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1104 |
14 | 1105 // Flip screen, increase frame count, wait |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1106 if (SDL_MUSTLOCK(engine.screen) != 0) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1107 SDL_UnlockSurface(engine.screen); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1108 |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1109 engine.frameCount++; |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1110 SDL_Flip(engine.screen); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1111 SDL_Delay(20); |
3
4dd2b0c81ad2
Cleanups, removing cruft, re-indent.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
1112 } |
9 | 1113 |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1114 error_exit: |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1115 // Shutdown |
14 | 1116 dmPrint("Shutting down.\n"); |
11
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1117 SDL_ShowCursor(SDL_ENABLE); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1118 if (engine.screen) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1119 SDL_FreeSurface(engine.screen); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1120 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1121 SDL_LockAudio(); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1122 SDL_PauseAudio(1); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1123 SDL_UnlockAudio(); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1124 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1125 if (initSDL) |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1126 SDL_Quit(); |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1127 |
fcae85b39931
Slowly getting closer. Does not compile yet, and it's messy.
Matti Hamalainen <ccr@tnsp.org>
parents:
9
diff
changeset
|
1128 return 0; |
0 | 1129 } |