リビジョン | 1805b3669dd4aae057d67b7a96b9fe9af9a09ca5 (tree) |
---|---|
日時 | 2012-09-30 02:12:46 |
作者 | angeart <angeart@git....> |
コミッター | angeart |
ジャンプモーションありのコード
@@ -254,10 +254,27 @@ void FieldPlayer::Update() | ||
254 | 254 | }else if(additional_motion_.flag_) |
255 | 255 | { |
256 | 256 | bool connect_prev = true; |
257 | - motion_player_->Play(additional_motion_.handle_, connect_prev, 400, -1, false,additional_motion_.isloop_,additional_motion_.nextanim_handle_,additional_motion_.loopcheck_); | |
257 | + motion_player_->Play( | |
258 | + additional_motion_.handle_, | |
259 | + additional_motion_.connection_, | |
260 | + additional_motion_.connection_time_, | |
261 | + -1, | |
262 | + false, | |
263 | + additional_motion_.isloop_, | |
264 | + additional_motion_.nextanim_handle_, | |
265 | + additional_motion_.loopcheck_); | |
258 | 266 | additional_motion_.loopcheck_ = false; |
259 | 267 | additional_motion_.flag_ = false; |
260 | 268 | additional_motion_.nextanim_handle_ = -1; |
269 | + additional_motion_.connection_ = true; | |
270 | + additional_motion_.next_connection_ = true; | |
271 | + }else if(additional_motion_.motion_change_) | |
272 | + { | |
273 | + if(motion_player_->GetPlayEnd()) | |
274 | + { | |
275 | + additional_motion_.motion_change_ = false; | |
276 | + motion_player_->Play(current_stat_.motion, true, 200, -1, false); | |
277 | + } | |
261 | 278 | } |
262 | 279 | // モーション再生時刻更新 |
263 | 280 | motion_player_->Next(timer_->Delta()); |
@@ -341,7 +358,7 @@ void FieldPlayer::Move() | ||
341 | 358 | if (prev_stat_.acc.y == 0) |
342 | 359 | { |
343 | 360 | jump_wait_ = false; |
344 | - // 前回接地していた | |
361 | + // 前回接地していた | |
345 | 362 | // std::cout << " previous on the ground" << std::endl; |
346 | 363 | |
347 | 364 | // 登ったり下ったりできる段差の大きさの制限を求める |
@@ -417,16 +434,19 @@ void FieldPlayer::Move() | ||
417 | 434 | // 落下している |
418 | 435 | // std::cout << " previous falling" << std::endl; |
419 | 436 | |
420 | - // 地面に食い込むのを防止する | |
437 | + // 地面に食い込むのを防止する | |
421 | 438 | |
422 | 439 | if (foot_floor_exists.first) |
423 | 440 | { |
424 | 441 | // 地面に到達した |
425 | 442 | // std::cout << " current on the ground" << std::endl; |
426 | 443 | additional_motion_.handle_ = motion.end_jmp_; |
444 | + additional_motion_.connection_ = false; | |
427 | 445 | additional_motion_.isloop_ = false; |
428 | - additional_motion_.nextanim_handle_ = motion.stand_; | |
446 | + additional_motion_.nextanim_handle_ = current_stat_.motion; | |
447 | + additional_motion_.loopcheck_ = true; | |
429 | 448 | additional_motion_.flag_ = true; |
449 | + additional_motion_.motion_change_ = true; | |
430 | 450 | current_stat_.pos = foot_floor_exists.second; |
431 | 451 | current_stat_.acc.y = 0; |
432 | 452 | current_stat_.vel.y = 0; |
@@ -602,11 +622,22 @@ void FieldPlayer::InputFromUser() | ||
602 | 622 | input.GetGamepadCount(InputManager::PADBIND_JUMP) > 0)) |
603 | 623 | { |
604 | 624 | jump_wait_ = true; |
605 | - additional_motion_.handle_ = motion.pre_jmp_; | |
606 | - additional_motion_.isloop_ = false; | |
607 | - additional_motion_.flag_ = true; | |
608 | - additional_motion_.nextanim_handle_ = motion.jmp_; | |
609 | - additional_motion_.loopcheck_ = true; | |
625 | + if(move_dir == 0) | |
626 | + { | |
627 | + additional_motion_.handle_ = motion.pre_jmp_; | |
628 | + additional_motion_.isloop_ = false; | |
629 | + additional_motion_.flag_ = true; | |
630 | + additional_motion_.nextanim_handle_ = motion.jmp_; | |
631 | + additional_motion_.loopcheck_ = true; | |
632 | + additional_motion_.next_connection_ = false; | |
633 | + }else if(current_stat_.acc.y == 0){ | |
634 | + additional_motion_.handle_ = motion.jmp_; | |
635 | + additional_motion_.isloop_ = true; | |
636 | + any_move_ = true; | |
637 | + current_stat_.acc.y = -9.8 * stage_->map_scale(); | |
638 | + current_stat_.vel += VGet(0, jump_height_ * stage_->map_scale(), 0); | |
639 | + additional_motion_.flag_ = true; | |
640 | + } | |
610 | 641 | } |
611 | 642 | |
612 | 643 | if (current_stat_.acc.y == 0 && jump_wait_) |
@@ -618,6 +649,14 @@ void FieldPlayer::InputFromUser() | ||
618 | 649 | current_stat_.vel += VGet(0, jump_height_ * stage_->map_scale(), 0); |
619 | 650 | } |
620 | 651 | } |
652 | + | |
653 | + if (stage_->CheckWarpPoint(current_stat_.pos)) | |
654 | + { | |
655 | + //stage_->SetHostChangeFlag(true); | |
656 | + | |
657 | + auto pos = ConvWorldPosToScreenPos(current_stat_.pos+VGet(0,25,25)); | |
658 | + | |
659 | + } | |
621 | 660 | } |
622 | 661 | |
623 | 662 | void FieldPlayer::PlayMotion(const tstring& name,bool isloop) |
@@ -5,15 +5,15 @@ | ||
5 | 5 | |
6 | 6 | MotionPlayer::MotionPlayer(int model_handle) |
7 | 7 | : model_handle_(model_handle), prev_attach_index_(-1), current_attach_index_(-1), |
8 | - connect_prev_(false), prev_blend_rate_(0), blend_time_(0),prev_anim_index_(-1),isloop_(true),isloopcheck_(false) | |
8 | + connect_prev_(false), prev_blend_rate_(0), blend_time_(0),prev_anim_index_(-1),isloop_(true),isloopcheck_(false),nextconnect_(true) | |
9 | 9 | {} |
10 | 10 | |
11 | -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) | |
11 | +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, bool nextconnect) | |
12 | 12 | { |
13 | 13 | if(nextanim_handle != -1) |
14 | 14 | { |
15 | 15 | prev_anim_index_ = nextanim_handle; |
16 | - }else{ | |
16 | + }else if(!isloop){ | |
17 | 17 | prev_anim_index_ = MV1GetAttachAnim(model_handle_,current_attach_index_); |
18 | 18 | } |
19 | 19 |
@@ -25,6 +25,7 @@ void MotionPlayer::Play(int anim_index, bool connect_prev, int blend_time, int a | ||
25 | 25 | blend_time_ = blend_time; |
26 | 26 | isloop_ = isloop; |
27 | 27 | isloopcheck_ = isloopcheck; |
28 | + nextconnect_ = nextconnect; | |
28 | 29 | if(!isloopcheck_)isplayend_ = false; |
29 | 30 | |
30 | 31 | prev_attach_index_ = current_attach_index_; |
@@ -108,7 +109,7 @@ void MotionPlayer::AdvancePlayTime(int diff_time) | ||
108 | 109 | { |
109 | 110 | Stop(); |
110 | 111 | isplayend_ = true; |
111 | - Play(prev_anim_index_,connect_prev_,200,-1,false,true,-1,isloopcheck_); | |
112 | + Play(prev_anim_index_,nextconnect_,200,-1,false,true,-1,isloopcheck_); | |
112 | 113 | return; |
113 | 114 | } |
114 | 115 | anim_time -= anim_total_time; |
@@ -4,7 +4,7 @@ class MotionPlayer | ||
4 | 4 | { |
5 | 5 | public: |
6 | 6 | MotionPlayer(int model_handle); |
7 | - void Play(int anim_index, bool connect_prev, int blend_time, int anim_src_model_handle, bool check_name, bool isloop = true, int nextanim_handle = -1,bool isloopcheck = false); | |
7 | + void Play(int anim_index, bool connect_prev, int blend_time, int anim_src_model_handle, bool check_name, bool isloop = true, int nextanim_handle = -1,bool isloopcheck = false,bool nextconnect = true); | |
8 | 8 | void Next(int diff_time); |
9 | 9 | void Stop(); |
10 | 10 | bool GetPlayEnd(); |
@@ -19,6 +19,7 @@ private: | ||
19 | 19 | int prev_anim_index_; |
20 | 20 | bool isplayend_; |
21 | 21 | bool isloopcheck_; |
22 | + bool nextconnect_; | |
22 | 23 | |
23 | 24 | void SetBlendRateToModel(); |
24 | 25 | void DetachPrevMotionIfExist(); |