bool UpdateTextured(Textured & t, Range & r){
  
  //now, set new current_range:
  V3f center((r.min+r.max)/2);
  center.x = floorf(center.x);
  center.y = floorf(center.y);
  center.z = floorf(center.z);

  V3f half_diagonal(SIZE/2, SIZE/2, SIZE/2);
  t.current_range = Range(center-half_diagonal, 
			  center+half_diagonal);
  
  //fill it with a dummy texture for now (maybe 
  //better done with an external class
  Range fast_volume_range(V3f(0,0,0), V3f(255,255,255));

  unsigned char res;

  V3f c(t.current_range.min); //start
  for(int x = 0; x < SIZE; x++)
    for(int y = 0; y < SIZE; y++)
      for(int z = 0; z < SIZE; z++){
	V3f cur(c.x+x, c.y+y, c.z+z);
	if(t.texturing_fastvolume){
	  res = 
	    (unsigned char)t.texturing_fastvolume->\
	    SampleCentered((int)cur.x%255, 
		   (int)cur.y%255, 
		   (int)cur.z%255);

	  //Color conversion.
	  int r = res * 3; r=(r<0)?0:(r>255?255:r);
	  int g = (res - 80) * 3; g=(g<0)?0:(g>255?255:g);
	  int b = (res - 160) * 3; b=(b<0)?0:(b>255?255:b);

	  ((BYTE)t.data)[Offset(x,y,z)] = r;
	  ((BYTE)t.data)[Offset(x,y,z)+1] = g;
	  ((BYTE)t.data)[Offset(x,y,z)+2] =  b;
	  ((BYTE)t.data)[Offset(x,y,z)+3] =  255;
	}else{
	  bool line_hit = 
	    !((int)cur.x % 10) || 
	    !((int)cur.y % 10) || 
	    !((int)cur.z % 10);
	  ((BYTE)t.data)[Offset(x,y,z)] = line_hit?30:300;
	  ((BYTE)t.data)[Offset(x,y,z)+1] =line_hit?70:0;
	  ((BYTE)t.data)[Offset(x,y,z)+2] =line_hit?300:30;
	  ((BYTE)t.data)[Offset(x,y,z)+3] =  200;
	};
      };
  //ready; now load the texture
  UploadTexture(t.data);

  return true;
};
Exemple #2
0
studiohdr_t *StudioModel::LoadModel( char *modelname )
{
	FILE *fp;
	long size;
	void *buffer;

	// load the model
	if( (fp = fopen( modelname, "rb" )) == NULL)
	{
		printf("unable to open %s\n", modelname );
		exit(1);
	}

	fseek( fp, 0, SEEK_END );
	size = ftell( fp );
	fseek( fp, 0, SEEK_SET );
	buffer = malloc( size );
	fread( buffer, size, 1, fp );

	int					i;
	byte				*pin;
	studiohdr_t			*phdr;
	mstudiotexture_t	*ptexture;

	pin = (byte *)buffer;
	phdr = (studiohdr_t *)pin;

	ptexture = (mstudiotexture_t *)(pin + phdr->textureindex);
	if (phdr->textureindex != 0)
	{
		for (i = 0; i < phdr->numtextures; i++)
		{
			// strcpy( name, mod->name );
			// strcpy( name, ptexture[i].name );
			UploadTexture( &ptexture[i], pin + ptexture[i].index, pin + ptexture[i].width * ptexture[i].height + ptexture[i].index );
		}
	}

	// UNDONE: free texture memory

	fclose( fp );

	return (studiohdr_t *)buffer;
}
studiohdr_t *StudioModel::LoadModel( char *modelname )
{
	FILE *fp;
	long size;
	void *buffer;

	if (!modelname)
		return 0;

	// load the model
	if( (fp = fopen( modelname, "rb" )) == NULL)
		return 0;

	fseek( fp, 0, SEEK_END );
	size = ftell( fp );
	fseek( fp, 0, SEEK_SET );

	buffer = malloc( size );
	if (!buffer)
	{
		fclose (fp);
		return 0;
	}

	fread( buffer, size, 1, fp );
	fclose( fp );

	byte				*pin;
	studiohdr_t			*phdr;
	mstudiotexture_t	*ptexture;

	pin = (byte *)buffer;
	phdr = (studiohdr_t *)pin;
	ptexture = (mstudiotexture_t *)(pin + phdr->textureindex);

	if (strncmp ((const char *) buffer, "IDST", 4) &&
		strncmp ((const char *) buffer, "IDSQ", 4))
	{
		free (buffer);
		return 0;
	}

	if (!strncmp ((const char *) buffer, "IDSQ", 4) && !m_pstudiohdr)
	{
		free (buffer);
		return 0;
	}

	if (phdr->textureindex > 0 && phdr->numtextures <= MAXSTUDIOSKINS)
	{
		int n = phdr->numtextures;
		for (int i = 0; i < n; i++)
		{
			// strcpy( name, mod->name );
			// strcpy( name, ptexture[i].name );
			UploadTexture( &ptexture[i], pin + ptexture[i].index, pin + ptexture[i].width * ptexture[i].height + ptexture[i].index, g_texnum++ );
		}
	}

	// UNDONE: free texture memory

	if (!m_pstudiohdr)
		m_pstudiohdr = (studiohdr_t *)buffer;

	return (studiohdr_t *)buffer;
}
Exemple #4
0
void CGameGunHound::Loop()
{
	//-----------------------------------------
	//ハウンドメイン
	//-----------------------------------------

	if( m_bResetOK )
	{
		if( m_bResetPlease )
		{
			m_bResetPlease = gxFalse;
			m_sEndSeq = -1;
			ChangeGameSeq( enMainSeqGameEnd );
		}
		else if( CDashBoard::GetInstance()->IsMenuBar() )
		{
			m_bPauseFlag = gxTrue;
		}
		else
		{
			m_bPauseFlag = gxFalse;
		}

	}


	switch( m_GameSeq ){
	case enMainSeqInit:
		//-----------------------------------------
		//ゲーム初期化
		//-----------------------------------------
		m_bBriefingRoot = gxTrue;
		m_bResetOK      = gxFalse;
		viiDbg::log("ハウンドシーケンス:enMainSeqInit");
		//SaveDataInit();
		//GameConfigLoad();
		m_bPauseFlag = gxFalse;
		ChangeGameSeq( enMainSeqStart );
		break;

	case enMainSeqStart:
		//-----------------------------------------
		//スコア初期化
		//-----------------------------------------
		m_bResetOK = gxFalse;
		viiDbg::log("ハウンドシーケンス:enMainSeqStart");

#ifdef _VII_DEBUG_
		CDashBoard::GetInstance()->SetMenuDisable(gxFalse);
		CDashBoard::GetInstance()->SetLogo(gxFalse);
		CDashBoard::GetInstance()->SetWallPaper(gxFalse);
		ChangeGameSeq( enMainSeqRestart );
#else
//		ChangeGameSeq( enMainSeqGameOpeningDemo );
		CDashBoard::GetInstance()->SetMenuDisable(gxFalse);
		CDashBoard::GetInstance()->SetLogo(gxFalse);
		CDashBoard::GetInstance()->SetWallPaper(gxFalse);
		ChangeGameSeq( enMainSeqGameTitle );
#endif
		break;

	case enMainSeqGameTitle:
		//-----------------------------------------
		//タイトルのシーケンス
		//-----------------------------------------
		UploadTexture();
		m_bResetOK = gxFalse;
		ChangeGameSeq( enMainSeqRestart );
		break;

	case enMainSeqRestart:
		//-----------------------------------------
		//リスタートのポイント
		//-----------------------------------------
		m_bResetOK = gxFalse;

		ResetClass();

#ifdef GX_DEBUG
		ChangeGameSeq( enMainSeqDebugMenu );
#else
		ChangeGameSeq( enMainSeqGameMainMenu );
#endif
		break;

	case enMainSeqGameMainMenu:
		//-----------------------------------------
		//メインメニューのシーケンス
		//-----------------------------------------
		m_bResetOK = gxTrue;
		CDashBoard::GetInstance()->SetMenuDisable(gxTrue);
		switch( MainMenu() ){
		case enMenuSeqBack:
		case enMenuSeqNext:
			g_StGameInfo.Reset();
			if( m_sMainMenuSelected == CMainMenu::enMainMenuOpening )
			{
				//オープニングへ
				ChangeGameSeq( enMainSeqGameOpeningDemo );
			}
			else if( m_sMainMenuSelected == CMainMenu::enMainMenuDebug )
			{
				//デバッグモードへ
				g_StGameInfo.m_sGameMode = StGameInfo::enGameModeNormal;
				ChangeGameSeq( enMainSeqDebugMenu );
			}
			else if( m_sMainMenuSelected == CMainMenu::enMainMenuEnding )
			{
				//エンディング
				CDashBoard::GetInstance()->SetIcon( enIconNone );
				ChangeGameSeq( enMainSeqGameEndingDemo );
			}
			else if( m_sMainMenuSelected == CMainMenu::enMainMenuStart )
			{
				//ゲームスタートへ
				CDashBoard::GetInstance()->SetIcon( enIconNone );
				g_StGameInfo.m_sGameMode = StGameInfo::enGameModeNormal;
				g_StGameInfo.m_bMessage = gxTrue;
				ChangeGameSeq( enMainSeqGameBriefing );
			}
			else if( m_sMainMenuSelected == CMainMenu::enMainMenuTutorial )
			{
				//チュートリアルスタートへ
				g_StGameInfo.m_bMusic   = gxTrue;
				g_StGameInfo.m_bMessage = gxTrue;
				g_StGameInfo.m_bReplay  = gxFalse;
				CDashBoard::GetInstance()->SetIcon( enIconNone );
				g_StGameInfo.m_sGameMode = StGameInfo::enGameModeNormal;
				g_StGameInfo.PlayStage = enScenarioTutorial;
				StageSet();
				g_StGameInfo.PlayArea  = m_sSelectedStage;
				ChangeGameSeq( enMainSeqGameInit );
			}
			else if( m_sMainMenuSelected == CMainMenu::enMainMenuMission )
			{
				//ゲームスタートへ
				CDashBoard::GetInstance()->SetIcon( enIconNone );
				g_StGameInfo.m_sGameMode = StGameInfo::enGameModeMission;
				g_StGameInfo.PlayStage   = m_sSelectedStage;//enScenarioTutorial;
				g_StGameInfo.PlayArea = 0;

				StageSet();

				ChangeGameSeq( enMainSeqGameInit );

			}
			else if( m_sMainMenuSelected == CMainMenu::enMainMenuExit )
			{
				//ゲーム終了
				ExitGame();
			}
			break;

		default:
			break;
		}
		break;

	case enMainSeqGameOpeningDemo:
		//-----------------------------------------
		//オープニングのシーケンス
		//-----------------------------------------
		m_bResetOK = gxFalse;
		if( AdvertiseDemo()  )
		{
			ChangeGameSeq( enMainSeqGameTitle );
		}
		break;

	case enMainSeqDebugMenu:
		//-----------------------------------------
		//デバッグメニュー
		//-----------------------------------------
		m_bResetOK = gxTrue;
		switch( DebugMenu() ) {
		case enMenuSeqBack:
			ChangeGameSeq( enMainSeqGameMainMenu );
			break;
		case enMenuSeqNext:
//			g_StGameInfo.Reset();
			g_StGameInfo.m_bMessage = gxTrue;
			g_StGameInfo.m_bMusic   = gxTrue;
			g_StGameInfo.m_bReplay  = gxFalse;
			ChangeGameSeq( enMainSeqGameInit );
			break;
		}
		break;

	case enMainSeqGameBriefing:
		g_StGameInfo.ContinueArea = 0;

		CCockpit::GetInstance()->SetHidden();
		CDashBoard::GetInstance()->SetMenuDisable(gxFalse);
		m_bResetOK = gxTrue;

		if( m_pSetUp == NULL )
		{
			//セットアップ画面を作る
			m_pSetUp = new CSetUp( -1 );//g_StGameInfo.PlayStage );
		}

		if( BriefingMain() )
		{
			//ステージ決定
			StageSet();
			m_bBriefingRoot = gxTrue;
			ChangeGameSeq( enMainSeqGameSetUp );
		}

		CockpitControl();
		break;

	case enMainSeqGameSetUp:
		CCockpit::GetInstance()->SetHidden();
		m_bResetOK = gxTrue;

		if( m_pSetUp->IsEnd() )
		{
			ChangeGameSeq( enMainSeqGameBefore );
		}

		CockpitControl();
		break;

	case enMainSeqGameBefore:
		//-----------------------------------------
		//ゲーム初期化
		//-----------------------------------------
		CCockpit::GetInstance()->ReNew();
		CCockpit::GetInstance()->SetHidden();

		CockpitControl();

		m_bResetOK = gxTrue;

		if( !m_pSetUp->IsWait() )
		{
			//CCockpit::GetInstance()->Reset();
			viiMus::StopBGM( enSoundBgm1 );
			ChangeGameSeq( enMainSeqGameInit );
		}

		break;

	case enMainSeqGameInit:
		//-----------------------------------------
		//ゲーム初期化
		//-----------------------------------------
		CCockpit::GetInstance()->Destroy();
		CCockpit::GetInstance()->SetHidden();
		m_bResetOK = gxFalse;

		if( pGame ) delete pGame;
		pGame = new CGameManager();

		GameInit();

		pGame->init();

		CockpitControl();

		viiMus::Destroy();
		ChangeGameSeq( enMainSeqGameMain );
		break;

	case enMainSeqGameMain:
		//-----------------------------------------
		//ゲームメイン
		//-----------------------------------------
		CDashBoard::GetInstance()->SetMenuDisable(gxFalse);
		m_bResetOK = gxTrue;

		if( m_pSetUp )
		{
			m_bResetOK = gxFalse;

			m_pSetUp->Draw();

			if( m_pSetUp->GoDestroy() )
			{
				//----------------------------------------------
				//セットアップ終了
				//----------------------------------------------
				CCockpit::GetInstance()->Reset();
				delete m_pSetUp;
				m_pSetUp = NULL;
			}
		}

		if( !m_bGameStart && pGame->IsGameStart() )
		{
			m_bGameStart = gxTrue;
		}

		GameMain();

		if( pGame->IsStageClear() )
		{
			m_sEndSeq = pGame->GetNextSeq();	//m_sEndSeq = 1;	//次へ
			ChangeGameSeq( enMainSeqGameEnd );
		}
		else if( CCockpit::GetInstance()->IsGameOver() )
		{
			m_sEndSeq = enClearSeqContinue;
			ChangeGameSeq( enMainSeqGameEnd );
		}

		break;

	case enMainSeqGameEnd:
		//-----------------------------------------
		//ゲーム終了
		//-----------------------------------------
		m_bResetOK = gxFalse;

		GameEnd();

		if( pGame )
		{
			delete pGame;
			pGame = NULL;
		}

		if( !m_bBriefingRoot )
		{
			m_sEndSeq = 0;
		}

		CCockpit::GetInstance()->ReNew();

		if( m_sMainMenuSelected == CMainMenu::enMainMenuMission || m_sMainMenuSelected == CMainMenu::enMainMenuTutorial)
		{
			//---------------------------------------
			//ストーリーモード以外の時
			//---------------------------------------

			//スコアを加算する
			g_CHoundSaveData.UpdateHighScore( g_StGameInfo.m_uAllScore );

			//ミッションモードだった
			ChangeGameSeq( enMainSeqGameMainMenu );

			//チュートリアルモードだった
			ChangeGameSeq( enMainSeqGameMainMenu );

		}
		else if( m_sEndSeq == enClearSeqStageClear )
		{
#ifdef _TRIAL_VERSION_
			//タイトルに戻る
			g_CHoundSaveData.UpdateHighScore( g_StGameInfo.m_uAllScore );
			ChangeGameSeq( enMainSeqRestart );
#else
			//ステージクリアだった
			g_StGameInfo.SetStageClear( g_StGameInfo.PlayStage );
			switch( g_StGameInfo.PlayStage ){
			case enScenarioJungle:
				g_CHoundSaveData.SetHiddenOpen( enHiddenItemMission2 );
				break;
			case enScenarioRiver:
				g_CHoundSaveData.SetHiddenOpen( enHiddenItemMission3 );
				break;
			case enScenarioMountain:
				g_CHoundSaveData.SetHiddenOpen( enHiddenItemMission4 );
				break;
			case enScenarioBase:
				g_CHoundSaveData.SetHiddenOpen( enHiddenItemMission5 );
				break;
			}

			ChangeGameSeq( enMainSeqGameBriefing );
#endif
		}
		else if( m_sEndSeq == enClearSeqContinue )
		{
			//ステージ失敗だった(コンティニュールート)
			ChangeGameSeq( enMainSeqGameContinue );
		}
		else if( m_sEndSeq == enClearSeqGameOver )
		{
			//ゲームオーバーだった
			ChangeGameSeq( enMainSeqGameContinue );
		}
		else if( m_sEndSeq == enClearSeqEnding )
		{
			//エンディングだった
			g_StGameInfo.SetStageClear( g_StGameInfo.PlayStage );
			g_CHoundSaveData.UpdateHighScore( MISSION_ALLOVER_BONUS );

			Uint32 uScore = 0;

			//ゲームスコアを加算
			m_stEndingBonus.uAllScore = g_StGameInfo.m_uAllScore;

			//オールオーバーボーナスをコンティニュー回数で割る
			m_stEndingBonus.uContinueBonus = MISSION_ALLOVER_BONUS/(g_StGameInfo.m_sContinueCnt+1);
			m_stEndingBonus.uContinueBonus = m_stEndingBonus.uContinueBonus/10;
			m_stEndingBonus.uContinueBonus = m_stEndingBonus.uContinueBonus*10;


			//Trueエンディングの場合場合ボーナス
			m_stEndingBonus.uTrueEndBonus = 0;
			if( g_StGameInfo.m_bTrueEnd )
			{
				m_stEndingBonus.uTrueEndBonus = ENDING_TRUEVERSION_BONUS;
				g_CHoundSaveData.SetHiddenOpen( enHiddenItemViewEnding );
			}

			//ノーコンティニューだった場合2倍ボーナス
			if( g_StGameInfo.m_sContinueCnt == 0 )
			{
				m_stEndingBonus.uNoContinueBonus = m_stEndingBonus.uAllScore + m_stEndingBonus.uContinueBonus + m_stEndingBonus.uTrueEndBonus;
			}

			uScore =  m_stEndingBonus.uAllScore;
			uScore += m_stEndingBonus.uContinueBonus;
			uScore += m_stEndingBonus.uTrueEndBonus;
			uScore += m_stEndingBonus.uNoContinueBonus;

			m_stEndingBonus.uTotalScore = uScore;

			//スコアを加算する
			g_CHoundSaveData.UpdateHighScore( uScore );

			ChangeGameSeq( enMainSeqGameEndingDemo );
		}
		else
		{
			//リセットだった
/*
			if( m_bGameStart && m_sMainMenuSelected == CMainMenu::enMainMenuStart )
			{
				m_sResetCount = 120;
				ChangeGameSeq( enMainSeqResetInGame );
			}
			else
			{
				ChangeGameSeq( enMainSeqRestart );
			}
*/
			ChangeGameSeq( enMainSeqRestart );

		}
		break;

	case enMainSeqGameContinue:
		//-----------------------------------------
		//コンティニュー
		//-----------------------------------------
		m_bResetOK = gxTrue;
		m_bGameStart = gxFalse;
		switch( ContinueScreen() ){
		case enMenuSeqNext:
			{
				//タイトルに戻る
				g_CHoundSaveData.UpdateHighScore( g_StGameInfo.m_uAllScore );
				ChangeGameSeq( enMainSeqRestart );
			}
			break;

		case enMenuSeqBack:
			{
				//コンティニューする
//				Sint32 sMem = g_StGameInfo.PlayArea;
//				StageSet();
				//スコアをリセットする
/*
				g_StGameInfo.m_uAllScore   = (g_StGameInfo.m_uAllScore/2);
				g_StGameInfo.m_uAllScore   -= g_StGameInfo.m_uAllScore%10;;
*/
				//スコア更新
				g_CHoundSaveData.UpdateHighScore( g_StGameInfo.m_uAllScore );
				g_StGameInfo.m_uAllScore   = 0;//(g_StGameInfo.m_uAllScore/2);
				g_StGameInfo.m_uStageScore = g_StGameInfo.m_uAllScore;

				if( g_StGameInfo.m_sContinueCnt < 99 ) g_StGameInfo.m_sContinueCnt ++;
				g_StGameInfo.ContinueArea = g_StGameInfo.PlayArea;
				ChangeGameSeq( enMainSeqGameInit );
			}
			break;

		default:
			break;
		}
		break;

	case enMainSeqGameEndingDemo:
		//-----------------------------------------
		//ゲーム終了
		//-----------------------------------------
		m_bResetOK = gxTrue;
		m_bGameStart = gxFalse;
		CCockpit::GetInstance()->SetHidden();
		CDashBoard::GetInstance()->SetMenuDisable(gxFalse);
		if( EndingDemo() )
		{
			ChangeGameSeq( enMainSeqRestart );
		}
		break;
	case enMainSeqResetInGame:
		if( m_sResetCount > 0 )
		{
			m_sResetCount --;
		}
		else
		{
			g_StGameInfo.m_uAllScore   = 0;
			g_StGameInfo.m_uStageScore = 0;
			g_StGameInfo.ContinueArea = g_StGameInfo.PlayArea;
			CCockpit::GetInstance()->ReNew();
			ChangeGameSeq( enMainSeqGameInit );
		}
		break;
	default:
		break;
	}

	viiMus::GetInstance()->Action();
	CFadeManager::GetInstance()->action();
}
Exemple #5
0
gxBool HoundStartUpLoading()
{
	Uint32 sDummy=0;

	static CGXImage *pCGXImage = CGXImage::GetInstance();

	pCGXImage->Load("asset/gh/GXI/cmn.GXI");

//	Sint32 sPer = pCGXImage->GetLoading();

//	viiDbg::printf( 128,-32,"NOW_LOADING(%d)",sPer);

	if( !pCGXImage->IsLoadFinish() ) return gxFalse;

//	viiSub::LoadTexture(0	,pCGXImage,"HoundData\\vram\\bank00\\DashBoard.bmp" );
	viiSub::LoadTexture(2	,pCGXImage,"HoundData\\vram\\bank00\\UI1.tga" );
//	viiSub::LoadTexture(3	,pCGXImage,"HoundData\\vram\\bank00\\UI3.bmp" );

//	viiSub::LoadTexture(4	,pCGXImage,"HoundData\\vram\\bank00\\AsNEW.bmp" );
	viiSub::LoadTexture(4	,pCGXImage,"HoundData\\vram\\bank00\\GunHound01.bmp" );
//	viiSub::LoadTexture(5	,pCGXImage,"HoundData\\vram\\bank00\\GunHound02.bmp" );	//BLACKに差し替え
	viiSub::LoadTexture(6   ,pCGXImage,"HoundData\\vram\\bank00\\TexDummyHound.bmp" );
	viiSub::LoadTexture(enTexPageLineHound	,pCGXImage,"HoundData\\vram\\bank00\\gunhoundLine.bmp" );

	viiSub::LoadTexture(8	,pCGXImage,"HoundData\\vram\\bank00\\face1.bmp" );
//	viiSub::LoadTexture(9	,pCGXImage,"HoundData\\vram\\bank00\\face2.bmp" );
	viiSub::LoadTexture(10	,pCGXImage,"HoundData\\vram\\bank00\\string.tga" );
//	viiSub::LoadTexture(10	,pCGXImage,"HoundData\\vram\\bank00\\face.bmp" );
//	viiSub::LoadTexture(11	,pCGXImage,"HoundData\\vram\\bank00\\face.bmp" );
	viiSub::LoadTexture(12	,pCGXImage,"HoundData\\vram\\bank00\\effect.bmp" );
	viiSub::LoadTexture(13	,pCGXImage,"HoundData\\vram\\bank00\\StageEffect02.bmp" );
	viiSub::LoadTexture(14	,pCGXImage,"HoundData\\vram\\bank00\\cloud.tga" );
	viiSub::LoadTexture(enTexPageEffect4	,pCGXImage,"HoundData\\vram\\bank00\\effect3.bmp" );
	viiSub::LoadTexture(16	,pCGXImage,"HoundData\\vram\\bank01\\ene_soldier.bmp" );
	viiSub::LoadTexture(17	,pCGXImage,"HoundData\\vram\\bank01\\TexEneCmn03.bmp" );
	viiSub::LoadTexture(18	,pCGXImage,"HoundData\\vram\\bank01\\TexEneCmn05.bmp" );
	viiSub::LoadTexture(19	,pCGXImage,"HoundData\\vram\\bank01\\TexEneCmn01.bmp" );
	viiSub::LoadTexture(20	,pCGXImage,"HoundData\\vram\\bank01\\TexEneCmn06.bmp" );
	viiSub::LoadTexture(21	,pCGXImage,"HoundData\\vram\\bank01\\TexEneCmn04.bmp" );
	viiSub::LoadTexture(22	,pCGXImage,"HoundData\\vram\\bank01\\TexEneStg0502.bmp" );

	//viiSub::LoadTexture(23	,pCGXImage,"HoundData\\vram\\bank00\\" );

	viiSub::LoadTexture(32    ,pCGXImage,"HoundData\\vram\\bank02\\font.bmp" );

	viiSub::LoadTexture(38    ,pCGXImage,"HoundData\\vram\\bank02\\briefingObj.tga" );//←こっちが先
	viiSub::LoadTexture(34    ,pCGXImage,"HoundData\\vram\\bank02\\brbg.bmp" );
//	viiSub::LoadTexture(39    ,pCGXImage,"HoundData\\vram\\bank02\\briefingObj2.bmp" );
	viiSub::LoadTexture(40    ,pCGXImage,"HoundData\\vram\\bank02\\river.bmp" );
//	viiSub::LoadTexture(42    ,pCGXImage,"HoundData\\vram\\bank02\\dbgene0407.bmp" );
//	viiSub::LoadTexture(44    ,pCGXImage,"HoundData\\vram\\bank02\\TexEneStg0405.bmp" );
//	viiSub::LoadTexture(45    ,pCGXImage,"HoundData\\vram\\bank02\\TexEneStg0406.bmp" );
//	viiSub::LoadTexture(enTexPageSearchLight    ,pCGXImage,"HoundData\\vram\\bank02\\SearchLight.tga" );
#ifdef _TRIAL_VERSION_
	viiSub::LoadTexture(enTexPageSearchLight    ,pCGXImage,"HoundData\\vram\\bank02\\taikenban.bmp" );
#endif
//		viiSub::LoadTexture(48    ,pCGXImage,"HoundData\\vram\\bank03\\gxLogo.tga" );

	//↓こっちを先に読みこむこと!!!
	viiSub::LoadTexture(52    ,pCGXImage,"HoundData\\vram\\bank03\\ScreenShot.bmp" );	
	//↑こっちを先に読みこむこと!!!

	viiSub::LoadTexture(50    ,pCGXImage,"HoundData\\vram\\bank03\\TitleScreen1.bmp" );
	viiSub::LoadTexture(56    ,pCGXImage,"HoundData\\vram\\bank03\\TitleScreen2.bmp" );
	viiSub::LoadTexture(enTexPageEyeCatch    ,pCGXImage,"HoundData\\vram\\bank03\\eyecatch.bmp" );

	//viiSub::LoadTexture(58  ,pCGXImage,"HoundData\\vram\\bank00\\" );
	//viiSub::LoadTexture(59  ,pCGXImage,"HoundData\\vram\\bank00\\" );
	//viiSub::LoadTexture(62  ,pCGXImage,"HoundData\\vram\\bank00\\" );
	//viiSub::LoadTexture(63  ,pCGXImage,"HoundData\\vram\\bank00\\" );


	viiSub::LoadSound( enSoundSwitch01 ,pCGXImage, "HoundData\\sound\\sw01.wav");
	viiSub::LoadSound( enSoundSwitch02 ,pCGXImage, "HoundData\\sound\\sw02.wav");
	viiSub::LoadSound( enSoundSwitch03 ,pCGXImage, "HoundData\\sound\\sw03.wav");

	viiSub::LoadSound( enSoundGun01    ,pCGXImage, "HoundData\\sound\\gun01.wav");
	viiSub::LoadSound( enSoundMissile,pCGXImage,"HoundData\\sound\\missile.wav");
	viiSub::LoadSound( enSoundPunch,pCGXImage,"HoundData\\sound\\knouckle.wav");
	viiSub::LoadSound( enSoundBazooka,pCGXImage,"HoundData\\sound\\Bazooka.wav");

	viiSub::LoadSound( enSoundJump,pCGXImage,"HoundData\\sound\\jump.wav");
	viiSub::LoadSound( enSoundLanding,pCGXImage,"HoundData\\sound\\landing.wav");
	viiSub::LoadSound( enSoundBoost,pCGXImage,"HoundData\\sound\\Boost.wav");
	viiSub::LoadSound( enSoundExplosionSmall,pCGXImage,"HoundData\\sound\\exp_s.wav");
	viiSub::LoadSound( enSoundExplosionMiddle,pCGXImage,"HoundData\\sound\\exp_m.wav");
	viiSub::LoadSound( enSoundExplosionLarge,pCGXImage,"HoundData\\sound\\exp_l.wav");
	viiSub::LoadSound( enSoundExplosionMaximum,pCGXImage,"HoundData\\sound\\exp_ll.wav");

//	viiSub::LoadSound( enSoundMachine,pCGXImage,"");
	viiSub::LoadSound( enSoundMenuOpen ,pCGXImage,"HoundData\\sound\\MenuOpen.wav");
	viiSub::LoadSound( enSoundMenuSel  ,pCGXImage,"HoundData\\sound\\MenuSel.wav");
	viiSub::LoadSound( enSoundMenuDec  ,pCGXImage,"HoundData\\sound\\MenuDec.wav");
	viiSub::LoadSound( enSoundMenuCan  ,pCGXImage,"HoundData\\sound\\MenuCan.wav");
	viiSub::LoadSound( enSoundStageClear,pCGXImage,"HoundData\\sound\\StageClear.wav");
	viiSub::LoadSound( enSoundGameOver,pCGXImage,"HoundData\\sound\\GameOver.wav");
	viiSub::LoadSound( enSoundEyeCatch,pCGXImage,"HoundData\\sound\\EyeCatch.wav");
	viiSub::LoadSound( enSoundSplashS ,pCGXImage,  "HoundData\\sound\\w_exp_s.wav" );
	viiSub::LoadSound( enSoundSplashM ,pCGXImage,  "HoundData\\sound\\w_exp_m.wav" );
	viiSub::LoadSound( enSoundSplashL ,pCGXImage,  "HoundData\\sound\\w_exp_l.wav" );
	viiSub::LoadSound( enSoundOutofRange ,pCGXImage,  "HoundData\\sound\\warning.wav" );

	viiSub::LoadSound( enSoundTypeWriter ,pCGXImage,  "HoundData\\sound\\type.wav" );
	viiSub::LoadSound( enSoundDirArrow ,pCGXImage,  "HoundData\\sound\\arrow.wav" );
	viiSub::LoadSound( enSoundShotErase ,pCGXImage,  "HoundData\\sound\\bltClr.wav" );
	viiSub::LoadSound( enSoundDash ,pCGXImage,  "HoundData\\sound\\dash01.wav" );
	viiSub::LoadSound( enSoundHeliRoter ,pCGXImage,  "HoundData\\sound\\heli.wav" );
	viiSub::LoadSound( enSoundHpPowerUp ,pCGXImage,  "HoundData\\sound\\AA_hp_up.wav" );


	viiSub::LoadSound( enSoundCrashA   ,pCGXImage,  "HoundData\\sound\\AA_Crash1.wav" );
	viiSub::LoadSound( enSoundCrashB   ,pCGXImage,  "HoundData\\sound\\AA_Crash2.wav" );
	viiSub::LoadSound( enSoundGachan   ,pCGXImage,  "HoundData\\sound\\AA_Gachan.wav" );
	viiSub::LoadSound( enSoundRelord   ,pCGXImage,  "HoundData\\sound\\AA_Relord.wav" );
//	viiSub::LoadSound( enSoundTank     ,pCGXImage,  "HoundData\\sound\\AA_Tank.wav" );
//	viiSub::LoadSound( enSoundWarning2 ,pCGXImage,  "HoundData\\sound\\AA_Warning2.wav" );

	viiSub::LoadSound( enSoundEneShotSmall ,pCGXImage,  "HoundData\\sound\\AA_EneShot1.wav" );
	viiSub::LoadSound( enSoundEneShotLaser   ,pCGXImage,  "HoundData\\sound\\AA_EneShot2.wav" );
	viiSub::LoadSound( enSoundEneShotBiriBiri   ,pCGXImage,  "HoundData\\sound\\__AA_BiriBiri.wav");

//	delete pCGXImage;

	UploadTexture();

	return gxTrue;
}
Exemple #6
0
gxBool CGameGunHound::EndingDemo()
{
	//---------------------------------------------
	//エンディングデモ
	//---------------------------------------------
	if( m_pEndingDemo == NULL )
	{
		m_pEndingDemo = new CEndingDemo();
		if( m_sMainMenuSelected == CMainMenu::enMainMenuEnding )
		{
			m_pEndingDemo->SetScoreDisp(gxTrue);
			m_pEndingDemo->SetAfterEpisode();
		}
		else
		{
			m_pEndingDemo->SetScoreDisp(gxTrue);
			m_pEndingDemo->SetAllScore       (m_stEndingBonus.uAllScore);
			m_pEndingDemo->SetContinueBonus  (m_stEndingBonus.uContinueBonus);
			m_pEndingDemo->SetTrueEndBonus   (m_stEndingBonus.uTrueEndBonus);
			m_pEndingDemo->SetNoContinueBonus(m_stEndingBonus.uNoContinueBonus);
			m_pEndingDemo->SetTotalScore     (m_stEndingBonus.uTotalScore);
		}

		if( g_StGameInfo.m_bTrueEnd )
		{
			m_pEndingDemo->SetAfterEpisode();
		}

		CGXImage::GetInstance()->Load( "asset/gh/GXI/second.GXI" );

		//-------------------------------------------
		//ファイル読み込み
		//-------------------------------------------
		Uint32 sSize = 0;
		Uint8 *p;
		p = CGXImage::GetInstance()->GetFile( "Epilogue.wav" , &sSize );
		viiMus::ReadBGM( enSoundBgm1 , p , sSize );

		p = CGXImage::GetInstance()->GetFile( "Ending.wav" , &sSize );
		viiMus::ReadBGM( enSoundBgm2 , p , sSize );

		CGXImage::GetInstance()->SetTexture( enTexPageBackGround+0   ,"END1.bmp" );
		CGXImage::GetInstance()->SetTexture( enTexPageBackGround+16  ,"END2.bmp" );
		CGXImage::GetInstance()->SetTexture( enTexPageBackGround+24+0,"EndingLaugh1.bmp" );
		CGXImage::GetInstance()->SetTexture( enTexPageBackGround+24+1,"EndingLaugh2.bmp" );
		CGXImage::GetInstance()->SetTexture( enTexPageBackGround+24+2,"EndingLaugh3.bmp" );
		CGXImage::GetInstance()->SetTexture( enTexPageBackGround+24+3,"EndingLaugh4.bmp" );
		CGXImage::GetInstance()->SetTexture( enTexPageBackGround+24+4,"EndingLaugh5.bmp" );
		CGXImage::GetInstance()->SetTexture( enTexPageBackGround+24+5,"EndingLaugh6.bmp" );

		g_StGameInfo.m_bMessage = gxTrue;
		g_StGameInfo.m_bMusic   = gxTrue;
		g_StGameInfo.m_bSound   = gxTrue;
		CCockpit::GetInstance()->LoadMessageFromMemory( "datmsg.txt" );

		UploadTexture();
	}

	if( m_pEndingDemo->IsEnd() )
	{
		delete m_pEndingDemo;
		m_pEndingDemo = NULL;
		viiMus::StopBGM( enSoundBgm1 );
		return gxTrue;
	}

	m_pEndingDemo->Action();
	m_pEndingDemo->Draw();

	return gxFalse;
}
Exemple #7
0
void nuiGLPainter::ApplyTexture(const nuiRenderState& rState, bool ForceApply)
{
//  if ((rState.mTexturing && !rState.mpTexture) || (!rState.mTexturing && rState.mpTexture))
//  {
//    printf("bleh!\n");
//    char* bleh = NULL;
//    bleh[0] = 0;
//  }

  // 2D Textures: 
  std::map<nuiTexture*, TextureInfo>::const_iterator it = mTextures.find(rState.mpTexture);
  bool uptodate = (it == mTextures.end()) ? false : ( !it->second.mReload && it->second.mTexture >= 0 );
  if (ForceApply || (mState.mpTexture != rState.mpTexture) || (mState.mpTexture && !uptodate))
  { 
    GLenum intarget = 0;
    GLenum outtarget = 0;

    if (mState.mpTexture)
    {      
      outtarget = GetTextureTarget(mState.mpTexture->IsPowerOfTwo());

      //mState.mpTexture->UnapplyGL(this); #TODO Un apply the texture
      nuiCheckForGLErrors();
      mState.mpTexture->Release();
      nuiCheckForGLErrors();
    }

    //NGL_OUT(_T("Change texture to 0x%x (%ls)\n"), rState.mpTexture, rState.mpTexture?rState.mpTexture->GetSource().GetChars() : nglString::Empty.GetChars());
    mState.mpTexture = rState.mpTexture ;

    if (mState.mpTexture)
    {
      intarget = GetTextureTarget(mState.mpTexture->IsPowerOfTwo());

      mState.mpTexture->Acquire();
  
      nuiSurface* pSurface = mState.mpTexture->GetSurface();
      if (pSurface)
      {
        std::map<nuiSurface*, FramebufferInfo>::const_iterator it = mFramebuffers.find(pSurface);
        bool create = (it == mFramebuffers.end()) ? true : false;  
        if (create || pSurface->IsDirty())
        {
          PushClipping();
          nuiRenderState s(mState);// PushState();
          PushProjectionMatrix();
          PushMatrix();

#ifdef _OPENGL_ES_
          if (mpSurfaceStack.empty())
          {
            //  mDefaultFramebuffer = 0;
            //  mDefaultRenderbuffer = 0;
            glGetIntegerv(GL_FRAMEBUFFER_BINDING_NUI, &mDefaultFramebuffer);
            glGetIntegerv(GL_RENDERBUFFER_BINDING_NUI, (GLint *) &mDefaultRenderbuffer);
          }
#endif

          PushSurface();


          SetState(nuiRenderState());
          ResetClipRect();
          mClip.Set(0, 0, pSurface->GetWidth(), pSurface->GetHeight());

          LoadMatrix(nglMatrixf());

          NGL_ASSERT(pSurface);
          SetSurface(pSurface);
          //Set2DProjectionMatrix(nuiRect(0.0f, 0.0f, pSurface->GetWidth(), pSurface->GetHeight()));
          nuiMatrix m;
          m.Translate(-1.0f, 1.0f, 0.0f);
          m.Scale(2.0f / pSurface->GetWidth(), -2.0f / pSurface->GetHeight(), 1.0f);
          LoadProjectionMatrix(nuiRect(pSurface->GetWidth(), pSurface->GetHeight()), m);

          // clear the surface with transparent black:
//          nuiRenderState s2(mState);// PushState();
//          mState.mClearColor = nuiColor(0.0f, 0.0f, 0.0f, 0.0f);
          SetState(mState);
//          ClearColor();  
//          SetState(s2);

//////////////////////////////          
          nuiDrawContext Ctx(nuiRect(pSurface->GetWidth(), pSurface->GetHeight()));
          Ctx.SetPainter(this);
          pSurface->Realize(&Ctx);
          Ctx.SetPainter(NULL);
//////////////////////////////

          PopSurface();
          PopMatrix();
          PopProjectionMatrix();
          //PopState();
          SetState(s);
          PopClipping();
        }
      }

      UploadTexture(mState.mpTexture);
      nuiCheckForGLErrors();
    }

    //NGL_OUT(_T("Change texture type from 0x%x to 0x%x\n"), outtarget, intarget);

    mTextureTarget = intarget;
    if (intarget != outtarget)
    {
      // Texture Target has changed
      if (outtarget)
      {
        glDisable(outtarget);
        nuiCheckForGLErrors();
      }
      //NGL_OUT(_T("disable outtarget\n"));
      if (intarget && mState.mTexturing && mState.mpTexture)
      {
        mState.mTexturing = rState.mTexturing;
        //NGL_OUT(_T("enable intarget\n"));
        glEnable(intarget);
        nuiCheckForGLErrors();
      }
    }
    else
    {
      // Texture Target have not changed     
      if (mState.mTexturing != rState.mTexturing) // Have texture on/off changed?
      {
        // Should enable or disable texturing
        mState.mTexturing = rState.mTexturing;
        if (mState.mTexturing)
        {
          glEnable(mTextureTarget);
          nuiCheckForGLErrors();
        }
        else
        {
          glDisable(mTextureTarget);
          nuiCheckForGLErrors();
        }
      }
    }
  }

  if (ForceApply || (mState.mTexturing != rState.mTexturing))
  {
    // Texture have not changed, but texturing may have been enabled / disabled
    mState.mTexturing = rState.mTexturing;

    if (mState.mpTexture)
    {
      if (mTextureTarget && mState.mTexturing)
      {
        //NGL_OUT(_T("Enable 0x%x\n"), mTextureTarget);
        glEnable(mTextureTarget);
        nuiCheckForGLErrors();
      }
      else
      {
        //NGL_OUT(_T("Disable 0x%x\n"), mTextureTarget);
        glDisable(mTextureTarget);
        nuiCheckForGLErrors();
      }
    }
    else
    {
      if (mTextureTarget)
      {
        //NGL_OUT(_T("Disable 0x%x\n"), mTextureTarget);
        glDisable(mTextureTarget);
      }
      nuiCheckForGLErrors();
    }
  }
}
Exemple #8
0
void nuiGLPainter::SetSurface(nuiSurface* pSurface)
{
  if (mpSurface == pSurface)
    return;
  
  if (pSurface)
    pSurface->Acquire();
  if (mpSurface)
    mpSurface->Release();
  mpSurface = pSurface;
  
  if (pSurface)
  {
    std::map<nuiSurface*, FramebufferInfo>::const_iterator it = mFramebuffers.find(pSurface);
    bool create = (it == mFramebuffers.end()) ? true : false;  
    
    GLuint width = (GLuint)pSurface->GetWidth();
    GLuint height = (GLuint)pSurface->GetHeight();
    
    nuiTexture* pTexture = pSurface->GetTexture();
    if (pTexture && !pTexture->IsPowerOfTwo())
    {
      switch (GetRectangleTextureSupport())
      {
        case 0:
          width = (GLuint)pTexture->GetWidthPOT();
          height= (GLuint)pTexture->GetHeightPOT();
          break;
        case 1:
        case 2:
          break;
      }
    }
    
    
    FramebufferInfo info;
    
    if (create)
    {      
      glGenFramebuffersNUI(1, &info.mFramebuffer);
      //printf("glGenFramebuffersNUI -> %d\n", info.mFramebuffer);
      
      nuiCheckForGLErrors();
      glBindFramebufferNUI(GL_FRAMEBUFFER_NUI, info.mFramebuffer);
      nuiCheckForGLErrors();
      glBindRenderbufferNUI(GL_RENDERBUFFER_NUI, 0);
      nuiCheckForGLErrors();
      
      ///< Do we need a depth buffer
      if (pSurface->GetDepth())
      {
        glGenRenderbuffersNUI(1, &info.mDepthbuffer);
        nuiCheckForGLErrors();
        glBindRenderbufferNUI(GL_RENDERBUFFER_NUI, info.mDepthbuffer);
        nuiCheckForGLErrors();
        
        glRenderbufferStorageNUI(GL_RENDERBUFFER_NUI,
                                 GL_DEPTH_COMPONENT16,
                                 width, height);
        nuiCheckForGLErrors();
        
        glBindRenderbufferNUI(GL_RENDERBUFFER_NUI, 0);
        nuiCheckForGLErrors();
        
        glFramebufferRenderbufferNUI(GL_FRAMEBUFFER_NUI,
                                     GL_DEPTH_ATTACHMENT_NUI,
                                     GL_RENDERBUFFER_NUI,
                                     info.mDepthbuffer);
        nuiCheckForGLErrors();
      }
      
      ///< Do we need a stencil buffer
      if (pSurface->GetStencil())
      {
        NGL_ASSERT(!"Stencil attachement not supported");
#ifndef _OPENGL_ES_
        glGenRenderbuffersNUI(1, &info.mStencilbuffer);
        nuiCheckForGLErrors();
        
        glBindRenderbufferNUI(GL_RENDERBUFFER_NUI, info.mStencilbuffer);
        nuiCheckForGLErrors();
        
        glRenderbufferStorageNUI(GL_RENDERBUFFER_NUI,
                                 GL_STENCIL_INDEX,
                                 width, height);
        nuiCheckForGLErrors();
        
        glBindRenderbufferNUI(GL_RENDERBUFFER_NUI, 0);
        nuiCheckForGLErrors();
        
        glFramebufferRenderbufferNUI(GL_FRAMEBUFFER_NUI,
                                     GL_STENCIL_ATTACHMENT_NUI,
                                     GL_RENDERBUFFER_NUI,
                                     info.mStencilbuffer);
        nuiCheckForGLErrors();
#endif
      }
      
      ///< We definetly need a color attachement, either a texture, or a renderbuffer
      if (pTexture && pSurface->GetRenderToTexture())
      {
        GLint oldTexture;
        glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint *) &oldTexture);
        
        UploadTexture(pTexture);
        
        std::map<nuiTexture*, TextureInfo>::iterator tex_it = mTextures.find(pTexture);
        NGL_ASSERT(tex_it != mTextures.end());
        TextureInfo& tex_info(tex_it->second);
        
        //        glBindTexture(GL_TEXTURE_2D, oldTexture);
        glBindTexture(GL_TEXTURE_2D, 0);
        
        nuiCheckForGLErrors();
        
        glFramebufferTexture2DNUI(GL_FRAMEBUFFER_NUI,
                                  GL_COLOR_ATTACHMENT0_NUI,
                                  GetTextureTarget(pTexture->IsPowerOfTwo()),
                                  tex_info.mTexture,
                                  0);
        //printf("surface texture -> %d\n", tex_info.mTexture);
        nuiCheckForGLErrors();
      }
      else
      {
        glGenRenderbuffersNUI(1, &info.mRenderbuffer);
        nuiCheckForGLErrors();
        
        glBindRenderbufferNUI(GL_RENDERBUFFER_NUI, info.mRenderbuffer);
        nuiCheckForGLErrors();
        
        GLint pixelformat = pSurface->GetPixelFormat();
        GLint internalPixelformat = pSurface->GetPixelFormat();
        internalPixelformat = GL_RGBA;
#if !defined(_OPENGL_ES_) && defined(_MACOSX_)
        if (internalPixelformat == GL_RGBA)
        {
          pixelformat = GL_BGRA;
        }
        else if (internalPixelformat == GL_RGB)
        {
          pixelformat = GL_BGR;
        }
#endif
        
        glRenderbufferStorageNUI(GL_RENDERBUFFER_NUI, pixelformat, width, height);
        nuiCheckForGLErrors();
        
        glFramebufferRenderbufferNUI(GL_FRAMEBUFFER_NUI,
                                     GL_COLOR_ATTACHMENT0_NUI,
                                     GL_RENDERBUFFER_NUI,
                                     info.mRenderbuffer);
        //printf("surface render buffer -> %d\n", info.mRenderbuffer);
        nuiCheckForGLErrors();
      }
      CheckFramebufferStatus();
      nuiCheckForGLErrors();
      mFramebuffers[pSurface] = info;
    }
    else
    {
      /// !create
      info = it->second;
      glBindFramebufferNUI(GL_FRAMEBUFFER_NUI, info.mFramebuffer);
      glBindRenderbufferNUI(GL_RENDERBUFFER_NUI, info.mRenderbuffer);
      //printf("glBindFramebufferNUI -> %d\n", info.mFramebuffer);
      //printf("glBindRenderbufferNUI -> %d\n", info.mRenderbuffer);
      
      nuiCheckForGLErrors();
      CheckFramebufferStatus();
    }
  }
  else
  {
    /// !pSurface
    glBindFramebufferNUI(GL_FRAMEBUFFER_NUI, mDefaultFramebuffer);
    //printf("UNBIND glBindFramebufferNUI -> %d\n", mDefaultFramebuffer);
    glBindRenderbufferNUI(GL_RENDERBUFFER_NUI, mDefaultRenderbuffer);
    //printf("UNBIND glBindRenderbufferNUI -> %d\n", mDefaultRenderbuffer);
    
    nuiCheckForGLErrors();
    CheckFramebufferStatus();
  }
}