table.cxx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. #include <toolbox/dir_walk.h>
  2. #include <toolbox/path.h>
  3. #include <toolbox/stream/stream.h>
  4. #include <toolbox/stream/file_stream.h>
  5. #include <toolbox/args.h>
  6. #include "nxjson/nxjson.h"
  7. #include "pinball0.h"
  8. #include "table.h"
  9. // Table defaults
  10. #define LIVES 3
  11. #define LIVES_POS Vec2(20, 20)
  12. // forward declares
  13. Table* table_init_table_select(void* ctx);
  14. Table* table_init_table_error(void* ctx);
  15. Table::~Table() {
  16. for(size_t i = 0; i < objects.size(); i++) {
  17. delete objects[i];
  18. }
  19. if(plunger != nullptr) {
  20. delete plunger;
  21. }
  22. }
  23. void Table::draw(Canvas* canvas) {
  24. // da balls
  25. for(auto& b : balls) {
  26. b.draw(canvas);
  27. }
  28. // loop through objects on the table and draw them
  29. for(auto& o : objects) {
  30. o->draw(canvas);
  31. }
  32. for(auto& f : flippers) {
  33. f.draw(canvas);
  34. }
  35. if(plunger) {
  36. plunger->draw(canvas);
  37. }
  38. // we don't draw the last one, as it's in play!
  39. if(num_lives > 0) {
  40. float x = num_lives_pos.x;
  41. float y = num_lives_pos.y;
  42. for(size_t l = 0; l < num_lives - 1; x += (2 * 20) + 20, l++) {
  43. canvas_draw_disc(canvas, x / 10, y / 10, 2);
  44. }
  45. }
  46. // score
  47. // char buf[32];
  48. // snprintf(buf, 32, "%8u", score);
  49. // canvas_draw_str_aligned(canvas, LCD_WIDTH - 30, 1, AlignLeft, AlignTop, buf);
  50. }
  51. void table_table_list_init(void* ctx) {
  52. PinballState* pb = (PinballState*)ctx;
  53. // using the asset file path, read the table files, and for each one, extract their
  54. // display name (oof). let's just use their filenames for now (stripping any XX_ prefix)
  55. // sort tables by original filename
  56. const char* paths[] = {APP_ASSETS_PATH("tables"), APP_DATA_PATH("tables")};
  57. for(size_t p = 0; p < 2; p++) {
  58. const char* path = paths[p];
  59. // const char* asset_path = APP_ASSETS_PATH("tables");
  60. FURI_LOG_I(TAG, "Loading table list from: %s", path);
  61. FuriString* table_path = furi_string_alloc();
  62. DirWalk* dir_walk = dir_walk_alloc(pb->storage);
  63. dir_walk_set_recursive(dir_walk, false);
  64. if(dir_walk_open(dir_walk, path)) {
  65. while(dir_walk_read(dir_walk, table_path, NULL) == DirWalkOK) {
  66. FURI_LOG_I(TAG, furi_string_get_cstr(table_path));
  67. // set display 'name' and 'filename'
  68. TableMenuItem tmi;
  69. const char* cpath = furi_string_get_cstr(table_path);
  70. tmi.filename = furi_string_alloc_set_str(cpath);
  71. tmi.name = furi_string_alloc();
  72. path_extract_filename_no_ext(cpath, tmi.name);
  73. // If filename starts with XX_ (for custom sorting) strip the prefix
  74. char c = furi_string_get_char(tmi.name, 2);
  75. if(c == '_') {
  76. char a = furi_string_get_char(tmi.name, 0);
  77. char b = furi_string_get_char(tmi.name, 1);
  78. if(a >= '0' && a <= '9' && b >= '0' && b <= '9') {
  79. furi_string_right(tmi.name, 3);
  80. }
  81. }
  82. // Insert in sorted order
  83. size_t i = 0;
  84. auto it = pb->table_list.menu_items.begin();
  85. for(; it != pb->table_list.menu_items.end(); it++, i++) {
  86. if(strcmp(
  87. furi_string_get_cstr(tmi.filename),
  88. furi_string_get_cstr(it->filename)) > 0) {
  89. continue;
  90. }
  91. pb->table_list.menu_items.insert(it, tmi);
  92. break;
  93. }
  94. if(pb->table_list.menu_items.size() == i) {
  95. pb->table_list.menu_items.push_back(tmi);
  96. }
  97. }
  98. }
  99. furi_string_free(table_path);
  100. dir_walk_free(dir_walk);
  101. }
  102. FURI_LOG_I(TAG, "Found %d tables", pb->table_list.menu_items.size());
  103. for(auto& tmi : pb->table_list.menu_items) {
  104. FURI_LOG_I(TAG, "%s", furi_string_get_cstr(tmi.name));
  105. }
  106. pb->table_list.display_size = 5; // how many tables to display at once
  107. pb->table_list.selected = 0;
  108. }
  109. // json parse helper function
  110. bool table_file_parse_vec2(const nx_json* json, const char* key, Vec2* v) {
  111. furi_assert(v);
  112. const nx_json* item = nx_json_get(json, key);
  113. if(!item || item->children.length != 2) {
  114. return false;
  115. }
  116. v->x = nx_json_item(item, 0)->num.dbl_value;
  117. v->y = nx_json_item(item, 1)->num.dbl_value;
  118. return true;
  119. }
  120. bool table_file_parse_int(const nx_json* json, const char* key, int* v) {
  121. furi_assert(v);
  122. const nx_json* item = nx_json_get(json, key);
  123. if(!item) return false;
  124. *v = item->num.u_value;
  125. return true;
  126. }
  127. bool table_file_parse_float(const nx_json* json, const char* key, float* v) {
  128. furi_assert(v);
  129. const nx_json* item = nx_json_get(json, key);
  130. if(!item) return false;
  131. *v = item->num.dbl_value;
  132. return true;
  133. }
  134. Table* table_load_table_from_file(PinballState* pb, size_t index) {
  135. auto& tmi = pb->table_list.menu_items[index];
  136. FURI_LOG_I(TAG, "Reading file: %s", furi_string_get_cstr(tmi.filename));
  137. File* file = storage_file_alloc(pb->storage);
  138. FileInfo fileinfo;
  139. FS_Error error =
  140. storage_common_stat(pb->storage, furi_string_get_cstr(tmi.filename), &fileinfo);
  141. if(error != FSE_OK) {
  142. FURI_LOG_E(TAG, "Could not find file");
  143. storage_file_free(file);
  144. return NULL;
  145. }
  146. // TODO: determine an appropriate max file size and make configurable
  147. FURI_LOG_I(TAG, "Found file ok!");
  148. if(fileinfo.size >= 8192) {
  149. FURI_LOG_E(TAG, "Table file size too big");
  150. snprintf(pb->text, 256, "Table file\nis too big!\n> 8192 bytes");
  151. storage_file_free(file);
  152. return NULL;
  153. }
  154. FURI_LOG_I(TAG, "File size is ok!");
  155. bool ok =
  156. storage_file_open(file, furi_string_get_cstr(tmi.filename), FSAM_READ, FSOM_OPEN_EXISTING);
  157. FURI_LOG_I(TAG, "File opened? %s", ok ? "YES" : "NO");
  158. // read the file as a string
  159. uint8_t* buffer;
  160. uint64_t file_size = storage_file_size(file);
  161. if(file_size > 8192) { // TODO - what's the right size?
  162. FURI_LOG_E(TAG, "Table file is too large! (> 8192 bytes)");
  163. snprintf(pb->text, 256, "Table file\nis too big!\n> 8192 bytes");
  164. storage_file_free(file);
  165. return NULL;
  166. }
  167. buffer = (uint8_t*)malloc(file_size);
  168. size_t read_count = storage_file_read(file, buffer, file_size);
  169. // if(storage_file_get_error(file) != FSE_OK) {
  170. // FURI_LOG_E(TAG, "Um, couldn't read file");
  171. // storage_file_free(file);
  172. // return NULL;
  173. // }
  174. storage_file_free(file);
  175. if(read_count != file_size) {
  176. FURI_LOG_E(TAG, "Error reading file. expected %lld, got %d", file_size, read_count);
  177. free(buffer);
  178. return NULL;
  179. }
  180. FURI_LOG_I(TAG, "Read file into buffer! %d bytes", read_count);
  181. // let's parse this shit
  182. char* json_buffer = (char*)malloc(read_count * sizeof(char) + 1);
  183. for(uint16_t i = 0; i < read_count; i++) {
  184. json_buffer[i] = buffer[i];
  185. }
  186. json_buffer[read_count] = 0;
  187. free(buffer);
  188. const nx_json* json = nx_json_parse(json_buffer, 0);
  189. if(!json) {
  190. FURI_LOG_E(TAG, "Failed to parse table json!");
  191. snprintf(pb->text, 256, "Failed to\nparse table\njson!!");
  192. free(json_buffer);
  193. return NULL;
  194. }
  195. Table* table = new Table();
  196. int lives = LIVES;
  197. table_file_parse_int(json, "lives", &lives);
  198. table->num_lives = lives;
  199. table->num_lives_pos = LIVES_POS;
  200. table_file_parse_vec2(json, "lives_position", &table->num_lives_pos);
  201. // TODO: this should be an attribute of balls?
  202. table->balls_released = false;
  203. const nx_json* released = nx_json_get(json, "released");
  204. if(released) {
  205. table->balls_released = released->num.u_value > 0;
  206. }
  207. do {
  208. const nx_json* balls = nx_json_get(json, "balls");
  209. if(balls) {
  210. for(int i = 0; i < balls->children.length; i++) {
  211. const nx_json* ball = nx_json_item(balls, i);
  212. Vec2 p;
  213. if(!table_file_parse_vec2(ball, "position", &p)) {
  214. FURI_LOG_E(TAG, "Ball missing \"position\", skipping");
  215. continue;
  216. }
  217. int r = DEF_BALL_RADIUS;
  218. table_file_parse_int(ball, "radius", &r);
  219. Vec2 v = (Vec2){0, 0};
  220. table_file_parse_vec2(ball, "velocity", &v);
  221. Ball new_ball(p, r);
  222. new_ball.accelerate(v);
  223. table->balls_initial.push_back(new_ball);
  224. table->balls.push_back(new_ball);
  225. }
  226. }
  227. if(table->balls.size() == 0) {
  228. FURI_LOG_E(TAG, "Table has NO BALLS");
  229. snprintf(pb->text, 256, "No balls\nfound in\ntable file!");
  230. delete table;
  231. table = NULL;
  232. break;
  233. }
  234. // TODO: plungers need work
  235. const nx_json* plunger = nx_json_get(json, "plunger");
  236. if(plunger) {
  237. Vec2 p;
  238. table_file_parse_vec2(plunger, "position", &p);
  239. int s = 100;
  240. table_file_parse_int(plunger, "size", &s);
  241. table->plunger = new Plunger(p);
  242. } else {
  243. FURI_LOG_E(TAG, "Table has NO PLUNGER");
  244. }
  245. const nx_json* flippers = nx_json_get(json, "flippers");
  246. if(flippers) {
  247. for(int i = 0; i < flippers->children.length; i++) {
  248. const nx_json* flipper = nx_json_item(flippers, i);
  249. Vec2 p;
  250. if(!table_file_parse_vec2(flipper, "position", &p)) {
  251. FURI_LOG_E(TAG, "Flipper missing \"position\", skipping");
  252. continue;
  253. }
  254. const nx_json* side = nx_json_get(flipper, "side");
  255. Flipper::Side sd = Flipper::LEFT;
  256. if(side && !strcmp(side->text_value, "RIGHT")) {
  257. sd = Flipper::RIGHT;
  258. }
  259. int sz = DEF_FLIPPER_SIZE;
  260. table_file_parse_int(flipper, "size", &sz);
  261. Flipper flip(p, sd, sz);
  262. table->flippers.push_back(flip);
  263. }
  264. }
  265. const nx_json* bumpers = nx_json_get(json, "bumpers");
  266. if(bumpers) {
  267. for(int i = 0; i < bumpers->children.length; i++) {
  268. const nx_json* bumper = nx_json_item(bumpers, i);
  269. Vec2 p;
  270. if(!table_file_parse_vec2(bumper, "position", &p)) {
  271. FURI_LOG_E(TAG, "Bumper missing \"position\", skipping");
  272. continue;
  273. }
  274. int r = DEF_BUMPER_RADIUS;
  275. table_file_parse_int(bumper, "radius", &r);
  276. float bnc = DEF_BUMPER_BOUNCE;
  277. table_file_parse_float(bumper, "bounce", &bnc);
  278. Bumper* new_bumper = new Bumper(p, r);
  279. FURI_LOG_I(TAG, "new bumper: %.3f,%.3f", (double)p.x, (double)p.y);
  280. new_bumper->bounce = bnc;
  281. table->objects.push_back(new_bumper);
  282. }
  283. }
  284. constexpr float pi_180 = M_PI / 180;
  285. const nx_json* arcs = nx_json_get(json, "arcs");
  286. if(arcs) {
  287. for(int i = 0; i < arcs->children.length; i++) {
  288. const nx_json* arc = nx_json_item(arcs, i);
  289. Vec2 p;
  290. if(!table_file_parse_vec2(arc, "position", &p)) {
  291. FURI_LOG_E(TAG, "Arc missing \"position\"");
  292. continue;
  293. }
  294. int r = DEF_BUMPER_RADIUS;
  295. table_file_parse_int(arc, "radius", &r);
  296. float bnc = 0.95f; // DEF_BUMPER_BOUNCE?
  297. table_file_parse_float(arc, "bounce", &bnc);
  298. float start_angle = 0.0;
  299. table_file_parse_float(arc, "start_angle", &start_angle);
  300. start_angle *= pi_180;
  301. float end_angle = 0.0;
  302. table_file_parse_float(arc, "end_angle", &end_angle);
  303. end_angle *= pi_180;
  304. Arc::Surface surface = Arc::OUTSIDE;
  305. const nx_json* stype = nx_json_get(arc, "surface");
  306. if(stype && !strcmp(stype->text_value, "INSIDE")) {
  307. surface = Arc::INSIDE;
  308. }
  309. Arc* new_bumper = new Arc(p, r, start_angle, end_angle, surface);
  310. new_bumper->bounce = bnc;
  311. table->objects.push_back(new_bumper);
  312. }
  313. }
  314. const nx_json* rails = nx_json_get(json, "rails");
  315. if(rails) {
  316. for(int i = 0; i < rails->children.length; i++) {
  317. const nx_json* rail = nx_json_item(rails, i);
  318. Vec2 s;
  319. if(!table_file_parse_vec2(rail, "start", &s)) {
  320. FURI_LOG_E(TAG, "Rail missing \"start\", skipping");
  321. continue;
  322. }
  323. Vec2 e;
  324. if(!table_file_parse_vec2(rail, "end", &e)) {
  325. FURI_LOG_E(TAG, "Rail missing \"end\", skipping");
  326. continue;
  327. }
  328. Polygon* new_rail = new Polygon();
  329. new_rail->add_point(s);
  330. new_rail->add_point(e);
  331. float bnc = DEF_RAIL_BOUNCE;
  332. table_file_parse_float(rail, "bounce", &bnc);
  333. new_rail->bounce = bnc;
  334. int double_sided = 0;
  335. table_file_parse_int(rail, "double_sided", &double_sided);
  336. new_rail->finalize();
  337. table->objects.push_back(new_rail);
  338. if(double_sided) {
  339. new_rail = new Polygon();
  340. new_rail->add_point(e);
  341. new_rail->add_point(s);
  342. new_rail->bounce = bnc;
  343. new_rail->finalize();
  344. table->objects.push_back(new_rail);
  345. }
  346. }
  347. }
  348. const nx_json* portals = nx_json_get(json, "portals");
  349. if(portals) {
  350. for(int i = 0; i < portals->children.length; i++) {
  351. const nx_json* portal = nx_json_item(portals, i);
  352. Vec2 a1;
  353. if(!table_file_parse_vec2(portal, "a_start", &a1)) {
  354. FURI_LOG_E(TAG, "Portal missing \"a_start\", skipping");
  355. continue;
  356. }
  357. Vec2 a2;
  358. if(!table_file_parse_vec2(portal, "a_end", &a2)) {
  359. FURI_LOG_E(TAG, "Portal missing \"a_end\", skipping");
  360. continue;
  361. }
  362. Vec2 b1;
  363. if(!table_file_parse_vec2(portal, "b_start", &b1)) {
  364. FURI_LOG_E(TAG, "Portal missing \"b_start\", skipping");
  365. continue;
  366. }
  367. Vec2 b2;
  368. if(!table_file_parse_vec2(portal, "b_end", &b2)) {
  369. FURI_LOG_E(TAG, "Portal missing \"b_end\", skipping");
  370. continue;
  371. }
  372. Portal* new_portal = new Portal(a1, a2, b1, b2);
  373. new_portal->finalize();
  374. table->objects.push_back(new_portal);
  375. }
  376. }
  377. const nx_json* rollovers = nx_json_get(json, "rollovers");
  378. if(rollovers) {
  379. for(int i = 0; i < rollovers->children.length; i++) {
  380. const nx_json* rollover = nx_json_item(rollovers, i);
  381. Vec2 p;
  382. if(!table_file_parse_vec2(rollover, "position", &p)) {
  383. FURI_LOG_E(TAG, "Rollover missing \"position\", skipping");
  384. continue;
  385. }
  386. char sym = '*';
  387. const nx_json* symbol = nx_json_get(rollover, "symbol");
  388. if(symbol) {
  389. sym = symbol->text_value[0];
  390. }
  391. Rollover* new_rollover = new Rollover(p, sym);
  392. table->objects.push_back(new_rollover);
  393. }
  394. }
  395. const nx_json* turbos = nx_json_get(json, "turbos");
  396. if(turbos) {
  397. for(int i = 0; i < turbos->children.length; i++) {
  398. const nx_json* turbo = nx_json_item(turbos, i);
  399. Vec2 p;
  400. if(!table_file_parse_vec2(turbo, "position", &p)) {
  401. FURI_LOG_E(TAG, "Turbo missing \"position\"");
  402. continue;
  403. }
  404. float angle = 0;
  405. table_file_parse_float(turbo, "angle", &angle);
  406. angle *= pi_180;
  407. float boost = 10;
  408. table_file_parse_float(turbo, "boost", &boost);
  409. Turbo* new_turbo = new Turbo(p, angle, boost);
  410. table->objects.push_back(new_turbo);
  411. }
  412. }
  413. break;
  414. } while(true);
  415. nx_json_free(json);
  416. free(json_buffer);
  417. return table;
  418. }
  419. bool table_load_table(void* ctx, size_t index) {
  420. PinballState* pb = (PinballState*)ctx;
  421. // read the index'th file in pb->table_list and allocate
  422. FURI_LOG_I(TAG, "Loading table %u", index);
  423. // if there's already a table loaded, free it
  424. if(pb->table) {
  425. delete pb->table;
  426. pb->table = nullptr;
  427. }
  428. pb->gameStarted = false;
  429. switch(index) {
  430. case TABLE_SELECT:
  431. pb->table = table_init_table_select(ctx);
  432. break;
  433. case TABLE_ERROR:
  434. pb->table = table_init_table_error(ctx);
  435. break;
  436. default:
  437. pb->table = table_load_table_from_file(pb, index - TABLE_INDEX_OFFSET);
  438. break;
  439. }
  440. return pb->table != NULL;
  441. }
  442. TableList::~TableList() {
  443. for(auto& mi : menu_items) {
  444. furi_string_free(mi.name);
  445. furi_string_free(mi.filename);
  446. }
  447. }
  448. Table* table_init_table_select(void* ctx) {
  449. UNUSED(ctx);
  450. Table* table = new Table();
  451. table->balls.push_back(Ball(Vec2(20, 880), 35));
  452. table->balls.back().add_velocity(Vec2(7, 0), .10f);
  453. table->balls.push_back(Ball(Vec2(610, 920), 30));
  454. table->balls.back().add_velocity(Vec2(-8, 0), .10f);
  455. table->balls.push_back(Ball(Vec2(250, 980), 20));
  456. table->balls.back().add_velocity(Vec2(10, 0), .10f);
  457. table->balls_released = true;
  458. Polygon* new_rail = new Polygon();
  459. new_rail->add_point({-1, 840});
  460. new_rail->add_point({-1, 1280});
  461. new_rail->finalize();
  462. new_rail->hidden = true;
  463. table->objects.push_back(new_rail);
  464. new_rail = new Polygon();
  465. new_rail->add_point({-1, 1280});
  466. new_rail->add_point({640, 1280});
  467. new_rail->finalize();
  468. new_rail->hidden = true;
  469. table->objects.push_back(new_rail);
  470. new_rail = new Polygon();
  471. new_rail->add_point({640, 1280});
  472. new_rail->add_point({640, 840});
  473. new_rail->finalize();
  474. new_rail->hidden = true;
  475. table->objects.push_back(new_rail);
  476. int gap = 8;
  477. int speed = 3;
  478. float top = 20;
  479. // right side
  480. table->objects.push_back(new Chaser(Vec2(32, top), Vec2(62, top), gap, speed));
  481. table->objects.push_back(new Chaser(Vec2(62, top), Vec2(62, 84), gap, speed));
  482. table->objects.push_back(new Chaser(Vec2(62, 84), Vec2(32, 84), gap, speed));
  483. // left side
  484. table->objects.push_back(new Chaser(Vec2(32, top), Vec2(1, top), gap, speed));
  485. table->objects.push_back(new Chaser(Vec2(1, top), Vec2(1, 84), gap, speed));
  486. table->objects.push_back(new Chaser(Vec2(1, 84), Vec2(32, 84), gap, speed));
  487. return table;
  488. }
  489. Table* table_init_table_error(void* ctx) {
  490. UNUSED(ctx);
  491. // PinballState* pb = (PinballState*)ctx;
  492. Table* table = new Table();
  493. table->balls.push_back(Ball(Vec2(20, 880), 30));
  494. table->balls.back().add_velocity(Vec2(7, 0), .10f);
  495. // table->balls.push_back(Ball(Vec2(610, 920), 30));
  496. // table->balls.back().add_velocity(Vec2(-8, 0), .10f);
  497. // table->balls.push_back(Ball(Vec2(250, 980), 20));
  498. // table->balls.back().add_velocity(Vec2(10, 0), .10f);
  499. table->balls_released = true;
  500. Polygon* new_rail = new Polygon();
  501. new_rail->add_point({-1, 840});
  502. new_rail->add_point({-1, 1280});
  503. new_rail->finalize();
  504. new_rail->hidden = true;
  505. table->objects.push_back(new_rail);
  506. new_rail = new Polygon();
  507. new_rail->add_point({-1, 1280});
  508. new_rail->add_point({640, 1280});
  509. new_rail->finalize();
  510. new_rail->hidden = true;
  511. table->objects.push_back(new_rail);
  512. new_rail = new Polygon();
  513. new_rail->add_point({640, 1280});
  514. new_rail->add_point({640, 840});
  515. new_rail->finalize();
  516. new_rail->hidden = true;
  517. table->objects.push_back(new_rail);
  518. int gap = 8;
  519. int speed = 3;
  520. float top = 20;
  521. table->objects.push_back(new Chaser(Vec2(2, top), Vec2(61, top), gap, speed, Chaser::SLASH));
  522. table->objects.push_back(new Chaser(Vec2(2, top), Vec2(2, 84), gap, speed, Chaser::SLASH));
  523. table->objects.push_back(new Chaser(Vec2(2, 84), Vec2(61, 84), gap, speed, Chaser::SLASH));
  524. table->objects.push_back(new Chaser(Vec2(61, top), Vec2(61, 84), gap, speed, Chaser::SLASH));
  525. return table;
  526. }