Ejemplo n.º 1
0
void PlayerBrowser::draw(){
	
	s8 i = 0;
	
	PA_SetBrightness(0, -31); // all black
	PA_SetBrightness(1, -31); // all black	
  	
	PA_ResetSpriteSys();
	PA_Init16cBg(1, 0);
	PA_Init16cBg(0, 0);
	PA_LoadTiledBg(1, 1, bgplayer1);  
	PA_LoadTiledBg(0, 1, bgplayer0);  
	PA_LoadSpritePal(0, 1, (void*)pbutton_Pal); 
	PA_KeyboardOut();

	PA_CreateSprite(0, TERM_SCREEN, (void*)term_Sprite, OBJ_SIZE_64X32, 1, 1, 0, 0);  
	PA_CreateSprite(0, PLAYERS_SCREEN, (void*)players_Sprite, OBJ_SIZE_64X32, 1, 1, 64, 0);  
	PA_CreateSprite(0, GAMES_SCREEN, (void*)games_Sprite, OBJ_SIZE_64X32, 1, 1, 128, 0);  
	PA_CreateSprite(0, OPTIONS_SCREEN, (void*)options_Sprite, OBJ_SIZE_64X32, 1, 1, 192, 0);  

	PA_SetSpriteAnim(0, 11, 1);
	
	for(i = -31; i < 0 ; i++){
		PA_SetBrightness(0, i); 
		PA_SetBrightness(1, i); 
		PA_WaitForVBL();		   
	}  	
	PA_16cText(0, 6, 85, 80, 95, "NAMEXXXXXX", 1, 1, 100);
	PA_16cText(0, 88, 85, 127, 95, "[12k*]", 1, 1, 100);
	PA_16cText(0, 128, 85, 136, 95, "X", 1, 1, 100);
	
	PA_16cText(0, 6, 95, 80, 115, "NAMEXXXXXX", 1, 1, 100);
	PA_16cText(0, 88, 95, 127, 115, "[12k*]", 1, 1, 100);
	PA_16cText(0, 128, 95, 136, 115, "X", 1, 1, 100);	 
}
Ejemplo n.º 2
0
// Fonction de fondu d'entrée
void fonduentree() {
	s8 i;
	for (i = -31; i <= 0; i++) {
			PA_SetBrightness(0, i);
			PA_SetBrightness(1, i);
			PA_WaitForVBL(); 
	}	
}	
Ejemplo n.º 3
0
// Fonction de fondu de sortie
void fondusortie() {
   	s8 i;
	for (i = 0; i >= -31; i--) {
		PA_SetBrightness(0, i); 
		PA_SetBrightness(1, i);		                 
		PA_WaitForVBL();
	}   
}
Ejemplo n.º 4
0
void HBL_function(void){
   s16 vcount = PA_GetVcount();
   vcount++;
   if(vcount > 192) vcount = 0; // Get correct vcount
   fade = (vcount+(level*4)-192)>>2;   
   if(fade < 0) fade = 0;
   if(fade > 31) fade = 31;
   
   if(black) PA_SetBrightness(0, fade-31);
   else PA_SetBrightness(0, 31-fade);
}   
Ejemplo n.º 5
0
/**
**Splash init function
**/
void Splash::init(){

	PA_SetBrightness(0, 31); // all White
	PA_SetBrightness(1, 31); // all White	
	
	// Load splash while hidden
	PA_LoadGif(	1, (void*)splash_top); // Gif File
	PA_LoadGif(	0, (void*)splash_bottom); // Gif File
	
	//Give backgrounds time to load
	for(uint i = -5; i <= 0; i++){
		PA_WaitForVBL();		   
	}   
}
Ejemplo n.º 6
0
/**
**Splash run function
**/
void Splash::run(){
	s16 i;
	// Transition to normal visible background
	for(i = 160; i >= 0; i--){
		PA_SetBrightness(0, i/5); 
		PA_SetBrightness(1, i/5); 
		PA_WaitForVBL();		   
	}   

	s16 time = 180; // 180 frames = 3 seconds
	while(time && (!Pad.Newpress.Anykey) && (!Stylus.Newpress)){ // Display until time over or keys pressed
		time--; // time goes by
		PA_WaitForVBL();
	}		
	
	// Transition to white
	for(i = 0; i < 160; i++){
		PA_SetBrightness(0, i/5); 
		PA_SetBrightness(1, i/5); 
		PA_WaitForVBL();		   
	}  	

	// Now that it's all white, clean all that and you're ready to go !
	PA_ResetBgSys();
	PA_SetBrightness(0, 0); // normal
	PA_SetBrightness(1, 0); // normal
	
	//Switch to main game state 
	delete mainState;
	mainState = new Menu();
}
Ejemplo n.º 7
0
// Function: main()
int main(int argc, char ** argv)
{
	PA_Init();    // Initializes PA_Lib
	PA_InitVBL(); // Initializes a standard VBL
	
	PA_InitText(1, 0);
	
	PA_SetBrightness(0, 31);
	
	PA_Init8bitBg(0, 3);
	PA_LoadGif(0, (void*)test);
	


	irqSet(IRQ_HBLANK, HBL_function);
	irqEnable(IRQ_HBLANK);
	
	u8 i;
	level = 0; 
	while(1){
	   PA_OutputText(1, 8, 10, "Fading in, white  ");
		for(level = 0; level < 80; level++) PA_WaitForVBL();
		for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second
		
		black = 1;
		PA_OutputText(1, 8, 10, "Fading out, black ");
		for(level = 80; level > 0; level--) PA_WaitForVBL();	
		for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second
		
	   PA_OutputText(1, 8, 10, "Fading in, black  ");
		for(level = 0; level < 80; level++) PA_WaitForVBL();
		for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second				
		
		black = 0;		
		PA_OutputText(1, 8, 10, "Fading out, white ");
		for(level = 80; level > 0; level--) PA_WaitForVBL();
		for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second		
	}		

	return 0;
} // End of main()
Ejemplo n.º 8
0
void PA_Init(void)
{
	s32 i;
	for (i = 0; i < 130000>>2; i++) Blank[i] = 0;

	REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR; // enable & clear FIFO

	PA_Init2D();

	pa_checklid = 1; // Autochecklid by default
	pa_update_padtimes = 0; // Don't update pad-times by default
	gh_update_padtimes = 0; // Don't update GuitarHero-pad-times by default

	Pad.Uptime.Up     = 0; Pad.Downtime.Up     = 0;
	Pad.Uptime.Down   = 0; Pad.Downtime.Down   = 0;
	Pad.Uptime.Left   = 0; Pad.Downtime.Left   = 0;
	Pad.Uptime.Right  = 0; Pad.Downtime.Right  = 0;
	Pad.Uptime.A      = 0; Pad.Downtime.A      = 0;
	Pad.Uptime.B      = 0; Pad.Downtime.B      = 0;
	Pad.Uptime.X      = 0; Pad.Downtime.X      = 0;
	Pad.Uptime.Y      = 0; Pad.Downtime.Y      = 0;
	Pad.Uptime.L      = 0; Pad.Downtime.L      = 0;
	Pad.Uptime.R      = 0; Pad.Downtime.R      = 0;
	Pad.Uptime.Start  = 0; Pad.Downtime.Start  = 0;
	Pad.Uptime.Select = 0; Pad.Downtime.Select = 0;
	Pad.Uptime.Anykey = 0; Pad.Downtime.Anykey = 0;

	//WAIT_CR &= ~(1 << 7);


	PA_VBLCountersReset();

	Stylus.X = 128;
	Stylus.Y = 96;


	PA_VBLFunctionReset();
	irqInit();
	//PA_ResetInterrupts();

	IPC->mailData = (u32)(&PA_IPC);

	for (i = 0; i < 2; i++){
		PA_SetBrightness(i, 0); // On affiche les écrans

		PA_font[i] = 0;
	//	#ifndef TEXT_ALLCHARACTERS
			PA_textmap[i] = (u16*)PA_text_Map;
			PA_texttiles[i] = (u8*)PA_text_Tiles;
			PA_textpal[i] = (u16*)PA_text_Pal;
	//	#endif
	/*	#ifdef TEXT_ALLCHARACTERS
			PA_textmap[i] = (u16*)PA_text2_Map;
			PA_texttiles[i] = (u8*)PA_text2_Tiles;
			PA_textpal[i] = (u16*)PA_text2_Pal;
		#endif	*/
	}
	PA_UpdateUserInfo();
	PA_ResetRecoSys(); // Reco system init
	PA_SetScreenSpace(48); // Default spacing

	PA_GifInfo.StartFrame = 0; // start from the beginning
	PA_GifInfo.EndFrame = 10000; // random high number

	MotionVBL = PA_Nothing;
	PaddleVBL = PA_Nothing;
	GHPadVBL = PA_Nothing;

	PA_UpdateRTC();
	PA_InitRand();
}
Ejemplo n.º 9
0
void CMenu::displayMenu(void) {
    u16 position_castle(36);
    s8 l_i;
    // Reset the background system
    PA_ResetBgSys();
    // Initialize the text at the top and bottom screens
    PA_InitText(1,0);
    PA_Init16cBg(1, 1);
    //PA_Init16cBg(1, 1);
    //PA_InitCustomText(1, 0, PA_Text);
    //PA_InitText(0,0);
    PA_Init16cBg(0, 1);
    // Load the grass background at the top screen
    PA_EasyBgLoad(1, 2, grass);
    // Set the screens' brightness to white
    PA_SetBrightness(1, 31);
    PA_SetBrightness(0, 31);
    // Load the title background at the top screen
    PA_EasyBgLoad(1, 3, title);
    // Change the brightness of the top screen to neutral (fading)
    for (l_i = 31; l_i >= 0; l_i--) {
        PA_SetBrightness(1, l_i);
        PA_WaitForVBL();
        PA_WaitForVBL();
    }
    // Create the sprites for the two castles below the grass level
    PA_DualCreateSprite(SPRITE_NB_CASTLE1_PART1, (void*)topcastle_Sprite,
                        OBJ_SIZE_64X64, 1, PALETTE_NB_CASTLE,
                        69, 192-position_castle);
    PA_DualCreateSprite(SPRITE_NB_CASTLE1_PART2, (void*)castle_Sprite,
                        OBJ_SIZE_64X64, 1, PALETTE_NB_CASTLE,
                        69, 192+64-position_castle);
    PA_DualCreateSprite(SPRITE_NB_CASTLE2_PART1, (void*)topcastle_Sprite,
                        OBJ_SIZE_64X64, 1, PALETTE_NB_CASTLE,
                        151, 192-position_castle);
    PA_DualCreateSprite(SPRITE_NB_CASTLE2_PART2, (void*)castle_Sprite,
                        OBJ_SIZE_64X64, 1, PALETTE_NB_CASTLE,
                        151, 192+64-position_castle);
    // Display the castle sprites behind the grass
    PA_DualSetSpritePrio (SPRITE_NB_CASTLE1_PART1, 3);
    PA_DualSetSpritePrio (SPRITE_NB_CASTLE1_PART2, 3);
    PA_DualSetSpritePrio (SPRITE_NB_CASTLE2_PART1, 3);
    PA_DualSetSpritePrio (SPRITE_NB_CASTLE2_PART2, 3);
    // Move gradually the castle sprites above the grass
    for (position_castle = 36; position_castle <= 90; position_castle++) {
        PA_WaitForVBL();
        PA_DualSetSpriteXY(SPRITE_NB_CASTLE1_PART1, 69, 192-position_castle);
        PA_DualSetSpriteXY(SPRITE_NB_CASTLE1_PART2, 69, 192+64-position_castle);
        PA_DualSetSpriteXY(SPRITE_NB_CASTLE2_PART1, 151, 192-position_castle);
        PA_DualSetSpriteXY(SPRITE_NB_CASTLE2_PART2, 151, 192+64-position_castle);
    }
    // Display the main menu
    PA_EasyBgLoad(0, 0, menu2);
    PA_SetBrightness(0, 0);
    // Wait for a player's action
    m_itemTouched = NO_MODE;
    while ((m_itemTouched == NO_MODE) || (m_itemTouched == MODE_TWOPLAYERS) || (m_itemTouched == BACK)) {
        m_itemTouched = itemTouched();
        if (m_itemTouched == MODE_INSTRUCTIONS)
            displayInstructions();
        if (m_itemTouched == MODE_TWOPLAYERS) {
            PA_DeleteBg (0, 0);
            PA_EasyBgLoad(0, 0, hotseat_wifi);
        }
        if (m_itemTouched == BACK) {
            PA_DeleteBg (0, 0);
            PA_EasyBgLoad(0, 0, menu2);
        }
        PA_WaitForVBL();
    }
    // Delete the castle sprites
    PA_DualDeleteSprite(SPRITE_NB_CASTLE1_PART1);
    PA_DualDeleteSprite(SPRITE_NB_CASTLE1_PART2);
    PA_DualDeleteSprite(SPRITE_NB_CASTLE2_PART1);
    PA_DualDeleteSprite(SPRITE_NB_CASTLE2_PART2);
    // Load the empty bottom screen
    PA_EasyBgLoad(0, 3, bottomscreen);
    // Activate the Wifi
    if (m_itemTouched == MODE_WIFI) {
        PA_DeleteBg (0, 0);
        PA_EasyBgLoad(1, 2, opponentchoice);
        l_wifi.goToState(WIFI_STATE_ACTIVE);
        m_playerOrder = l_wifi.connection();
    }
    // Fading to white at the top screen
    for (l_i = 0; l_i <=31; l_i++) {
        PA_SetBrightness(1, l_i);
        PA_WaitForVBL();
        PA_WaitForVBL();
    }
    // Start to play the music
#ifndef DEBUG
    AS_SetMP3Loop(true);
    AS_SetMP3Volume(m_musicVolume);
    AS_MP3DirectPlay((u8*)sound9, (u32)sound9_size);
#endif
    CGame l_game;  // Main game object
    // Initialise the game object where m_itemTouched corresponds to the game mode
    l_game.initGame(m_musicVolume, m_cardSpeed, m_itemTouched, m_playerOrder);
    // Infinite loop to keep the program running
    bool finish = false;
    while(!finish) {
        // Play the game
        finish = l_game.play(&m_musicVolume, &m_cardSpeed);
        PA_WaitForVBL();
    }
    // Stop the music
#ifndef DEBUG
    AS_MP3Stop();
#endif
}