annotate demo.c @ 0:f339a3903bc9

Initial import.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 21 May 2015 22:52:30 +0300
parents
children 496b9ab9238c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 #include "dmengine.h"
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 #include "dmtext.h"
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 #include "dmfft.h"
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 #include "dmvecmat.h"
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 #include <math.h>
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 static int demoInit(DMEngineData *engine);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 static void demoShutdown(DMEngineData *engine);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 static int demoRender(DMEngineData *engine);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 int demoPreInit(DMEngineData *engine)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 dmInitProg("bussi",
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 "Bussi by AnCiat ProDz",
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 "0", "ENGINE INITTIALISSSIZING!!!!!", NULL);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 engine->optPackFilename = "bussi.dat";
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 engine->optDataPath = NULL;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 engine->optResFlags = DRF_USE_PACK | DRF_PRELOAD_RES | DRF_USE_STDIO;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 engine->optAudioSetup = DM_ASETUP_JSS;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 engine->optVidSetup = DM_VSETUP_ASPECT;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 engine->optVidWidth = 640;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 engine->optVidHeight = 480;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 engine->optVidDepth = 32;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 engine->optVFlags = SDL_SWSURFACE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 engine->demoInit = demoInit;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 engine->demoRender = demoRender;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 engine->demoShutdown = demoShutdown;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 return DMERR_OK;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 #define FFT_SIZE 128
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 DMFFTContext fft;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 static int demoInit(DMEngineData *engine)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 int i;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 JSSModule *mod = NULL;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 dmInitializeFFT(&fft, FFT_SIZE);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 engineGetResModule(engine, mod, "pas2.xm");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 if ((i = jssConvertModuleForPlaying(mod)) != DMERR_OK)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 dmErrorMsg("Could not convert module for playing, %d: %s\n",
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 i, dmErrorStr(i));
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 return DMERR_INIT_FAIL;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 jvmSetCallback(engine->jssDev, jmpExec, engine->jssPlr);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 jmpSetModule(engine->jssPlr, mod);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 jmpPlayOrder(engine->jssPlr, 0);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 jvmSetGlobalVol(engine->jssDev, 55);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 // Jne
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 srand(15);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 return DMERR_OK;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 static void demoShutdown(DMEngineData *engine)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 (void) engine;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 dmEndFFT(&fft);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 static inline float dmCX(DMEngineData *engine, const float x)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 return (x * engine->screen->w);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 static inline float dmCY(DMEngineData *engine, const float y)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 return (y * engine->screen->h);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 static inline float dmQX(DMEngineData *engine, SDL_Surface *img, const float x)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 return engine->optVidNative ? (img->w * x) : (img->w * engine->screen->w * x) / 640.0f;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 static inline float dmQY(DMEngineData *engine, SDL_Surface *img, const float y)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 return engine->optVidNative ? (img->h * y) : (img->h * engine->screen->h * y) / 480.0f;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 typedef struct
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103 char *filename;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 float xc, yc;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105 SDL_Surface *img;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106 } DMTextItem;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109 static DMTextItem textItems[] =
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 { "text01.png", 0.05, 0.10, NULL },
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 { "text02.png", 0.10, 0.30, NULL },
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113 { "text03.png", 0.60, 0.30, NULL },
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114 { "text04.png", 0.20, 0.60, NULL },
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115 { "text05.png", 0.30, 0.70, NULL },
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116 };
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 static const int ntextItems = sizeof(textItems) / sizeof(textItems[0]);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 static DMTextItem textItems2[] =
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 { "text11.png", 0.05, 0.10, NULL },
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 { "text02.png", 0.30, 0.25, NULL },
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 { "text12.png", 0.10, 0.40, NULL },
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 { "text13.png", 0.20, 0.60, NULL },
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127 { "text14.png", 0.30, 0.70, NULL },
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 };
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 static const int ntextItems2 = sizeof(textItems2) / sizeof(textItems2[0]);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 static DMTextItem textItems3[] =
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 { "teki.png" , 0.25, 0.20, NULL },
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 { "mitvit.png" , 0.05, 0.40, NULL },
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 { "ja.png" , 0.05, 0.65, NULL },
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 { "kemisti.png", 0.15, 0.65, NULL },
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 };
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 static const int ntextItems3 = sizeof(textItems3) / sizeof(textItems3[0]);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 #define DM_RADIAL_BLUR(YC, XC) \
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 DMVector p1 = { xc, yc, 0, 0 }, p2 = { cx, cy, 0, 0 }, v; \
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 dm_vector_sub_r(&v, &p2, &p1); \
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149 dm_vector_scale(&v, scale); \
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150 dm_vector_add(&v, &p1); \
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 if (v.y YC || v.x XC) continue; \
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 DMColor *dp = pix + xc, \
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153 *q = ((DMColor *)img->pixels) + ((int)(v.y) * pitch) + (int)v.x; \
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 dp->r = (q->r + dp->r) / 2; \
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 dp->g = (q->g + dp->g) / 2; \
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 dp->b = (q->b + dp->b) / 2;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160 void dmRadialBlur(SDL_Surface *img, const int cx, const int cy, const DMFloat scale)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162 const int pitch = img->pitch / sizeof(DMColor);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163 int xc, yc;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 #pragma omp parallel private(yc, xc) shared(img)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167 #pragma omp sections nowait
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169 #pragma omp section
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 for (yc = cy; yc >= 0; yc--)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172 DMColor *pix = ((DMColor *)img->pixels) + yc * pitch;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173 for (xc = cx + 1; xc < img->w; xc++)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 DM_RADIAL_BLUR(< 0, >= img->w)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179 #pragma omp section
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180 for (yc = cy; yc >= 0; yc--)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 DMColor *pix = ((DMColor *)img->pixels) + yc * pitch;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 for (xc = cx; xc > 0; xc--)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185 DM_RADIAL_BLUR(< 0, < 0)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189 #pragma omp section
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 for (yc = cy + 1; yc < img->h; yc++)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192 DMColor *pix = ((DMColor *)img->pixels) + yc * pitch;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
193 for (xc = cx; xc > 0; xc--)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195 DM_RADIAL_BLUR(>= img->h, < 0)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
196 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
197 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
199 #pragma omp section
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200 for (yc = cy + 1; yc < img->h; yc++)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202 DMColor *pix = ((DMColor *)img->pixels) + yc * pitch;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203 for (xc = cx + 1; xc < img->w; xc++)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205 DM_RADIAL_BLUR(>= img->h, >= img->w)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
212
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
213 static int hitlerText(DMEngineData *engine, const int dt, float fftPow, DMTextItem *items, const int nitems, BOOL *nollattu)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215 int i, vis;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
216 if (!(*nollattu))
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
217 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218 for (i = 0; i < nitems; i++)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219 engineGetResImage(engine, items[i].img, items[i].filename);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
220
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
221 *nollattu = TRUE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
222 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
223
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
224 float q = fftPow * 0.05f;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225 vis = dt / 1000;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226 for (i = 0; i < nitems; i++)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228 DMTextItem *item = &items[i];
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229 if (i < vis)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
230 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
231 dmScaledBlitSurface32to32TransparentGA(
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232 item->img,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
233 dmCX(engine, item->xc - q),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
234 dmCY(engine, item->yc - q),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
235
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236 dmQX(engine, item->img, 1.0f + q * 2.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
237 dmQY(engine, item->img, 1.0f + q * 2.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
238
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239 engine->screen,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
240
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241 100 + 80 * fftPow);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
242 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
243 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
244
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245 return DMERR_OK;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
246 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
247
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249 static int demoRender(DMEngineData *engine)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
250 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251 float t = engineGetTimeDT(engine);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
252 static DMScaledBlitFunc cblit = NULL;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
253
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 // Do FFT
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
255 DMFFTType fftPow = 0;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 BOOL fftOK = FALSE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257 static DMFFTType fftAmp[FFT_SIZE / 2];
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258 static DMFFTType fftData[FFT_SIZE];
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
260 dmMutexLock(engine->audioStreamMutex);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261 if (engine->audioStreamBuf != 0 && engine->audioStreamLen > FFT_SIZE)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
263 int i;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 Sint16 *buf = (Sint16 *) engine->audioStreamBuf;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
265 for (i = 0; i < FFT_SIZE; i++)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
266 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
267 fftData[i] = *buf;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268 buf += 2;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
270 fftOK = TRUE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
271 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272 dmMutexUnlock(engine->audioStreamMutex);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
273
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
274 if (fftOK)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
275 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
276 dmRealFFT(&fft, fftData);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277 dmConvertFFTtoPowerAndSum(&fft, fftData, fftAmp, 1.0, &fftPow, 0.00004f);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
278 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
279
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
280
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
281 #if 1
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
282 // Demokoodi
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283 if (t < 5)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
284 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285 // Alkufeidi sisään
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
286 int dt = engineGetTime(engine, 0);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287 static DMLerpContext fadeLerp;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
288 static SDL_Surface *tausta = NULL;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
289 static BOOL nollattu = FALSE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
290 if (!nollattu)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
291 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
292 engineGetResImage(engine, tausta, "tausta.jpg");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
293 cblit = dmGetScaledBlitFunc(tausta->format, engine->screen->format, DMD_NONE);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295 dmLerpInit(&fadeLerp, 0, 255, 5000);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
296 nollattu = TRUE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
297 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
298
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
299 dmClearSurface(engine->screen, dmMapRGB(engine->screen, 0,0,0));
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
300
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
301 dmScaledBlitSurface32to32TransparentGA(tausta,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
302 0,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303 0,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
304
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305 dmQX(engine, tausta, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
306 dmQX(engine, tausta, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
307
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
308 engine->screen,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
309 dmLerpSCurveClamp(&fadeLerp, dt + 150500 * fftPow));
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
310 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
311 #endif
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
312 #if 0
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
313 else
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
314 if (t < 25)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
315 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
316 static BOOL nollattu = FALSE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
317 static SDL_Surface *tausta = NULL;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
318 if (!nollattu)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
319 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
320 engineGetResImage(engine, tausta, "tausta.jpg");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
321 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
322
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
323 cblit(tausta,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
324 0,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
325 0,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
326
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
327 dmQX(engine, tausta, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
328 dmQX(engine, tausta, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
329
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
330 engine->screen);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
331 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
332
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
333 if (t <= 7)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
334 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
335 int dt = engineGetTime(engine, 2);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
336 static DMLerpContext fadeLerp;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
337 static SDL_Surface *logo1 = NULL, *logo2 = NULL;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
338 static BOOL nollattu = FALSE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
339 if (!nollattu)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
340 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
341 engineGetResImage(engine, logo1, "iso.png");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
342 engineGetResImage(engine, logo2, "forevisar.png");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
343
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
344 dmLerpInit(&fadeLerp, 0, 255, 2500);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
345 nollattu = TRUE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
346 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
347
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
348 int fade;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
349 if (dt < 2500)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
350 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
351 fade = dmLerpSCurveClamp(&fadeLerp, dt + fftPow * 1000);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
352 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
353 else
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
354 if (dt > 4500)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
355 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
356 fade = 255 - dmLerpSCurveClamp(&fadeLerp, dt - 4500 + fftPow * 1000);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
357 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
358 else
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
359 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
360 fade = 255;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
361 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
362
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
363 float d = fftPow * 0.1f;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
364
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
365 dmScaledBlitSurface32to32TransparentGA(logo1,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
366 dmCX(engine, 0.1f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
367 dmCY(engine, 0.22f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
368
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
369 dmQX(engine, logo1, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
370 dmQY(engine, logo1, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
371
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
372 engine->screen,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
373 fade);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
374
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
375 dmScaledBlitSurface32to32TransparentGA(logo2,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
376 dmCX(engine, 0.2f - d),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
377 dmCY(engine, 0.72f - d),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
378
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
379 dmQX(engine, logo2, 1.0f + d * 2.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
380 dmQY(engine, logo2, 1.0f + d * 2.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
381
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
382 engine->screen,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
383 fade);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
384 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
385 else
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
386 if (t <= 15)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
387 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
388 int dt = engineGetTime(engine, 7);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
389 static DMLerpContext fadeLerp;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
390 static SDL_Surface *logo1 = NULL, *logo2 = NULL;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
391 static BOOL nollattu = FALSE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
392 if (!nollattu)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
393 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
394 engineGetResImage(engine, logo1, "hitler_on_kiva.png");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
395 engineGetResImage(engine, logo2, "hitler.png");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
396
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
397 dmLerpInit(&fadeLerp, 0, 255, 2500);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
398 nollattu = TRUE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
399 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
400
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
401 int fade;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
402 if (dt < 2500)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
403 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
404 fade = dmLerpSCurveClamp(&fadeLerp, dt + fftPow * 1000);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
405 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
406 else
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
407 if (dt > 4500)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
408 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
409 fade = 255 - dmLerpSCurveClamp(&fadeLerp, dt - 4500 + fftPow * 1000);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
410 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
411 else
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
412 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
413 fade = 255;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
414 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
415
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
416 dmScaledBlitSurface32to32TransparentGA(logo1,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
417 dmCX(engine, 0.1f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
418 dmCY(engine, 0.22f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
419
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
420 dmQX(engine, logo1, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
421 dmQY(engine, logo1, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
422
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
423 engine->screen,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
424 fade);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
425
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
426 float q = fftPow * 0.2;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
427 dmScaledBlitSurface32to32TransparentGA(logo2,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
428 dmCX(engine, 0.15f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
429 dmCY(engine, 0.47f - q),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
430
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
431 dmQX(engine, logo2, 1.0f + q),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
432 dmQY(engine, logo2, 1.0f + q),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
433
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
434 engine->screen,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
435 fade);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
436 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
437
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
438 if (t <= 15)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
439 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
440 int dt = engineGetTime(engine, 0);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
441 static DMLerpContext posLerp, posLerp2;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
442 static SDL_Surface *mainos = NULL;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
443 static BOOL nollattu = FALSE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
444 if (!nollattu)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
445 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
446 engineGetResImage(engine, mainos, "radio.png");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
447
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
448 dmLerpInit(&posLerp, 1, -1, 15000);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
449 dmLerpInit(&posLerp2, 0.3, 0.7, 15000);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
450 nollattu = TRUE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
451 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
452
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
453 dmScaledBlitSurface32to32TransparentGA(mainos,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
454 dmCX(engine, dmLerpSCurveClamp(&posLerp2, dt)),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
455 dmCY(engine, dmLerpSCurveClamp(&posLerp, dt)),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
456
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
457 dmQX(engine, mainos, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
458 dmQY(engine, mainos, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
459
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
460 engine->screen,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
461 50);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
462 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
463 else
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
464 if (t <= 25)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
465 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
466 int dt = engineGetTime(engine, 15);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
467 static DMLerpContext posLerp, posLerp2;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
468 static DMScaledBlitFunc qblit = NULL;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
469 static SDL_Surface *mainos = NULL, *mainos2 = NULL, *hitler = NULL, *sydan = NULL;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
470 static BOOL nollattu = FALSE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
471 if (!nollattu)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
472 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
473 engineGetResImage(engine, mainos, "lasi.jpg");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
474 engineGetResImage(engine, mainos2, "nigrolin.jpg");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
475 engineGetResImage(engine, hitler, "hitler2.png");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
476 engineGetResImage(engine, sydan, "sydan.png");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
477
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
478 qblit = dmGetScaledBlitFunc(hitler->format, engine->screen->format, DMD_TRANSPARENT);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
479
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
480 dmLerpInit(&posLerp, 1, -1, 20000);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
481 dmLerpInit(&posLerp2, -0.5, -0.2, 20000);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
482
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
483 nollattu = TRUE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
484 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
485
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
486 dmScaledBlitSurface32to32TransparentGA(mainos,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
487 dmCX(engine, dmLerpSCurveClamp(&posLerp2, dt)),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
488 dmCY(engine, dmLerpSCurveClamp(&posLerp, dt + fftPow * 250)),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
489
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
490 dmQX(engine, mainos, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
491 dmQY(engine, mainos, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
492
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
493 engine->screen,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
494 50);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
495
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
496 dmScaledBlitSurface32to32TransparentGA(mainos2,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
497 dmCX(engine, dmLerpSCurveClamp(&posLerp, dt)),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
498 dmCY(engine, dmLerpSCurveClamp(&posLerp2, dt + fftPow * 250)),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
499
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
500 dmQX(engine, mainos2, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
501 dmQY(engine, mainos2, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
502
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
503 engine->screen,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
504 50);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
505
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
506 float d = fftPow * 0.1f;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
507
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
508 qblit(hitler,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
509 dmCX(engine, 0.4 - d),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
510 dmCY(engine, 0.3 - d),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
511
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
512 dmQX(engine, hitler, 1.0f + d * 2.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
513 dmQY(engine, hitler, 1.0f + d * 2.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
514
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
515 engine->screen);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
516
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
517
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
518
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
519 if (t > 17)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
520 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
521 static BOOL xnollattu = FALSE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
522
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
523 if (t > 19)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
524 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
525 float z = sin(t * 2.0f + fftPow) * 0.1f;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
526 qblit(sydan,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
527 dmCX(engine, 0.7) + dmQX(engine, sydan, 0.5f - z),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
528 dmCY(engine, 0.55) + dmQX(engine, sydan, 0.5f - z),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
529
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
530 dmQX(engine, sydan, 1.0f + z * 2.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
531 dmQY(engine, sydan, 1.0f + z * 2.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
532
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
533 engine->screen);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
534 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
535
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
536 hitlerText(engine, engineGetTime(engine, 17), fftPow, textItems, ntextItems, &xnollattu);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
537 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
538 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
539 else
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
540 if (t <= 60)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
541 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
542 int dt = engineGetTime(engine, 25);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
543 static SDL_Surface *tekstur, *poni1, *poni2;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
544 static BOOL nollattu = FALSE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
545 static DMScaledBlitFunc qblit = NULL;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
546 if (!nollattu)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
547 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
548 engineGetResImage(engine, tekstur, "disco.jpg");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
549 engineGetResImage(engine, poni1, "poni1.png");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
550 engineGetResImage(engine, poni2, "poni2.png");
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
551
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
552 qblit = dmGetScaledBlitFunc(poni1->format, engine->screen->format, DMD_TRANSPARENT);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
553
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
554 nollattu = TRUE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
555 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
556
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
557 float m = t*2.0f;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
558 float q = sin(m) * 0.3f,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
559 q2 = sin(m + 0.2) * 0.4f,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
560 z = sin(m) * 0.3f + 2.0f,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
561 z2 = sin(m + 0.1f) * 0.3f + 2.0f;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
562
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
563 dmScaledBlitSurface32to32TransparentGA(tekstur,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
564 dmCX(engine, sin(q) * 0.1f - 0.2f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
565 dmCY(engine, cos(q) * 0.1f - 0.2f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
566
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
567 dmQX(engine, tekstur, z),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
568 dmQY(engine, tekstur, z),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
569
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
570 engine->screen,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
571 130);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
572
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
573 dmScaledBlitSurface32to32TransparentGA(tekstur,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
574 dmCX(engine, sin(q2) * 0.1f - 0.2f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
575 dmCY(engine, cos(q2) * 0.1f - 0.2f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
576
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
577 dmQX(engine, tekstur, z2),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
578 dmQY(engine, tekstur, z2),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
579
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
580 engine->screen,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
581 130);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
582
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
583
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
584 qblit(poni1,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
585 dmCX(engine, 0.2f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
586 dmCY(engine, 0.07f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
587
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
588 dmQX(engine, poni1, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
589 dmQY(engine, poni1, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
590
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
591 engine->screen);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
592
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
593
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
594 dmScaledBlitSurface32to32TransparentGA(poni2,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
595 dmCX(engine, 0.2f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
596 dmCY(engine, 0.07f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
597
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
598 dmQX(engine, poni2, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
599 dmQY(engine, poni2, 1.0f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
600
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
601 engine->screen,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
602 50 + fftPow * 400);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
603
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
604 dmRadialBlur(engine->screen,
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
605 dmCX(engine, 0.5f + sin(m) * 0.1f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
606 dmCY(engine, 0.5f + cos(m) * 0.1f),
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
607 0.035f);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
608
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
609 if (t >= 30 && t <= 37)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
610 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
611 static BOOL xnollattu = FALSE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
612 hitlerText(engine, engineGetTime(engine, 30), fftPow + 0.2, textItems2, ntextItems2, &xnollattu);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
613 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
614 else
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
615 if (t >= 38 && t <= 47)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
616 {
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
617 static BOOL xnollattu = FALSE;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
618 hitlerText(engine, engineGetTime(engine, 38), fftPow + 0.2, textItems3, ntextItems3, &xnollattu);
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
619 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
620 else
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
621 if (t > 50)
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
622 return 1;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
623 }
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
624
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
625 #endif
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
626
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
627 return DMERR_OK;
f339a3903bc9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
628 }