#include "noid.h"

void NoidINTRO(void);
void MenuINIT(void);
void InitTrance(void);
/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
/*                               INIT MAIN                                   */
/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */

/* 	SDL INIT : initialise sdl component
	commencer : prep all structure and load data
	main loop : where the prog run
	finire : were it finish and free all memory		 */

/* */

int main ( int argc, char** argv ) {
	int cntNOID;
/* --------------------------> SDL INIT <----------------------------------- */
    if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) < 0 ) {
        return(1);    }
    atexit(SDL_Quit);

    fNOID.jeton[100] = SDL_SetVideoMode(400, 400, 32,SDL_SWSURFACE| SDL_ANYFORMAT|SDL_RLEACCEL);
	SDL_SetColorKey(fNOID.jeton[100],SDL_RLEACCEL,0);

    SDL_WM_SetCaption("NOiD",NULL);
	SDL_ShowCursor(SDL_DISABLE);

    if( TTF_Init() == -1 ) 
	{ return (1); }

    int noisefreq = 22050;    Uint16 noisebin = AUDIO_S16;
    int noisepara = 1;    int noisepak = 4096;
    if (Mix_OpenAudio(22050, noisebin , noisepara, noisepak)) {
        return(1);     }  
    Mix_QuerySpec(&noisefreq, &noisebin, &noisepara);                           
/* -----------------------------> commencer <------------------------------- */
	NoidServerINIT();
	InitTrance();
	MenuINIT();
	NoidINTRO();
/* -----------------------------> MAIN LOOP <------------------------------- */
	NoidServerLOOP();
/* -----------------------------> THE END <--------------------------------- */
    for (cntNOID=1;cntNOID < 169;cntNOID = cntNOID+1) {
        SDL_FreeSurface(fNOID.jeton[cntNOID]);    }

    Mix_HaltMusic();
	Mix_FreeMusic(museNOID);	Mix_FreeMusic(trackNOID);
    Mix_CloseAudio();

    SDL_Quit();
    return(0);
}
/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
