Пример #1
0
void InitializeScores() {
    INT8 i;
    for (i = 0; i < MAX_SCORES; ++i) {
        game_data.scores[i] = 0;
    }
    LoadScores();
}
Пример #2
0
HighScores::HighScores() : Rocket::Controls::DataSource("high_scores")
{
	ROCKET_ASSERT(instance == NULL);
	instance = this;

	for (int i = 0; i < NUM_SCORES; i++)
	{
		scores[i].score = -1;
	}

	LoadScores();
}
Пример #3
0
/* Just show the high scores */
void PrintHighScores(void)
{
	int i;

	LoadScores();
	/* FIXME! -- Put all lines into a single formatted message */
	printf("Name			Score	Wave\n");
	for ( i=0; i<NUM_SCORES; ++i ) {
		printf("%-20s	%-3.1u	%u\n", hScores[i].name,
					hScores[i].score, hScores[i].wave);
	}
}
Пример #4
0
    void Scan() override
    {
        _scenarios.clear();

        // Scan RCT2 directory
        std::string rct2dir = _env->GetDirectoryPath(DIRBASE::RCT2, DIRID::SCENARIO);
        std::string openrct2dir = _env->GetDirectoryPath(DIRBASE::USER, DIRID::SCENARIO);
        Scan(rct2dir);
        Scan(openrct2dir);

        Sort();
        LoadScores();
        LoadLegacyScores();
        AttachHighscores();
    }
Пример #5
0
int main( int argc, char* args[] )
{

    int err,z;

    for (z=0;z<100;z++)
    {
        hiname[z]=(char*)malloc(5);
        //hiscores[z]=10000-z*100;
        hiscores[z]=0;
        hinew[z]=0;
        if (z&1) strcpy(hiname[z],"ED!"); else  strcpy(hiname[z],"FUZ");
    }


    #ifdef _WIN32
    _setmode( _fileno( stdin ), _O_BINARY );
    _setmode( _fileno( stdout ), _O_BINARY );
    #endif

    // Initialize all SDL subsystems
    err=SDL_Init( SDL_INIT_JOYSTICK | SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO );

    if (err ==-1)
    {
        printf(  "SDL Init error: %d\n",  err  );
        return 1;
    }
    screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 16, SDL_HWSURFACE | SDL_HWPALETTE | SDL_DOUBLEBUF);
    SDL_ShowCursor(false);

    if (Mix_OpenAudio(44100, AUDIO_S16, MIX_DEFAULT_CHANNELS, 1024))
    {
        printf ("SDL Could not open sound hardware\n");
        soundpresent=0;
    }

    srand((int)SDL_GetTicks());

	// Do PC specific stuff
    #ifdef _WIN32
	// Set the window caption
	SDL_WM_SetCaption( "FuZeD", NULL );
    #endif // PLATFORM_PC

    SDL_Surface* intro_screen_scroll;
    SDL_Surface* intro_header;
    SDL_Surface* intro_footer;
    SDL_Surface* intro_icons;
    SDL_Surface* mouse_pointer;


    loadgfx(&intro_screen_scroll,(char*)"graphics/page_background_1280_scroll_wrap.png");
    loadgfx(&intro_header,(char*)"graphics/page_header.png");
    loadgfx(&intro_footer,(char*)"graphics/page_footer.png");

    loadgfx(&intro_icons,(char*)"graphics/intro_icons.png");
    loadgfx(&mouse_pointer,(char*)"graphics/mouse_pointer.png");

    loadgfx(&font,(char*)"graphics/16x16_font.png");
    loadgfx(&smallfont,(char*)"graphics/8x8_font.png");

    loadgfx(&spritemasks,(char*)"graphics/collmask.png");
    loadgfx(&coin_collide,(char*)"graphics/coin_collide.png");

    music = NULL;

    if (soundpresent)
    {

        mine_arm_snd=Mix_LoadWAV("audio/blips4.wav");
        explosion_snd=Mix_LoadWAV("audio/explosion_x.wav");
        collect_snd=Mix_LoadWAV("audio/sound005.wav");
        jump_snd=Mix_LoadWAV("audio/sound008.wav");
        bomb_land_snd=Mix_LoadWAV("audio/hammer.wav");
    }

    playercontrols[0].left=SDLK_LEFT;
    playercontrols[0].right=SDLK_RIGHT;
    playercontrols[0].cycle=SDLK_PAGEUP;
    playercontrols[0].jump=SDLK_PAGEDOWN;
    playercontrols[0].fire=SDLK_END;

    playercontrols[1].left=SDLK_z;
    playercontrols[1].right=SDLK_x;
    playercontrols[1].cycle=SDLK_c;
    playercontrols[1].jump=SDLK_t;
    playercontrols[1].fire=SDLK_f;

    playercontrols[0].joy=10; //keyboard
    playercontrols[1].joy=10;


InitCollisions(15);
level.Init();
wheelie.init();
grog.init();
slinky.init();
bomb.init();
explosion.init();
smoke.init();
mine.init();
dynamite.init();
player.init();
gem.init();
coin.init();
pickup.init();
pickedup16.init();
pickedup32.init();
hiscore.init();
LoadScores();
LoadSettings();
quitgame=0;
//level=new Tlevel;
while (quitgame==0)
{
    int keydata=0;
    int introscroll=0;
    int s1clip=640;
    long ticks=SDL_GetTicks();

    int exit_intro=0;
    int intro_option=0;
    startlevel=0;

    if (soundpresent)
    {
        if (music) Mix_FreeMusic(music);
        music = Mix_LoadMUS("audio/FuZED.title.Main.xm");
        if (!music) printf("SDL could not load music: %s\n" , SDL_GetError());
        if (music) Mix_PlayMusic(music, -1);
    }
    while (exit_intro<2)
    {
        introscroll+=4;
        if (introscroll>=1280) introscroll=0;
        s1clip=640-(introscroll-640);
        if (s1clip>640) s1clip=640;

        drawSprite(intro_screen_scroll, screen, introscroll, 0, 0, 96, s1clip, 352);
        if (s1clip<640) drawSprite(intro_screen_scroll, screen, 0, 0, s1clip, 96, 640-s1clip, 352);

        //drawSprite(intro_screen_scroll, screen, 0, 0, introscroll, 96, 1280, 352);
        //drawSprite(intro_screen_scroll, screen, 0, 0, 1280+introscroll, 96, 1280, 352);

        drawSprite(intro_header, screen, 0, 0, 0, 0, 640, 96);
        drawSprite(intro_footer, screen, 0, 0, 0, 448, 640, 32);

        drawSprite(intro_icons, screen, 0, 0, 32, 160, 96, 96);
        drawSprite(intro_icons, screen, 96, 0, 192, 160, 96, 96);
        drawSprite(intro_icons, screen, 192, 0, 352, 160, 96, 96);
        drawSprite(intro_icons, screen, 288, 0, 512, 160, 96, 96);

        drawSprite(intro_icons, screen, 288+96, 0, 32, 300, 96, 96);
        drawSprite(intro_icons, screen, 288+192, 0, 192, 300, 96, 96);
        drawSprite(intro_icons, screen, 288+288+96, 0, 352, 300, 96, 96);
        drawSprite(intro_icons, screen, 288+288, 0, 512, 300, 96, 96);


        drawSprite(mouse_pointer, screen, 0, 0, mx,my, 19, 31);

        if (images_collide(mx, my, 8, 8, mouse_pointer, 0, 0, 24, 31, 0xFF00FF, 32, 160, 96, 96, intro_icons, 0, 0, 96, 96, 0xFF00FF))
        {
            Text((char*)"SINGLE PLAYER",216,462);
            if (keydata & MY_BUTT_B)
            {
                exit_intro=2;
                intro_option=0;
            }
        }
        if (images_collide(mx, my, 8, 8, mouse_pointer, 0, 0, 24, 31, 0xFF00FF, 192, 160, 96, 96, intro_icons, 0, 0, 96, 96, 0xFF00FF))
        {
            Text((char*)"TWO PLAYER TEAM",200,462);
               if (keydata & MY_BUTT_B)
            {
                exit_intro=2;
                intro_option=1;
            }
        }
        //if (images_collide(mx, my, 8, 8, mouse_pointer, 0, 0, 24, 31, 0xFF00FF, 32, 160, 96, 96, intro_icons, 0, 0, 96, 96, 0xFF00FF)) Text((char*)"SINGLE PLAYER",216,462);
        //if (images_collide(mx, my, 8, 8, mouse_pointer, 0, 0, 24, 31, 0xFF00FF, 32, 160, 96, 96, intro_icons, 0, 0, 96, 96, 0xFF00FF)) Text((char*)"SINGLE PLAYER",216,462);
        if (images_collide(mx, my, 8, 8, mouse_pointer, 0, 0, 24, 31, 0xFF00FF, 512, 300, 96, 96, intro_icons, 0, 0, 96, 96, 0xFF00FF))
        {
            Text((char*)"EXIT GAME",248,462);
               if (keydata & MY_BUTT_B)
            {
                exit_intro=2;
                intro_option=7;
            }
        }


        SDL_Flip(screen);


        keydata=get_key(0);

//        printf("MS %d Millisecs\n",SDL_GetTicks()-ticks);
//        ticks=SDL_GetTicks();
    }

    if (soundpresent) Mix_HaltMusic();

    if ((intro_option>=0) && (intro_option<=3))
    {
		level.Create(startlevel);							//Create level (level id)
		player.spawn(1,level.GetPx(0),level.GetPy(0),2,0,0,3,1);		//Create Player 1
		if (intro_option>0) player.spawn(2,level.GetPx(1),level.GetPy(1),2,0,0,3,0);		//Create Player 2
		if (soundpresent)
		{
		    if (music) Mix_FreeMusic(music);
			if (startlevel<5) music = Mix_LoadMUS("audio/FuZED.lev.Checkers.xm");
			if ((startlevel>=5) && (startlevel<10)) Mix_LoadMUS("audio/FuZED.lev.Ancient.xm");

		}
		level.AddEnemies();

		level.Fadein();
		keydata=0;
        if ((soundpresent) && (music)) Mix_PlayMusic(music, -1);	//Start music playing
		while ((player.CountList()>0) && (QDOWN==0))
		{
		    while ((((player.CountList()>0) && (level.door_appear<4)) || hiscore.CountList()>0) && (QDOWN==0))
		    {
                level.Play();

                SDL_Flip(screen);
                keydata=get_key(0);
/*                if (keydata & MY_BUTT_A)
                {
                    SDL_SaveBMP(screen,"screenshot.bmp");
                    printf("screenshot saved\n");
                }*/
		    }
		    if ((player.CountList()>0) && (QDOWN==0))
		    {
				ClearAllLists();
				level.ScrollToNext();
				level.AddEnemies();
                player.InitialPosition();

		    }
		}

		level.Fadeout();
		ClearAllLists();
		player.ClearList();

    }


    if (intro_option==7) quitgame=1;
}
    Mix_FreeMusic(music);
    SaveScores();
    SaveSettings();
    SDL_Quit();

    return 0;

}
Пример #6
0
Engine::Engine(int width, int height, bool fscreen, const char* winName)
{
	gpEngine = this;
	//registering profiler funcs
	PROFILE_REG_SLICE("ENGINE_Pump");
	PROFILE_REG_SLICE("ENGINE_Update");
	PROFILE_REG_SLICE("ENGINE_Render");
	//basic vars
	bQuit = false;
	bPaused = false;
	winWidth = width;
	winHeight = height;
	int vsync=0, bpp=32, log=1, joystick=1;
	int fullscreen = fscreen?1:0;
	int renderTargets=1;
	int FPS=0;
	int scanlines = 1;
	gSerializer.PutComment("Engine.cfg","[Display Properties]");
/*	gSerializer.ReadVariable("Engine.cfg","winWidth",winWidth);
	gSerializer.ReadVariable("Engine.cfg","winHeight",winHeight);
	gSerializer.ReadVariable("Engine.cfg","bpp",bpp);
*/	gSerializer.ReadVariable("Engine.cfg","Vsync",vsync);
	gSerializer.ReadVariable("Engine.cfg","PBuffers",renderTargets);
	gSerializer.ReadVariable("Engine.cfg","ShowFPS",FPS);
	gSerializer.ReadVariable("Engine.cfg","Fullscreen",fullscreen);
	gSerializer.ReadVariable("Engine.cfg","Scanlines",scanlines);
	gSerializer.PutComment("Engine.cfg","[Engine Properties]");
	gSerializer.ReadVariable("Engine.cfg","Keeplog",log);
	gSerializer.ReadVariable("Engine.cfg","Joystick",joystick);
	FPS?bShowFps = true: bShowFps= false;
	scanlines?bScanlines=true:bScanlines=false;
	renderTargets
		?bRenderTargetSupport=true
		:bRenderTargetSupport=false;
	gLog.SetLogState(log);
	fscreen = fullscreen?true:false;

	//init
	if(!UTIL_SDL::InitSDL(winName,winWidth,winHeight,bpp,vsync?true:false,fscreen))
		return;
	InitializeRenderTargets();

	//init joystick support
	if(joystick)
	{
		if(UTIL_SDL::InitJoystick())
		{
			bJoystickSupported = true;
			oldPadAxisH=oldPadAxisV=0;
		}
		else
			bJoystickSupported = false;
	}
	else
		bJoystickSupported = false;
	InitializeKeys();

	InitDevil();
	InitFmod();

	LoadScores();
	//InitPhysics();
	iStage = 1;
	bPauseScrolling = false;
	if(!LoadConstantData())
		return;

	//Display Loading message
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	UTIL_GL::GL2D::SetOrtho((float)winWidth,(float)winHeight);
	glColor4f(1,1,1,1);
	mFont1.SetColor(0,1,1,1);
	mFont1.SetAlignment(ALIGN_LEFT);
	mFont1.SetBlendMode(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
	mFont1.SetScale(0.5f,1.0f);
	mFont1.Print("LOADING...",550,430);
	SDL_GL_SwapBuffers();

	fGameDifficulty = 3;//easy
	float delayStartup = mTimer.GetTime()+2;
	while(mTimer.GetTime()<delayStartup)
	{
		mTimer.Update();
	}
	
	curDemo=1;
	bDemo = false;
	mWeaponCheats = false;
	bHyperMode = false;
	bWimpMode = false;
	bBossFight = false;
	bCompileWithEditor = false;
	StartFrontEnd();
	SetState(&Engine::UpdateIntro,&Engine::RenderIntro);

	//start rolling
	Pump();

	//output a profiler log
	PROFILE_LOG_FINAL_STATS;
}
Пример #7
0
Top10::Top10() {
	LoadScores();
}