Beispiel #1
0
//==============================================================================
//移動位置の設定
//==============================================================================
//[input]
//	pMouse:マウス用デバイス
//	pEnemy:敵クラス
//	pSceneMgr:シーン管理デバイス
//==============================================================================
void CPlayer::SetTargetPos( Selene::Peripheral::IMouse *pMouse, CEnemy *pEnemy, Scene::ISceneManager *pSceneMgr )
{
	Collision::CLine3D vRay( 
			pSceneMgr->TransformFromScreen( Math::Vector3D(toF(pMouse->GetPosX()), toF(pMouse->GetPosY()), 0.0f) ),
			pSceneMgr->TransformFromScreen( Math::Vector3D(toF(pMouse->GetPosX()), toF(pMouse->GetPosY()), 1.0f) ) );
	
	
	/*左クリックで乗り移り*/
	if( pMouse->GetStateL() == MOUSE_PUSH && pEnemy->GetModelActor( SCREEN_MAIN )->Collision_Check( vRay ))
	{
				
		/*捕獲フラグを設定*/
		pEnemy->SetCapdFlag( true );
		
		/*捕獲位置をバックアップ*/
		pEnemy->SetCatchBeforePos( pEnemy->GetPosition() );
		
		m_vCapedPos = m_vPos;
		
		/*状態を捕獲状態にする*/
		SetState( STATE_CAPSTART );
				
		/*捕獲した敵を代入*/
		m_pCapedEnemy = pEnemy;
		
	}	
}
Beispiel #2
0
Sint32 CStyle::GetAngleY() const {
    if (m_vFront.y == -1.0f || m_vFront.y == 1.0f) {
        return GET_ANGLE_PI(toF(atan2(m_vUp.x, m_vUp.z)));
    } else {
        return GET_ANGLE_PI(toF(atan2(m_vFront.x, m_vFront.z)));
    }
}
Beispiel #3
0
//================================================
//フェードアウト
//================================================
void Fadeout(void)
{
	/*バッファリセット*/
	LunaPrimitive::ResetBuffer(lPrim);
	
	Sint32 Alpha = L(LunaAnimation::FlatSpeed( 0.0f, 255.0f, toF(FRAME_RATE), toF(g_Time) ));

	LUNARECT Dst = { 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT };
	LunaEffect::FillSquare( lPrim, &Dst, PRIMITIVE_Z_CENTER, D3DCOLOR_ARGB(Alpha, 0,0,0) );
	
	// 1秒で次へ
	if ( ++g_Time >= FRAME_RATE )
	{
		g_Time = 0;
		g_GameMode = SCENE_FADEIN;
	}
	
	/*バッファ更新*/
	LunaPrimitive::UpdateBuffer(lPrim);
	
	/*シーン開始*/
	if(Luna3D::BeginScene() )
	{
		Luna3D::SetTexture(0, INVALID_TEXTURE);
		
		/*レンダリング*/
		LunaPrimitive::Rendering(lPrim);
		
		/*シーン終了*/
		Luna3D::EndScene();
	}
	
}
Beispiel #4
0
//==============================================================================
//写真撮影判定用レイの生成
//==============================================================================
//[input]
//	pMouse:マウスデバイス
//	pSceneMgr:シーン管理デバイス
//==============================================================================
void CPlayer::CreateShootRay( Scene::ISceneManager *pSceneMgr )
{
	Math::Vector3D vPt0( toF( SCREEN_WIDTH / 2 ), toF( SCREEN_HEIGHT / 2 ), 0.0f );
	Math::Vector3D vPt1( vPt0.x, vPt0.y, 1.0f );
	
	m_ShootChkRay.vStart = pSceneMgr->TransformFromScreen( vPt0 );
	m_ShootChkRay.vEnd = pSceneMgr->TransformFromScreen( vPt1 );
}
static void
PictureTransformErrorF (PictTransform *t)
{
    ErrorF ("{ { %f %f %f } { %f %f %f } { %f %f %f } }",
	    toF(t->matrix[0][0]), toF(t->matrix[0][1]), toF(t->matrix[0][2]), 
	    toF(t->matrix[1][0]), toF(t->matrix[1][1]), toF(t->matrix[1][2]), 
	    toF(t->matrix[2][0]), toF(t->matrix[2][1]), toF(t->matrix[2][2]));
}
Beispiel #6
0
//=============================================================================
//フェードアウト
//=============================================================================
void CScene::FadeOut( )
{
	static Sint32 Alphacount = 0;
	
	static Sint32 Alpha	= 0;
	
	Alphacount++;
	
	Alpha = Interpolation::Flat(0, 255, toI(m_fFadeTime), Alphacount);

	m_pApp->GetRenderer()->SetDrawType( DRAW_TYPE_BLEND );
	
	m_pApp->GetRenderer()->FillRect( Math::Rect2DF( 0, 0, toF( m_pApp->GetScreenWidth() ),toF(  m_pApp->GetScreenHeight() ) ), CColor( 0, 0, 0, Alpha ) );
	
	if( Alpha >= 255 )
	{
		Alpha = 0;
		Alphacount = 0;

		ChangeScene( m_eNextScene );
		
		m_pApp->GetRenderer()->SetDrawTextFont("MS ゴシック", m_FontSize );		
		
		m_eSceneState = STATE_STANDBY;
	}
	
	
	
}
Beispiel #7
0
//=============================================================================
//フェードイン
//=============================================================================
void CScene::FadeIn( )
{
	static Sint32 Alphacount = 0;
	
	static Sint32 Alpha	= 255;
	
	Alphacount++;
	
	Alpha = Interpolation::Flat(255, 0, toI(m_fFadeTime), Alphacount);

	m_pApp->GetRenderer()->SetDrawType( DRAW_TYPE_BLEND );
	
	m_pApp->GetRenderer()->FillRect( Math::Rect2DF( 0, 0, toF( m_pApp->GetScreenWidth() ),toF(  m_pApp->GetScreenHeight() ) ), CColor( 255, 255, 255, Alpha ) );
	
	if( Alpha <= 0 )
	{
		Alpha = 255;
		Alphacount = 0;
		
		ChangeScene( m_eNextScene );
		
		m_eSceneState = STATE_STANDBY;
		
		//pScene->Get2DObject()->RemoveObject( pTitle );
	}
	
}
Beispiel #8
0
//=============================================================================
//フェードアウト
//=============================================================================
//[input]
//	pScene:シーン
//=============================================================================
void CSceneEffect::FadeOut( CScene *pScene )
{
	static Sint32 Alphacount = 0;
	
	static Sint32 Alpha	= 0;
	
	Alphacount++;
	
	Alpha = Interpolation::Flat(0, 255, toI(60*m_FadeTime), Alphacount);

	pScene->GetAppDevice()->GetRenderer()->SetDrawType( DRAW_TYPE_BLEND );
	
	pScene->GetAppDevice()->GetRenderer()->FillRect( Math::Rect2DF( 0, 0, toF( pScene->GetAppDevice()->GetScreenWidth() ),toF(  pScene->GetAppDevice()->GetScreenHeight() ) ), CColor( 0, 0, 0, Alpha ) );
	
	if( Alpha >= 255 )
	{
		Alpha = 0;
		Alphacount = 0;

		pScene->SetSceneState( STATE_STANDBY );
		
		pScene->ChangeScene( pScene->GetNextScene() );

		//pScene->Get2DObject()->RemoveObject( pTitle );
	}
	
	
	
}
float calc_heatIndex(float RH ,int temperature)
{
    float x, temp_f;
    
    //concert temp from [°C] to [°F]
    temp_f = toF(temperature);
    //std::cout << "Temp F: " << temp_f << std::endl; 
    
    if( (RH >= 40) && (temp_f >= 80) )
    {
        //std::cout << "HeatIndex Inputs:" << temp_f << " ** " << RH << std::endl; 
        //Calculate heat index in [°F]
        x = -42.379 + 2.04901523*temp_f + 10.14333127*RH 
                   - 0.22475541*temp_f*RH - 0.00683783*(pow(temp_f,2));
        //std::cout << "seq1:" << x << std::endl;
        
        x = x -  0.05481717*(pow(RH,2)) + 0.00122874*(pow(temp_f,2))*RH 
                    + 0.00085282*temp_f*(pow(RH,2)) 
                    - 0.00000199*(pow(temp_f,2))*(pow(RH,2));
        //std::cout << "seq2:" << x << std::endl;
        return x;
    }
    
    return 0; //NA    
}
Beispiel #10
0
Sint32 CStyle::GetAngleZ() const {
    float n = toF(asin(m_vRight.y / sqrtf(1.0f - (m_vFront.y * m_vFront.y))));
    if (m_vUp.y < 0) {
        return GET_ANGLE_PI(PI - n);
    } else {
        return GET_ANGLE_PI(n);
    }
}
Beispiel #11
0
//==============================================================================
//移動処理
//==============================================================================
//[input]
//	vTargetPos:対象位置
//	pCam:カメラデバイス
//	pField:チェックするマップ
//	IsShowMark:マークが表示されているか
//[return]
//	移動中かどうか
//==============================================================================
bool CPlayer::Move( Selene::Math::Vector3D vTargetPos, CCamera *pCam, 
					CField *pField, bool IsShowMark )
{
	if( IsShowMark )
	{
		/*カメラ方向を基準に移動*/
		
		m_vDirection.x = vTargetPos.x * pCam->GetRight().x + vTargetPos.y * (-pCam->GetFront().x);
		m_vDirection.y = 0.0f;
		m_vDirection.z = vTargetPos.x * pCam->GetRight().z + vTargetPos.y * (-pCam->GetFront().z);
		
		//
		
		
		float fLength = m_vDirection.Length();
		
		m_fSpeed = fLength * m_fStSpeed ;
		
		if( m_fSpeed > 2.0f )
		{
			m_fSpeed = 2.0f;
		}
		
		
		/*移動チェック*/
		if( m_vDirection.Length() > 0.0f )
		{
			if( vTargetPos.Length() > 0.5f )
			{	
				m_Rot.x = toF( Math::ATan2( -m_vDirection.z, -m_vDirection.x ) );
			}
			
			/*正規化*/
			m_vDirection /= fLength;
			
			/*移動(-1の場合は通れる)*/
			if( MoveCheck( pField ) == -1 )
			{
				m_vPos += m_vDirection * m_fSpeed;
				//CCommonObject::GetSoundMgr()->Play( CSoundManager::SND_PLAYERMOVE );
				return true;
			}
			
			else
			{
				m_fSpeed = 0.0f;
				
			}
			
		
		}
	}
		
	return false;
	
}
Beispiel #12
0
//==============================================================================
//移動処理(ツール用)
//==============================================================================
//[input]
//	pCam:カメラデバイス
//	pMouse:マウスデバイス
//	pField:フィールド
//	pSceneMgr:シーン管理デバイス
//==============================================================================
void CPlayer::Move( CCamera *pCam, Peripheral::IMouse *pMouse, CField *pField, Scene::ISceneManager *pSceneMgr )
{
	
	Collision::CLine3D vRay( 
			pSceneMgr->TransformFromScreen( Math::Vector3D(toF(pMouse->GetPosX()), toF(pMouse->GetPosY()), 0.0f) ),
			pSceneMgr->TransformFromScreen( Math::Vector3D(toF(pMouse->GetPosX()), toF(pMouse->GetPosY()), 1.0f) ) );
			
		
	Renderer::SCollisionResult Ret;
	
	if( pField->GetMapActor( SCREEN_MAIN )->HitCheckByRay( vRay, Ret ) )
	{
		m_vTarget = Ret.vHitPosition;
	}
				
	
	m_vDirection.x = m_vTarget.x - m_vPos.x;
	m_vDirection.y = 0.0f;
	m_vDirection.z = m_vTarget.z - m_vPos.z;
	
	m_fSpeed = 0.3f ;
	
	/*移動チェック*/
	if( m_vDirection.LengthSq() > 0.0f )
	{
		m_Rot.x = toF( Math::ATan2( m_vDirection.z, m_vDirection.x ) );
		
		float fLength = m_vDirection.Length();
		
		/*正規化*/
		m_vDirection /= fLength;
		
		if( pMouse->GetClickL() )
		{	
			m_vPos += m_vDirection * m_fSpeed;
		}
	}
		
	
	
}
Beispiel #13
0
//============================================================================
//ファイル読み込み
//============================================================================
//[return]
//	ファイル読み込みに成功したか
//===========================================================================
bool CSprite::Load( )
{
	Renderer::IRender *pRender = CCommonObject::GetAppli()->GetRenderer();
	File::IFileManager *pFileMgr = CCommonObject::GetAppli()->GetFileMgr();
	
	pFileMgr->SetCurrentPath("Texture");
	
	const char *pFileName = m_strFileName.c_str();
	
	printf("LOAD TEXTURE[%s]", pFileName );
	
	//テクスチャファイルの生成(同一ファイルがあったら複製)
	m_pTex = pRender->CreateTextureFromFile( pFileName );

	_ASSERT( m_pTex );
	
	//読み込みに失敗?
	if( m_pTex->IsInvalid() )
	{
		return false;
	}
	
	printf( "                 : -> %s\n", m_pTex->IsInvalid() ? "Failed" : "Succeeded" );
	
	/*サイズの設定*/
	m_fSize.x = toF( m_pTex->GetOriginalSize().x / m_DivNum.x );
	m_fSize.y = toF( m_pTex->GetOriginalSize().y / m_DivNum.y );
	
	m_SrcRect.Set( 0, 0, m_fSize.x, m_fSize.y ),
	
	/*スプライトの生成*/
	CreateSprite( pRender, 500 );
	
	return true;
	
}
Beispiel #14
0
//============================================================================
//処理
//============================================================================
void CGameFont::DrawRequest()
{
	m_pSpr->Begin();
	
	Math::Vector2D vPos[] =
	{
		 Math::Vector2D( 272, 16 ),
		 Math::Vector2D( 576, 0 ),
		 Math::Vector2D( 272, 0 ),
	};


	for( int i = 0;i < m_DivNum.y;++i )
	{
		m_DstRect.Set( vPos[i].x, vPos[i].y, m_fSize.x, m_fSize.y );
		m_SrcRect.Set( 0, toF(i) * m_fSize.y, m_fSize.x, m_fSize.y );

		m_pSpr->DrawSquare( m_DstRect, m_SrcRect, m_Color );

	}

	m_pSpr->End();
}
Beispiel #15
0
//==============================================================================
//移動処理
//==============================================================================
//[input]
//	vTargetPos:対象位置
//	pCam:カメラデバイス
//	pField:チェックするマップ
//	IsShowMark:マークが表示されているか
//[return]
//	移動中かどうか
//==============================================================================
bool CEnemyLizard::Move( Selene::Math::Vector3D vTargetPos, CCamera *pCam, CField *pField, bool IsShowMark )
{
	m_vDirection.x = vTargetPos.x * pCam->GetRight().x + vTargetPos.y * (-pCam->GetFront().x);
	m_vDirection.y = 0.0f;
	m_vDirection.z = vTargetPos.x * pCam->GetRight().z + vTargetPos.y * (-pCam->GetFront().z);
	
	m_Rot.x = toF( Math::ATan2( -m_vDirection.z, -m_vDirection.x ) );
	
	float fLength = m_vDirection.Length();
	
	m_fSpeed = fLength * 0.001f ;
	
	if( m_fSpeed > 2.0f )
	{
		m_fSpeed = 2.0f;
	}
	
	
	/*移動チェック*/
	if( m_vDirection.LengthSq() > 0.0f )
	{
		/*正規化*/
		m_vDirection /= fLength;
		
		/*移動(-1, 0の場合は通れる)*/
		if( MoveCheck( pField ) == -1  )
		{
			if( IsShowMark )
			{
				m_Rot.y = DEG_TO_ANGLE( 0 );
				m_vPos += m_vDirection * m_fSpeed;
				m_IsMoving = true;
			}
				
			return true;
		}
		
		/*壁の場合上る*/
		else if( MoveCheck( pField ) == 0 )
		{
			if( IsShowMark )
			{
				m_Rot.y = DEG_TO_ANGLE( 90 );
				m_vPos.y += m_vDirection.Length() * m_fSpeed;
				m_vPos.x += m_vDirection.x * m_fSpeed;
			}
		}
		
		else
		{
			m_fSpeed = 0.0f;
			m_IsMoving = false;
			
		}
		
	}
	
	else
	{
		m_IsMoving = false;
	}
	
	return false;
	
}
Beispiel #16
0
//============================================================================
//ノベル風に描画
//============================================================================
bool CFontSprite::DrawNovelStyle( ICore *pCore, Peripheral::IInputController *pCtrl )
{

    if( (pCore->GetSyncCount() % 5) == 0 )
    {
        m_StrCount ++;
    }

    //if( pCtrl->GetState( BUTTON_STATE_HOLD, BUTTON_R1 ) )
    //{
    //	if( pCore->GetSyncCount() % 3 == 0 )
    //	{
    //		m_StrCount += 1;
    //	}
    //}

    if( m_pFontSpr != NULL )
    {
        Uint32 Cnt = m_StrCount;
        const char *pStr = m_vecText.at( m_RefCount ).c_str();//(char *)( m_Str.c_str() );

        Math::Rect2DF Dst( m_vPos.x, m_vPos.y, 0, 0 );

        /*描画開始*/
        m_pFontSpr->Begin();

        while( (*pStr != '\0') && (Cnt > 0) )
        {

            /*2Byte文字かどうか*/
            Bool Is2Byte = Is2ByteChara( (unsigned char)(*pStr) );

            //Math::Point2DF Size = m_pFontSpr->GetStringSize( pStr );

            Sint32 FontSize = m_pFontSpr->GetSize();//21;//m_pFontSpr->gt;//フォントサイズ

            if( !Is2Byte )
            {
                /*改行かどうか*/
                if( *pStr == '\n' )
                {
                    //Dst.y += toF( Size.y );
                    //Dst.y += FontSize;
                    //Dst.x = m_vPos.x;
                    pStr += 1;
                    continue;
                }

                /*改行*/
                else if( *pStr == 'B' )
                {

                    Dst.x = m_vInitPos.x;
                    Dst.y += FontSize;
                    pStr += 1;
                    //m_pFontSpr->Begin();

                    continue;

                }

                else if( *pStr == '@')
                {
                    //IsStop = true;
                    pStr += 1;

                    continue;
                }

                /*終了フラグ*/
                else if( *pStr == 'E')
                {
                    m_IsTextEnd = true;
                    return true;
                }


            }

            Dst.x += FontSize;

            //Dst.x += Size;


            //	Math::Point2DF Size = m_pFontSpr->GetStringSize( Str2.c_str() );

            Dst.w = toF( FontSize );
            Dst.h = toF( FontSize );

            /*一文字描画*/
            m_pFontSpr->DrawChara( pStr, Dst, CColor(0, 0, 0 ));

            Dst.x -= FontSize;

            if( Is2Byte )
            {
                //Dst.x += Size.y;

                Dst.x += FontSize;
            }

            else
            {
                Dst.x += FontSize;
            }

            if( Dst.x >= 700 - FontSize * 2 )
            {
                Dst.x = m_vInitPos.x;
                Dst.y += FontSize;
            }

            pStr += Is2Byte ? 2 : 1;

            Cnt--;

        }

        /*描画終了*/
        m_pFontSpr->End();

        if( Cnt > 0 && !m_IsTextEnd )
        {

            //if( pCtrl->GetState( BUTTON_STATE_PUSH, BUTTON_R2 ) )
            //{
            //	m_StrCount = 1;
            //	m_RefCount++;
            //
            //}
        }

        if( m_RefCount >= m_vecText.size() -1)
        {
            m_RefCount = m_vecText.size() -1;
        }



    }

    return false;

}
Beispiel #17
0
Sint32 CStyle::GetAngleX() const {
    return GET_ANGLE_PI(toF(asin(m_vFront.y)));
}