/[projet1]/public/oric/demos/OricTech/code/main.c
Defence Force logotype

Contents of /public/oric/demos/OricTech/code/main.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1346 - (show annotations)
Sat Jan 9 16:14:40 2016 UTC (3 years, 8 months ago) by dbug
File MIME type: text/plain
File size: 7472 byte(s)
Updated Oric Tech to use the new FloppyBuilder API, and fixed some bugs.
1 //
2 // VIP 2015
3 // (c) 2015 Dbug / Defence Force
4 //
5
6 #include <lib.h>
7
8 #include "defines.h"
9 #include "floppy_description.h"
10 #include "loader_api.h"
11 #include "script.h"
12
13 #ifdef OSDKNAME_intro
14 //#error "FUCK"
15 #endif
16
17
18 // irq.s
19 extern void System_InstallIRQ_SimpleVbl();
20 extern void VSync();
21 extern void Stop();
22 extern unsigned char KeyboardState;
23 extern unsigned char KeyboardStateMemorized;
24
25 // scroller.s
26 extern void BigScrollerInit();
27 extern void BigScrollerUpdate();
28
29 extern char* BackgroundPosition;
30 extern unsigned char BackgroundMapX;
31 extern unsigned char BackgroundMapActive;
32
33 extern unsigned char ScrollerCommand;
34 extern unsigned char ScrollerCommandParam1;
35 extern unsigned char ScrollerCommandParam2;
36 extern unsigned char ScrollerCommandParam3;
37 extern unsigned char ScrollerCommandParam4;
38
39
40
41 // buffer.s
42 extern unsigned char RastersPaper[];
43 extern unsigned char RastersInk[];
44 extern unsigned char GradientRainbow[];
45 extern unsigned char GradientVip[];
46
47 extern char BufferCharset[];
48 extern char BufferCharset30x40[];
49 extern char BufferInverseVideo[];
50
51 extern char MusicData[];
52 extern char CloudPicture[];
53 extern char RainDropPicture[];
54 extern char VipLogoPicture[];
55 extern char LongScrollerPicture[];
56 extern char SoundWarningPicture[];
57 extern char SampleSound[];
58 extern char SampleSoundDefence[];
59 extern char SampleSoundForce[];
60 extern char SampleSoundMusicNonStop[];
61 extern char SampleSoundTechnoPop[];
62 extern char SampleSoundChimeStart[];
63 extern char SampleSoundChimeEnd[];
64
65
66 #ifdef OSDKNAME_intro
67
68 void Pause(int delay)
69 {
70 int i;
71
72 for (i=0;i<delay;i++)
73 {
74 VSync();
75 }
76 }
77
78
79
80 char* screen;
81 char* picture;
82 int x,y,xx,yy;
83
84
85
86 //int mapDx=1;
87 //int mapDy=1;
88
89 int i,ii,x,y,yy;
90 int maxdrop;
91
92 char* buffer;
93 char* buffer2;
94 char* screen;
95 char* screen2;
96
97
98
99
100 int vipCounter;
101
102
103 void ShowVipLogo()
104 {
105 vipCounter=-30;
106
107 buffer=LongScrollerPicture+vipCounter*37;
108 yy=0;
109 while (vipCounter<350)
110 {
111 screen=(char*)0xa000;
112 xx=x;
113 yy=x;
114 for (y=0;y<170;y++)
115 {
116 if (y<130)
117 {
118 if (y&1)
119 {
120 // VIP logo
121 //screen[1]=6;
122 screen[0]=16+7;
123 screen[1]=GradientVip[xx&31];
124 xx++;
125 }
126 else
127 {
128 // Rainbow
129 //screen[1]=1;
130 screen[0]=16+6;
131 screen[1]=GradientRainbow[yy&31];
132 yy--;
133 }
134 }
135 else
136 {
137 if (y&1)
138 {
139 screen[0]=16+7;
140 screen[1]=1;
141 }
142 else
143 {
144 screen[0]=16+6;
145 if ((y<138) || (y>165))
146 {
147 screen[1]=1;
148 }
149 else
150 {
151 screen[1]=3;
152 }
153 }
154 }
155 screen+=40;
156 }
157
158 screen=(char*)0xa000+40*170;
159 buffer2=buffer;
160 buffer+=37;
161 for (y=0;y<30;y++)
162 {
163 screen[1]=0;
164 if ( ((vipCounter+y)<0) || ((vipCounter+y)>=329) )
165 {
166 memset(screen+2,64,37);
167 }
168 else
169 {
170 memcpy(screen+2,buffer2,37);
171 }
172 buffer2+=37;
173 screen+=40;
174 }
175
176 VSync();
177 x++;
178 vipCounter++;
179 }
180 }
181
182
183 unsigned int DropStartOffset[]=
184 {
185 40*102+8,
186 40*97 +13,
187 40*104+18,
188 40*101+26,
189 40*98 +30
190 };
191
192
193 void ShowThalionSequence()
194 {
195 // Move down
196 screen=(char*)0xa000;
197 for (y=0;y<200;y+=2)
198 {
199 screen[0]=16+4;
200 screen[1]=7;
201 memset(screen+2,64,38);
202 screen+=80;
203 #ifndef FAST_INTRO
204 VSync();
205 VSync();
206 #endif
207 }
208
209 // Move up
210 screen+=40;
211 for (y=0;y<200;y+=2)
212 {
213 screen-=80;
214 screen[0]=16+4;
215 screen[1]=7;
216 memset(screen+2,64,38);
217 #ifndef FAST_INTRO
218 VSync();
219 VSync();
220 #endif
221 }
222
223 // Scroll down the clouds -- 33 bytes large, 198x104 pixels in size
224 #ifdef FAST_INTRO
225 y=104;
226 #else
227 for (y=0;y<105;y++)
228 #endif
229 {
230 screen=(char*)0xa000+y*40;
231 buffer=CloudPicture+33*104;
232 for (yy=0;yy<y;yy++)
233 {
234 buffer-=33;
235 screen-=40;
236 memcpy(screen+3,buffer,33);
237 }
238 VSync();
239 }
240
241 // Wait a bit
242 Pause(50*1);
243
244 // Then the rain droplets
245 // RainDropPicture -- 2 bytes large 12x25 pixels
246 screen2=(char*)0xa000;
247 for (i=0;i<60;i++)
248 {
249 screen=screen2;
250 buffer=RainDropPicture;
251 for (y=0;y<25;y++)
252 {
253 for (x=0;x<5;x++)
254 {
255 *(screen+DropStartOffset[x]+0)=buffer[0];
256 *(screen+DropStartOffset[x]+1)=buffer[1];
257 }
258 buffer+=2;
259 screen+=40;
260 }
261 screen2+=40;
262 }
263
264 // Wait a bit
265 //Pause(50*5);
266
267 // Fade to light blue background
268 screen=(char*)0xa000+40*200;
269 buffer=VipLogoPicture+40*200;
270 for (y=0;y<200;y+=2)
271 {
272 buffer-=40;
273 screen-=40;
274 screen[0]=16+7;
275 screen[1]= 7;
276 memcpy(screen+2,buffer+2,38);
277
278 buffer-=40;
279 screen-=40;
280 screen[0]=16+6;
281 screen[1]= 6;
282 memcpy(screen+2,buffer+2,38);
283 VSync();
284 }
285
286 //while (1){}
287 // Display the VIP logo
288 ShowVipLogo();
289 }
290
291 #endif
292
293
294
295 #ifdef OSDKNAME_intro
296 //
297 // The VIP cloud intro
298 //
299 void main()
300 {
301 //#ifdef ENABLE_VIP_INTRO
302 // Install the IRQ handler
303 System_InstallIRQ_SimpleVbl();
304
305
306 // Load the cloud picture
307 LoadFileAt(LOADER_CLOUD,CloudPicture);
308
309 // Load the rain drop picture
310 LoadFileAt(LOADER_RAINDROP,RainDropPicture);
311
312 // Load the VIP scroll stuff
313 LoadFileAt(LOADER_VIP_LOGO,VipLogoPicture);
314
315 // Load the Long Scroller
316 LoadFileAt(LOADER_LONG_SCROLLER,LongScrollerPicture);
317
318 // Load the sound warning picture
319 LoadFileAt(LOADER_SOUND_WARNING,SoundWarningPicture);
320
321 #ifdef ENABLE_MUSIC
322 // Load and play the music
323 LoadFileAt(LOADER_INTRO_MUSIC,MusicData);
324 Mym_MusicStart();
325 #endif
326
327 // Display the Thalion blue bubbles sequence
328 ShowThalionSequence();
329
330 #ifdef ENABLE_MUSIC
331 // Stop the music
332 Mym_MusicStop();
333 #endif
334
335 // Clear the screen
336 memset((char*)0xa000,64,8000);
337
338 // Wait one second
339 Pause(50*1);
340
341 // Show the sound warning picture
342 memcpy((char*)0xa000,SoundWarningPicture,8000);
343
344 // Wait three seconds
345 Pause(50*3);
346
347 // Quit
348 System_RestoreIRQ();
349 //#endif
350 }
351 #endif
352
353
354
355 #ifdef OSDKNAME_techtech
356
357 //
358 // The Tech Tech intro
359 // _EndDemoData
360 // 3146 - 3402 - 4170 - 4426 - 4938 - 5194
361 //
362 // _InitColorText
363 // 922 - 0
364 //
365 // main
366 // 185 - 33
367 /*
368 void main()
369 {
370 // Initialize stuff
371 TechTechInit();
372 }
373 */
374 #endif
375
376
377 /*
378
379 Some more design stuff:
380 - TEXT screen goes from $BB80 to $BFDF
381 - HIRES screen goes from $A000 to $BFDF
382 - The usable STD charset is from $b400+8*32 to $b400+8*(32+96)
383 $B400+256 to $B400+1024
384 $B500 to $B7FF
385
386 $B500-$A000=5376 / 40 = 134.4
387 $B800-$A000=6144 / 40 = 153.6
388
389 154-134=20 lines
390
391 134/8 -> 16.75
392
393 For each line:
394 HIRES ATTRIBUTE TEXT
395
396
397 TechTech history:
398 -
399 - November 1987 - Amiga - TechTech by Sodan & Magician42 -> http://www.pouet.net/prod.php?which=4445 (http://www.sodan.dk)
400 - December 1989 - Atari ST - grodan and kvack kvack (Sowatt Demo) by The Carebears -> http://www.pouet.net/prod.php?which=754
401 - March 2004 - Windows - Ported to pc -> http://www.pouet.net/prod.php?which=11934
402
403
404
405 November 1987
406 Sodan & Magician 42
407 release
408 Tech Tech
409 on the Amiga
410 -
411 December 1989
412 The Carebears
413 convert it in
414 Grodan and Kvack Kvack
415 on the Atari ST
416
417 FontleroyBrown 20
418
419 --------------------
420 In November 1987
421 Sodan & Magician 42
422 released Tech Tech
423 on the Amiga.
424
425 In December 1989
426 The Carebears
427 converted it into
428 Grodan and Kvack Kvack
429 for the Atari ST.
430
431 In May 2005
432 Defence Force
433 realized it could not be done
434 on the Oric but tried anyway !!!
435 -----------------------
436
437
438 */
439
440
441
442
443

  ViewVC Help
Powered by ViewVC 1.1.26