修訂 | 8f6eed7f717632626be916a7b4697df155ea33e0 (tree) |
---|---|
時間 | 2012-09-25 18:27:16 |
作者 | angeart <angeart@git....> |
Commiter | angeart |
ジャンプモーションの対応
新バージョンDXライブラリ対応
@@ -5,12 +5,17 @@ | ||
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) | |
8 | + connect_prev_(false), prev_blend_rate_(0), blend_time_(0),prev_anim_index_(-1),isloop_(true),isloopcheck_(false) | |
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) | |
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) | |
12 | 12 | { |
13 | - prev_anim_index_ = MV1GetAttachAnim(model_handle_,current_attach_index_); | |
13 | + if(nextanim_handle != -1) | |
14 | + { | |
15 | + prev_anim_index_ = nextanim_handle; | |
16 | + }else{ | |
17 | + prev_anim_index_ = MV1GetAttachAnim(model_handle_,current_attach_index_); | |
18 | + } | |
14 | 19 | |
15 | 20 | // まだ前回の移行期間の最中なら、移行を中止する |
16 | 21 | DetachPrevMotionIfExist(); |
@@ -19,6 +24,8 @@ void MotionPlayer::Play(int anim_index, bool connect_prev, int blend_time, int a | ||
19 | 24 | prev_blend_rate_ = blend_time; |
20 | 25 | blend_time_ = blend_time; |
21 | 26 | isloop_ = isloop; |
27 | + isloopcheck_ = isloopcheck; | |
28 | + if(!isloopcheck_)isplayend_ = false; | |
22 | 29 | |
23 | 30 | prev_attach_index_ = current_attach_index_; |
24 | 31 | if (blend_time_ <= 0) |
@@ -100,7 +107,8 @@ void MotionPlayer::AdvancePlayTime(int diff_time) | ||
100 | 107 | if(!isloop_) |
101 | 108 | { |
102 | 109 | Stop(); |
103 | - Play(prev_anim_index_,connect_prev_,200,-1,false); | |
110 | + isplayend_ = true; | |
111 | + Play(prev_anim_index_,connect_prev_,200,-1,false,true,-1,isloopcheck_); | |
104 | 112 | return; |
105 | 113 | } |
106 | 114 | anim_time -= anim_total_time; |
@@ -123,4 +131,12 @@ void MotionPlayer::AdvancePlayTime(int diff_time) | ||
123 | 131 | } |
124 | 132 | } |
125 | 133 | |
126 | - | |
134 | +bool MotionPlayer::GetPlayEnd() | |
135 | +{ | |
136 | + if(isplayend_) | |
137 | + { | |
138 | + isplayend_ = false; | |
139 | + return true; | |
140 | + } | |
141 | + return false; | |
142 | +} |
@@ -4,9 +4,10 @@ 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); | |
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); | |
8 | 8 | void Next(int diff_time); |
9 | 9 | void Stop(); |
10 | + bool GetPlayEnd(); | |
10 | 11 | |
11 | 12 | private: |
12 | 13 | int model_handle_; |
@@ -16,6 +17,8 @@ private: | ||
16 | 17 | int blend_time_; |
17 | 18 | bool isloop_; |
18 | 19 | int prev_anim_index_; |
20 | + bool isplayend_; | |
21 | + bool isloopcheck_; | |
19 | 22 | |
20 | 23 | void SetBlendRateToModel(); |
21 | 24 | void DetachPrevMotionIfExist(); |
@@ -243,8 +243,8 @@ public: | ||
243 | 243 | //moved_pos.y = std::max(moved_pos.y, floor_y); // 床にあたっているときは床の方がyが高くなる |
244 | 244 | if(!jump_flag_){ |
245 | 245 | // 登ったり下ったりできる段差の大きさの制限を求める |
246 | - static const float y_max_limit_factor = sin(45 * PHI_F / 180); | |
247 | - static const float y_min_limit_factor = sin(-45 * PHI_F / 180); | |
246 | + static const float y_max_limit_factor = sin(45 * DX_PI_F / 180); | |
247 | + static const float y_min_limit_factor = sin(-45 * DX_PI_F / 180); | |
248 | 248 | const float y_max_limit = y_max_limit_factor * VSize(diff_pos); |
249 | 249 | const float y_min_limit = y_min_limit_factor * VSize(diff_pos); |
250 | 250 |
@@ -196,7 +196,7 @@ std::pair<bool,VECTOR> Stage::FrontCollides(float collision_length, const VECTOR | ||
196 | 196 | { |
197 | 197 | for(int j = 0; j < slide_coll_info.HitNum; ++j) |
198 | 198 | { |
199 | - auto angle = (acos(VDot(slide_coll_info.Dim[j].Normal,current_pos - prev_pos) / (VSize(slide_coll_info.Dim[j].Normal) * VSize(current_pos - prev_pos)))*180.0f)/PHI_F; | |
199 | + auto angle = (acos(VDot(slide_coll_info.Dim[j].Normal,current_pos - prev_pos) / (VSize(slide_coll_info.Dim[j].Normal) * VSize(current_pos - prev_pos)))*180.0f)/DX_PI_F; | |
200 | 200 | if(angle < 90.0f || angle > 270.0f) |
201 | 201 | { |
202 | 202 | NowPos += VScale(slide_coll_info.Dim[j].Normal, 0.1f * map_scale_); |
@@ -3,7 +3,7 @@ | ||
3 | 3 | |
4 | 4 | #include <ostream> |
5 | 5 | |
6 | -#define TORADIAN(DEGREE) ((DEGREE*PHI_F)/180.0f) | |
6 | +#define TORADIAN(DEGREE) ((DEGREE*DX_PI_F)/180.0f) | |
7 | 7 | |
8 | 8 | inline VECTOR operator +(const VECTOR& lhs, const VECTOR& rhs) |
9 | 9 | { |
@@ -44,10 +44,10 @@ const float GameLoop::CAMERA_MAX_RADIUS = 40.0f; | ||
44 | 44 | |
45 | 45 | GameLoop::GameLoop(const StagePtr& stage) |
46 | 46 | : stage_(stage), |
47 | - camera_default_stat(CameraStatus(7.0f, 0.8f, 0.0f, 20 * PHI_F / 180, false)), | |
47 | + camera_default_stat(CameraStatus(7.0f, 0.8f, 0.0f, 20 * DX_PI_F / 180, false)), | |
48 | 48 | camera(camera_default_stat) |
49 | 49 | { |
50 | - SetupCamera_Perspective(PHI_F * 60.0f / 180.0f); // 視野角60度 | |
50 | + SetupCamera_Perspective(DX_PI_F * 60.0f / 180.0f); // 視野角60度 | |
51 | 51 | SetCameraNearFar(1.0f * stage_->map_scale(), 700.0f * stage_->map_scale()); |
52 | 52 | } |
53 | 53 |
@@ -199,12 +199,12 @@ void GameLoop::MoveCamera(InputManager* input) | ||
199 | 199 | camera.theta += diff_x * 0.005f; |
200 | 200 | camera.phi += diff_y * 0.005f; |
201 | 201 | } |
202 | - if(camera.phi < (-40.0f * PHI_F)/180.0f) | |
202 | + if(camera.phi < (-40.0f * DX_PI_F)/180.0f) | |
203 | 203 | { |
204 | - camera.phi = (-39.9f * PHI_F)/180.0f; | |
205 | - }else if(camera.phi > (220.0f * PHI_F)/180.0f) | |
204 | + camera.phi = (-39.9f * DX_PI_F)/180.0f; | |
205 | + }else if(camera.phi > (220.0f * DX_PI_F)/180.0f) | |
206 | 206 | { |
207 | - camera.phi = (219.0f * PHI_F)/180.0f; | |
207 | + camera.phi = (219.0f * DX_PI_F)/180.0f; | |
208 | 208 | } |
209 | 209 | } |
210 | 210 | else |