コード例 #1
0
ファイル: Main.c プロジェクト: PocketInsanity/wolf3d
int WolfMain(int argc, char *argv[])
{
	WaitTick();			/* Wait for a system tick to go by */
	playstate = (exit_t)setjmp(ResetJmp);	
	NumberIndex = 36;	/* Force the score to redraw properly */
	IntermissionHack = FALSE;
	if (playstate) {
		goto DoGame;	/* Begin a new game or saved game */
	}
	JumpOK = TRUE;		/* Jump vector is VALID */
	FlushKeys();		/* Allow a system event */
	Intro();			/* Do the game intro */
	for (;;) {
		if (TitleScreen()) {		/* Show the game logo */
			StartSong(SongListPtr[0]);
			ClearTheScreen(BLACK);	/* Blank out the title page */
			BlastScreen();
			SetAPalette(rBlackPal);
			if (ChooseGameDiff()) {	/* Choose your difficulty */
				playstate = EX_NEWGAME;	/* Start a new game */
DoGame:
				FadeToBlack();		/* Fade the screen */
				StartGame();		/* Play the game */
			}
		}
		/* TODO: demos or whatever here */
	}
	
	return 0;
}
コード例 #2
0
ファイル: Intro.c プロジェクト: PocketInsanity/wolf3d
void Intro(void)
{	
	NewGameWindow(1);	/* Set to 512 mode */ 

	FadeToBlack();		/* Fade out the video */
	
	DisplayScreen(rMacPlayPic, rMacPlayPal);
	BlastScreen();

	StartSong(SongListPtr[0]);	/* Play the song */
	
	FadeTo(rMacPlayPal);		/* Fade in the picture */
	WaitTicksEvent(240);		/* Wait for event */
	
	DisplayScreen(rMacPlayPic, rIdLogoPal); /* higher bpp hack */
	BlastScreen();
	
	FadeTo(rIdLogoPal);

	if (toupper(WaitTicksEvent(240))=='B') { /* Wait for event */
		FadeToBlack();
		ClearTheScreen(BLACK);
		DisplayScreen(rYummyPic, rYummyPal);
		BlastScreen();
		FadeTo(rYummyPal);
		
		WaitTicksEvent(600);
	}	
}
コード例 #3
0
ファイル: BlockBoy.c プロジェクト: weber21w/uzebox-weber
void PlayDifferentSong(){
#ifdef FASTDEBUG
return;
#endif
	if(music_off){
		StopSong();
		return;
	}
	if(current_song == 1){
		StartSong(Song1);
		current_song = 2;
	}else{
		StartSong(Song2);
		current_song = 1;
	}

}
コード例 #4
0
ファイル: gghost.c プロジェクト: kivan117/gghost
/**
 * \brief Performs some basic initialization functions.
 *
 * Sets up our graphics, initializes a few variables for convenience, loads saved scores and gets the music going.
 */
static void initialSetup()
{
	SetSpritesTileTable(ghost_sprites); //sets the tiles to be used for our various sprites
	SetFontTilesIndex(TITLE_TILES_SIZE); //tiles for the font were included immediately after the include for background tiles
	                               //therefore this says how many tiles in memory to move forward from the first one
	                               //in order to find the beginning of the font tiles
	SetTileTable(title_tiles); //sets the tiles to be used for the normal background tiles in the game
	                     //fonts use this and the index above to set font tiles
	InitMusicPlayer(patches); //initialize the sound engine
	SetMasterVolume(0xff); //set volume to max
	StartSong(midisong); //start playing the main theme
	ClearVram(); //fill entire screen with first tile in the tileset (blank the screen)

	//set up some convenience variables for changing player image and drawing the score
	player_sprites[0]=ghost0;
	player_sprites[1]=ghost1;
	player_sprites[2]=ghost2;
	player_sprites[3]=ghost3;
	player_sprites[4]=ghost4;
	player_sprites[5]=ghost5;
	player_sprites[6]=ghost6;
	player_sprites[7]=ghost7;
	player_sprites[8]=ghost8;
	numbers[0]=num0;
	numbers[1]=num1;
	numbers[2]=num2;
	numbers[3]=num3;
	numbers[4]=num4;
	numbers[5]=num5;
	numbers[6]=num6;
	numbers[7]=num7;
	numbers[8]=num8;
	numbers[9]=num9;

	//checks if our desired eeprom block is setup correctly,
	//if not, it wipes it so we don't have to deal with garbage data in the high score list
	if(checkEeprom()==1)
	{
		wipeEeprom();
	}
	//load our top 10 saved scores from eeprom
	LoadScore(0, 9);
}
コード例 #5
0
ファイル: Main.c プロジェクト: PocketInsanity/wolf3d
Boolean TitleScreen()
{
	Word RetVal;		/* Value to return */

	playstate = EX_LIMBO;	/* Game is not in progress */
	NewGameWindow(1);	/* Set to 512 mode */
	FadeToBlack();		/* Fade out the video */

	DisplayScreen(rTitlePic, rTitlePal);
	BlastScreen();

	StartSong(SongListPtr[0]);
	FadeTo(rTitlePal);	/* Fade in the picture */
	BlastScreen();
	
	RetVal = WaitTicksEvent(0);		/* Wait for event */
	
	playstate = EX_COMPLETED;

	return TRUE;	
}
コード例 #6
0
ファイル: main.cpp プロジェクト: jasoncarlough/doomretro
//
// MidiRPC_PlaySong
//
// Start playing the song.
//
void MidiRPC_PlaySong(boolean looping)
{
    RegisterSong(song->getBuffer(), song->getSize());
    StartSong(looping);
}
コード例 #7
0
ファイル: SuperMarioDemo.c プロジェクト: Aliandrana/uzebox
int main(){	
	TriggerFx(0,0,0);


	ClearVram();
	InitMusicPlayer(patches);
	SetMasterVolume(0x40);
	StartSong(midisong);

	SetSpritesTileTable(mario_sprites_tileset);
	SetFontTilesIndex(SMB_TILESET_SIZE);
	SetTileTable(smb_tileset);

    Screen.scrollHeight = 23;
	

    Screen.overlayHeight=4;
    Screen.overlayTileTable=smb_tileset;
	DrawMap2(0,Screen.scrollHeight,map_hud);
	
	unsigned char c;
	for(int y=0;y<22;y++){
		for(int x=0;x<30;x++){
			c=pgm_read_byte(&(map_main[(y*MAP_MAIN_WIDTH)+x+2]));
			SetTile(x,y+1,c);
		}	
	}


	dx=0;
	sx=50;
	sy=169-32+8;
	sprDir=1;

	goombaX[0]=17; //159;
	goombaDir[0]=-1;
	goombaAnim[0]=0;
	goombaSpr[0]=0;
	goombaSprIndex[0]=6;

	goombaX[1]=65 ;//201;
	goombaDir[1]=1;
	goombaAnim[1]=0;
	goombaSpr[1]=0;
	goombaSprIndex[1]=10;


	MapSprite2(0,map_rwalk1,0);
	MapSprite2(6,map_rgoomba1,SPRITE_FLIP_X);
	MapSprite2(10,map_rgoomba2,0);



	g=0;
	MoveSprite(0,sx,sy,2,3);
	Scroll(0,-1);

	MoveSprite(goombaSprIndex[0],goombaX[0],176,2,2);
	MoveSprite(goombaSprIndex[1],goombaX[1],176,2,2);

	Screen.scrollY=0;
	Screen.overlayHeight=4;//OVERLAY_LINES;

	
	while(1){
		WaitVsync(1);
	

		processControls();

		if((active&1)!=0){
			PerformActions();
			MoveSprite(0,sx,sy+dy,2,3);
		}else{
			MoveSprite(0,sx,230,2,3);
		}



		//animate goombas
		for(g=0;g<2;g++){
		

				if(goombaX[g]<=0 && goombaDir[g]==-1){
					goombaDir[g]=1;
				}
		
				if(goombaX[g] >= (215+15) && goombaDir[g]==1){
					goombaDir[g]=-1;
			
				}
		
				goombaX[g]+=goombaDir[g];
				goombaAnim[g]++;

				if(goombaAnim[g]==8){
					goombaSpr[g]^=1;
					goombaAnim[g]=0;
				}

				if(goombaSpr[g]==0){
					MapSprite2(goombaSprIndex[g],map_rgoomba1,goombaDir[g]!=1?SPRITE_FLIP_X:0);
				}else{
					MapSprite2(goombaSprIndex[g],map_rgoomba2,goombaDir[g]!=1?SPRITE_FLIP_X:0);
				}

				MoveSprite(goombaSprIndex[g],goombaX[g],176-32+8,2,2);
			

		}
	

	}		
	
}
コード例 #8
0
ファイル: InterMis.c プロジェクト: ProjectZeroSlackr/hWolf3D
void LevelCompleted(void)
{
    Word k;

    /* setup */

    ParTime = MapListPtr->InfoArray[gamestate.mapon].ParTime;
    BonusScore = 0;		/* Init the bonus */

    IntermissionHack = TRUE;	/* Hack to keep score from drawing twice */
    NumberIndex = 47;		/* Hack to draw score using an alternate number set */
    NewGameWindow(1);		/* Force 512 mode screen */

    DisplayScreen(rIntermission, rInterPal);
    BlastScreen();

    InitInterMisPic();

    WhichBJ = 0;		/* Init BJ */
    BJTime = ReadTick()-50;		/* Force a redraw */
    BlastScreen();		/* Draw the screen */
    ShowBJ();			/* Draw BJ */
    StartSong(SongListPtr[1]);	/* Play the intermission song */
    SetAPalette(rInterPal);	/* Set the palette */
    DrawIScore();			/* Draw the current score */
    FlushKeys();			/* Flush the keyboard buffer */

    /* First an initial pause */

    BJBreath(60);

    /* Display Par Time, Player's Time, and show bonus if any. */

    if (gamestate.playtime>=(100*60*60UL)) {
        k =(99*60)+59;
    } else {
        k = gamestate.playtime/60;
    }
    DrawTime(TIMEX,TIMEY,k);		/* How much time has elapsed? */
    DrawTime(TIMEX,TIMEY2,ParTime);

    if (k < ParTime) {
        k = (ParTime-k) * 50;		/* 50 points per second */
        BonusScore += k;		/* Add to the bonus */
        DrawIBonus();			/* Draw the bonus */
        PlaySound(SND_EXTRA);
        BJBreath(60);			/* Breath a little */
    }

    /* Show ratios for "terminations", treasure, and secret stuff. */
    /* If 100% on all counts, Perfect Bonus! */

    k=0;		/* Not perfect (Yet) */
    RollRatio(RATIOX,RATIOY,(gamestate.treasurecount*100)/gamestate.treasuretotal);
    if (gamestate.treasurecount == gamestate.treasuretotal) {
        k++;			/* Perfect treasure */
    }
    if (!NoEnemies) {
        RollRatio(RATIOX,RATIOY2,(gamestate.killcount*100)/gamestate.killtotal);
        if (gamestate.killcount == gamestate.killtotal) {
            k++;			/* Perfect kills */
        }
    }
    RollRatio(RATIOX,RATIOY3,(gamestate.secretcount*100)/gamestate.secrettotal);
    if (gamestate.secretcount == gamestate.secrettotal) {
        k++;			/* Perfect secret */
    }
    if (BonusScore) {	/* Did you get a bonus? */
        RollScore();
        BJBreath(60);
    }
    if (k==3) {
        WhichBJ = 2;	/* Draw thumbs up for BJ */
        PlaySound(SND_THUMBSUP);
    }
    do {
        ShowBJ();		/* Animate BJ */
    } while (!WaitTicksEvent(1));		/* Wait for a keypress */

    FadeToBlack();		/* Fade away */

    FreeInitMisPic();
    IntermissionHack = FALSE;		/* Release the hack */
    NumberIndex = 36;			/* Restore the index */
}