summaryrefslogtreecommitdiffstats
path: root/mufhd0/mufhd0.cpp
blob: c6fdd9131fcf117d1cf48703b2c4028682ec8e75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
/*
 * coded in 0x7d1 (2001 -maggio15)
 * by jaromil /// korova.dyne.org
 *
 * This source code is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Public License as published 
 * by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * This source code is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * Please refer to the GNU Public License for more details.
 *
 * You should have received a copy of the GNU Public License along with
 * this source code; if not, write to:
 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * !!!!!!!!!!!!!!!!!!!!! ATTENZIONE !!!!!!!!!!!!!!!!!!!!
 *          QUESTO CODICE E' _ZOZZO_ E POTREBBE
 *          OFFENDERE VOI, LE VOSTRE ABITUDINI
 *         SESSUALI E IL VOSTRO CREDO RELIGIOSO
 *         VOSTRA NONNA E L'INQUILINA DIRIMPETTO
 *         IL CODER DECLINA *OGNI RESPONSABILITA'*
 *
 *         QUESTO CODICE POTREBBE ESSERE COMPILATO
 *       SOTTO WINDOZ, MA CHI LO FA MUORE DI DIARREA
 *
 */

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <math.h>
#include <string.h>
#include <time.h>

#include <SDL/SDL.h>
#include <SDL/SDL_thread.h>
#include <mikmod.h>

#include "water.h"
#include "font_6x11.h"

#define W 512
#define H 512
#define NAME "HKM[0x7d1]"
#define ROTOR_IMAGE "data/circuit.bmp"
#define BEROOT "data/beroot.bmp"
#define ANAURALE "data/misfu-anaurale.xm"
#define KALIGARI "data/misfu-kaligari.xm"
#define OLDSCHOOL "data/oldschool.bmp"
#define FULLSCREEN false
#define mikmod() MikMod_Update()
#define w(int) SDL_Delay( int )

#ifndef M_PI
#define	M_PI		3.14159265358979323846	/* pi greco */
#endif

using namespace std;

static SDL_Surface *surf;
unsigned char *buffer;

static SDL_Surface *t_fl;
static unsigned char *texture;

static SDL_Surface *wat;

static SDL_Surface *img;

static int teta = 180;
static int h_cos [360];
static int h_sin [360];
static int xi [360];
static int yi [360];
static int xj [360];
static int yj [360];

static bool quit = false;
static bool fertig = false;

Uint16 raster[4] = {0,0,0,0};

unsigned int starttime;
unsigned int delaycheck;

SDL_Surface *optimize(SDL_Surface *surface) {
  SDL_Surface *temp;
  temp = SDL_DisplayFormat(surface);
  SDL_FreeSurface(surface);
  return(temp);
}

void sync_init() {
  delaycheck = 0;
  starttime = time(NULL);
}

bool passati(unsigned int secondi) {
  if(delaycheck<24) {
    delaycheck++;
    return(false);
  } else {
    delaycheck = 0;
    if((time(NULL)-starttime)>secondi) {
      starttime = time(NULL);
      return(true);
    } else return(false);
  }
}
void rotor_init_texture() {
  t_fl = SDL_LoadBMP(ROTOR_IMAGE);
  if (t_fl == NULL) exit(1);
  t_fl = optimize(t_fl);
  printf("* texture %ux%u %ubpp\n",t_fl->w,t_fl->h,t_fl->format->BitsPerPixel);

  texture = (Uint8 *) t_fl->pixels;
}

void rotor_init_tables() {
  
  int i;
  double h;
  double radian;

  teta = 180;

  srand(time(NULL));
  
  unsigned int h_cos_rand = (unsigned int) (1024.0*rand()/(RAND_MAX+1.0));
  unsigned int h_sin_rand = (unsigned int) (1024.0*rand()/(RAND_MAX+1.0));
  unsigned int h_rand = (unsigned int) (3.0*rand()/(RAND_MAX+1.0));
  unsigned int xi_rand = (unsigned int) (1024.0*rand()/(RAND_MAX+1.0));
  unsigned int yi_rand = (unsigned int) (1024.0*rand()/(RAND_MAX+1.0));
  unsigned int xj_rand = (unsigned int) (1024.0*rand()/(RAND_MAX+1.0));
  unsigned int yj_rand = (unsigned int) (1024.0*rand()/(RAND_MAX+1.0));

  for ( i=0 ; i<360 ; i++ )
    {
      radian = 2*i*M_PI/360;

      h = h_rand+ cos(radian);
      h_cos[i] = (int) ((h_cos_rand) * (h * cos(radian)));
      h_sin[i] = (int) ((h_sin_rand) * (h * sin(radian)));
      xi[i] = -(xi_rand>>1) * h_cos[i];
      yi[i] = (yi_rand>>1) * h_sin[i];
      xj[i] = -(xj_rand>>1) * h_sin[i];
      yj[i] = -(yj_rand>>1) * h_cos[i];
    }
}

void rotor_update () {

  unsigned char *scrtmp = buffer;

  int i,j;
  
  Uint16 x,y;
  Uint32 rotor;
  int xprime = xj[teta];
  int yprime = yj[teta];
  
  for ( j=0 ; j<512 ; j++ ) {
      x = (xprime + xi[teta]);
      xprime += h_sin[teta];

      y = (yprime + yi[teta]);
      yprime += h_cos[teta];
      
      for ( i=0 ; i<512 ; i++ ) {	  
	x += h_cos[teta];
	y -= h_sin[teta];
	
	rotor = ((y&0xFF00) + ((x>>8)&0x00FF))<<1;
	*(scrtmp++) = *(texture+rotor);
	*(scrtmp++) = *(texture+rotor+1);
      }      
  }
}

# define CHAR_HEIGHT  11
# define CHAR_WIDTH   6
# define CHAR_START   4

void diocrap(char *testo, Uint16 col, int xpos, int ypos, int hsize, int vsize) {
  int y,x,i,len,f,v,ch,cv;
  Uint16 *ptr;
  Uint16 *diocrap = (Uint16 *)buffer+((ypos-1)<<9)+xpos;
  
  v = 512*vsize;
  
  len = strlen(testo);
  
  /* quest'algoritmo di rastering a grandezza variabile delle font
     e' una cosa di cui vado molto fiero, ogni volta che lo vedo il
     petto mi si gonfia e mi escono sonore scorregge. */
  for (y=0; y<CHAR_HEIGHT; y++) {
    ptr = diocrap += v;
    if(diocrap-(Uint16 *)buffer>261632) return; /* low bound */
    while(diocrap-(Uint16 *)buffer<1024) ptr = diocrap += v;
    for (x=0; x<len; x++) {
      f = fontdata[testo[x] * CHAR_HEIGHT + y];
      for (i = CHAR_WIDTH-1; i >= 0; i--)
	if (f & (CHAR_START << i))
	  for(ch=0;ch<hsize;ch++) {
	    for(cv=0;cv<v;cv+=512) ptr[cv] = col;
	    ptr++; }
        else ptr+=hsize; 
    }
  }

}

void init_x (int w, int h, int bpp, bool fullscreen = false, const char *Name = NAME) {
  
  Uint32 flags = 0x00000000;
  int i;
  
  if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
    {
      cerr << "Error : impossibbole to connect the display\n";
      cerr << "Sorry, vaffangulexiting.\n";
      exit (1);
    } else {
      cout << "* display inizializzato didietro\n";
    }
  
  flags = SDL_SWSURFACE|SDL_HWPALETTE|SDL_DOUBLEBUF;
  if (fullscreen) flags |= SDL_FULLSCREEN;
  surf = SDL_SetVideoMode(w, h, bpp, flags);
  if ( surf == NULL )
    {
      cerr << "Error : impossibbole to initialize screen at " << w << "x" << h << " " << bpp << "bpp\n";
      fprintf ( stderr , "Sorry, vaffangulexiting.\n");
      exit (1);
    } else {
      cout << "* squatarra il display: " << surf->w << "x" << surf->h << " " << bpp << "bpp\n";
    }
  
  SDL_WM_SetCaption ( Name, Name );
  
  for ( i=SDL_NOEVENT; i<SDL_NUMEVENTS; ++i )
    if ( (i != SDL_KEYDOWN) && (i != SDL_QUIT) )
      SDL_EventState(i, SDL_IGNORE);
  
  buffer = (unsigned char *) surf->pixels;
}

void the_end() {
  SDL_FreeSurface(wat);
  SDL_FreeSurface(t_fl);
  SDL_Quit();
  MikMod_Exit();
  cout << "---------------------------------- cya!\n";
  exit(0);
}

int poll_event(void *data) {
  SDL_Event event;

  while (!quit) {
    
    while ( SDL_PollEvent(&event) ) {
      switch (event.type) {
      case SDL_KEYDOWN:
	if ( event.key.keysym.sym == SDLK_ESCAPE ) {
	  quit = true;
	}
	break;
      case SDL_QUIT:
	quit = true;
	break;
      default:
	break;
      }
    }
    SDL_Delay(500);
  }
  return(1);
}

struct prcd {
  char *text;
  Uint16 col;
  int x;
  int y;
  int w;
  int h;
};

static const struct prcd t[] = {
  { "HKM[0x7d1]",0xffff,165,70,3,5 },
  { "22 - 24 june 2001 - c a t a n i a",0x0,50,440,2,2},
  { "f r e a k n e t - m e d i a l a b",0x0,50,470,2,2},
  { ":: come to meet mufhd0 ::",0xffff,26,200,3,8},
  { NULL,0,0,0,0,0 }
};

void vaimo() {
  int c=0,cc=0,gr;
  //  mikmod(); w(300); mikmod(); w(300);
  while(t[c].text!=NULL) {
    for(gr=0;gr<50;gr++) {
      water_update();
      SDL_BlitSurface(wat,NULL,surf,NULL);
      for(cc=0;cc<c+1;cc++)
	diocrap(t[cc].text,t[cc].col,t[cc].x,t[cc].y,t[cc].w,t[cc].h);
      SDL_Flip(surf);
      mikmod();
    }
    c++;
  }
  c--;
  for(gr=0;gr<50;gr++) {
    water_update();
    SDL_BlitSurface(wat,NULL,surf,NULL);
    for(cc=0;cc<c+1;cc++)
      diocrap(t[cc].text,t[cc].col,t[cc].x,t[cc].y,t[cc].w,t[cc].h);
    SDL_Flip(surf);
    mikmod();
  }
}

static const struct prcd p[] = {
  { "the hackmeeting is a completely no-profit",0xffff,100,100,1,2 },
  { "autoorganized social event in which hackers",0xffff,140,130,1,2 },
  { "meet to xperiment and discuss tech and it's uses",0xffff,180,160,1,2 },

  { "it is about freespeech, technology, freesoftware",0xffff,190,180,1,2 },
  { "technical social cultural and political hacking",0xffff,170,210,1,2 },
  { "against censorship for the freedom of informations",0xffff,184,240,1,2 },

  { "three days of autoorganized and independent seminars",0xffff,60,240,1,2 },
  { "for who wants to teach and learn experience on a free basis",0xffff,40,270,1,2 },
  { "everybody is invited to come and share his knowledge",0xffff,80,300,1,2 },

  { "in this 4th edition the centro sociale AURO in catania",0xffff,167,200,1,2 },
  { "will host hackers coming from every angle of the netspace,",0xffff,140,230,1,2 },
  { "to meet and collaborate in building this free event",0xffff,125,260,1,2 },

  { "three days of contamination between everybody's research",0xffff,40,100,1,2 },
  { "theorical and thecnical discussions, installations, seminars,",0xffff,67,130,1,2 },
  { "wild coding, project presentations and mufhd0 ceremonies",0xffff,90,160,1,2 },
  
  { "the hackmeeting gathers hacklabs, independents, associations",0xffff,70,100,1,2 },
  { "freesoftware developers and anybody who believes that",0xffff,50,130,1,2 },
  { "INFORMATION WANTS TO BE FREE",0xffff,60,160,2,3 },

  { NULL,0,0,0,0,0}
};

static struct prcd m[] = {
  { "human beings are animals no longer subject to evolutive",0x0,90,400,1,2 },
  { "processes. the incidence of diseases on them is allready",0x0,90,430,1,2 },
  { "one of the lowest in the realm of life.",0x0,90,460,1,2 },

  { "it is also assumed that humanity is a neoparassite with",0x0,90,400,1,2 },
  { "no possibility for further evolution. if such a theory is true",0x0,90,430,1,2 },
  { "humans have reached to evolve into very miserable creatures:",0x0,90,460,1,2 },
  
  { "beings that have lost the memory of the force that makes them alive,",0x0,90,400,1,2},
  { "animals which keep a body with the only scope of satisfying",0x0,90,430,1,2 },
  { "ephemeral desires. don't you think all this is sad?",0x0,90,460,1,2 },

  { "humanity is, at last, a very small phenomenon.",0x0,90,400,1,2 },
  { "Alltough something created by humans can be revealed as a way",0x0,90,430,1,2 },
  { "out from this desolation.",0x0,90,460,1,2 },

  { NULL,0,0,0,0,0 }
};

void mufhd0() {
  int c=0,madput,rcodi,caz;
  Uint8 a;

  wat = water_init("data/moody.bmp",surf);
  water_setphysics(SUPER_SLUDGE);

  for(a=0;a<255;a++) {
    SDL_SetAlpha(wat,SDL_SRCALPHA,a);
    SDL_BlitSurface(wat,NULL,surf,NULL);    
    SDL_Flip(surf);
  }

  SDL_SetAlpha(wat,0x0,255);

  /* inizio splash no testo  geusd sak ske ske yay */
  c = 0; sync_init();
  while(!passati(15)) {
    c++;
    if(c==100) { water_bigsplash(260,130); c=0; }
    water_update();
    SDL_BlitSurface(wat,NULL,surf,NULL);
    SDL_Flip(surf);
    mikmod();
  }

  c=0;
  for(rcodi=0;rcodi<12;rcodi+=3) {
    if(rcodi==0||rcodi==6) water_distort();
    sync_init();
    while(!passati(15)) {
      if(c==100) { water_bigsplash(260,130); c=0; }
      else c++;
      water_update();
      SDL_BlitSurface(wat,NULL,surf,NULL);
      diocrap(m[rcodi].text,m[rcodi].col,m[rcodi].x,m[rcodi].y,m[rcodi].w,m[rcodi].h);
      diocrap(m[rcodi+1].text,m[rcodi+1].col,m[rcodi+1].x,m[rcodi+1].y,m[rcodi+1].w,m[rcodi+1].h);
      diocrap(m[rcodi+2].text,m[rcodi+2].col,m[rcodi+2].x,m[rcodi+2].y,m[rcodi+2].w,m[rcodi+2].h);      
      SDL_Flip(surf);
      mikmod();
    }
  }
  
  sync_init();
  while(!passati(10)) {
    water_update();
    SDL_BlitSurface(wat,NULL,surf,NULL);
    SDL_Flip(surf);
    mikmod();
  }

  water_bigsplash(260,130);

  sync_init();
  while(!passati(5)) {
    water_update();
    SDL_BlitSurface(wat,NULL,surf,NULL);
    diocrap("LINE:",0x0,200,430,1,2);
    diocrap("what do you mean?",0x0,200,460,1,2);
    SDL_Flip(surf);
    mikmod();
  }

  water_bigsplash(260,130);
  
  sync_init();
  while(!passati(8)) {
    water_update();
    SDL_BlitSurface(wat,NULL,surf,NULL);
    diocrap("the Network, i talk about the Wired Line.",0x0,110,430,1,2);
    SDL_Flip(surf);
    mikmod();
  }

  water_bigsplash(260,130);

  sync_init();
  while(!passati(5)) {
    water_update();
    SDL_BlitSurface(wat,NULL,surf,NULL);
    diocrap("LINE:",0x0,200,430,1,2);
    diocrap("who are you?? tell me!",0x0,200,460,1,2);
    SDL_Flip(surf);
    mikmod();
  }

  water_distort();
  
  sync_init();
  while(!passati(20)) {
    water_update();
    SDL_BlitSurface(wat,NULL,surf,NULL);
    diocrap("i am, MUFHD0.",0x0,210,430,1,2);
    SDL_Flip(surf);
    mikmod();
  }
}

static const struct prcd abrno[] = {
  { "+ mufhd0",0xffff,5,100,3,5 },
  { "+ autismo",0xffff,5,100,3,5 },
  { "+ paranoia",0xffff,5,100,3,5 },
  { "+ consapevolezza",0xffff,5,100,3,5 },
  { "+ sharing",0xffff,5,100,3,5 },
  { "+ freedom",0xffff,5,100,3,5 },
  { "+ privacy",0xffff,5,100,3,5 },
  { "+ freesoftware",0xffff,5,100,3,5 },
  { "+ linux",0xffff,5,100,3,5 },
  { "+ bandwidth",0xffff,5,100,3,5 },
  { "+ hascii",0xffff,5,100,3,5 },
  { "+ freaknet",0xffff,5,100,3,5 },
  { "+ code",0xffff,5,100,3,5 },
};

void rotor() {
  int c=0;int k=0;
  short xbounce = 0;
  short ybounce = 0;

  for(;teta!=179;teta = (teta+1)%360) {
    rotor_update();
    SDL_Flip(surf);
    mikmod();
  }

  while((p[c].text!=NULL)&&(quit!=true)) {
    sync_init();
    while (!passati(10)) {
      rotor_update();
      teta = (teta+1)%360;
      
      diocrap(p[c].text,p[c].col,p[c].x,p[c].y,p[c].w,p[c].h);
      diocrap(p[c+1].text,p[c+1].col,p[c+1].x,p[c+1].y,p[c+1].w,p[c+1].h);
      diocrap(p[c+2].text,p[c+2].col,p[c+2].x,p[c+2].y,p[c+2].w,p[c+2].h);
      
      if(!Voice_Stopped(3)) ybounce = (ybounce<-200) ? ybounce+4 : ybounce-6;
      if(!Voice_Stopped(1)) ybounce = (ybounce>15) ? ybounce-6 : ybounce+4;
      if(!Voice_Stopped(4)) xbounce-=2;
      if(!Voice_Stopped(2)) xbounce+=5;
      
      if(ybounce>0) k = (k+1)%13;
      diocrap(abrno[k].text,0xffff,160+xbounce,513+ybounce,3,5);
      
      SDL_Flip(surf);
      mikmod();

      ybounce = (ybounce>0) ? ybounce-1 : (ybounce<0) ? ybounce+1 : ybounce;
      xbounce = (xbounce>0) ? xbounce-1 : (xbounce<0) ? xbounce+1 : xbounce;
      
    }
    c+=3;
  }
}

static struct prcd j[] = {
  { "CODING +++ jaromil [ dyne.org ]",0x0,10,512,2,3 },
  { "MUSIC +++ davidepinna [ misfu ]",0x0,10,512,2,3 },
  { "gfx ++ mapplethorpe jaromil",0x0,10,512,2,2 },
  { NULL,0,0,0,0,0 },
  { NULL,0,0,0,0,0 },
  { "this intro is 100% FREESOFTWARE: no proprietary",0x0,10,512,1,2 },
  { "libs or tools employed, feel free to misuse ;)",0x0,10,512,1,2 },
  { "(yes, this font sucks, but comes from the kernel)",0x0,10,512,1,2 },
  { NULL,0,0,0,0,0 },
  { NULL,0,0,0,0,0 },
  { "GREETINGS to:",0x0,10,512,1,2 },
  { "lobo - superbuddakarma",0x0,10,512,2,2 },
  { "asbesto - asciifarts|suspence|existing",0x0,10,512,2,2 },
  { "august - nicestwife one can have",0x0,10,512,2,2 },
  { "hackmeeting people - too long to list",0x0,10,512,2,2 },
  { "AVANA TPO FORTEPRENESTINO _TO BATCAVERNA",0x0,10,512,2,2 },
  { "LOA BULK AUTISTICI.ORG SERVUS MINMEGATV",0x0,10,512,2,2 },
  { "STADTWERKSTATT LUPIP ECN-INR STRANONET",0x0,10,512,2,2 },
  { "HACKLABFI SGAMATI OLOGRAFIX MADDLER.NET",0x0,10,512,2,2 },
  { "ENEMY.ORG CANDIDATV BBK.ORG MENT.ORG QUBE",0x0,10,512,2,2 },
  { NULL,0,0,0,0,0 },
  { NULL,0,0,0,0,0 },
  { NULL,0,0,0,0,0 },
  { "in memory of Douglas Adams",0x0,10,512,2,3 },
  { NULL,0,0,0,0,0 },
  { "il nostro scopo e' la veglia,",0x0,10,512,2,2 },
  { "il nostro nemico e' il sonno senza sogni",0x0,10,512,2,2 },
  { "                              - mindwarp",0x0,10,512,2,2 }
};

#define DIOBAVA 27

void greetz() {
  int c=0,cc=0, dist = 0;
  int finito = 0;
  SDL_Surface *phone;
  phone = SDL_LoadBMP(OLDSCHOOL);
  if (phone == NULL) exit(1);
  SDL_SetAlpha(phone,SDL_SRCALPHA|SDL_RLEACCEL,0);
  phone = optimize(phone);
  
  for(Uint8 a=0;a<255;a++) {
    SDL_SetAlpha(phone,SDL_SRCALPHA,a);
    SDL_BlitSurface(phone,NULL,surf,NULL);
    SDL_Flip(surf);
    mikmod();
  }

  while(j[DIOBAVA].y>256) {
    SDL_BlitSurface(phone,NULL,surf,NULL);
    for(cc=0;cc<c;cc++) {
      if((j[cc].y>0)&&(j[cc].text!=NULL))
	diocrap(j[cc].text,j[cc].col,j[cc].x,j[cc].y,j[cc].w,j[cc].h);
      j[cc].y--;
    }
    SDL_Flip(surf);
    SDL_Delay( 30 );
    if(dist==40&&c<DIOBAVA+1) { c++; dist=0; } else dist++;
    if(j[c].text==NULL) finito++;
    mikmod();
  }

  sync_init();
  while(!passati(10)) {
    SDL_BlitSurface(phone,NULL,surf,NULL);
    diocrap(j[DIOBAVA-4].text,j[DIOBAVA-4].col,j[DIOBAVA-4].x,j[DIOBAVA-4].y,j[DIOBAVA-4].w,j[DIOBAVA-4].h);
    diocrap(j[DIOBAVA].text,j[DIOBAVA].col,j[DIOBAVA].x,j[DIOBAVA].y,j[DIOBAVA].w,j[DIOBAVA].h);
    diocrap(j[DIOBAVA-1].text,j[DIOBAVA-1].col,j[DIOBAVA-1].x,j[DIOBAVA-1].y,j[DIOBAVA-1].w,j[DIOBAVA-1].h);
    diocrap(j[DIOBAVA-2].text,j[DIOBAVA-2].col,j[DIOBAVA-2].x,j[DIOBAVA-2].y,j[DIOBAVA-2].w,j[DIOBAVA-2].h);
    SDL_Flip(surf);
    mikmod();
  }
  SDL_FreeSurface(phone);
}  
 
int main (int argc, char **argv)
{

  SDL_Thread *ilporcodio;

  cerr << "MUFHD0 INTRO ::::::: HACKMEETING[0x7d1]\n";
  cerr << " -------- code = jaromil ..//dyne.org\n";
  cerr << " ----- muzaq = misfu ..//misfu.dyne.org\n";
  cerr << " ++++++++++++++++++++++++++++++++++++++\n";
  
  /* Init X */
  init_x(W, H, 16, FULLSCREEN);

  /*** MIKMOD LOAD SOUND INITIALIZATION A VOTAMAZZA ***/
  MODULE *kaligari, *anaurale;
  setenv("MM_FRAGSIZE","16",0); /* latenza bassa e vivi meglio */
  md_mixfreq=44100;
  md_device       = 0;                // device: autodetect
  md_volume       = 128;              // MAX VOLUME A VOTAMAZZA
  md_musicvolume  = 128;              // music volume (max 128)
  md_sndfxvolume  = 128;              // sound effects volume (max 128)
  md_pansep       = 128;              // panning separation (0 = mono, 128 = full stereo)
  md_reverb = 0; /* 0 - 15 */
  md_mode = DMODE_16BITS|DMODE_STEREO|DMODE_SOFT_MUSIC;
  MikMod_RegisterAllDrivers();
  MikMod_RegisterLoader(&load_xm);
  if(MikMod_Init("")) {
    fprintf(stderr,"aiacristo! mikmod error!\n"); exit(-1); }
  kaligari = Player_Load(KALIGARI,32,0);
  anaurale = Player_Load(ANAURALE,32,0);
  Player_SetVolume(100);
  Player_Start(kaligari);
  cerr << "* e mo parte pure la moseca\n";
  /* ---------- VAIMO' ---------- */

  /* TAVOLE Sin/Cosin */
  rotor_init_tables();

  /* Texture per rotor*/
  rotor_init_texture();

  ilporcodio = SDL_CreateThread(poll_event,NULL);

  sync_init();

  mufhd0();
  
  quit = false;
  Player_Stop();
  Player_Start(anaurale);

  vaimo();

  quit = false;
  
  rotor();

  greetz();

  fertig = true;
  quit = true;
  SDL_WaitThread(ilporcodio,NULL);  

  /* the end*/
  the_end();
}