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

Function testMove

tests/move_route.cpp:191–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189
190template <bool success, bool repeat, bool skip>
191static void testMove(lcf::rpg::MoveCommand::Code code, int x, int y, int dir, int face, int tx, int ty, int tdir, int tface, int px = 0, int py = 0) {
192 Main_Data::game_player->SetX(px);
193 Main_Data::game_player->SetY(py);
194
195 auto ch = MoveRouteVehicle();
196 ch.SetX(x);
197 ch.SetY(y);
198 ch.SetDirection(dir);
199 ch.SetFacing(face);
200 ch.SetAllowMovement(success);
201
202 auto mr = MakeRoute(static_cast<int>(code), repeat, skip);
203
204 CAPTURE(code);
205 CAPTURE(x);
206 CAPTURE(y);
207 CAPTURE(dir);
208 CAPTURE(face);
209 CAPTURE(tx);
210 CAPTURE(ty);
211 CAPTURE(tdir);
212 CAPTURE(tface);
213 CAPTURE(px);
214 CAPTURE(py);
215 CAPTURE(success);
216 CAPTURE(repeat);
217 CAPTURE(skip);
218
219 auto dx = tx - x;
220 auto dy = ty - y;
221
222 ch.ForceMoveRoute(mr, 3);
223 testMoveRouteMove(ch, x, y, 0, dir, face, false, 3, 0xFFFF, 64, 0, true, false, mr);
224
225 if (success) {
226 bool repeated = false;
227 for(int n = (repeat ? 3 : 1); n > 0; --n) {
228 CAPTURE(n);
229 for(int i = 224; i > 0; i -= 32) {
230 ForceUpdate(ch);
231 testMoveRouteMove(ch, tx, ty, i, tdir, tface, false, 3, 0, 64, 1, true, repeated, mr);
232 }
233
234 if (!repeat) {
235 ForceUpdate(ch);
236 testMoveRouteMove(ch, tx, ty, 0, tdir, tface, false, 2, 0, 128, 0, false, false, mr);
237 break;
238 }
239
240 repeated = true;
241 for (int i = 0; i <= 64; ++i) {
242 ForceUpdate(ch);
243 testMoveRouteMove(ch, tx, ty, 0, tdir, tface, false, 3, i, 64, 0, true, repeated, mr);
244 }
245
246 tx += dx;
247 ty += dy;
248 }

Callers

nothing calls this directly

Calls 10

MoveRouteVehicleClass · 0.85
MakeRouteFunction · 0.85
testMoveRouteMoveFunction · 0.85
SetDirectionMethod · 0.80
SetFacingMethod · 0.80
ForceMoveRouteMethod · 0.80
ForceUpdateFunction · 0.70
SetXMethod · 0.45
SetYMethod · 0.45
SetAllowMovementMethod · 0.45

Tested by

no test coverage detected