void MotionPlayer::_ChainPlay(const std::vector<ChainData>::const_iterator &it) { // まだ前回の移行期間の最中なら、移行を中止する DetachPrevMotionIfExist(); chain_data_it_ = it; connect_prev_ = chain_data_it_->connect_prev; prev_blend_rate_ = chain_data_it_->blend_time; blend_time_ = chain_data_it_->blend_time; isloop_ = chain_data_it_->isloop; isloopcheck_ = false; if(!isloopcheck_)isplayend_ = false; prev_attach_index_ = current_attach_index_; if (blend_time_ <= 0) { DetachPrevMotionIfExist(); } current_attach_index_ = MV1AttachAnim(model_handle_, chain_data_it_->anim_index, chain_data_it_->anim_src_model_handle, chain_data_it_->check_name ? TRUE : FALSE); MV1SetAttachAnimTime(model_handle_, current_attach_index_, 0); SetBlendRateToModel(); }
void MotionPlayer::Play(int anim_index, bool connect_prev, int blend_time, int anim_src_model_handle, bool check_name, bool isloop, int nextanim_handle, bool isloopcheck) { if(nextanim_handle != -1) { prev_anim_index_ = nextanim_handle; }else{ prev_anim_index_ = MV1GetAttachAnim(model_handle_,current_attach_index_); } // まだ前回の移行期間の最中なら、移行を中止する DetachPrevMotionIfExist(); connect_prev_ = connect_prev; prev_blend_rate_ = blend_time; blend_time_ = blend_time; isloop_ = isloop; isloopcheck_ = isloopcheck; if(!isloopcheck_)isplayend_ = false; chain_data_.clear(); prev_attach_index_ = current_attach_index_; if (blend_time_ <= 0) { DetachPrevMotionIfExist(); } current_attach_index_ = MV1AttachAnim(model_handle_, anim_index, anim_src_model_handle, check_name ? TRUE : FALSE); MV1SetAttachAnimTime(model_handle_, current_attach_index_, 0); SetBlendRateToModel(); }
//public--start inline MODEL :: MODEL(SHOT* mS, float rotateY){ init(); ModelHandle = MV1LoadModel("model\\heri\\heri.mv1"); MV1SetFrameVisible(ModelHandle, 39, FALSE); MV1SetupCollInfo(ModelHandle, 39, 8, 16, 32); attachIndex = MV1AttachAnim(ModelHandle, 0, -1, FALSE); animTime = MV1GetAttachAnimTotalTime(ModelHandle, attachIndex); playTime = 0.0f; this->mS = mS; this->rotateY = rotateY; }
void Character::Init(float a, float b, float c, float X, float Y, float Z, int graph){ x = a; y = b; z = c; RotateX = X; RotateY = Y; RotateZ = Z; RotateZ2 = 0; life = 10; power = 0; this->graph = graph; DeathTimer = 180; targetwindow = MV1LoadModel("target.mqo"); MV1SetScale(targetwindow, VGet(0.025f, 0.025f, 0.025f)); MV1SetScale(graph, VGet(0.06f, 0.06f, 0.06f)); for(int i = 0; i < SNUM; i++){ shot[i].flag = 0; shot[i].graph = MV1LoadModel("shotp.pmx"); shot[i].attach = MV1AttachAnim( shot[i].graph, 0, -1, FALSE ) ; shot[i].shottime = MV1GetAttachAnimTotalTime( shot[i].graph, shot[i].attach ); shot[i].playtime = 0; MV1SetScale(shot[i].graph, VGet(0.3f, 0.3f, 0.8f)); } //ブーストの初期化 boost.graph = MV1LoadModel("boost.pmd"); boost.attach = MV1AttachAnim(boost.graph, 1, -1, FALSE ) ; boost.totaltime= MV1GetAttachAnimTotalTime( boost.graph, boost.attach ) ; boost.playtime = 0; MV1SetScale(boost.graph, VGet(0.11f, 0.11f, 0.11f)); boost2.graph = MV1LoadModel("boost.pmd"); boost2.attach = MV1AttachAnim(boost2.graph, 2, -1, FALSE ) ; boost2.totaltime= MV1GetAttachAnimTotalTime( boost2.graph, boost2.attach ) ; boost2.playtime = 0; MV1SetScale(boost2.graph, VGet(0.11f, 0.11f, 0.11f)); shotsound = LoadSoundMem( "sound/shoot1.mp3" ); ChangeVolumeSoundMem( 100, shotsound ) ; }
void Boss::SetAnimPattern(BossAnimPettern num){ AnimPattern = num; MV1DetachAnim(graph, AttachIndex); AttachIndex = MV1AttachAnim(graph, AnimPattern, -1, FALSE); AnimTime = 0; // MMDで作成したアニメーションと再生時間のフレームに誤差が生じてしまった上に // 直せないので手動で入力 switch(AnimPattern){ case stand: TotalTime = 45.0f; break; default: TotalTime = MV1GetAnimTotalTime(graph, AttachIndex); break; } }
// キャラクターに新たなアニメーションを再生する void Chara_PlayAnim( CHARA *ch, int PlayAnim ) { // 再生中のモーション2が有効だったらデタッチする if( ch->PlayAnim2 != -1 ) { MV1DetachAnim( ch->ModelHandle, ch->PlayAnim2 ) ; ch->PlayAnim2 = -1 ; } // 今まで再生中のモーション1だったものの情報を2に移動する ch->PlayAnim2 = ch->PlayAnim1 ; ch->AnimPlayCount2 = ch->AnimPlayCount1 ; // 新たに指定のモーションをモデルにアタッチして、アタッチ番号を保存する ch->PlayAnim1 = MV1AttachAnim( ch->ModelHandle, PlayAnim ) ; ch->AnimPlayCount1 = 0.0f ; // ブレンド率は再生中のモーション2が有効ではない場合は1.0f( 再生中のモーション1が100%の状態 )にする ch->AnimBlendRate = ch->PlayAnim2 == -1 ? 1.0f : 0.0f ; }