this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

#2602: move bytebattle under BUILD_EDITORS option

+24 -10
+22 -10
src/studio/studio.c
··· 209 209 Surf* surf; 210 210 211 211 tic_net* net; 212 + 213 + Bytebattle bytebattle; 214 + 212 215 #endif 213 216 214 217 Start* start; ··· 222 225 s32 samplerate; 223 226 tic_font systemFont; 224 227 225 - Bytebattle bytebattle; 226 228 }; 227 229 228 230 #if defined(BUILD_EDITORS) ··· 1707 1709 } 1708 1710 #endif 1709 1711 1712 + #if defined(BUILD_EDITORS) 1710 1713 static u32 getTime() 1711 1714 { 1712 1715 return tic_sys_counter_get() * 1000 / tic_sys_freq_get(); ··· 1721 1724 { 1722 1725 studio->bytebattle.battle.started = getTime(); 1723 1726 } 1727 + #endif 1724 1728 1725 1729 #if defined(TIC80_PRO) 1726 1730 ··· 2523 2527 #if defined(BUILD_EDITORS) 2524 2528 tic_net_close(studio->net); 2525 2529 free(studio->video.buffer); 2530 + if(studio->bytebattle.exp) free(studio->bytebattle.exp); 2531 + if(studio->bytebattle.imp) free(studio->bytebattle.imp); 2526 2532 #endif 2527 2533 2528 2534 free(studio->fs); 2529 - 2530 - if(studio->bytebattle.exp) free(studio->bytebattle.exp); 2531 - if(studio->bytebattle.imp) free(studio->bytebattle.imp); 2532 - 2533 2535 free(studio); 2534 2536 } 2535 2537 2538 + #if defined(BUILD_EDITORS) 2536 2539 Bytebattle* getBytebattle(Studio* studio) 2537 2540 { 2538 2541 return studio->bytebattle.exp || studio->bytebattle.imp ? &(studio->bytebattle) : NULL; 2539 2542 } 2543 + #endif 2540 2544 2541 2545 static StartArgs parseArgs(s32 argc, char **argv) 2542 2546 { ··· 2548 2552 2549 2553 StartArgs args = {0}; 2550 2554 args.volume = -1; 2555 + 2556 + #if defined(BUILD_EDITORS) 2551 2557 args.lowerlimit = 256; 2552 2558 args.upperlimit = 512; 2559 + #endif 2553 2560 2554 2561 struct argparse_option options[] = 2555 2562 { ··· 2557 2564 #define CMD_PARAMS_DEF(name, ctype, type, post, help) OPT_##type('\0', #name, &args.name, help), 2558 2565 CMD_PARAMS_LIST(CMD_PARAMS_DEF) 2559 2566 #undef CMD_PARAMS_DEF 2567 + #if defined(BUILD_EDITORS) 2560 2568 OPT_GROUP("Byte battle options:\n"), 2561 2569 OPT_STRING('\0', "codeexport", &args.codeexport, "export code to filename"), 2562 2570 OPT_STRING('\0', "codeimport", &args.codeimport, "import code from filename"), ··· 2564 2572 OPT_INTEGER('\0', "lowerlimit", &args.lowerlimit, "lower limit for code size (256 by default)"), 2565 2573 OPT_INTEGER('\0', "upperlimit", &args.upperlimit, "upper limit for code size (512 by default)"), 2566 2574 OPT_INTEGER('\0', "battletime", &args.battletime, "battletime in minutes"), 2575 + #endif 2567 2576 OPT_END(), 2568 2577 }; 2569 2578 ··· 2689 2698 .tic = tic_core_create(samplerate, format), 2690 2699 }; 2691 2700 2692 - #if defined(BUILD_EDITORS) 2693 - 2694 - #endif 2695 - 2696 2701 { 2697 2702 const char *path = args.fs ? args.fs : folder; 2698 2703 ··· 2784 2789 studio->config->data.soft |= args.soft; 2785 2790 studio->config->data.cli |= args.cli; 2786 2791 2792 + #if defined(BUILD_EDITORS) 2787 2793 if(args.codeexport) 2788 2794 studio->bytebattle.exp = strdup(args.codeexport); 2789 2795 else if(args.codeimport) ··· 2799 2805 studio->bytebattle.battle.left 2800 2806 = studio->bytebattle.battle.time 2801 2807 = args.battletime * 60 * 1000; 2808 + #endif 2802 2809 2803 2810 studioConfigChanged(studio); 2804 2811 2805 2812 if(args.cli) 2806 2813 args.skip = true; 2807 2814 2808 - #if defined(BUILD_EDITORS) 2809 2815 if(args.skip) 2816 + setStudioMode(studio, TIC_CONSOLE_MODE); 2817 + 2818 + #if defined(BUILD_EDITORS) 2819 + Bytebattle* bb = getBytebattle(studio); 2820 + 2821 + if(bb) 2810 2822 { 2811 2823 studio->console->tick(studio->console); 2812 2824 gotoCode(studio);
+2
src/studio/studio.h
··· 96 96 CMD_PARAMS_LIST(CMD_PARAMS_DEF) 97 97 #undef CMD_PARAMS_DEF 98 98 99 + #if defined(BUILD_EDITORS) 99 100 const char *codeexport; 100 101 const char *codeimport; 101 102 s32 delay; 102 103 s32 lowerlimit; 103 104 s32 upperlimit; 104 105 s32 battletime; 106 + #endif 105 107 } StartArgs; 106 108 107 109 typedef enum