MCPcopy Create free account
hub / github.com/EasyRPG/Player / MoveTo

Method MoveTo

src/game_player.cpp:129–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129void Game_Player::MoveTo(int map_id, int x, int y) {
130 const auto map_changed = (GetMapId() != map_id);
131
132 Game_Character::MoveTo(map_id, x, y);
133 SetTotalEncounterRate(0);
134 SetMenuCalling(false);
135
136 auto* vehicle = GetVehicle();
137 if (vehicle) {
138 // RPG_RT doesn't check the aboard flag for this one
139 vehicle->MoveTo(map_id, x, y);
140 }
141
142 if (map_changed) {
143 // FIXME: Assert map pre-loaded in cache.
144
145 // pan_state does not reset when you change maps.
146 data()->pan_speed = lcf::rpg::SavePartyLocation::kPanSpeedDefault;
147 data()->pan_finish_x = GetDefaultPanX();
148 data()->pan_finish_y = GetDefaultPanY();
149 data()->pan_current_x = GetDefaultPanX();
150 data()->pan_current_y = GetDefaultPanY();
151 maniac_pan_current_x = static_cast<double>(GetDefaultPanX());
152 maniac_pan_current_y = static_cast<double>(GetDefaultPanY());
153
154 ResetAnimation();
155
156 auto map = Game_Map::LoadMapFile(GetMapId());
157
158 Game_Map::Setup(std::move(map));
159 Game_Map::PlayBgm();
160
161 // This Fixes an RPG_RT bug where the jumping flag doesn't get reset
162 // if you change maps during a jump
163 SetJumping(false);
164 } else {
165 Game_Map::SetPositionX(GetSpriteX() - GetPanX());
166 Game_Map::SetPositionY(GetSpriteY() - GetPanY());
167 }
168
169 ResetGraphic();
170}
171
172bool Game_Player::MakeWay(int from_x, int from_y, int to_x, int to_y) {
173 if (IsAboard()) {

Callers 9

OnMapFileReadyFunction · 0.45
testAnimPanFunction · 0.45
testAnimBlockedFunction · 0.45
testPlayerFunction · 0.45
testNonPlayerFunction · 0.45

Calls 1

SetupFunction · 0.85

Tested by

no test coverage detected