Exemplo n.º 1
0
void toggleConsole(bool show)
{
	debug_on = show;
	
	if (show)
	{
		videoBgEnableSub(0);
		videoBgDisableSub(1);
	}
	else
	{
		videoBgEnableSub(1);
		videoBgDisableSub(0);
	}
}
Exemplo n.º 2
0
void TunnelPartInit(void)
{
	T_Mesh* mesh;
	int i;
	
	/* 
	 * Initialisation vidéo
	 */ 
	/* Modes video */
	videoSetMode(MODE_5_3D);
	videoSetModeSub(MODE_5_2D);
	lcdMainOnBottom();
	
	vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
	vramSetBankB(VRAM_B_MAIN_BG_0x06020000);
	vramSetBankC(VRAM_C_SUB_BG_0x06200000);
	vramSetBankD(VRAM_D_TEXTURE_SLOT3);
	
	videoBgEnable(DISPLAY_BG0_ACTIVE | DISPLAY_BG2_ACTIVE);
	videoBgEnableSub(DISPLAY_BG2_ACTIVE | DISPLAY_BG3_ACTIVE);
	
	/* Le BG qui servira pour le tunnel */
	TunnelBgId = bgInitSub(2, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
	TunnelBgPixels = (u16*)bgGetGfxPtr(TunnelBgId);
	bgSetPriority(TunnelBgId, 2); /* Le tunnel en fond */

	/* L'avant plan de l'éléphant */	
	FrontLayerId = bgInit(2, BgType_Bmp8, BgSize_B8_256x256, 8, 0);
	FrontLayerPixels = (u8*)bgGetGfxPtr(FrontLayerId);
	bgSetPriority(FrontLayerId, 0); /* En avant plan */
	decompress(bouleBitmap, FrontLayerPixels, LZ77Vram);
	decompress(boulePal, BG_PALETTE, LZ77Vram); 
	
	bgSetPriority(0, 1); /* La 3D entre les deux */
	
	
	/* Initialisation de la 3D */
    Init3DEngine();
    
	TunnelFxInit(TunnelBgPixels);
	        
    mesh = CreateMesh();
    mesh->display_list = DiscoElephant_mesh;
    mesh->alpha = 31;
    mesh->texturing = TRUE;
    mesh->lighting = TRUE;
    DiscoElephant = CreateObj3D(mesh);
    Scene = CreateScene();
    AddObject(Scene, DiscoElephant);
    
    Scene->lights[0] = CreateLight(floattov10(0), floattov10(0), floattov10(-1), RGB15(16, 0, 01), TRUE);
    Scene->lights[1] = CreateLight(floattov10(0), floattov10(0), floattov10(-1), RGB15(0, 16, 0), TRUE);
    Scene->lights[2] = CreateLight(floattov10(0), floattov10(0), floattov10(-1), RGB15(0, 0, 16), TRUE);
    Scene->lights[3] = CreateLight(floattov10(0), floattov10(0), floattov10(-1), RGB15(16, 16, 0), TRUE);
    
    glClearColor(0, 0, 0, 0);
    
    flare_tex = CreateTextureFromMemory((u8*)flareBitmap, GL_RGBA, 0, 16, 64, TRUE, LZ77Vram);
    
    for(i=0; i<4; i++) {
    	flares[i] = malloc(sizeof(*flares[i]));
    }
    
    flares[0]->position[0] = 0;
    flares[0]->position[1] = 0;
    flares[0]->position[2] = floattof32(-1);
    flares[0]->poly_alpha = 16;
    flares[0]->color = RGB15(31, 0, 0);
    flares[0]->size = floattov16(0.15f);
    flares[0]->texture_id = flare_tex->id;
    flares[0]->poly_id = 5;
    
    flares[1]->position[0] = 0;
    flares[1]->position[1] = 0;
    flares[1]->position[2] = floattof32(-1);
    flares[1]->poly_alpha = 16;
    flares[1]->color = RGB15(0, 31, 0);
    flares[1]->size = floattov16(0.15f);
    flares[1]->texture_id = flare_tex->id;
    flares[1]->poly_id = 6;
    
    flares[2]->position[0] = 0;
    flares[2]->position[1] = 0;
    flares[2]->position[2] = floattof32(-1);
    flares[2]->poly_alpha = 16;
    flares[2]->color = RGB15(0, 0, 31);
    flares[2]->size = floattov16(0.15f);
    flares[2]->texture_id = flare_tex->id;
    flares[2]->poly_id = 6;
    
    flares[3]->position[0] = 0;
    flares[3]->position[1] = 0;
    flares[3]->position[2] = floattof32(-1);
    flares[3]->poly_alpha = 16;
    flares[3]->color = RGB15(31, 31, 0);
    flares[3]->size = floattov16(0.15f);
    flares[3]->texture_id = flare_tex->id;
    flares[3]->poly_id = 7;
    
    tex = CreateTextureFromMemory((u8*)DiscoElephantBitmap, GL_RGB, 0, 16, 64, TRUE, LZ77Vram);
    DiscoElephant->mesh->texture_id = tex->id;
    DiscoElephant->mesh->texturing = TRUE;
    
	/* Initialisation du fade in depuis le blanc */
	REG_MASTER_BRIGHT = (1<<14);
	REG_MASTER_BRIGHT_SUB = REG_MASTER_BRIGHT;
	
	StartFlash(-1000); // pour éviter un flash à la première seconde
	
	glMaterialf(GL_AMBIENT, RGB15(16,16,16));
    glMaterialf(GL_SPECULAR, BIT(15) | RGB15(31,31,31));
	glMaterialShinyness();
}