//================================================ //カメラ初期化関数 //================================================ void CCameraData::Initialize() { //Vx = 0.0f; //Vy = 0.0f; // //Angle = GET_ANGLE(30); // //fDistance = 30.0f; //Pitch = GET_ANGLE(30); //RotY = GET_ANGLE(30); // //vEye.Set(100, 200, 0); //vPos.Set(100, 500, -100); // //IsLoop = FALSE; RotX = 900; RotY = 2500; Vx = 0.0f; Vy = 0.0f; Angle = GET_ANGLE(30); //camera.vEye.Set(-100, -100, -100); vEye.Set(0, 0, -100); vUp.Set(0, 1, 0); vPos.Set(300, 200, -250); IsLoop = FALSE; Mouse.W = 0; }
//================================================ //傘セット //================================================ void CChara::SetUmbrella(float posx, float posy) { if(IsExist) { fPosX = posx; fPosY = posy - 30; } if(LunaPad::GetState(0, PAD_STATE_PUSH, PAD_BUTTON_01) ) { Se[SE_UMBRELLA].PlaySoundA(); } if(LunaPad::GetState(0, PAD_STATE_HOLD, PAD_BUTTON_01) ) { Attack = 1; IsExist = TRUE; counter++; if(IsExist) { if(Luna::GetSyncCounter() % 3 == 0) { animcounter++; } if(counter > 8) { Angle += GET_ANGLE(30); } if(animcounter >= 2) { animcounter = 2; } } } if(LunaPad::GetState(0, PAD_STATE_PULL, PAD_BUTTON_01) ) { IsExist = FALSE; counter = 0; animcounter = 0; } }
/** @brief Return the reaction velocity values of an object that hits dirt * * The function analyses the pixels around @a x and @a y to find * a plane the vector @a xv / @a yv has an angle to and returns * appropriate reaction velocity values in @a rxv and @a ryv. **/ void getDirtBounceReact(int32_t x, int32_t y, double xv, double yv, double &rxv, double &ryv) { int32_t from_x = xv < 0. ? 1 : -1; double vel = FABSDISTANCE2(xv, yv, 0., 0.); // First find the heights around x/y: int32_t y_map[5]; for (int i = 0 ; i < 5 ; ++i) { int32_t xpos = x + (i - 2); int32_t min_y = y - 2; int32_t max_y = y + 2; int32_t start_y = std::max(min_y, MENUHEIGHT); int32_t stop_y = std::min(max_y + 1, env.screenHeight); y_map[i] = -1; if ( (xpos > 0) && (xpos < env.screenWidth) && (min_y < env.screenHeight) && (max_y > MENUHEIGHT) && ( (stop_y - start_y) > 0) ) { y_map[i] = 5; for (int32_t j = 4; (j >= 0) && (5 == y_map[i]); --j) { int32_t ypos = y + (j - 2); if ( (ypos < start_y) || (ypos >= stop_y) || (PINK != getpixel(global.terrain, xpos, ypos)) ) y_map[i] = j; } } } // End of generating height map. /* atan2(x, y) will be used which results in the following angles: * Only right 1/ 0 : 90 (270) (The number in brackets is the normalized * Only left -1/ 0 : - 89 ( 91) angle used in atanks) * Only down 0/ 1 : 0 (180) * Only up 0/-1 : 180 (360) * Down right 1/ 1 : 45 (225) * Up right 1/-1 : 135 (315) * Down left -1/ 1 : - 44 (136) * Up left -1/-1 : -134 ( 46) * * The plane is calculated using the same x direction if present. * If the plane is a vertical wall, only the x-movement is reversed using * a plane angle of 0. * * HA = Hit Angle, PA = Plane Angle, RA = Reaction Angle * * 1: HA = PA - Movement angle * 2: RA = PA + (PA - HA) * 3: Values > 180 gets 360 substracted * 4: Value < -180 gets 360 added * * Examples: * 1: Shot from left to right and down (down right = 1/1 = 45°) * Plane is horizontal (only right = 1/0 = 90°) * HA = 90 - 45 = 45 * RA = 90 + (90 - 45) = 135 (Up right) * 2: Shot is the same, but the plane goes up right (1/-1 = 135°) * HA = 135 - 45 = 90 * RA = 135 + (135 - 45) = 225 => 225 - 360 = -135 (Up left) * 3: Shot from right to left and down (down left = -1/1 = -45) * Plane is horizontal (only left = -1/0 = -90°) * HA = -90 - -45 = -45 * RA = -90 + (-90 - -45) = -135 (Up left) * 4: Shot from the right bottom (up-left (-1/-1) = -135) * Plane is a vertical wall (only down = 0) * HA = 0 - -135 = 135 = RA * 5: Shot from right to left down (-1/1) = -40 * Plane up left (-1/-1) = -135 * HA = -135 - -40 = -95 * RA = -135 + (-135 - -95) = -175 */ // Find a plane with angle using the height map int32_t MA = GET_ANGLE(xv, yv); int32_t PA = 0, HA = 0, RA = 0; // Look for the special case of a vertical wall first: if ( (y_map[2] < 2) && (y_map[2 + from_x] > 3) ) if (MA) RA = 0 - MA; else // Just let it drip off RA = 5 * (y_map[3] ? 1 : -1); else { // Here a plane must be determined. double x1 = 2., y1 = y_map[2]; double x2 = 2., y2 = y_map[2]; double p1 = 1., p2 = 1.; // If y2 is 0, no further look is needed into movement direction if (y2 > 0.) { // Ah, it is. int32_t ly1 = y_map[2 + (-1 * from_x)]; int32_t ly2 = y_map[2 + (-2 * from_x)]; if (ly1 > -1) { x2 += 2. + (-1. * from_x); y2 += ly1; p2 += 1.; // Must ly2 be considered? if (ly2 > -1) { if ( ( (ly1 <= y_map[2]) && (ly2 <= ly1) ) || ( (ly1 >= y_map[2]) && (ly2 >= ly1) ) ) { x2 += 2. + (-2. * from_x); y2 += ly2; p2 += 1.; } } // End of having a non-wall ly2 // Set final x2/y2: x2 /= p2; y2 /= p2; } // End of having a non-wall ly1 } // end of having a non-vertical hit plane. // For the 'from'-direction the already set y2 can be used int32_t ly1 = y_map[2 + from_x]; int32_t ly2 = y_map[2 + (2 * from_x)]; if ( (ly1 > -1) && ( ( (ly1 >= y_map[2]) && (ly1 >= y2) ) || ( (ly1 <= y_map[2]) && (ly1 <= y2) ) ) ) { x1 += 2. + (1. * from_x); y1 += ly1; p1 += 1.; // Only continue if useful. if (ly2 > -1) { if ( ( (ly1 <= y_map[2]) && (ly2 <= ly1) ) || ( (ly1 >= y_map[2]) && (ly2 >= ly1) ) ) { x1 += 2. + (2. * from_x); y1 += ly2; p1 += 1.; } } // end of having a non-wall ly2 // Set final x1/y1: x1 /= p1; y1 /= p1; } // End of having a non-wall ly1 without contra-slope. // Set resulting angles: PA = GET_ANGLE(x2 - x1, y2 - y1); HA = PA - MA; RA = PA + (PA - HA); // Secure against vertical drop traps: if (!MA && !PA && !HA) // RA is now 0 but must be 180 RA = 180; if (RA > 180) RA -= 360; if (RA < -180) RA += 360; } // End of plane determination // The [R]eaction [A]angle now has to be translated into // atanks compatible velocity values: if (RA < 0) RA += 360; // atanks range rxv = env.slope[RA][0] * vel; ryv = env.slope[RA][1] * vel; }
//=============================================== //初期化 //=============================================== void CSceneManager::Initialize() { m_IsAppend = false; for( int i = 0;i < PLAYER_MAX;i++ ) { m_IsWin[i] = false; } field = new CField(); field->Init(); grpLoading = CTextureFactory::Create(GRP_LOADING); cam->Init(); g_Turn = 0; if(Joker::GetDevice() == NULL) { MessageBox(NULL, "pD3DDeviceが見つからない", "Base", MB_OK | MB_ICONSTOP); } /*レンダリング状態のセット*/ Joker3D::SetRenderState(); /*ビューポートの設定*/ Joker3D::SetViewPort(); /*マルチスレッドの初期化*/ if(!m_IsAnalog) { CMultiThread::Initialize(); CNetWork::CServer::SetConnectFlag( false ); } static int total_status[PLAYER_MAX] = {0};//ステータスの合計値 /*キャラクターデータの生成*/ for( int i = 0;i < MAX_CHARA;i++ ) { pl1_model[i] = CCharaFactory::Create( (eCharaType)i, PLAYER_1 ); pl2_model[i] = CCharaFactory::Create( (eCharaType)i, PLAYER_2 ); //temp_model1[i] = CCharaFactory::Create( (eCharaType)i, PLAYER_1 ); //temp_model2[i] = CCharaFactory::Create( (eCharaType)i, PLAYER_2 ); } //---------------------------------------------------------------------------- //システムグラフィック //---------------------------------------------------------------------------- /*ステータスの生成*/ for( int i = 0;i < MAX_CHARA;i++ ) { Status1[i] = CTextureFactory::Create(GRP_HP1); Status2[i] = CTextureFactory::Create(GRP_HP2); numStatus1[i] = CTextureFactory::Create(GRP_NUMBER); numStatus2[i] = CTextureFactory::Create(GRP_NUMBER); } /*ステータスの文字*/ for( int i = 0;i < ALL_CHARA;i++ ) { capHp[i] = CTextureFactory::Create(CAP_HP); } for( int i = 0;i < CAP_MAX;i++ ) { caption[i] = CTextureFactory::Create( (eCaption)(i) ); } for( int i = 0;i < ALL_CHARA;i++ ) { icon[i] = CTextureFactory::Create(GRP_ICON);//CTextureFactory::Create(GRP_ICON); charaIcon[i] = CTextureFactory::Create(GRP_ICON); } grpLargeTurn = CTextureFactory::Create(GRP_LARGETURN); numLargeTurn = CTextureFactory::Create(GRP_LARGENUMBER); for( int i = 0;i < SPTYPE_MAX;i++ ) { grpSpecial[i] = CTextureFactory::Create( (eCaption)(11 + i) ); } for( int i = 0;i < RESULT_MAX;i++ ) { grpResult[i] = CTextureFactory::Create( (eCaption)(13 + i) ); } numTurn = new CFont(30, "Inalphabet");//CTextureFactory::Create(GRP_NUMBER); for( int i = 0;i < PLAYER_MAX;i++ ) { TeamName[i] = new CFont(20, "Inalphabet");//(50, "tahoma"); } //---------------------------------------------------------------------------- //サウンドデータ //---------------------------------------------------------------------------- for( int i = 0;i < MAX_CHARA;i++ ) { pl1_model[i]->LoadSe(); pl2_model[i]->LoadSe(); } bgm = new CSound("data/BGM.ogg"); //---------------------------------------------------------------------------- //モデルデータの設定 //---------------------------------------------------------------------------- /*アナログの場合*/ if(m_IsAnalog) { /*ステータスのセット*/ for( int i = 0;i < MAX_CHARA;i++ ) { pl1_model[i]->SetStatus(1000 + i * 100); pl2_model[i]->SetStatus(1000 + i * 200); } } /*合計ステータスの計算*/ for( int i = 0;i < MAX_CHARA;i++ ) { total_status[PLAYER_1] += pl1_model[i]->GetStatus(); total_status[PLAYER_2] += pl2_model[i]->GetStatus(); } for( int i = 0;i < MAX_CHARA;i++ ) { pl1_model[i]->SetPosition( -2, 0, (float)(i*2) ); pl1_model[i]->SetRotate( GET_ANGLE(45), 0, 0 ); pl2_model[i]->SetPosition( 2, 0, (float)(i*2) ); pl2_model[i]->SetRotate( GET_ANGLE(-45), 0, 0 ); } for( int i = 0;i < PLAYER_MAX;i++ ) { TeamName[i]->SetPosition(F(i*420 + 40), 525); } for( int i = 0;i < MAX_CHARA;i++ ) { model[i] = pl1_model[i]; model[i+5] = pl2_model[i]; } /*カーソルの初期位置をセット*/ if(m_IsAnalog) { cursor[PLAYER_1]->SetCursor( PLAYER_1, pl2_model[FENCER] ); cursor[PLAYER_2]->SetCursor( PLAYER_2, pl1_model[FENCER] ); } for( int i = 0;i < MAX_CHARA;i++ ) { pl1_model[i]->SetDeadFlag( false ); pl1_model[i]->SetEndFlag( false ); pl2_model[i]->SetDeadFlag( false ); pl2_model[i]->SetEndFlag( false ); //temp_model1[i]->SetDeadFlag( false ); //temp_model2[i]->SetDeadFlag( false ); //temp_model1[i]->SetEndFlag( false ); //temp_model2[i]->SetEndFlag( false ); } //---------------------------------------------------------------------------- //オブジェクトの追加 //---------------------------------------------------------------------------- /*次のシーンのセット*/ if(m_IsAnalog) { SetNextScene(SCENE_CHOOSESPECIAL); } else { SetNextScene(SCENE_WAIT); } /*描画の開始*/ Joker3D::BeginScene(); Joker3D::EndScene(); /*次のシーンに移動*/ MoveNextScene(); }
//=============================================== //ゲームメイン画面 //=============================================== void CSceneManager::GameMain() { for( int i = 0;i < MAX_CHARA;i++ ) { model[i]->SetRotate(GET_ANGLE(45), 0, 0); model[i + 5]->SetRotate(GET_ANGLE(-45), 0, 0); } if(model[MAGICIAN]->Burst->GetVariableFlag() ) { model[MAGICIAN]->Burst->SetVariableFlag( false ); } if(model[MAGICIAN]->Fire->GetVariableFlag() ) { model[MAGICIAN]->Fire->SetVariableFlag( false ); } if(model[MAGICIAN + 5]->Burst->GetVariableFlag() ) { model[MAGICIAN]->Burst->SetVariableFlag( false ); } if(model[MAGICIAN + 5]->Fire->GetVariableFlag() ) { model[MAGICIAN]->Fire->SetVariableFlag( false ); } //---------------------------------------------- //ブレンドモードの設定 //---------------------------------------------- Joker::GetDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); Joker::GetDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); Joker::GetDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE,TRUE); for( int i = 0;i < MAX_CHARA;i++ ) { float charaZPos[MAX_CHARA] = {8, 5, 2, -1, -3 }; float fontXPos[MAX_CHARA] = {160, 130, 100, 70, 40}; float fontXPos2[MAX_CHARA] = {554, 584, 614, 644, 674 }; //float fontYPos[MAX_CHARA] = {128, 150, 200, 270, 390}; pl1_model[i]->SetPosition( -2, 0, charaZPos[i] ); Status1[i]->SetPosition( fontXPos[i], F(128 + i*64) ); pl2_model[i]->SetPosition( 2, 0, charaZPos[i] ); Status2[i]->SetPosition( fontXPos2[i], F(128 + i*64) ); char Buff[MAX_PATH] = ""; wsprintf( Buff, "%d", pl1_model[i]->GetStatus() ); string Str = Buff; numStatus1[i]->SetText(Str); numStatus1[i]->SetPosition(fontXPos[i] + 15, F(142 + i * 64 ) ); wsprintf( Buff, "%d", pl2_model[i]->GetStatus() ); Str = Buff; numStatus2[i]->SetText(Str); numStatus2[i]->SetPosition( fontXPos2[i] + 15, F(142 + i * 64) ); //pl1_model[i]->SetPosition( 0, 0, 0 ); //pl2_model[i]->SetPosition( 0, 0, 0 ); } //JRand::Seed( if(!cam->m_IsMove) { cam->SetPosition(-0.1f, 2.0f, -1.1f); } /*座標の設定*/ for( int i = 0;i < MAX_CHARA;i++ ) { float charaZPos[MAX_CHARA] = {8, 5, 2, -1, -3 }; float fontXPos[MAX_CHARA] = {160, 130, 100, 70, 40}; float fontXPos2[MAX_CHARA] = {554, 584, 614, 644, 674 }; //float fontYPos[MAX_CHARA] = {128, 150, 200, 270, 390}; pl1_model[i]->SetPosition( -2, 0, charaZPos[i] ); Status1[i]->SetPosition( fontXPos[i], F(128 + i*64) ); pl2_model[i]->SetPosition( 2, 0, charaZPos[i] ); Status2[i]->SetPosition( fontXPos2[i], F(128 + i*64) ); //pl1_model[i]->SetPosition( 0, 0, 0 ); //pl2_model[i]->SetPosition( 0, 0, 0 ); } /*HP文字位置設定*/ for( int i = 0;i < MAX_CHARA;i++ ) { float XPos[MAX_CHARA] = {170, 140, 110, 80, 50}; float XPos2[MAX_CHARA] = {644, 674, 704, 734, 764}; capHp[i]->SetPosition( XPos[i], F(128 + i * 64) ); capHp[i + 5]->SetPosition( XPos2[i], F(128 + i * 64) ); } //cam->SetPosition(0, 2, 0); m_liOrder.clear(); if(m_IsAnalog) { for( int i = 0;i < PLAYER_MAX;i++ ) { cursor[i]->SetEndFlag(false); } } /*ステータスのバックアップ*/ for( int i = 0;i < MAX_CHARA;i++ ) { pl1_model[i]->SetOldStatus(); pl2_model[i]->SetOldStatus(); } for( int i = 0;i < MAX_CHARA;i++ ) { model[i] = pl1_model[i]; model[i+5] = pl2_model[i]; } set<int> sStatus;//ソート用ステータス int status[ALL_CHARA+1];//常用ステータス multiset<int> modeldata;//モデルデータ int status1[MAX_CHARA + 1]; int status2[MAX_CHARA + 1]; for( int i = 0;i < MAX_CHARA;i++ ) { status1[i] = pl1_model[i]->GetStatus(); status2[i] = pl2_model[i]->GetStatus(); } for( int i = 0;i < ALL_CHARA;i++ ) { status[i] = model[i]->GetStatus(); } for( int i = 0;i < MAX_CHARA;i++ ) { if(pl1_model[i]->GetAttackType() == SPECIAL) { switch(pl1_model[i]->GetSpecial() ) { /*先制攻撃*/ case FIRST_ATTACK: { const int FAST = 5000; status1[i] = FAST; break; } /*溜め攻撃*/ case CHARGE_ATTACK: { status1[i] /= 2; break; } } } if( pl2_model[i]->GetAttackType() == SPECIAL ) { switch(pl2_model[i]->GetSpecial() ) { /*先制攻撃*/ case FIRST_ATTACK: { const int FAST = 5000; status2[i] = FAST; break; } /*溜め攻撃*/ case CHARGE_ATTACK: { status2[i] /= 2; break; } } } } int rand = JRand::GetInt(0, 1); for(int i = 0;i < MAX_CHARA;i++ ) { status[i] = status1[i]; status[i + 5] = status2[i]; } for( int i = 0;i < ALL_CHARA - 1;i++ ) { for( int j = i + 1;j < ALL_CHARA;j++ ) { if( status[i] == status[j] ) { rand = JRand::GetInt(1, 11); if(rand >= 1 && rand <= 5) { status[i] += rand; } else { status[j] += rand; } } } } for( int i = 0;i < ALL_CHARA;i++ ) { sStatus.insert( status[i] ); } set<int>::reverse_iterator it = sStatus.rbegin(); for( it = sStatus.rbegin();it != sStatus.rend();it++ ) { CDebug::DrawString("status:%d", *it); } for( it = sStatus.rbegin();it != sStatus.rend();it++ ) { for( int i = 0;i < ALL_CHARA;i++ ) { if( *it == status[i]) { m_liOrder.push_back(i); m_liOrder.unique(); } } } //for( int i = 0;i < ALL_CHARA;i++ ) //{ // if( model[i]-) // { // // } //} list<int>::iterator it2 = m_liOrder.begin(); Joker3D::BeginScene(); for( it2 = m_liOrder.begin();it2 != m_liOrder.end(); ) { for( int i = 0;i < ALL_CHARA;i++ ) { charaIcon[i] = OldCharaIcon[*it2]; /*アイコンの並べ替え*/ icon[i] = oldIcon[*it2]; it2++; } } it2 = m_liOrder.begin(); static int next = 0; if(model[next]->GetEndFlag() ) { next++; } charaIcon[next]->SetPosition(25, 25); charaIcon[next + 1]->SetPosition(125, 25); //charaIcon[next]->DrawCharaIcon( model[next]->GetPlayerType(), model[next]->GetCharaType() ); //charaIcon[next+1]->DrawCharaIcon( model[next + 1]->GetPlayerType(), model[next + 1]->GetCharaType() ); // /*アイコンの位置の設定*/ for( int i = 0;i < MAX_CHARA;i++ ) { icon[i]->SetPosition( F(525 + i * 50), 0 ); icon[i+5]->SetPosition( F(525 + i * 50), 50 ); } for( int i = 0;i < MAX_CHARA;i++ ) { //icon[i]->DrawWeaponIcon(model[i]->GetCharaType() ); //icon[i+5]->DrawWeaponIcon(model[i]->GetCharaType() ); } // cam->Exec(); field->Exec(); for( int i = 0;i < PLAYER_MAX;i++ ) { TeamName[i]->Exec(); //TeamName[i]->DrawFont(); } for( int i = 0;i < ALL_CHARA;i++ ) { model[i]->Exec(); } for( int i = 0;i < CAP_MAX;i++ ) { caption[i]->Exec(); } numTurn->SetPosition(380, 80); numTurn->Exec(); for( int i = 0;i < MAX_CHARA;i++ ) { Status1[i]->Exec(); Status2[i]->Exec(); numStatus1[i]->Exec(); numStatus2[i]->Exec(); } for( int i = 0;i < ALL_CHARA;i++ ) { capHp[i]->Exec(); } Joker3D::EndScene(); for( int i = 0;i < ALL_CHARA;i++ ) { if( model[i]->GetAttackType() == SPECIAL ) { if( model[i]->GetSpecial() == BURST ) { model[i]->SetBurstFlag( true ); } else if( model[i]->GetSpecial() == ALTER ) { if( !(model[i]->GetDeadFlag() )) { model[i]->GetTarget()->SetProtectedFlag(true); } } else if( model[i]->GetSpecial() == GUARD ) { model[i]->SetGuardFlag( true ); } else if( model[i]->GetSpecial() == CHARGE_ATTACK ) { model[i]->SetChargeFlag( true ); } else if( model[i]->GetSpecial() == COUNTER ) { if( !(model[i]->GetDeadFlag() )) { model[i]->SetCounterFlag( true ); } } } } //for( it2 = m_liOrder.begin();it2 != m_liOrder.end();it2++ ) //{ // CDebug::DrawString("order:%d", *it2); //} for( int i = 0;i < ALL_CHARA;i++ ) { if( model[i]->GetMotion() != MOT_DEAD ) { model[i]->SetMotion(MOT_STAND); } } static int count = 0; /*メイン画面に戻る*/ /*どちらかのキャラが全員死亡していた場合*/ if( pl1_model[0]->GetDeadFlag() && pl1_model[1]->GetDeadFlag() && pl1_model[2]->GetDeadFlag() && pl1_model[3]->GetDeadFlag() && pl1_model[4]->GetDeadFlag() || pl2_model[0]->GetDeadFlag() && pl2_model[1]->GetDeadFlag() && pl2_model[2]->GetDeadFlag() && pl2_model[3]->GetDeadFlag() && pl2_model[4]->GetDeadFlag() ) { /*終了画面をセット*/ for(int i = 0;i < MAX_CHARA;i++ ) { if(pl1_model[i]->GetDeadFlag() ) { m_IsWin[PLAYER_2] = true; } if(pl2_model[i]->GetDeadFlag() ) { m_IsWin[PLAYER_1] = true; } } next = 0; SetNextScene(SCENE_RESULT); Uint64 NowTime = Joker::GetSystemTimeSecond(); Uint64 OldTime = NowTime; static int count = 0; if(m_IsZKey) { if(CJoyPad::GetState(0, PAD_STATE_PUSH, PAD_BUTTON_01) ) { /*次のシーンに移動*/ MoveNextScene(); } } else { if(++count > 30) { count = 0; /*ターンの設定*/ CNetWork::CServer::SetTurnToServerData(g_Turn); /*次のシーンに移動*/ MoveNextScene(); } } } else if( model[0]->GetEndFlag() && model[1]->GetEndFlag() && model[2]->GetEndFlag() && model[3]->GetEndFlag() && model[4]->GetEndFlag() && model[5]->GetEndFlag() && model[6]->GetEndFlag() && model[7]->GetEndFlag() && model[8]->GetEndFlag() && model[9]->GetEndFlag() )/*pl1_model[i]->GetEndFlag() && pl2_model[i]->GetEndFlag() )*/ { for( int i = 0;i < ALL_CHARA;i++ ) { model[i]->SetEndFlag( false ); model[i]->SetAttackEndFlag( false ); model[i]->SetProtectedFlag( false ); model[i]->SetBuildFlag( false ); model[i]->SetChargeFlag( false ); model[i]->SetCounterFlag( false ); model[i]->SetCriticalFlag( false ); model[i]->SetGuardFlag( false ); } next = 0; g_Turn++; SetNextScene(SCENE_CHOOSECHARA); MoveNextScene(); //pl1_model[i]->SetEndFlag( false ); //pl2_model[i]->SetEndFlag( false ); } else { for( int i = 0;i < ALL_CHARA;i++ ) { model[i]->numDamage->SetVisibleFlag( false ); } //model[ SetNextScene( SCENE_BEFOREBATTLE ); Uint64 NowTime = Joker::GetSystemTimeSecond(); Uint64 OldTime = NowTime; //for( int i = 0;i < ALL_CHARA;i++ ) //{ // model[i]->numDamage->SetVisibleFlag( false ); //} //if(Joker::GetSystemTime() - NowTime > 20) //{ //if(CJoyPad::GetState(0, PAD_STATE_PUSH, PAD_BUTTON_01) ) //{ // /*次のシーンに移動*/ // MoveNextScene(); //} static int count = 0; if(m_IsZKey) { if(CJoyPad::GetState(0, PAD_STATE_PUSH, PAD_BUTTON_01) ) { /*ターンの設定*/ CNetWork::CServer::SetTurnToServerData(g_Turn); /*次のシーンに移動*/ MoveNextScene(); } } else { if(++count > 30) { count = 0; /*ターンの設定*/ CNetWork::CServer::SetTurnToServerData(g_Turn); /*次のシーンに移動*/ MoveNextScene(); } } //if( Joker::GetSystemTimeSecond() - NowTime > 3000) //{ // /*次のシーンに移動*/ // MoveNextScene(); //} //} } }
//=============================================== //戦闘画面 //=============================================== void CSceneManager::Battle() { int Damage = 0;//ダメージ SetBeforeScene(SCENE_BATTLE); SetNextScene(SCENE_BATTLEEND); list<int>::iterator it = m_liOrder.begin(); for( it = m_liOrder.begin();it != m_liOrder.end(); ) { if(model[*it]->GetEndFlag() ) { it++; } else { break; } } CDebug::DrawString("*it:%d", *it); //---------------------------------------------- //キャラの位置設定 //---------------------------------------------- if( !(m_IsAppend) ) { for( int i = 0;i < ALL_CHARA;i++ ) { model[i]->SetCurrentAnimPos(0.0f); } /*プレイヤー1の場合*/ if(model[*it]->GetPlayerType() == PLAYER_1) { if( model[*it]->GetAttackType() == SPECIAL ) { if(model[*it]->GetSpecial() == ALLMAGIC) { model[*it]->SetRotate( GET_ANGLE(45), 0, 0 ); model[*it]->GetTarget()->SetRotate( GET_ANGLE(-45), 0, 0 ); } else if(model[*it]->GetSpecial() == RECOVER) { } else if(model[*it]->GetSpecial() == BUILDUP) { } else { model[*it]->SetRotate( GET_ANGLE(45), 0, 0 ); model[*it]->GetTarget()->SetRotate( GET_ANGLE(-45), 0, 0 ); model[*it]->SetPosition( -4, 0, 6 ); model[*it]->GetTarget()->SetPosition( 3, 0, 6 ); if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[FENCER]->SetRotate(GET_ANGLE(45), 0, 0); model[FENCER]->SetPosition( 4, 0, 6); } } } else { model[*it]->SetPosition( -4, 0, 6 ); model[*it]->GetTarget()->SetPosition( 3, 0, 6 ); if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[FENCER]->SetRotate(GET_ANGLE(45), 0, 0); model[FENCER]->SetPosition( 2, 0, 6); } } } /*プレイヤー2の場合*/ else { if( model[*it]->GetAttackType() == SPECIAL ) { if(model[*it]->GetSpecial() == ALLMAGIC) { model[*it]->SetRotate( GET_ANGLE(-45), 0, 0 ); model[*it]->GetTarget()->SetRotate( GET_ANGLE(45), 0, 0 ); } else if(model[*it]->GetSpecial() == RECOVER) { } else if(model[*it]->GetSpecial() == BUILDUP) { } else { model[*it]->SetRotate( GET_ANGLE(-45), 0, 0 ); model[*it]->GetTarget()->SetRotate( GET_ANGLE(45), 0, 0 ); model[*it]->SetPosition( 4, 0, 6 ); model[*it]->GetTarget()->SetPosition( -3, 0, 6 ); if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[FENCER + 5]->SetRotate( GET_ANGLE(45), 0, 0 ); model[FENCER + 5]->SetPosition( -2, 0, 6); } } } else { model[*it]->SetPosition( 4, 0, 6 ); model[*it]->GetTarget()->SetPosition( -3, 0, 6 ); if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[FENCER + 5]->SetRotate( GET_ANGLE(45), 0, 0 ); model[FENCER+5]->SetPosition( -2, 0, 6); } } } m_IsAppend = true; } //---------------------------------------------- //カメラの位置設定 //---------------------------------------------- if( model[*it]->GetAttackType() == ATTACK ) { if( model[*it]->GetCharaType() == MAGICIAN ) { cam->SetPosition(-0.1f, 2.0f, -1.1f); } else { cam->SetPosition(model[*it]->GetPosition().x, model[*it]->GetPosition().y, model[*it]->GetPosition().z + 2); } } else { switch( model[*it]->GetSpecial() ) { case CRITICAL: { cam->SetPosition(model[*it]->GetPosition().x, model[*it]->GetPosition().y, model[*it]->GetPosition().z + 2); break; } case ALLMAGIC: { cam->SetPosition(-0.1f, 2.0f, -1.1f); break; } case FIRST_ATTACK: { } case BURST: { } case CHARGE_ATTACK: { cam->SetPosition(model[*it]->GetPosition().x, model[*it]->GetPosition().y, model[*it]->GetPosition().z + 2); break; } case ALTER: { } case RECOVER: { } case BUILDUP: { cam->SetPosition(-0.1f, 2.0f, -1.1f); break; } case GUARD: { } case COUNTER: { cam->SetPosition(model[*it]->GetPosition().x, model[*it]->GetPosition().y, model[*it]->GetPosition().z + 2); break; } } } //---------------------------------------------- //描画開始 //---------------------------------------------- Joker3D::BeginScene(); cam->Exec(); field->Exec(); model[*it]->Exec(); if(model[*it]->GetAttackType() == SPECIAL) { if( model[*it]->GetSpecialType() == SP_ATTACK ) { grpSpecial[SP_ATTACK]->SetPosition(100, 400); if( model[*it]->GetCharaType() == FENCER ) { if( model[*it]->GetCriticalFlag() ) { grpSpecial[SP_ATTACK]->DrawSpecialAttack(CRITICAL); } } else { grpSpecial[SP_ATTACK]->DrawSpecialAttack(model[*it]->GetSpecial() ); } } else if( model[*it]->GetSpecialType() == SP_ASSIST) { grpSpecial[SP_ASSIST]->SetPosition(100, 400); grpSpecial[SP_ASSIST]->DrawSpecialAssist(model[*it]->GetSpecial() ); //if(model[*it]->GetCharaType() == CONTRACTOR) //{ // //if(model[*it]->GetTarget()->GetProtectedFlag() ) // //{ // // grpSpecial[SP_ASSIST]->DrawSpecialAssist(ALTER); // //} // // // if(model[*it]->GetCounterFlag() ) // { // grpSpecial[SP_ASSIST]->DrawSpecialAssist(COUNTER); // } // //} // //else if( model[*it]->GetCharaType() == GUARDIAN ) //{ // //if(model[*it]->GetTarget()->GetProtectedFlag() ) // //{ // // grpSpecial[SP_ASSIST]->DrawSpecialAssist(ALTER); // // // //} // // if(model[*it]->GetGuardFlag() ) // { // grpSpecial[SP_ASSIST]->DrawSpecialAssist(GUARD); // } //} // //else if( model[*it]->GetCharaType() == RANGER ) //{ // if( model[*it]->GetAttackType() == SPECIAL ) // { // if( model[*it]->GetSpecial() == BUILDUP ) // { // grpSpecial[SP_ASSIST]->DrawSpecialAssist(BUILDUP); // } // } //} // //else if( model[*it]->GetCharaType() == MAGICIAN ) //{ // if( model[*it]->GetAttackType() == SPECIAL ) // { // if( model[*it]->GetSpecial() == RECOVER ) // { // grpSpecial[SP_ASSIST]->DrawSpecialAssist(RECOVER); // } // } //} // //else //{ // //if(model[*it]->GetTarget()->GetProtectedFlag() ) // //{ // // grpSpecial[SP_ASSIST]->DrawSpecialAssist(ALTER); // //} // // // //else // //{ // grpSpecial[SP_ASSIST]->DrawSpecialAssist(model[*it]->GetSpecial() ); // //} //} } } if(model[*it]->GetAttackType() == SPECIAL) { if( model[*it]->GetSpecial() == ALLMAGIC ) { if(model[*it]->GetPlayerType() == PLAYER_1) { for( int i = 5;i < ALL_CHARA;i++ ) { model[i]->Exec(); } } else { for( int i = 0;i < MAX_CHARA;i++ ) { model[i]->Exec(); } } } else { model[*it]->GetTarget()->Exec(); } } else { model[*it]->GetTarget()->Exec(); } if(model[*it]->GetTarget()->GetProtectedFlag() ) { if(model[*it]->GetPlayerType() == PLAYER_2 ) { model[FENCER]->Exec(); } else { model[FENCER + 5]->Exec(); } } Joker3D::EndScene(); //---------------------------------------------- //キャラクターごとの処理 //---------------------------------------------- if( model[*it]->GetAttackType() == ATTACK ) { switch( model[*it]->GetCharaType() ) { case FENCER: { model[*it]->Attack( model[*it]->GetTarget(), 2, model[*it]->GetLastAnimFrame() / 2 + 0.1); if(model[*it]->GetPlayerType() == PLAYER_1 ) { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl2_model); } } else { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl1_model); } } break; } case MAGICIAN: { model[*it]->MagicAttack( model[*it]->GetTarget() ); if(model[*it]->GetPlayerType() == PLAYER_1 ) { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl2_model); } } else { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl1_model); } } break; } case RANGER: { model[*it]->Attack(model[*it]->GetTarget(), 1, model[*it]->GetLastAnimFrame() / 2); if(model[*it]->GetPlayerType() == PLAYER_1 ) { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl2_model); } } else { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl1_model); } } break; } case CONTRACTOR: { model[*it]->Attack(model[*it]->GetTarget(), 1, model[*it]->GetLastAnimFrame() / 2); if(model[*it]->GetPlayerType() == PLAYER_1 ) { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl2_model); } } else { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl1_model); } } break; } case GUARDIAN: { model[*it]->Attack(model[*it]->GetTarget(), 2, model[*it]->GetLastAnimFrame() / 2); if(model[*it]->GetPlayerType() == PLAYER_1 ) { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl2_model); } } else { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl1_model); } } break; } } } else { switch( model[*it]->GetSpecial() ) { case CRITICAL: { model[*it]->Attack( model[*it]->GetTarget(), 2, model[*it]->GetLastAnimFrame() / 2 - 0.1); if(model[*it]->GetPlayerType() == PLAYER_1 ) { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl2_model); } } else { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl1_model); } } break; } case ALLMAGIC: { if(model[*it]->GetPlayerType() == PLAYER_1 ) { model[*it]->MagicAllAttack( pl2_model ); } else { model[*it]->MagicAllAttack( pl1_model ); } break; } case FIRST_ATTACK: { model[*it]->Attack( model[*it]->GetTarget(), 1, model[*it]->GetLastAnimFrame() / 2 - 0.1); if(model[*it]->GetPlayerType() == PLAYER_1 ) { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl2_model); } } else { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl1_model); } } break; } case BURST: { model[*it]->BurstS( model[*it]->GetTarget(), 1, model[*it]->GetLastAnimFrame() / 2 - 0.1 ); if(model[*it]->GetPlayerType() == PLAYER_1 ) { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl2_model); } } else { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl1_model); } } break; } case CHARGE_ATTACK: { model[*it]->Attack( model[*it]->GetTarget(), 2, model[*it]->GetLastAnimFrame() / 2 - 0.1 ); if(model[*it]->GetPlayerType() == PLAYER_1 ) { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl2_model); } } else { if(model[*it]->GetTarget()->GetProtectedFlag() ) { model[*it]->Alternate(pl1_model); } } break; } case ALTER: { //model[*it]->SetEndFlag( true ); break; } case RECOVER: { if( model[*it]->GetTarget()->GetCharaType() == MAGICIAN ) { if( model[*it]->GetPlayerType() == PLAYER_1 ) { if(model[*it]->GetTarget()->GetProtectedFlag() ) { if(model[*it]->GetTarget()->GetCharaType() == MAGICIAN) { model[*it]->Alternate(pl1_model); } } } else { if(model[*it]->GetTarget()->GetProtectedFlag() ) { if(model[*it]->GetTarget()->GetCharaType() == MAGICIAN) { model[*it]->Alternate(pl2_model); } } } } model[*it]->Recover(model[*it]->GetTarget() ); break; } case BUILDUP: { if( model[*it]->GetPlayerType() == PLAYER_1 ) { if(model[*it]->GetTarget()->GetProtectedFlag() ) { if(model[*it]->GetTarget()->GetCharaType() == RANGER) { model[*it]->Alternate(pl1_model); } } } else { if(model[*it]->GetTarget()->GetProtectedFlag() ) { if(model[*it]->GetTarget()->GetCharaType() == RANGER) { model[*it]->Alternate(pl2_model); } } } model[*it]->BuildUp(model[*it]->GetTarget() ); break; } case GUARD: { break; } case COUNTER: { break; } } } //------------------------------------ //次のシーンに移るための条件 //------------------------------------ //if(model[*it]->GetAttackType() == SPECIAL) //{ // if(model[*it]->GetSpecial() == ALLMAGIC) // { // if(model[*it]->GetPlayerType() == PLAYER_1) // { // for( int i = 5;i < ALL_CHARA;i++ ) // { // if( model[i]->GetMotion() == MOT_DEAD ) // { // if(model[i]->GetCurrentAnim().AnimPos >= model[i]->GetLastAnimFrame() ) // { // model[i]->SetCurrentAnimPos(model[i]->GetLastAnimFrame() ); // // model[i]->SetDeadFlag( true ); // // } // } // // else if(model[i]->GetMotion() == MOT_DAMAGE) // { // if(model[i]->GetCurrentAnim().AnimPos >= model[i]->GetLastAnimFrame() ) // { // model[i]->SetCurrentAnimPos(model[i]->GetLastAnimFrame() ); // } // } // } // // model[*it]->SetEndFlag(true); // } // // else // { // for( int i = 0;i < MAX_CHARA;i++ ) // { // if( model[i]->GetMotion() == MOT_DEAD ) // { // if(model[i]->GetCurrentAnim().AnimPos >= model[i]->GetLastAnimFrame() ) // { // model[i]->SetCurrentAnimPos(model[i]->GetLastAnimFrame() ); // // model[i]->SetDeadFlag( true ); // // } // } // // else if(model[i]->GetMotion() == MOT_DAMAGE) // { // if(model[i]->GetCurrentAnim().AnimPos >= model[i]->GetLastAnimFrame() ) // { // model[i]->SetCurrentAnimPos(model[i]->GetLastAnimFrame() ); // } // } // // model[*it]->SetEndFlag(true); // } // // } // } // // else // { // if( model[*it]->GetTarget()->GetMotion() == MOT_DEAD ) // { // if( model[*it]->GetTarget()->GetCurrentAnim().AnimPos >= model[*it]->GetTarget()->GetLastAnimFrame() ) // { // model[*it]->GetTarget()->SetCurrentAnimPos(model[*it]->GetTarget()->GetLastAnimFrame() ); // // model[*it]->GetTarget()->SetDeadFlag( true ); // // model[*it]->SetEndFlag( true ); // // } // } // // else if(model[*it]->GetTarget()->GetMotion() == MOT_DAMAGE) // { // // if( model[*it]->GetCurrentAnim().AnimPos >= model[*it]->GetLastAnimFrame() ) // { // //model[*it]->SetCurrentAnimPos(model[*it]->GetLastAnimFrame() ); // // model[*it]->SetEndFlag( true ); // // } // // } // } // //} // //else //{ // if( model[*it]->GetTarget()->GetMotion() == MOT_DEAD ) // { // if( model[*it]->GetTarget()->GetCurrentAnim().AnimPos >= model[*it]->GetTarget()->GetLastAnimFrame() ) // { // model[*it]->GetTarget()->SetCurrentAnimPos(model[*it]->GetTarget()->GetLastAnimFrame() ); // // model[*it]->PlaySe( SE_DEAD ); // // model[*it]->GetTarget()->SetDeadFlag( true ); // // model[*it]->SetEndFlag( true ); // // } // } // // else if(model[*it]->GetTarget()->GetMotion() == MOT_DAMAGE) // { // // if( model[*it]->GetCurrentAnim().AnimPos >= model[*it]->GetLastAnimFrame() ) // { // //model[*it]->SetCurrentAnimPos(model[*it]->GetLastAnimFrame() ); // // model[*it]->SetEndFlag( true ); // // } // // } //} // //if(model[*it]->GetTarget()->GetDeadFlag() ) //{ // if( m_IsAppend ) // { // m_IsAppend = false; // } // // MoveNextScene(); // //} // //else if( model[*it]->GetEndFlag() ) //{ // if( m_IsAppend ) // { // m_IsAppend = false; // } // // MoveNextScene(); //} //if( model[*it]->GetTarget()->GetMotion() == MOT_DEAD ) //{ // if(model[*it]->GetTarget()->GetCurrentAnim().AnimPos == model[*it]->GetTarget()->GetLastAnimFrame() ) // { // model[*it]->SetEndFlag( true ); // } //} // //else if( model[*it]->GetTarget()->GetMotion() == MOT_DAMAGE ) //{ // if(model[*it]->GetTarget()->GetCurrentAnim().AnimPos == model[*it]->GetTarget()->GetLastAnimFrame() ) // { // model[*it]->SetEndFlag( true ); // } //} // // //if(model[*it]->GetEndFlag() ) //{ // if( m_IsAppend ) // { // m_IsAppend = false; // } // // MoveNextScene(); //} if(CJoyPad::GetState(0, PAD_STATE_PUSH, PAD_BUTTON_01) ) { //Uint64 NowTime = Joker::GetSystemTimeSecond(); // //Uint64 OldTime = NowTime; // //static int count = 0; model[*it]->SetEndFlag( true ); if( m_IsAppend ) { m_IsAppend = false; } for( int i = 0;i < ALL_CHARA;i++ ) { if(model[i]->GetStatus() <= 0) { model[i]->SetDeadFlag( true ); } } MoveNextScene(); } //} //if(Joker::GetSystemTime() - NowTime > 500) //{ //if(m_IsAppend) //{ // m_IsAppend = false; //} // //model[*it]->SetEndFlag( true ); //MoveNextScene(); //} }