修訂 | 36a9b6d90a74974c7a3e8257ad2b2ce70490c6c9 (tree) |
---|---|
時間 | 2012-10-30 00:06:54 |
作者 | angeart <angeart@git....> |
Commiter | angeart |
Revert "Merge branch 'develop' of git.sourceforge.jp:/gitroot/mmo/main into develop"
This reverts commit 455021345c1be906effcf822785d700bdcc9d032, reversing
changes made to fb6cb99cec98522b70040ffe060e4deb7564548c.
@@ -142,23 +142,19 @@ void FieldPlayer::Draw() const | ||
142 | 142 | // DrawLine3D(current_stat_.pos, current_stat_.pos + VGet(0, 0, 2 * (*stage_)->map_scale()), GetColor(0, 0, 255)); |
143 | 143 | } |
144 | 144 | |
145 | -void FieldPlayer::Init(tstring model_name, const std::shared_ptr<VECTOR>& init_position) | |
145 | +void FieldPlayer::Init(tstring model_name) | |
146 | 146 | { |
147 | 147 | LoadModel(model_name); |
148 | - ResetPosition(init_position); | |
148 | + ResetPosition(); | |
149 | 149 | } |
150 | 150 | |
151 | -void FieldPlayer::ResetPosition(const std::shared_ptr<VECTOR>& init_position) | |
151 | +void FieldPlayer::ResetPosition() | |
152 | 152 | { |
153 | - if (init_position) { | |
154 | - current_stat_.pos = *init_position; | |
155 | - } else { | |
156 | - const auto& points = (*stage_)->start_points(); | |
157 | - std::mt19937 engine(time(nullptr)); | |
158 | - std::uniform_int_distribution<int> distribution(0, points.size() - 1); | |
159 | - current_stat_.pos = points[distribution(engine)]; | |
160 | - } | |
153 | + const auto& points = (*stage_)->start_points(); | |
154 | + std::mt19937 engine(time(nullptr)); | |
155 | + std::uniform_int_distribution<int> distribution(0, points.size() - 1); | |
161 | 156 | |
157 | + current_stat_.pos = points[distribution(engine)]; | |
162 | 158 | current_stat_.pos.y = (*stage_)->GetFloorY(current_stat_.pos + VGet(0, 20, 0), current_stat_.pos - VGet(0, 20, 0)); |
163 | 159 | } |
164 | 160 |
@@ -53,8 +53,8 @@ public: | ||
53 | 53 | |
54 | 54 | void Draw() const; |
55 | 55 | void Update(); |
56 | - void Init(tstring model_path, const std::shared_ptr<VECTOR>& init_position); | |
57 | - void ResetPosition(const std::shared_ptr<VECTOR>& init_position); | |
56 | + void Init(tstring model_path); | |
57 | + void ResetPosition(); | |
58 | 58 | void RescuePosition(); |
59 | 59 | |
60 | 60 | void LoadModel(const tstring& name); |
@@ -41,7 +41,7 @@ Stage::Stage(const ChannelPtr& channel,const ConfigManagerPtr &config_manager) : | ||
41 | 41 | BOOST_FOREACH(const auto& warp_point, channel_->warp_points) { |
42 | 42 | auto handle = ResourceManager::LoadModelFromName(_T("warpobj:ワープオブジェクト")); |
43 | 43 | float scale = handle.property().get<float>("scale", 80.0); |
44 | - MV1SetPosition(handle.handle(), warp_point.position); | |
44 | + MV1SetPosition(handle.handle(), VGet(warp_point.x, warp_point.y, warp_point.z)); | |
45 | 45 | MV1SetScale(handle.handle(), VGet(scale, scale, scale)); |
46 | 46 | warpobj_handles_.push_back(handle); |
47 | 47 | } |
@@ -113,16 +113,7 @@ void CommandManager::FetchCommand(const network::Command& command) | ||
113 | 113 | auto x = warp_point.second.get<float>("position.x", 0); |
114 | 114 | auto y = warp_point.second.get<float>("position.y", 0); |
115 | 115 | auto z = warp_point.second.get<float>("position.z", 0); |
116 | - | |
117 | - std::shared_ptr<VECTOR> destination; | |
118 | - if (!warp_point.second.get_child("destination", ptree()).empty()) { | |
119 | - auto dest_x = warp_point.second.get<float>("destination.x", 0); | |
120 | - auto dest_y = warp_point.second.get<float>("destination.y", 0); | |
121 | - auto dest_z = warp_point.second.get<float>("destination.z", 0); | |
122 | - destination = std::make_shared<VECTOR>(VGet(dest_x, dest_y, dest_z)); | |
123 | - } | |
124 | - Channel::WarpPoint point = {VGet(x, y, z), channel, "", destination}; | |
125 | - | |
116 | + Channel::WarpPoint point = {x, y, z, channel, ""}; | |
126 | 117 | ptr->warp_points.push_back(point); |
127 | 118 | } |
128 | 119 | channels_[id] = ptr; |
@@ -15,10 +15,9 @@ namespace network { | ||
15 | 15 | struct Channel { |
16 | 16 | public: |
17 | 17 | struct WarpPoint { |
18 | - VECTOR position; | |
18 | + float x, y, z; | |
19 | 19 | unsigned int channel; |
20 | 20 | std::string name; |
21 | - std::shared_ptr<VECTOR> destination; | |
22 | 21 | }; |
23 | 22 | |
24 | 23 | public: |
@@ -5,16 +5,12 @@ | ||
5 | 5 | #include "MainLoop.hpp" |
6 | 6 | #include "ChannelChange.hpp" |
7 | 7 | #include "../CommandManager.hpp" |
8 | -#include "../AccountManager.hpp" | |
9 | 8 | #include "../../common/Logger.hpp" |
10 | 9 | #include "../../common/network/Utils.hpp" |
11 | 10 | #include "../3d/Stage.hpp" |
12 | 11 | |
13 | 12 | namespace scene { |
14 | -ChannelChange::ChannelChange( | |
15 | - unsigned char channel, | |
16 | - const std::shared_ptr<VECTOR>& init_position, | |
17 | - const ManagerAccessorPtr& manager_accessor) : | |
13 | +ChannelChange::ChannelChange(unsigned char channel, const ManagerAccessorPtr& manager_accessor) : | |
18 | 14 | manager_accessor_(manager_accessor), |
19 | 15 | card_manager_(manager_accessor->card_manager().lock()), |
20 | 16 | command_manager_(manager_accessor->command_manager().lock()), |
@@ -22,8 +18,7 @@ ChannelChange::ChannelChange( | ||
22 | 18 | config_manager_(manager_accessor->config_manager().lock()), |
23 | 19 | player_manager_(manager_accessor->player_manager().lock()), |
24 | 20 | channel_(channel), |
25 | - fade_counter_(0), | |
26 | - init_position_(init_position) | |
21 | + fade_counter_(0) | |
27 | 22 | { |
28 | 23 | |
29 | 24 | } |
@@ -59,10 +54,6 @@ void ChannelChange::Update() | ||
59 | 54 | world_manager_ = std::make_shared<WorldManager>(stage, manager_accessor_); |
60 | 55 | manager_accessor_->set_world_manager(world_manager_); |
61 | 56 | |
62 | - player_manager_->Init(); | |
63 | - world_manager_->Init(); | |
64 | - world_manager_->myself()->Init(unicode::ToTString(account_manager_->model_name()), init_position_); | |
65 | - | |
66 | 57 | next_scene_ = std::make_shared<scene::MainLoop>(manager_accessor_); |
67 | 58 | } |
68 | 59 | } |
@@ -13,10 +13,7 @@ namespace scene { | ||
13 | 13 | class ChannelChange : public Base{ |
14 | 14 | |
15 | 15 | public: |
16 | - ChannelChange( | |
17 | - unsigned char channel, | |
18 | - const std::shared_ptr<VECTOR>& destination, | |
19 | - const ManagerAccessorPtr&); | |
16 | + ChannelChange(unsigned char channel, const ManagerAccessorPtr&); | |
20 | 17 | ~ChannelChange(); |
21 | 18 | void Begin(); |
22 | 19 | void Update(); |
@@ -35,7 +32,6 @@ class ChannelChange : public Base{ | ||
35 | 32 | |
36 | 33 | unsigned char channel_; |
37 | 34 | int fade_counter_; |
38 | - std::shared_ptr<VECTOR> init_position_; | |
39 | 35 | }; |
40 | 36 | |
41 | 37 | } |
\ No newline at end of file |
@@ -104,7 +104,7 @@ void Connect::Update() | ||
104 | 104 | message_.Update(); |
105 | 105 | |
106 | 106 | if (command_manager_->status() == CommandManager::STATUS_READY) { |
107 | - next_scene_= std::make_shared<scene::ChannelChange>(0, std::shared_ptr<VECTOR>(), manager_accessor_); | |
107 | + next_scene_= std::make_shared<scene::ChannelChange>(0, manager_accessor_); | |
108 | 108 | } else if (return_flag_) { |
109 | 109 | next_scene_= std::make_shared<scene::Title>(manager_accessor_); |
110 | 110 | } |
@@ -50,6 +50,11 @@ MainLoop::MainLoop(const ManagerAccessorPtr& manager_accessor) : | ||
50 | 50 | |
51 | 51 | window_manager_->RestorePosition(); |
52 | 52 | |
53 | + player_manager_->Init(); | |
54 | + world_manager_->Init(); | |
55 | + | |
56 | + world_manager_->myself()->Init(unicode::ToTString(account_manager_->model_name())); | |
57 | + | |
53 | 58 | socket_server_manager_->Start(); |
54 | 59 | |
55 | 60 | } |
@@ -115,24 +120,12 @@ void MainLoop::ProcessInput(InputManager* input) | ||
115 | 120 | |
116 | 121 | if (const auto& channel = command_manager_->current_channel()) { |
117 | 122 | BOOST_FOREACH(const auto& warp_point, channel->warp_points) { |
118 | - auto point = warp_point.position; | |
119 | - point.y += 30; | |
123 | + auto point = VGet(warp_point.x, warp_point.y + 30, warp_point.z); | |
120 | 124 | const auto& pos = player_manager_->GetMyself()->position(); |
121 | 125 | |
122 | - auto distance = VSize(warp_point.position - VGet(pos.x, pos.y, pos.z)); | |
126 | + auto distance = VSize(VGet(warp_point.x - pos.x, warp_point.y - pos.y, warp_point.z - pos.z)); | |
123 | 127 | if (distance < 50 && input->GetKeyCount(KEY_INPUT_M) == 1) { |
124 | - | |
125 | - // 同一チャンネルの場合は移動するだけ | |
126 | - if (player_manager_->GetMyself()->channel() == warp_point.channel) { | |
127 | - if (warp_point.destination) { | |
128 | - world_manager_->myself()->ResetPosition(warp_point.destination); | |
129 | - } | |
130 | - } else { | |
131 | - next_scene_ = std::make_shared<scene::ChannelChange>( | |
132 | - warp_point.channel, | |
133 | - warp_point.destination, | |
134 | - manager_accessor_); | |
135 | - } | |
128 | + next_scene_ = std::make_shared<scene::ChannelChange>(warp_point.channel, manager_accessor_); | |
136 | 129 | } |
137 | 130 | } |
138 | 131 | } |
@@ -171,11 +164,10 @@ void MainLoop::Draw() | ||
171 | 164 | |
172 | 165 | if (const auto& channel = command_manager_->current_channel()) { |
173 | 166 | BOOST_FOREACH(const auto& warp_point, channel->warp_points) { |
174 | - auto point = warp_point.position; | |
175 | - point.y += 30; | |
167 | + auto point = VGet(warp_point.x, warp_point.y + 30, warp_point.z); | |
176 | 168 | const auto& pos = player_manager_->GetMyself()->position(); |
177 | - | |
178 | - auto distance = VSize(warp_point.position - VGet(pos.x, pos.y, pos.z)); | |
169 | + | |
170 | + auto distance = VSize(VGet(warp_point.x - pos.x, warp_point.y - pos.y, warp_point.z - pos.z)); | |
179 | 171 | |
180 | 172 | if (world_manager_->stage()->IsVisiblePoint(point)) { |
181 | 173 | auto screen_pos = ConvWorldPosToScreenPos(point); |