diff --git a/source/engine/config.h b/source/engine/config.h index f53f564..cda361b 100644 --- a/source/engine/config.h +++ b/source/engine/config.h @@ -13,7 +13,14 @@ #define MSAA_SAMPLES 2 - +/* S7 Scheme defines */ +#define INITIAL_HEAP_SIZE 4096 +#define INITIAL_STACK_SIZE 4096 +#define DEFAULT_BIGNUM_PRECISION 128 +#define WITH_PURE_S7 1 +#define WITH_SYSTEM_EXTRAS 0 +#define WITH_C_LOADER 0 +#define WITH_NUMBER_SEPARATOR 1 #endif diff --git a/source/engine/engine.c b/source/engine/engine.c index 881f60b..81f6686 100644 --- a/source/engine/engine.c +++ b/source/engine/engine.c @@ -10,9 +10,13 @@ #define STBI_FAILURE_USERMSG #include "stb_image.h" +#define STB_IMAGE_WRITE_IMPLEMENTATION +#include "stb_image_write.h" + #define PL_MPEG_IMPLEMENTATION #include + #ifdef EDITOR #include "editor.h" #endif diff --git a/source/engine/font.c b/source/engine/font.c index 44790d4..e201c97 100644 --- a/source/engine/font.c +++ b/source/engine/font.c @@ -14,7 +14,6 @@ #include "stb_truetype.h" #include "stb_rect_pack.h" -#define STB_IMAGE_WRITE_IMPLEMENTATION #include "stb_image_write.h" static uint32_t VBO = 0; diff --git a/source/engine/gameobject.c b/source/engine/gameobject.c index 5972bfa..2451702 100644 --- a/source/engine/gameobject.c +++ b/source/engine/gameobject.c @@ -33,6 +33,14 @@ int id_from_gameobject(struct gameobject *go) { return -1; } +void gameobject_apply(struct gameobject *go) +{ + cpBodySetType(go->body, go->bodytype); + + if (go->bodytype == CP_BODY_TYPE_DYNAMIC) + cpBodySetMass(go->body, go->mass); +} + static void gameobject_setpickcolor(struct gameobject *go) { float r = ((go->editor.id & 0x000000FF) >> 0) / 255.f; @@ -144,6 +152,8 @@ void gameobject_init(struct gameobject *go, FILE * fprefab) cpBodySetType(go->body, go->bodytype); cpBodySetUserData(go->body, go); + + int comp_n; fread(&comp_n, sizeof(int), 1, fprefab); arrfree(go->components); diff --git a/source/engine/gameobject.h b/source/engine/gameobject.h index 377c104..ef0e02f 100644 --- a/source/engine/gameobject.h +++ b/source/engine/gameobject.h @@ -43,6 +43,7 @@ struct gameobject { extern struct gameobject *gameobjects; int MakeGameobject(); +void gameobject_apply(struct gameobject *go); void init_gameobjects(); void gameobject_delete(int id); void clear_gameobjects(); diff --git a/source/engine/mrbffi.c b/source/engine/mrbffi.c index 9c3c55c..08402bd 100644 --- a/source/engine/mrbffi.c +++ b/source/engine/mrbffi.c @@ -251,6 +251,10 @@ s7_pointer s7_sys_cmd(s7_scheme *sc, s7_pointer args) { case 8: return s7_make_integer(sc, frame_fps()); + case 9: /* Clear the level out */ + new_level(); + break; + } return args; @@ -496,6 +500,10 @@ s7_pointer s7_make_gameobject(s7_scheme *sc, s7_pointer args) { go->f = s7_real(s7_cadddr(args)); go->e = s7_real(s7_list_ref(sc, args, 4)); + YughInfo("static %d, dynamic %d, kinematic %d", CP_BODY_TYPE_STATIC, CP_BODY_TYPE_DYNAMIC, CP_BODY_TYPE_KINEMATIC); + + gameobject_apply(go); + return s7_make_integer(sc, g); } diff --git a/source/engine/s7.c b/source/engine/s7.c index fa241bd..a003a53 100644 --- a/source/engine/s7.c +++ b/source/engine/s7.c @@ -62,13 +62,7 @@ * ---------------- compile time switches ---------------- */ -#if defined __has_include -# if __has_include ("mus-config.h") -# include "mus-config.h" -# endif -#else - #include "mus-config.h" -#endif +#include "config.h" /* * Your config file goes here, or just replace that #include line with the defines you need. diff --git a/source/engine/yugine.c b/source/engine/yugine.c index 2c73380..ef373b5 100644 --- a/source/engine/yugine.c +++ b/source/engine/yugine.c @@ -1,3 +1,5 @@ +#include "yugine.h" + #include "render.h" #include "camera.h" #include "window.h" @@ -11,7 +13,7 @@ #include -#include "yugine.h" + #include "2dphysics.h" #if ED diff --git a/source/scripts/engine.scm b/source/scripts/engine.scm index 8bd1f72..1b4d196 100644 --- a/source/scripts/engine.scm +++ b/source/scripts/engine.scm @@ -49,6 +49,7 @@ (define (load_level s) (gen_cmd 0 s)) (define (load_prefab s) (gen_cmd 1 s)) (define (newobject) (sys_cmd 7)) +(define (clear_level) (sys_cmd 9)) (define (fps) (sys_cmd 8)) (define (quit) (sys_cmd 0)) (define (exit) (quit))