Esempio n. 1
0
void Character::Draw(){
	MV1DrawModel( graph );
	MV1SetPosition( graph, VGet(x, y + 1, z ) ) ;
	MV1SetPosition( targetwindow, VGet( x +  -10 * tan(RotateZ * PI/   180), (y + 10 * tan(RotateX * PI/ 180)), z + 10));
	MV1SetRotationXYZ( graph, VGet( -RotateX * DX_PI_F / 180.0f, (RotateY +180) * DX_PI_F / 180.0f, (RotateZ+ RotateZ2 + 180) * DX_PI_F / 180.0f ));
	MV1SetOpacityRate(graph, !(damaged_timer % 2));
	if(life >= 0){
		//MV1DrawModel( targetwindow );
		MV1DrawModel( boost.graph );
		MV1DrawModel( boost2.graph );
	}
	//ブースト関連
	boost.playtime += 1.0f;
	if( boost.playtime >= boost.totaltime ) boost.playtime = 0.0f;
	MV1SetAttachAnimTime( boost.graph, boost.attach, boost.playtime );
	MV1SetPosition( boost.graph, VGet(x , y, z ));
	MV1SetRotationXYZ( boost.graph, VGet( -RotateX * DX_PI_F / 180.0f, (RotateY +180) * DX_PI_F / 180.0f, (RotateZ+ RotateZ2 + 180) * DX_PI_F / 180.0f ));

	boost2.playtime += 1.0f;
	if( boost2.playtime >= boost2.totaltime ) boost2.playtime = 0.0f;
	MV1SetAttachAnimTime( boost2.graph, boost2.attach, boost2.playtime );
	MV1SetPosition( boost2.graph, VGet( x, y, z ));
	MV1SetRotationXYZ( boost2.graph, VGet( -RotateX * DX_PI_F / 180.0f, (RotateY +180) * DX_PI_F / 180.0f, (RotateZ+ RotateZ2 + 180) * DX_PI_F / 180.0f ));

}
// キャラクターのアニメーション処理
void Chara_AnimProcess( CHARA *ch )
{
	float AnimTotalTime ;		// 再生しているアニメーションの総時間

	// ブレンド率が1以下の場合は1に近づける
	if( ch->AnimBlendRate < 1.0f )
	{
		ch->AnimBlendRate += CHARA_ANIM_BLEND_SPEED ;
		if( ch->AnimBlendRate > 1.0f )
		{
			ch->AnimBlendRate = 1.0f ;
		}
	}

	// 再生しているアニメーション1の処理
	if( ch->PlayAnim1 != -1 )
	{
		// アニメーションの総時間を取得
		AnimTotalTime = MV1GetAttachAnimTotalTime( ch->ModelHandle, ch->PlayAnim1 ) ;

		// 再生時間を進める
		ch->AnimPlayCount1 += CHARA_PLAY_ANIM_SPEED ;

		// 再生時間が総時間に到達していたら再生時間をループさせる
		if( ch->AnimPlayCount1 >= AnimTotalTime )
		{
			ch->AnimPlayCount1 = fmod( ch->AnimPlayCount1, AnimTotalTime ) ;
		}

		// 変更した再生時間をモデルに反映させる
		MV1SetAttachAnimTime( ch->ModelHandle, ch->PlayAnim1, ch->AnimPlayCount1 ) ;

		// アニメーション1のモデルに対する反映率をセット
		MV1SetAttachAnimBlendRate( ch->ModelHandle, ch->PlayAnim1, ch->AnimBlendRate ) ;
	}

	// 再生しているアニメーション2の処理
	if( ch->PlayAnim2 != -1 )
	{
		// アニメーションの総時間を取得
		AnimTotalTime = MV1GetAttachAnimTotalTime( ch->ModelHandle, ch->PlayAnim2 ) ;

		// 再生時間を進める
		ch->AnimPlayCount2 += CHARA_PLAY_ANIM_SPEED ;

		// 再生時間が総時間に到達していたら再生時間をループさせる
		if( ch->AnimPlayCount2 > AnimTotalTime )
		{
			ch->AnimPlayCount2 = fmod( ch->AnimPlayCount2, AnimTotalTime ) ;
		}

		// 変更した再生時間をモデルに反映させる
		MV1SetAttachAnimTime( ch->ModelHandle, ch->PlayAnim2, ch->AnimPlayCount2 ) ;

		// アニメーション2のモデルに対する反映率をセット
		MV1SetAttachAnimBlendRate( ch->ModelHandle, ch->PlayAnim2, 1.0f - ch->AnimBlendRate ) ;
	}
}
Esempio n. 3
0
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();
}
Esempio n. 4
0
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();
}
Esempio n. 5
0
void Boss::Animation(){
	AnimTime += AnimSpeed;
	if (AnimTime >= TotalTime){
		AnimTime = 0.0f;
	}
	MV1SetAttachAnimTime(graph, AttachIndex, AnimTime);
	HitAnim();
}
Esempio n. 6
0
void MotionPlayer::AdvancePlayTime(int diff_time)
{
    auto anim_total_time = MV1GetAttachAnimTotalTime(model_handle_, current_attach_index_);

    auto anim_time = MV1GetAttachAnimTime(model_handle_, current_attach_index_);
    anim_time += (diff_time * 30) / 1000.0f;
    if (anim_time > anim_total_time)
    {
		if(!isloop_)
		{
			Stop();
			isplayend_ = true;
			if(!chain_data_.empty()){
				++chain_data_it_;
				if(chain_data_it_ == chain_data_.end())
				{
					Play(prev_anim_index_,connect_prev_,200,-1,false,true,-1,isloopcheck_);
				}else{
					_ChainPlay(chain_data_it_);
				}
			}else{
				Play(prev_anim_index_,connect_prev_,200,-1,false,true,-1,isloopcheck_);
			}
			return;
		}
        anim_time -= anim_total_time;
    }
    if (MV1SetAttachAnimTime(model_handle_, current_attach_index_, anim_time) == -1)
    {
        throw std::logic_error("can't set anim time to current_attach_index_");
    }

    if (connect_prev_ && prev_attach_index_ != -1)
    {
        auto prev_anim_total_time = MV1GetAttachAnimTotalTime(model_handle_, prev_attach_index_);

        auto prev_anim_time = MV1GetAttachAnimTotalTime(model_handle_, prev_attach_index_);
        prev_anim_time = anim_time * prev_anim_total_time / anim_total_time;
        if (MV1SetAttachAnimTime(model_handle_, prev_attach_index_, prev_anim_time) == -1)
        {
            throw std::logic_error("can't set anim time to prev_attach_index_");
        }
    }
}
Esempio n. 7
0
void MODEL :: display(){
	/*DrawCapsule3D(	VGet(x+600*sinf(rotateY), y+y0+200.0f-500*sinf(rotateX), z+600*cosf(rotateY)),
					VGet(x-200*sinf(rotateY), y+y0+200.0f+500*sinf(rotateX), z-200*cosf(rotateY)),
					210.0f, 2, GetColor(255,255,255), GetColor(255,255,255), FALSE);*/
	playTime += 200.0f;
	if(playTime >= animTime)
		playTime = 0.0f;
	mS->move();
	mS->display();
	MV1RefreshCollInfo(ModelHandle, 39);
	MATRIX rot = MMult(MMult(MGetRotX(rotateX), MGetRotZ(rotateZ)),MGetRotY(rotateY));
	MATRIX trans = MGetTranslate(VGet(x+x0, y+y0, z+z0));
	MV1SetMatrix(ModelHandle, MMult(rot, trans));
	MV1SetAttachAnimTime(ModelHandle, attachIndex, playTime);
	MV1DrawModel(ModelHandle);
}
Esempio n. 8
0
void Character::Shot(){
	static unsigned int pad_timer = 0;
	if(KeyGet(KEY_INPUT_U)) power = 2;
	if (input & PAD_INPUT_1) {
		pad_timer++;
	}
	else{
		pad_timer = 0;
	}
	if (KeyGet(KEY_INPUT_SPACE) % 5 == 1 || pad_timer % 5 == 1  && muteki == 0){
		PlaySoundMem( shotsound , DX_PLAYTYPE_BACK ) ;

		for(int i = 0; i < SNUM; i++){
			if(shot[i].flag == 0){
				shot[i].flag = 1;
				shot[i].x = x;
				shot[i].y = y;
				shot[i].z = z;
				shot[i].angleX = RotateX;
				shot[i].angleY = RotateY;
				shot[i].angleZ = RotateZ;
				shot[i].playtime =0.0f;
				float sbx =  1 * tan((RotateZ * PI/ 180));
				float sb =  ((sbx * sbx) + 1 * 1);
				float sby = sb * tan((RotateX * PI/ 180));
				shot[i].rx = sbx / sb * 10.0f;
				shot[i].rz = 1 / sb * 10.0f;
				shot[i].ry = sby / sqrt(sb * sb + sby * sby) * 8.0f;
				MV1SetRotationXYZ( shot[i].graph, VGet(( shot[i].angleX / 1.5)* DX_PI_F / 180.0f, ((shot[i].angleZ  + 180 ) * -1) * DX_PI_F / 180.0f, 0 * DX_PI_F / 180.0f ));
				break;
				
			}
			
		}

	}
	if(KeyGet(KEY_INPUT_SPACE) % 5 == 1 && power == 1 ){
		PlaySoundMem( shotsound , DX_PLAYTYPE_BACK ) ;
		for(int i = 0; i < SNUM; i++){
			if(shot[i].flag == 0){
				shot[i].flag = 1;
				shot[i].x = x - 2;
				shot[i].y = y;
				shot[i].z = z;
				shot[i + 1].flag = 1;
				shot[i + 1].x = x + 2;
				shot[i + 1].y = y;
				shot[i + 1].z = z;
				shot[i].angleX = RotateX;
				shot[i].angleY = RotateY;
				shot[i].angleZ = RotateZ;
				shot[i].playtime =0.0f;
				shot[i + 1].angleX = RotateX;
				shot[i + 1].angleY = RotateY;
				shot[i + 1].angleZ = RotateZ;
				shot[i + 1].playtime =0.0f;
				float sbx =  1 * tan((RotateZ * PI/ 180));
				float sb =  ((sbx * sbx) + 1 * 1);
				float sby = sb * tan((RotateX * PI/ 180));
				shot[i].rx = sbx / sb * 10.0f;
				shot[i].rz = 1 / sb * 10.0f;
				shot[i].ry = sby / sqrt(sb * sb + sby * sby) * 8.0f;
				MV1SetRotationXYZ( shot[i].graph, VGet(( shot[i].angleX / 1.5)* DX_PI_F / 180.0f, ((shot[i].angleZ  + 180 ) * -1) * DX_PI_F / 180.0f, 0 * DX_PI_F / 180.0f ));
				shot[i + 1].rx = sbx / sb * 10.0f;
				shot[i + 1].rz = 1 / sb * 10.0f;
				shot[i + 1].ry = sby / sqrt(sb * sb + sby * sby) * 8.0f;
				MV1SetRotationXYZ( shot[i + 1].graph, VGet(( shot[i + 1].angleX / 1.5)* DX_PI_F / 180.0f, ((shot[i + 1].angleZ  + 180 ) * -1) * DX_PI_F / 180.0f, 0 * DX_PI_F / 180.0f ));
				break;
				
			}
			
		}

	}
	if(KeyGet(KEY_INPUT_SPACE) % 5 == 1 && power >= 2 ){
		PlaySoundMem( shotsound , DX_PLAYTYPE_BACK ) ;
		for(int i = 0; i < SNUM; i++){
			if(shot[i].flag == 0){
				shot[i].flag = 1;
				shot[i].x = x;
				shot[i].y = y;
				shot[i].z = z;
				shot[i].angleX = RotateX;
				shot[i].angleY = RotateY;
				shot[i].angleZ = RotateZ;
				shot[i].playtime =0.0f;

				shot[i + 1].flag = 1;
				shot[i + 1].x = x + 4;
				shot[i + 1].y = y;
				shot[i + 1].z = z;
				shot[i + 1].angleX = RotateX;
				shot[i + 1].angleY = RotateY;
				shot[i + 1].angleZ = RotateZ;
				shot[i + 1].playtime =0.0f;

				shot[i + 2].flag = 1;
				shot[i + 2].x = x - 4;
				shot[i + 2].y = y;
				shot[i + 2].z = z;
				shot[i + 2].angleX = RotateX;
				shot[i + 2].angleY = RotateY;
				shot[i + 2].angleZ = RotateZ;
				shot[i + 2].playtime =0.0f;

				float sbx =  1 * tan((RotateZ * PI/ 180));
				float sb =  ((sbx * sbx) + 1 * 1);
				float sby = sb * tan((RotateX * PI/ 180));
				shot[i].rx = sbx / sb * 10.0f;
				shot[i].rz = 1 / sb * 10.0f;
				shot[i].ry = sby / sqrt(sb * sb + sby * sby) * 8.0f;
				MV1SetRotationXYZ( shot[i].graph, VGet(( shot[i].angleX / 1.5)* DX_PI_F / 180.0f, ((shot[i].angleZ  + 180 ) * -1) * DX_PI_F / 180.0f, 0 * DX_PI_F / 180.0f ));

				shot[i + 1].rx = sbx / sb * 10.0f;
				shot[i + 1].rz = 1 / sb * 10.0f;
				shot[i + 1].ry = sby / sqrt(sb * sb + sby * sby) * 8.0f;
				MV1SetRotationXYZ( shot[i + 1].graph, VGet(( shot[i + 1].angleX / 1.5)* DX_PI_F / 180.0f, ((shot[i + 1].angleZ  + 180 ) * -1) * DX_PI_F / 180.0f, 0 * DX_PI_F / 180.0f ));

				shot[i + 2].rx = sbx / sb * 10.0f;
				shot[i + 2].rz = 1 / sb * 10.0f;
				shot[i + 2].ry = sby / sqrt(sb * sb + sby * sby) * 8.0f;
				MV1SetRotationXYZ( shot[i + 2].graph, VGet(( shot[i + 2].angleX / 1.5)* DX_PI_F / 180.0f, ((shot[i + 2].angleZ  + 180 ) * -1) * DX_PI_F / 180.0f, 0 * DX_PI_F / 180.0f ));
				break;
				
			}
			
		}

	}

	for(int i = 0; i < SNUM; i++){
		if(shot[i].flag == 1){
			shot[i].z += shot[i].rz;
			shot[i].x -= shot[i].rx;
			shot[i].y += shot[i].ry;
			MV1SetPosition( shot[i].graph, VGet(shot[i].x, shot[i].y, shot[i].z) );
			MV1DrawModel( shot[i].graph );
			
			MV1SetAttachAnimTime( shot[i].graph, shot[i].attach, shot[i].playtime ) ;
			
			shot[i].playtime += 2.0f;
			
			if(shot[i].playtime >= shot[i].shottime ) shot[i].playtime = 0;
			
			if(shot[i].z > z + 300.0f){
				shot[i].flag = 0;
				shot[i].playtime = 0.0f;
			}
		}
		if(shot[i].flag == 2){
			shot[i].x -= shot[i].rx;
			shot[i].y -= shot[i].ry;
			shot[i].z -= shot[i].rz;
			
			MV1SetScale(shot[i].graph, VGet(0.05f, 0.05f, 0.005f));
			MV1SetPosition( shot[i].graph, VGet(shot[i].x, shot[i].y, shot[i].z) );
			MV1DrawModel( shot[i].graph );
			
			if(shot[i].z > 100){
				shot[i].flag = 0;
			}
		}
	}

}