annotate 3x666.c @ 18:ea16e1b51284

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