• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisiónf48dd7814a1416b5dbc6b025c4e8d527c7012615 (tree)
Tiempo2012-10-10 19:42:19
Autorh2so5 <h2so5@git....>
Commiterh2so5

Log Message

チャンネル機能を仮実装

Cambiar Resumen

Diferencia incremental

--- a/client/3d/FieldPlayer.cpp
+++ b/client/3d/FieldPlayer.cpp
@@ -26,7 +26,7 @@ inline bool NearlyEqualRelative(const T& lhs, const T& rhs, const U& ratio)
2626
2727 } // namespace
2828
29-FieldPlayer::FieldPlayer(CharacterDataProvider& data_provider, const StagePtr& stage, const TimerPtr& timer)
29+FieldPlayer::FieldPlayer(CharacterDataProvider& data_provider, const std::shared_ptr<const StagePtr>& stage, const TimerPtr& timer)
3030 : prev_stat_(),
3131 current_stat_(PlayerStatus( VGet(0, 0, 0), VGet(0, 0, 0), VGet(0, 0, 0),
3232 0.0f, 0.0f, 0, 0, 1.0f, false)),
@@ -55,8 +55,8 @@ void FieldPlayer::Chara_ShadowRender() const
5555 MV1_COLL_RESULT_POLY *HitRes ;
5656 VERTEX3D Vertex[ 3 ] ;
5757 VECTOR SlideVec ;
58- auto shadow_height = model_height_*stage_->map_scale();
59- auto shadow_size = shadow_size_ * stage_->map_scale();
58+ auto shadow_height = model_height_ * (*stage_)->map_scale();
59+ auto shadow_size = shadow_size_ * (*stage_)->map_scale();
6060
6161 // ライティングを無効にする
6262 SetUseLighting( FALSE ) ;
@@ -68,7 +68,7 @@ void FieldPlayer::Chara_ShadowRender() const
6868 SetTextureAddressMode( DX_TEXADDRESS_CLAMP ) ;
6969
7070 // キャラクターの直下に存在する地面のポリゴンを取得
71- HitResDim = MV1CollCheck_Capsule( stage_->map_handle().handle() , -1, VAdd( current_stat_.pos, VGet( 0, 0.5f * shadow_height, 0 ) ), VAdd( current_stat_.pos, VGet( 0.0f,-shadow_height, 0.0f ) ), shadow_size ) ;
71+ HitResDim = MV1CollCheck_Capsule( (*stage_)->map_handle().handle() , -1, VAdd( current_stat_.pos, VGet( 0, 0.5f * shadow_height, 0 ) ), VAdd( current_stat_.pos, VGet( 0.0f,-shadow_height, 0.0f ) ), shadow_size ) ;
7272
7373 // 頂点データで変化が無い部分をセット
7474 Vertex[ 0 ].dif = GetColorU8( 255,255,255,255 ) ;
@@ -137,9 +137,9 @@ void FieldPlayer::Draw() const
137137 MV1DrawModel(model_handle_.handle());
138138 Chara_ShadowRender();
139139
140- // DrawLine3D(current_stat_.pos, current_stat_.pos + VGet(2 * stage_->map_scale(), 0, 0), GetColor(255, 0, 0));
141- // DrawLine3D(current_stat_.pos, current_stat_.pos + VGet(0, 2 * stage_->map_scale(), 0), GetColor(0, 255, 0));
142- // DrawLine3D(current_stat_.pos, current_stat_.pos + VGet(0, 0, 2 * stage_->map_scale()), GetColor(0, 0, 255));
140+ // DrawLine3D(current_stat_.pos, current_stat_.pos + VGet(2 * (*stage_)->map_scale(), 0, 0), GetColor(255, 0, 0));
141+ // DrawLine3D(current_stat_.pos, current_stat_.pos + VGet(0, 2 * (*stage_)->map_scale(), 0), GetColor(0, 255, 0));
142+ // DrawLine3D(current_stat_.pos, current_stat_.pos + VGet(0, 0, 2 * (*stage_)->map_scale()), GetColor(0, 0, 255));
143143 }
144144
145145 void FieldPlayer::Init(tstring model_name)
@@ -150,17 +150,17 @@ void FieldPlayer::Init(tstring model_name)
150150
151151 void FieldPlayer::ResetPosition()
152152 {
153- const auto& points = stage_->start_points();
153+ const auto& points = (*stage_)->start_points();
154154 std::mt19937 engine(time(nullptr));
155155 std::uniform_int_distribution<int> distribution(0, points.size() - 1);
156156
157157 current_stat_.pos = points[distribution(engine)];
158- current_stat_.pos.y = stage_->GetFloorY(current_stat_.pos + VGet(0, 20, 0), current_stat_.pos - VGet(0, 20, 0));
158+ current_stat_.pos.y = (*stage_)->GetFloorY(current_stat_.pos + VGet(0, 20, 0), current_stat_.pos - VGet(0, 20, 0));
159159 }
160160
161161 void FieldPlayer::RescuePosition()
162162 {
163- const auto& points = stage_->start_points();
163+ const auto& points = (*stage_)->start_points();
164164 const auto& new_pos =
165165 std::min_element(points.begin(), points.end(),
166166 [this](const VECTOR& a, const VECTOR& b){
@@ -173,7 +173,7 @@ void FieldPlayer::RescuePosition()
173173 });
174174
175175 current_stat_.pos = *new_pos;
176- current_stat_.pos.y = stage_->GetFloorY(current_stat_.pos - VGet(0, 100, 0), current_stat_.pos + VGet(0, 100, 0));
176+ current_stat_.pos.y = (*stage_)->GetFloorY(current_stat_.pos - VGet(0, 100, 0), current_stat_.pos + VGet(0, 100, 0));
177177 current_stat_.acc.y = 0;
178178 current_stat_.vel.y = 0;
179179 }
@@ -226,7 +226,7 @@ void FieldPlayer::Update()
226226 }
227227
228228 // 落ちた時に強制復帰
229- if (prev_stat_.pos.y < stage_->min_height()) {
229+ if (prev_stat_.pos.y < (*stage_)->min_height()) {
230230 RescuePosition();
231231 }
232232 /*
@@ -267,7 +267,7 @@ void FieldPlayer::Update()
267267 data_provider_.set_motion(current_stat_.motion);
268268 data_provider_.set_vy(current_stat_.vel.y);
269269
270- stage_->UpdateSkymapPosition(GetCameraTarget());
270+ (*stage_)->UpdateSkymapPosition(GetCameraTarget());
271271 }
272272
273273 void FieldPlayer::Move()
@@ -306,8 +306,8 @@ void FieldPlayer::Move()
306306
307307
308308 // 移動方向に障害物があるか、または床がない場合は移動不可能
309- auto front_collides = stage_->FrontCollides(
310- 0.4, current_stat_.pos, prev_stat_.pos,1.0 * stage_->map_scale(), (model_height_ - 0.1) * stage_->map_scale() ,128);
309+ auto front_collides = (*stage_)->FrontCollides(
310+ 0.4, current_stat_.pos, prev_stat_.pos,1.0 * (*stage_)->map_scale(), (model_height_ - 0.1) * (*stage_)->map_scale() ,128);
311311
312312 if(front_collides.first && current_stat_.acc.y == 0)
313313 {
@@ -320,7 +320,7 @@ void FieldPlayer::Move()
320320 current_stat_.vel.x = current_stat_.vel.z = 0;
321321 }
322322 // 50mの深さまで床検出
323- auto floor_exists = stage_->FloorExists(current_stat_.pos, model_height_, 50);
323+ auto floor_exists = (*stage_)->FloorExists(current_stat_.pos, model_height_, 50);
324324 if(!floor_exists.first)
325325 {
326326 current_stat_.pos.x = front_collides.second.x;
@@ -329,7 +329,7 @@ void FieldPlayer::Move()
329329 }
330330
331331 // 足が地面にめり込んでいるか
332- auto foot_floor_exists = stage_->FloorExists(current_stat_.pos, model_height_, 0);
332+ auto foot_floor_exists = (*stage_)->FloorExists(current_stat_.pos, model_height_, 0);
333333
334334 const auto pos_diff = current_stat_.pos - prev_stat_.pos;
335335 const auto pos_diff_length = VSize(pos_diff);
@@ -352,7 +352,7 @@ void FieldPlayer::Move()
352352 // 接地点計算
353353 //std::cout << " ground collision check: current pos = " << current_stat_.pos << std::endl;
354354
355- auto coll_info = MV1CollCheck_Line(stage_->map_handle().handle(), -1,
355+ auto coll_info = MV1CollCheck_Line((*stage_)->map_handle().handle(), -1,
356356 current_stat_.pos + VGet(0, y_max_limit, 0),
357357 current_stat_.pos + VGet(0, y_min_limit, 0));
358358 if (coll_info.HitFlag && NearlyEqualRelative(coll_info.HitPosition.y, floor_exists.second.y, 0.001))
@@ -372,9 +372,9 @@ void FieldPlayer::Move()
372372 if (floor_exists.second.y < current_stat_.pos.y)
373373 {
374374 // 床はあるし、自分より低い位置なので落ちる
375- current_stat_.acc.y = -9.8 * stage_->map_scale();
375+ current_stat_.acc.y = -9.8 * (*stage_)->map_scale();
376376 }
377- else if (floor_exists.second.y < current_stat_.pos.y + 0.6 * stage_->map_scale())
377+ else if (floor_exists.second.y < current_stat_.pos.y + 0.6 * (*stage_)->map_scale())
378378 {
379379 // 床があり、平らなので登る
380380 auto delta = prev_stat_.pos - current_stat_.pos;
@@ -432,8 +432,8 @@ void FieldPlayer::Move()
432432 // 上昇している
433433 // std::cout << " previous rising" << std::endl;
434434
435- const auto player_top = VGet(0, model_height_ * stage_->map_scale(), 0);
436- auto coll_info = MV1CollCheck_Line(stage_->map_handle().handle(), -1,
435+ const auto player_top = VGet(0, model_height_ * (*stage_)->map_scale(), 0);
436+ auto coll_info = MV1CollCheck_Line((*stage_)->map_handle().handle(), -1,
437437 prev_stat_.pos + player_top,
438438 current_stat_.pos + player_top);
439439 if (coll_info.HitFlag)
@@ -477,10 +477,10 @@ void FieldPlayer::InputFromUser()
477477 : 90.0f) * DX_PI_F / 180;
478478
479479 /*
480- auto warp_chk = stage_->CheckWarpPoint(current_stat_.pos);
480+ auto warp_chk = (*stage_)->CheckWarpPoint(current_stat_.pos);
481481 if (warp_chk && input.GetKeyCount(InputManager::KEYBIND_ENTER) > 0 )
482482 {
483- stage_->SetHostChangeFlag(warp_chk);
483+ (*stage_)->SetHostChangeFlag(warp_chk);
484484 }
485485 */
486486
@@ -534,7 +534,7 @@ void FieldPlayer::InputFromUser()
534534 {
535535 // 接地しており、かつ移動する
536536 any_move_ = true;
537- current_stat_.vel = VGet(sin(roty), 0, cos(roty)) * (-move_dir * move_speed * stage_->map_scale());
537+ current_stat_.vel = VGet(sin(roty), 0, cos(roty)) * (-move_dir * move_speed * (*stage_)->map_scale());
538538 current_stat_.motion =
539539 current_stat_.is_walking ? motion.walk_ : motion.run_;
540540 }
@@ -543,19 +543,19 @@ void FieldPlayer::InputFromUser()
543543 // 空中にいる
544544 any_move_ = true;
545545 auto acc = 5.0f;
546- auto vel = current_stat_.vel + VGet(sin(roty), 0, cos(roty)) * (-move_dir * acc * stage_->map_scale());// * timer_->DeltaSec());// * ((6.0f-current_stat_.vel.y)/(stage_->map_scale()*12.0f))
546+ auto vel = current_stat_.vel + VGet(sin(roty), 0, cos(roty)) * (-move_dir * acc * (*stage_)->map_scale());// * timer_->DeltaSec());// * ((6.0f-current_stat_.vel.y)/((*stage_)->map_scale()*12.0f))
547547 vel.y = 0;
548548
549- if (VSize(vel) > std::max(move_speed, 1.0f) * stage_->map_scale())
549+ if (VSize(vel) > std::max(move_speed, 1.0f) * (*stage_)->map_scale())
550550 {
551- vel = vel * (std::max(move_speed, 1.0f) * stage_->map_scale() / VSize(vel));
551+ vel = vel * (std::max(move_speed, 1.0f) * (*stage_)->map_scale() / VSize(vel));
552552 }
553553 vel.y = current_stat_.vel.y;
554554 current_stat_.vel = vel;
555555 current_stat_.acc.y =
556- (current_stat_.acc.y + (0.2f * chg_acc * stage_->map_scale())) > -6.5f * stage_->map_scale() ? -6.5f * stage_->map_scale() :
557- current_stat_.acc.y + (0.2f * chg_acc * stage_->map_scale()) < -11.0f * stage_->map_scale() ? -11.0f * stage_->map_scale() :
558- current_stat_.acc.y + (0.2f * chg_acc * stage_->map_scale());
556+ (current_stat_.acc.y + (0.2f * chg_acc * (*stage_)->map_scale())) > -6.5f * (*stage_)->map_scale() ? -6.5f * (*stage_)->map_scale() :
557+ current_stat_.acc.y + (0.2f * chg_acc * (*stage_)->map_scale()) < -11.0f * (*stage_)->map_scale() ? -11.0f * (*stage_)->map_scale() :
558+ current_stat_.acc.y + (0.2f * chg_acc * (*stage_)->map_scale());
559559 }
560560 else
561561 {
@@ -596,8 +596,8 @@ void FieldPlayer::InputFromUser()
596596 input.GetGamepadCount(InputManager::PADBIND_JUMP) > 0))
597597 {
598598 any_move_ = true;
599- current_stat_.acc.y = -9.8 * stage_->map_scale();
600- current_stat_.vel += VGet(0, jump_height_ * stage_->map_scale(), 0);
599+ current_stat_.acc.y = -9.8 * (*stage_)->map_scale();
600+ current_stat_.vel += VGet(0, jump_height_ * (*stage_)->map_scale(), 0);
601601 }
602602 }
603603
Binary files a/client/3d/FieldPlayer.hpp and b/client/3d/FieldPlayer.hpp differ
--- a/client/3d/PlayerCharacter.cpp
+++ b/client/3d/PlayerCharacter.cpp
@@ -24,7 +24,7 @@ inline bool NearlyEqualRelative(const T& lhs, const T& rhs, const U& ratio)
2424 class PlayerCharacter::Impl
2525 {
2626 public:
27- Impl(CharacterDataProvider& data_provider, const StagePtr& stage, const TimerPtr& timer)
27+ Impl(CharacterDataProvider& data_provider, const std::shared_ptr<const StagePtr>& stage, const TimerPtr& timer)
2828 : data_provider_(data_provider),
2929 model_handle_(-1),
3030 current_target_pos_(VGet(0, 1000, 0)),
@@ -67,8 +67,8 @@ public:
6767 MV1_COLL_RESULT_POLY *HitRes ;
6868 VERTEX3D Vertex[ 3 ] ;
6969 VECTOR SlideVec ;
70- auto shadow_height = model_height_*stage_->map_scale();
71- auto shadow_size = shadow_size_ * stage_->map_scale();
70+ auto shadow_height = model_height_ * (*stage_)->map_scale();
71+ auto shadow_size = shadow_size_ * (*stage_)->map_scale();
7272
7373 // ライティングを無効にする
7474 SetUseLighting( FALSE ) ;
@@ -80,7 +80,7 @@ public:
8080 SetTextureAddressMode( DX_TEXADDRESS_CLAMP ) ;
8181
8282 // キャラクターの直下に存在する地面のポリゴンを取得
83- HitResDim = MV1CollCheck_Capsule( stage_->map_handle().handle(), -1, VAdd( current_pos_, VGet( 0.0f, 0.5f * shadow_height, 0.0f ) ), VAdd( current_pos_, VGet( 0.0f, -shadow_height, 0.0f ) ), shadow_size ) ;
83+ HitResDim = MV1CollCheck_Capsule((*stage_)->map_handle().handle(), -1, VAdd( current_pos_, VGet( 0.0f, 0.5f * shadow_height, 0.0f ) ), VAdd( current_pos_, VGet( 0.0f, -shadow_height, 0.0f ) ), shadow_size ) ;
8484
8585 // 頂点データで変化が無い部分をセット
8686 Vertex[ 0 ].dif = GetColorU8( 255,255,255,255 ) ;
@@ -206,7 +206,7 @@ public:
206206
207207 /*
208208 const auto jump_result_y =
209- jump_height_ * stage_->map_scale() * (time_entire - time_now) * (jump_height_ / 5.0f) * 1.019952f +
209+ jump_height_ * (*stage_)->map_scale() * (time_entire - time_now) * (jump_height_ / 5.0f) * 1.019952f +
210210 0.5f * -9.8f * (time_entire - time_now) * (time_entire - time_now) * (1.0f / flight_duration_ideal_) * (jump_height_ / 5.0f) * (jump_height_ / 5.0f); // 今からジャンプした際の最終的な位置
211211 */
212212 static auto st_acc = -9.8f;
@@ -215,12 +215,12 @@ public:
215215
216216 if(jump_flag_ == false && current_target_vec_y_ != 0){
217217 for(acc;acc < -6.5f;acc+=0.1f){
218- prediction_vector = jump_height_ * stage_->map_scale() + (acc) * (time_entire - time_now) * (jump_height_ / 5.0f) * (1.0f / flight_duration_ideal_ );
218+ prediction_vector = jump_height_ * (*stage_)->map_scale() + (acc) * (time_entire - time_now) * (jump_height_ / 5.0f) * (1.0f / flight_duration_ideal_ );
219219 // ターゲット座標ではジャンプを始めている
220220 if( prediction_vector > current_target_vec_y_ - 1 && prediction_vector < current_target_vec_y_ + 1)
221221 {
222222 // 目標座標でベクトルが上向きなら一致、ジャンプを始める
223- move_vec_y_ = jump_height_ * stage_->map_scale();
223+ move_vec_y_ = jump_height_ * (*stage_)->map_scale();
224224 jump_flag_ = true;
225225 }// それ以外はそのまま
226226 }
@@ -231,7 +231,7 @@ public:
231231 moved_pos = current_pos_ + diff_pos;
232232 if( jump_flag_ == true )
233233 {
234- move_vec_y_ += (st_acc * stage_->map_scale() * timer_->DeltaSec() * (1.0f/flight_duration_ideal_) * (jump_height_ / 5.0f));
234+ move_vec_y_ += (st_acc * (*stage_)->map_scale() * timer_->DeltaSec() * (1.0f/flight_duration_ideal_) * (jump_height_ / 5.0f));
235235 moved_pos.y = current_pos_.y + move_vec_y_ * timer_->DeltaSec() * (jump_height_ / 5.0f);
236236 }
237237
@@ -239,7 +239,7 @@ public:
239239 float floor_y;
240240 std::pair<bool, VECTOR> floor_coll;
241241 // 足で接地検査
242- floor_coll = stage_->FloorExists(moved_pos,model_height_,0);
242+ floor_coll = (*stage_)->FloorExists(moved_pos,model_height_,0);
243243 //moved_pos.y = std::max(moved_pos.y, floor_y); // 床にあたっているときは床の方がyが高くなる
244244 if(!jump_flag_){
245245 // 登ったり下ったりできる段差の大きさの制限を求める
@@ -251,7 +251,7 @@ public:
251251 // 接地点計算
252252 //std::cout << " ground collision check: current pos = " << current_stat_.pos << std::endl;
253253
254- auto coll_info = MV1CollCheck_Line(stage_->map_handle().handle(), -1,
254+ auto coll_info = MV1CollCheck_Line((*stage_)->map_handle().handle(), -1,
255255 moved_pos + VGet(0, y_max_limit, 0),
256256 moved_pos + VGet(0, y_min_limit, 0));
257257 if(coll_info.HitFlag && NearlyEqualRelative(coll_info.HitPosition.y, floor_coll.second.y, 0.001)){
@@ -264,7 +264,7 @@ public:
264264 moved_pos = current_pos_ + VSize(diff_pos) * VNorm(diff);
265265 }
266266 }
267- auto floor_exists = stage_->FloorExists(moved_pos, model_height_, 50);
267+ auto floor_exists = (*stage_)->FloorExists(moved_pos, model_height_, 50);
268268 if( floor_exists.first )
269269 {
270270 if( floor_exists.second.y < moved_pos.y && current_target_pos.y < moved_pos.y)
@@ -290,8 +290,8 @@ public:
290290 }else{
291291 // 上昇している
292292
293- const auto player_top = VGet(0, model_height_ * stage_->map_scale(), 0);
294- auto coll_info = MV1CollCheck_Line(stage_->map_handle().handle(), -1,
293+ const auto player_top = VGet(0, model_height_ * (*stage_)->map_scale(), 0);
294+ auto coll_info = MV1CollCheck_Line((*stage_)->map_handle().handle(), -1,
295295 current_pos_ + player_top,
296296 moved_pos + player_top);
297297 if (coll_info.HitFlag)
@@ -300,7 +300,7 @@ public:
300300 // std::cout << " current collided to ceiling" << std::endl;
301301
302302 moved_pos = coll_info.HitPosition - player_top;
303- move_vec_y_ = -(move_vec_y_ - (st_acc * stage_->map_scale() * timer_->DeltaSec() * (1.0f/flight_duration_ideal_) * (jump_height_ / 5.0f))) * 1.0; // 反射
303+ move_vec_y_ = -(move_vec_y_ - (st_acc * (*stage_)->map_scale() * timer_->DeltaSec() * (1.0f/flight_duration_ideal_) * (jump_height_ / 5.0f))) * 1.0; // 反射
304304 }
305305 }
306306 }
@@ -373,7 +373,7 @@ private:
373373 std::unique_ptr<MotionPlayer> motion_player_;
374374 std::pair<bool, int> additional_motion_;
375375 TimerPtr timer_;
376- StagePtr stage_;
376+ std::shared_ptr<const StagePtr> stage_;
377377 int shadow_handle_;
378378 float shadow_size_;
379379 bool jump_end_;
@@ -383,7 +383,8 @@ private:
383383 } motion;
384384 };
385385
386-PlayerCharacter::PlayerCharacter(CharacterDataProvider& data_provider, const StagePtr& stage, const TimerPtr& timer)
386+PlayerCharacter::PlayerCharacter(CharacterDataProvider& data_provider,
387+ const std::shared_ptr<const StagePtr>& stage, const TimerPtr& timer)
387388 : impl_(new Impl(data_provider, stage, timer))
388389 {}
389390
--- a/client/3d/PlayerCharacter.hpp
+++ b/client/3d/PlayerCharacter.hpp
@@ -10,7 +10,7 @@
1010 class PlayerCharacter : public Character
1111 {
1212 public:
13- PlayerCharacter(CharacterDataProvider& data_provider, const StagePtr& stage, const TimerPtr& timer);
13+ PlayerCharacter(CharacterDataProvider& data_provider, const std::shared_ptr<const StagePtr>& stage, const TimerPtr& timer);
1414 virtual ~PlayerCharacter();
1515
1616 void Draw() const;
--- a/client/3d/Stage.cpp
+++ b/client/3d/Stage.cpp
@@ -5,13 +5,15 @@
55 #include "Stage.hpp"
66 #include "../../common/Logger.hpp"
77 #include "../Profiler.hpp"
8+#include "../CommandManager.hpp"
89 #include <string>
910
10-Stage::Stage(const tstring& model_name) :
11- map_handle_(ResourceManager::LoadModelFromName(model_name)),
11+Stage::Stage(const ChannelPtr& channel) :
12+ map_handle_(ResourceManager::LoadModelFromName(unicode::ToTString(channel->stage))),
1213 map_scale_(map_handle_.property().get<float>("scale", 20.0)),
1314 min_height_(map_handle_.property().get<float>("min_height", -200.0)),
14- host_change_flag_(false)
15+ host_change_flag_(false),
16+ channel_(channel)
1517 {
1618 MV1SetScale(map_handle_.handle(), VGet(map_scale_, map_scale_, map_scale_));
1719 MV1SetupCollInfo(map_handle_.handle(), -1, 128, 64, 128);// 元の数値は256,256,256
@@ -34,6 +36,15 @@ Stage::Stage(const tstring& model_name) :
3436 draw_after_meshes_.insert(i);
3537 }
3638 }
39+
40+ BOOST_FOREACH(const auto& warp_point, channel_->warp_points) {
41+ auto handle = ResourceManager::LoadModelFromName(_T("warpobj:ワープオブジェクト"));
42+ float scale = handle.property().get<float>("scale", 80.0);
43+ MV1SetPosition(handle.handle(), VGet(warp_point.x, warp_point.y, warp_point.z));
44+ MV1SetScale(handle.handle(), VGet(scale, scale, scale));
45+ warpobj_handles_.push_back(handle);
46+ }
47+
3748 /*
3849 auto warp_points_array = map_handle_.property().get_child("stage.warp_points", ptree());
3950 for (auto it = warp_points_array.begin(); it != warp_points_array.end(); ++it) {
@@ -85,6 +96,10 @@ void Stage::Draw()
8596
8697 MV1DrawModel(skymap_handle_.handle());
8798
99+ BOOST_FOREACH(const auto& warp_point_handle, warpobj_handles_) {
100+ MV1DrawModel(warp_point_handle.handle());
101+ }
102+
88103 /*
89104 BOOST_FOREACH(auto warp_handle,warpobj_array_)
90105 {
--- a/client/3d/Stage.hpp
+++ b/client/3d/Stage.hpp
@@ -11,9 +11,12 @@
1111 #include "../ResourceManager.hpp"
1212 #include "../ui/InputBox.hpp"
1313
14+struct Channel;
15+typedef std::shared_ptr<Channel> ChannelPtr;
16+
1417 class Stage {
1518 public:
16- Stage(const tstring& model_path);
19+ Stage(const ChannelPtr& channel);
1720 ~Stage();
1821 void Draw();
1922 void DrawAfter();
@@ -50,13 +53,13 @@ class Stage {
5053 std::unordered_set<int> draw_after_meshes_;
5154
5255 ModelHandle skymap_handle_;
53- ModelHandle warpobj_handle_;
54- std::vector<ModelHandle> warpobj_array_;
56+ std::vector<ModelHandle> warpobj_handles_;
5557
5658 std::vector<VECTOR> start_points_;
5759 std::vector<VECTOR> warp_points_;
5860
5961 bool host_change_flag_;
62+ ChannelPtr channel_;
6063 };
6164
6265 typedef std::shared_ptr<Stage> StagePtr;
--- a/client/CommandManager.cpp
+++ b/client/CommandManager.cpp
@@ -76,12 +76,12 @@ void CommandManager::FetchCommand(const network::Command& command)
7676 // サーバーデータ受信
7777 case ClientReceiveServerInfo:
7878 {
79- network::Utils::Deserialize(command.body(), & stage_);
80- if (ResourceManager::NameToFullPath(unicode::ToTString(stage_)).empty()) {
81- status_ = STATUS_ERROR_NOSTAGE;
82- } else {
83- status_ = STATUS_READY;
84- }
79+ //network::Utils::Deserialize(command.body(), & stage_);
80+ //if (ResourceManager::NameToFullPath(unicode::ToTString(stage_)).empty()) {
81+ // status_ = STATUS_ERROR_NOSTAGE;
82+ //} else {
83+ // status_ = STATUS_READY;
84+ //}
8585 }
8686 break;
8787
@@ -101,6 +101,47 @@ void CommandManager::FetchCommand(const network::Command& command)
101101 }
102102
103103 auto channels = pt.get_child("channels", ptree());
104+ BOOST_FOREACH(const auto& channel, channels) {
105+ auto ptr = std::make_shared<Channel>();
106+ auto id = boost::lexical_cast<int>(channel.first.substr(2));
107+ ptr->name = channel.second.get<std::string>("name");
108+ ptr->stage = channel.second.get<std::string>("stage");
109+
110+ auto warp_points = channel.second.get_child("warp_points", ptree());
111+ BOOST_FOREACH(const auto& warp_point, warp_points) {
112+ auto channel = warp_point.second.get<unsigned char>("channel", 0);
113+ auto x = warp_point.second.get<float>("position.x", 0);
114+ auto y = warp_point.second.get<float>("position.y", 0);
115+ auto z = warp_point.second.get<float>("position.z", 0);
116+ Channel::WarpPoint point = {x, y, z, channel, ""};
117+ ptr->warp_points.push_back(point);
118+ }
119+ channels_[id] = ptr;
120+ }
121+
122+ // 存在しないチャンネルへのワープポイントを削除
123+ BOOST_FOREACH(const auto& channel, channels_) {
124+ auto& warp_points = channel.second->warp_points;
125+ auto end_it = std::remove_if(warp_points.begin(),
126+ warp_points.end(),
127+ [this](Channel::WarpPoint& point) -> bool {
128+ auto it = channels_.find(point.channel);
129+ if (it != channels_.end()) {
130+ point.name = it->second->name;
131+ return false;
132+ } else {
133+ return true;
134+ }
135+ });
136+ warp_points.erase(end_it, warp_points.end());
137+ }
138+
139+ if (ResourceManager::NameToFullPath(
140+ unicode::ToTString(channels_[0]->stage)).empty()) {
141+ status_ = STATUS_ERROR_NOSTAGE;
142+ } else {
143+ status_ = STATUS_READY;
144+ }
104145 }
105146 break;
106147
@@ -210,11 +251,22 @@ CommandManager::Status CommandManager::status() const
210251 return status_;
211252 }
212253
213-std::string CommandManager::stage() const
254+const std::map<unsigned char, ChannelPtr>& CommandManager::channels() const
214255 {
215- return stage_;
256+ return channels_;
216257 }
217258
259+ChannelPtr CommandManager::current_channel() const
260+{
261+ PlayerManagerPtr player_manager = manager_accessor_->player_manager().lock();
262+ if (auto myself = player_manager->GetMyself()) {
263+ return channels_.at(myself->channel());
264+ } else {
265+ return ChannelPtr();
266+ }
267+}
268+
269+
218270 double CommandManager::GetReadByteAverage() const
219271 {
220272 if (client_) {
--- a/client/CommandManager.hpp
+++ b/client/CommandManager.hpp
@@ -12,6 +12,21 @@ namespace network {
1212 class Command;
1313 }
1414
15+struct Channel {
16+ public:
17+ struct WarpPoint {
18+ float x, y, z;
19+ unsigned int channel;
20+ std::string name;
21+ };
22+
23+ public:
24+ std::string name, stage;
25+ std::vector<WarpPoint> warp_points;
26+};
27+
28+typedef std::shared_ptr<Channel> ChannelPtr;
29+
1530 typedef std::unique_ptr<network::Client> ClientUniqPtr;
1631
1732 class CommandManager {
@@ -38,7 +53,8 @@ class CommandManager {
3853
3954 void set_client(ClientUniqPtr client);
4055 unsigned int user_id();
41- std::string stage() const;
56+ const std::map<unsigned char, ChannelPtr>& channels() const;
57+ ChannelPtr current_channel() const;
4258
4359 void FetchCommand(const network::Command& command);
4460
@@ -48,7 +64,8 @@ class CommandManager {
4864 ManagerAccessorPtr manager_accessor_;
4965 ClientUniqPtr client_;
5066 Status status_;
51- std::string stage_;
67+
68+ std::map<unsigned char, ChannelPtr> channels_;
5269 };
5370
5471 typedef std::shared_ptr<CommandManager> CommandManagerPtr;
Binary files a/client/PlayerManager.cpp and b/client/PlayerManager.cpp differ
--- a/client/PlayerManager.hpp
+++ b/client/PlayerManager.hpp
@@ -15,6 +15,9 @@ class CharacterDataProvider;
1515 class Timer;
1616 typedef std::shared_ptr<Timer> TimerPtr;
1717
18+class Stage;
19+typedef std::shared_ptr<Stage> StagePtr;
20+
1821 class InputManager;
1922
2023 class PlayerManager : public std::enable_shared_from_this<PlayerManager> {
@@ -51,6 +54,8 @@ class PlayerManager : public std::enable_shared_from_this<PlayerManager> {
5154 std::shared_ptr<CharacterManager> charmgr_;
5255 std::map<unsigned int, std::unique_ptr<CharacterDataProvider>> char_data_providers_;
5356
57+ const std::shared_ptr<StagePtr> stage_ptr_holder_;
58+
5459 int font_handle_;
5560 std::array<int, 4> name_tip_image_handle_;
5661
Binary files a/client/WorldManager.cpp and b/client/WorldManager.cpp differ
--- a/client/WorldManager.hpp
+++ b/client/WorldManager.hpp
@@ -9,12 +9,9 @@
99
1010 class InputManager;
1111
12-class Stage;
13-typedef std::shared_ptr<Stage> StagePtr;
14-
1512 class WorldManager {
1613 public:
17- WorldManager(const ManagerAccessorPtr& manager_accessor = ManagerAccessorPtr());
14+ WorldManager(const StagePtr& stage, const ManagerAccessorPtr& manager_accessor = ManagerAccessorPtr());
1815 void Init();
1916 void ProcessInput(InputManager* input);
2017 void Update();
--- /dev/null
+++ b/client/bin/server/channels/ch000/config.json
@@ -0,0 +1,12 @@
1+{
2+ "name": "ケロリン町チャンネル",
3+ "stage": "stage:ケロリン町",
4+ "capacity": 20,
5+ "warp_points":
6+ [
7+ {
8+ "position": {"x": 0, "y": 0, "z": 0},
9+ "channel": 1
10+ }
11+ ]
12+}
\ No newline at end of file
--- /dev/null
+++ b/client/bin/server/channels/ch001/config.json
@@ -0,0 +1,12 @@
1+{
2+ "name": "ゲキド街チャンネル",
3+ "stage": "stage:ゲキド街",
4+ "capacity": 25,
5+ "warp_points":
6+ [
7+ {
8+ "position": {"x": 0, "y": 0, "z": 0},
9+ "channel": 0
10+ }
11+ ]
12+}
\ No newline at end of file
--- /dev/null
+++ b/client/scene/ChannelChange.cpp
@@ -0,0 +1,61 @@
1+//
2+// ChannelChange.cpp
3+//
4+
5+#include "MainLoop.hpp"
6+#include "ChannelChange.hpp"
7+#include "../../common/Logger.hpp"
8+#include "../../common/network/Utils.hpp"
9+#include "../3d/Stage.hpp"
10+
11+namespace scene {
12+ChannelChange::ChannelChange(unsigned char channel, const ManagerAccessorPtr& manager_accessor) :
13+ manager_accessor_(manager_accessor),
14+ card_manager_(manager_accessor->card_manager().lock()),
15+ command_manager_(manager_accessor->command_manager().lock()),
16+ account_manager_(manager_accessor->account_manager().lock()),
17+ config_manager_(manager_accessor->config_manager().lock()),
18+ player_manager_(manager_accessor->player_manager().lock())
19+{
20+
21+ auto channel_str = (unsigned char)channel;
22+ command_manager_->Write(network::ServerUpdateAccountProperty(CHANNEL, network::Utils::Serialize(channel_str)));
23+
24+ auto channel_ptr = command_manager_->channels().at(channel);
25+ StagePtr stage = std::make_shared<Stage>(channel_ptr);
26+ world_manager_ = std::make_shared<WorldManager>(stage, manager_accessor);
27+ manager_accessor_->set_world_manager(world_manager_);
28+}
29+
30+ChannelChange::~ChannelChange()
31+{
32+}
33+
34+void ChannelChange::Begin()
35+{
36+
37+}
38+
39+void ChannelChange::End()
40+{
41+}
42+
43+void ChannelChange::Update()
44+{
45+ //if(world_manager_->stage()->host_change_flag())
46+ //{
47+ //account_manager_->set_host(world_manager_->stage()->host_change_flag().second);
48+ next_scene_ = std::make_shared<scene::MainLoop>(manager_accessor_);
49+ //}
50+}
51+
52+void ChannelChange::ProcessInput(InputManager* input)
53+{
54+
55+}
56+
57+void ChannelChange::Draw()
58+{
59+}
60+
61+}
\ No newline at end of file
--- /dev/null
+++ b/client/scene/ChannelChange.hpp
@@ -0,0 +1,34 @@
1+//
2+// ChannelChange.h
3+//
4+
5+#pragma once
6+
7+#include <memory>
8+#include "Base.hpp"
9+#include "../ManagerAccessor.hpp"
10+
11+namespace scene {
12+
13+class ChannelChange : public Base{
14+
15+ public:
16+ ChannelChange(unsigned char channel, const ManagerAccessorPtr&);
17+ ~ChannelChange();
18+ void Begin();
19+ void Update();
20+ void ProcessInput(InputManager*);
21+ void Draw();
22+ void End();
23+
24+ private:
25+ ManagerAccessorPtr manager_accessor_;
26+ CardManagerPtr card_manager_;
27+ CommandManagerPtr command_manager_;
28+ AccountManagerPtr account_manager_;
29+ ConfigManagerPtr config_manager_;
30+ WorldManagerPtr world_manager_;
31+ PlayerManagerPtr player_manager_;
32+};
33+
34+}
\ No newline at end of file
--- a/client/scene/Connect.cpp
+++ b/client/scene/Connect.cpp
@@ -5,9 +5,11 @@
55 #include "MainLoop.hpp"
66 #include "Title.hpp"
77 #include "Connect.hpp"
8+#include "ChannelChange.hpp"
89 #include <vector>
910 #include <algorithm>
1011 #include "../ResourceManager.hpp"
12+#include "../PlayerManager.hpp"
1113 #include "../../common/Logger.hpp"
1214
1315 namespace scene {
@@ -17,9 +19,11 @@ Connect::Connect(const ManagerAccessorPtr& manager_accessor) :
1719 account_manager_(manager_accessor->account_manager().lock()),
1820 config_manager_(manager_accessor->config_manager().lock()),
1921 command_manager_(std::make_shared<CommandManager>(manager_accessor_)),
22+ player_manager_(std::make_shared<PlayerManager>(manager_accessor_)),
2023 return_flag_(false)
2124 {
2225 manager_accessor_->set_command_manager(command_manager_);
26+ manager_accessor_->set_player_manager(player_manager_);
2327 }
2428
2529 Connect::~Connect()
@@ -87,11 +91,11 @@ void Connect::Update()
8791 message_.set_text(_T("エラー:サーバーとクライアントのバージョンが対応していません"));
8892 command_manager_->set_client(ClientUniqPtr());
8993 break;
90- case CommandManager::STATUS_ERROR_NOSTAGE:
91- message_.set_text((tformat(_T("エラー:接続するにはステージデータ「%s」が必要です")) %
92- unicode::ToTString(command_manager_->stage())).str());
93- command_manager_->set_client(ClientUniqPtr());
94- break;
94+ //case CommandManager::STATUS_ERROR_NOSTAGE:
95+ // message_.set_text((tformat(_T("エラー:接続するにはステージデータ「%s」が必要です")) %
96+ // unicode::ToTString(command_manager_->stage())).str());
97+ // command_manager_->set_client(ClientUniqPtr());
98+ // break;
9599 }
96100
97101 button_.Update();
@@ -99,7 +103,7 @@ void Connect::Update()
99103 message_.Update();
100104
101105 if (command_manager_->status() == CommandManager::STATUS_READY) {
102- next_scene_= std::make_shared<scene::MainLoop>(manager_accessor_);
106+ next_scene_= std::make_shared<scene::ChannelChange>(0, manager_accessor_);
103107 } else if (return_flag_) {
104108 next_scene_= std::make_shared<scene::Title>(manager_accessor_);
105109 }
--- a/client/scene/Connect.hpp
+++ b/client/scene/Connect.hpp
@@ -32,6 +32,7 @@ class Connect : public Base {
3232 AccountManagerPtr account_manager_;
3333 ConfigManagerPtr config_manager_;
3434 CommandManagerPtr command_manager_;
35+ PlayerManagerPtr player_manager_;
3536
3637 UILabel message_;
3738 UILabel button_label_;
--- a/client/scene/Include.hpp
+++ b/client/scene/Include.hpp
@@ -7,3 +7,4 @@
77 #include "Init.hpp"
88 #include "Title.hpp"
99 #include "MainLoop.hpp"
10+#include "ChannelChange.hpp"
--- a/client/scene/MainLoop.cpp
+++ b/client/scene/MainLoop.cpp
@@ -5,6 +5,7 @@
55 #include "MainLoop.hpp"
66 #include "Option.hpp"
77 #include "Dashboard.hpp"
8+#include "ChannelChange.hpp"
89 #include <vector>
910 #include <algorithm>
1011 #include "../ResourceManager.hpp"
@@ -17,10 +18,10 @@
1718 namespace scene {
1819 MainLoop::MainLoop(const ManagerAccessorPtr& manager_accessor) :
1920 manager_accessor_(manager_accessor),
20- player_manager_(std::make_shared<PlayerManager>(manager_accessor_)),
21+ player_manager_(manager_accessor->player_manager().lock()),
2122 card_manager_(manager_accessor->card_manager().lock()),
2223 command_manager_(manager_accessor->command_manager().lock()),
23- world_manager_(std::make_shared<WorldManager>(manager_accessor_)),
24+ world_manager_(manager_accessor->world_manager().lock()),
2425 account_manager_(manager_accessor->account_manager().lock()),
2526 config_manager_(manager_accessor->config_manager().lock()),
2627 window_manager_(std::make_shared<WindowManager>(manager_accessor_)),
@@ -29,8 +30,6 @@ MainLoop::MainLoop(const ManagerAccessorPtr& manager_accessor) :
2930 snapshot_number_(0),
3031 snapshot_(false)
3132 {
32- manager_accessor_->set_player_manager(player_manager_);
33- manager_accessor_->set_world_manager(world_manager_);
3433 manager_accessor_->set_window_manager(window_manager_);
3534
3635 inputbox_->ReloadTabs();
@@ -98,6 +97,18 @@ void MainLoop::ProcessInput(InputManager* input)
9897 snapshot_ = true;
9998 }
10099
100+ if (const auto& channel = command_manager_->current_channel()) {
101+ BOOST_FOREACH(const auto& warp_point, channel->warp_points) {
102+ auto point = VGet(warp_point.x, warp_point.y + 30, warp_point.z);
103+ const auto& pos = player_manager_->GetMyself()->position();
104+
105+ auto distance = VSize(VGet(warp_point.x - pos.x, warp_point.y - pos.y, warp_point.z - pos.z));
106+ if (distance < 50 && input->GetKeyCount(KEY_INPUT_M) == 1) {
107+ next_scene_ = std::make_shared<scene::ChannelChange>(warp_point.channel, manager_accessor_);
108+ }
109+ }
110+ }
111+
101112 }
102113
103114 void MainLoop::Draw()
@@ -129,6 +140,38 @@ void MainLoop::Draw()
129140 snapshot_number_++;
130141 snapshot_ = false;
131142 }
143+
144+ if (const auto& channel = command_manager_->current_channel()) {
145+ BOOST_FOREACH(const auto& warp_point, channel->warp_points) {
146+ auto point = VGet(warp_point.x, warp_point.y + 30, warp_point.z);
147+ const auto& pos = player_manager_->GetMyself()->position();
148+
149+ auto distance = VSize(VGet(warp_point.x - pos.x, warp_point.y - pos.y, warp_point.z - pos.z));
150+
151+ if (world_manager_->stage()->IsVisiblePoint(point)) {
152+ auto screen_pos = ConvWorldPosToScreenPos(point);
153+ int x = (screen_pos.x / 2) * 2;
154+ int y = (screen_pos.y / 2) * 2 - 16;
155+
156+ UILabel label_;
157+ label_.set_width(160);
158+ if (distance < 50) {
159+ label_.set_text(unicode::ToTString(warp_point.name) + _T("\nMキーで転送します"));
160+ label_.set_bgcolor(UIBase::Color(255,0,0,150));
161+ } else {
162+ label_.set_text(unicode::ToTString(warp_point.name));
163+ label_.set_bgcolor(UIBase::Color(0,0,0,150));
164+ }
165+ label_.set_textcolor(UIBase::Color(255,255,255,255));
166+
167+ label_.set_left(x - 60);
168+ label_.set_top(y + 10);
169+
170+ label_.Update();
171+ label_.Draw();
172+ }
173+ }
174+ }
132175 }
133176
134177 void MainLoop::End()
--- a/client/scene/Option.cpp
+++ b/client/scene/Option.cpp
@@ -290,8 +290,10 @@ StatusTab::StatusTab(const ManagerAccessorPtr& manager_accessor) :
290290
291291 items_.push_back(std::make_shared<TextItem>(_LT("option.status.channel"),
292292 std::make_shared<std::function<tstring(void)>>(
293- [player_manager](){
294- return (tformat(_T("%d")) % static_cast<int>(player_manager->GetMyself()->channel())).str();
293+ [player_manager, command_manager]() -> tstring {
294+ auto channel = player_manager->GetMyself()->channel();
295+ auto name = command_manager->channels().at(channel)->name;
296+ return (tformat(_T("%s (%d)")) % unicode::ToTString(name) % static_cast<int>(channel)).str();
295297 }), manager_accessor_));
296298
297299 items_.push_back(std::make_shared<TextItem>(_LT("option.status.user_id"),
@@ -302,8 +304,10 @@ StatusTab::StatusTab(const ManagerAccessorPtr& manager_accessor) :
302304
303305 items_.push_back(std::make_shared<TextItem>(_LT("option.status.stage"),
304306 std::make_shared<std::function<tstring(void)>>(
305- [command_manager](){
306- return unicode::ToTString(command_manager->stage());
307+ [player_manager, command_manager]() -> tstring {
308+ auto channel = player_manager->GetMyself()->channel();
309+ auto stage = command_manager->channels().at(channel)->stage;
310+ return unicode::ToTString(stage);
307311 }), manager_accessor_));
308312
309313 items_.push_back(std::make_shared<TextItem>(_LT("option.status.position"),