diff --git a/MAKE.bat b/MAKE.bat index 33c75c9..8abbe5d 100644 --- a/MAKE.bat +++ b/MAKE.bat @@ -322,6 +322,7 @@ if "%1"=="fwk" ( git fetch git reset --hard origin/main popd + call make.bat split call MAKE.bat fwk_prep start "" fwk_diff.WinMerge exit /b @@ -338,12 +339,12 @@ if "%1"=="gwk" ( copy/y ..\fwk-mirror\engine\fwk _fwk\engine\fwk copy/y ..\fwk-mirror\engine\split\*.inl _fwk\engine\split\ rem copy/y ..\fwk-mirror\engine\split\3rd_*.c _fwk\engine\split\ + make back exit /b ) if "%1"=="fwk_prep" ( - call make.bat split if not exist "_fwk" mkdir "_fwk" if not exist "_fwk\demos" mkdir "_fwk\demos" if not exist "_fwk\tools" mkdir "_fwk\tools" @@ -453,8 +454,8 @@ if "%1"=="back" ( rem tools\fwkren.exe tools\cook.ini to - call make.bat join - call make.bat amalgamation + rem call make.bat join + rem call make.bat amalgamation echo All done. endlocal diff --git a/bind/v4k.lua b/bind/v4k.lua index 4c94982..4bc2981 100644 --- a/bind/v4k.lua +++ b/bind/v4k.lua @@ -3222,7 +3222,7 @@ int u_coefficients_sh; size_t strlcpy(char *dst, const char *src, size_t dstcap); char** strsplit(const char *string, const char *delimiters); char* strjoin(char** list, const char *separator); - char * string8(const wchar_t *str); + char* string8(const wchar_t *str); uint32_t* string32( const char *utf8 ); const char* codepoint_to_utf8(unsigned cp); unsigned intern( const char *string ); @@ -3341,7 +3341,7 @@ unsigned play; bool paused; struct atlas_t *a; } sprite_t; -enum { OBJTYPE_sprite_t = 10 }; typedef struct { unsigned static_assert_on_L__LINE__ : !!(10 <= 255); } static_assert_on_Lconcat(_L,3959)___COUNTER__; typedef struct { unsigned static_assert_on_L__LINE__ : !!(sizeof(sprite_t)); } static_assert_on_Lconcat(_L,3959)___COUNTER__;; +enum { OBJTYPE_sprite_t = 10 }; typedef struct { unsigned static_assert_on_L__LINE__ : !!(10 <= 255); } static_assert_on_Lconcat(_L,3962)___COUNTER__; typedef struct { unsigned static_assert_on_L__LINE__ : !!(sizeof(sprite_t)); } static_assert_on_Lconcat(_L,3962)___COUNTER__;; void sprite_ctor(sprite_t *s); void sprite_dtor(sprite_t *s); void sprite_tick(sprite_t *s); diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index 44352cd..8d0dae8 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -14068,6 +14068,10 @@ extern "C" { #define COOK_DISABLED 0 // ifdef(nocook, 1, 0) ///+ #endif +#ifndef ENABLE_RPMALLOC +#define ENABLE_RPMALLOC 0 // ifdef(tcc, 0, 1) // forbidden on tcc because of lacking TLS support +#endif + // ----------------------------------------------------------------------------- // if/n/def hell @@ -15368,7 +15372,6 @@ API extern int (*obj_init[256])(); ///- API extern int (*obj_quit[256])(); ///- API extern int (*obj_tick[256])(); ///- API extern int (*obj_draw[256])(); ///- - API extern int (*obj_lerp[256])(); ///- API extern int (*obj_aabb[256])(); ///- @@ -15376,7 +15379,7 @@ API extern int (*obj_edit[256])(); ///- API extern int (*obj_menu[256])(); ///- API extern char* (*obj_icon[256])(); ///- -API extern const char*OBJTYPES[256]; /// - +API extern const char*OBJTYPES[256]; ///- // ---------------------------------------------------------------------------- // core @@ -17735,7 +17738,7 @@ typedef struct camera_t { vec2 last_look; vec3 last_move; // used for friction and damping bool damping; - bool orthographic; // 0 perspective, 1 orthographic; when ortho: dimetric[if pitch == -30o], isometric[if pitch == 35.264o] + bool orthographic; // 0 perspective, 1 orthographic; when ortho: dimetric[if pitch == -30º], isometric[if pitch == 35.264º] float distance; // distance to pivot, when orbiting // vec2 polarity = { +1,-1 }; // @todo // vec2 sensitivity = { 2,2 }; // @todo @@ -17935,7 +17938,7 @@ API array(char*) strsplit(const char *string, const char *delimiters); /// > char *joint = strjoin(tokens, "+"); // joint="hello+world" API char* strjoin(array(char*) list, const char *separator); -API char * string8(const wchar_t *str); /// convert from wchar16(win) to utf8/ascii +API char* string8(const wchar_t *str); /// convert from wchar16(win) to utf8/ascii API array(uint32_t) string32( const char *utf8 ); /// convert from utf8 to utf32 API const char* codepoint_to_utf8(unsigned cp); @@ -241313,7 +241316,7 @@ static char *ui_filter = 0; // - rlyeh, public domain // // changelog: -// - ported to FWK api +// - ported to V4K api // - namespaced symbols // - diverse win32 fixes // - adaptive cols/rows @@ -241490,7 +241493,7 @@ static void browser_reload_directory_content(struct browser *browser, const char // remove last '/' if present. ok to overwrite absolute var, file_*() API returns writeable strings. char *dir = absolute; if( dir[ strlen(dir) - 1 ] == '/' ) dir[ strlen(dir) - 1 ] = '\0'; - dir = file_name(dir); // /home/rlyeh/prj/fwk/art -> art + dir = file_name(dir); // /home/rlyeh/prj/v4k/art -> art BROWSER_PRINTF("%s\n", dir); if( dir[0] != '.' ) // skip special files, folders and internal files like .git or .art.zip @@ -348635,7 +348638,7 @@ static lm_bool lm_integrateHemisphereBatch(lm_context *ctx) int sx = ctx->hemisphere.storage.writePosition.x + x; unsigned int hemiIndex = y * ctx->hemisphere.fbHemiCountX + x; ctx->hemisphere.storage.toLightmapLocation[sy * ctx->hemisphere.storage.width + sx] = - (hemiIndex >= ctx->hemisphere.fbHemiIndex) ? + (hemiIndex >= ctx->hemisphere.fbHemiIndex) ? lm_i2(-1, -1) : ctx->hemisphere.fbHemiToLightmapLocation[hemiIndex]; } @@ -356614,8 +356617,8 @@ void cook_stop() { int cook_progress() { int count = 0, sum = 0; for( int i = 0, end = cook_jobs(); i < end; ++i ) { - sum += jobs[i].progress; - ++count; + sum += jobs[i].progress; + ++count; } return cook_jobs() ? sum / (count+!count) : 100; } @@ -360823,7 +360826,7 @@ vec2 gui_getskinsize(const char *skin, const char *fallback) { bool gui_ismouseinrect(const char *skin, const char *fallback, vec4 rect) { if (last_skin->ismouseinrect) return last_skin->ismouseinrect(last_skin->userdata, skin, fallback, rect); - return false; + return false; } vec4 gui_getscissorrect(const char *skin, const char *fallback, vec4 rect) { @@ -361003,7 +361006,7 @@ void skinned_free(void* userdata) { static atlas_slice_frame_t *skinned_getsliceframe(atlas_t *a, const char *name) { if (!name) return NULL; - for (int i = 0; i < array_count(a->slices); i++) + for (int i = 0; i < array_count(a->slices); i++) if (!strcmp(quark_string(&a->db, a->slices[i].name), name)) return &a->slice_frames[a->slices[i].frames[0]]; // PRINTF("slice name: '%s' is missing in atlas!\n", name); @@ -371557,8 +371560,8 @@ void camera_orbit( camera_t *cam, float yaw, float pitch, float inc_distance ) { cam->pitch += _mouse.y; cam->distance += _mouse.z; - // look: limit pitch angle [-89..89] - cam->pitch = cam->pitch > 89 ? 89 : cam->pitch < -89 ? -89 : cam->pitch; + // look: limit pitch angle [-89..89] + cam->pitch = cam->pitch > 89 ? 89 : cam->pitch < -89 ? -89 : cam->pitch; // compute view matrix float x = rad(cam->yaw), y = rad(-cam->pitch), cx = cosf(x), cy = cosf(y), sx = sinf(x), sy = sinf(y); @@ -378856,10 +378859,10 @@ void v4k_init() { // - network replication can be done by external tools by comparing the filesystems and by sending the resulting diff zipped // // ## Editor roadmap -// - Gizmos?, scene tree, property editor?, load/save?, undo/redo?, copy/paste, on/off (vis,tick,ddraw,log), vcs. -// - Scenenode pass: node singleton display, node console, node labels, node outlines?. -// - Render pass: billboards?, materials, un/lit, cast shadows, wireframe, skybox?/mie?, fog/atmosphere -// - Level pass: volumes, triggers, platforms, level streaming, collide?, physics +// - Gizmos✱, scene tree, property editor✱, load/save✱, undo/redo✱, copy/paste, on/off (vis,tick,ddraw,log), vcs. +// - Scenenode pass: node singleton display, node console, node labels, node outlines✱. +// - Render pass: billboards✱, materials, un/lit, cast shadows, wireframe, skybox✱/mie✱, fog/atmosphere +// - Level pass: volumes, triggers, platforms, level streaming, collide✱, physics // - Edit pass: Procedural content, brushes, noise and CSG. // - GUI pass: timeline and data tracks, node graphs. @@ -379044,20 +379047,20 @@ int editor_filter() { if (nk_begin(ui_ctx, "Filter", nk_rect(window_width()-window_width()*0.33,32, window_width()*0.33, 40), NK_WINDOW_NO_SCROLLBAR)) { - char *bak = ui_filter; ui_filter = 0; - ui_string(ICON_MD_CLOSE " Filter " ICON_MD_SEARCH, &bak); - ui_filter = bak; + char *bak = ui_filter; ui_filter = 0; + ui_string(ICON_MD_CLOSE " Filter " ICON_MD_SEARCH, &bak); + ui_filter = bak; if( input(KEY_ESC) || ( ui_label_icon_clicked_L.x > 0 && ui_label_icon_clicked_L.x <= 24 )) { if( ui_filter ) ui_filter[0] = '\0'; editor.filter = 0; - } - } + } + } nk_end(ui_ctx); } return editor.filter; - } +} static int editor_select_(void *o, const char *mask) { @@ -379081,7 +379084,7 @@ void editor_unselect() { // same than editor_select("!**"); for each_map_ptr(*editor_selected_map(), void*,o, int, k) { if( *k ) *k = 0; } - } +} void editor_select_aabb(aabb box) { int is_inv = input_held(KEY_CTRL); @@ -379121,8 +379124,8 @@ void editor_selectgroup(obj *first, obj *last) { editor_selectgroup_(o, first, last); } } - } } +} static obj *find_any_selected_(obj *o) { if( editor_selected(o) ) return o; @@ -379138,7 +379141,7 @@ void* editor_first_selected() { obj *oo = find_any_selected_(o); // if( oo ) printf("1st found: %s\n", obj_name(oo)); if( oo ) return oo; -} + } return 0; } @@ -379149,7 +379152,7 @@ static obj *find_last_selected_(obj *o) { obj *ooo = find_last_selected_(oo); if( ooo ) last = ooo; -} + } return last; } void* editor_last_selected() { @@ -379158,7 +379161,7 @@ void* editor_last_selected() { obj *oo = find_last_selected_(o); // if( oo ) printf("last found: %s\n", obj_name(oo)); if( oo ) last = oo; -} + } return last; } @@ -379168,7 +379171,7 @@ void editor_addtoworld(obj *o) { set_find_or_add(editor.world, o); for each_objchild(o, obj*, oo) { editor_addtoworld(oo); -} + } } void editor_watch(const void *o) { @@ -379349,9 +379352,9 @@ void editor_pump() { if( (*cmd)[0] ) { (*cmd)[0] = '\0'; strcatf(&(*cmd), "\1%s\n", "Ok\n"); (*cmd)[0] = '\0'; + } } } - } } } @@ -379500,8 +379503,8 @@ void editor_frame( void (*game)(unsigned, float, double) ) { for each_set_ptr(editor.world,obj*,o) { if( obj_hasmethod(*o,edit) ) { obj_edit(*o); + } } -} // draw silhouettes sprite_flush(); @@ -379513,8 +379516,8 @@ void editor_frame( void (*game)(unsigned, float, double) ) { } if( obj_hasmethod(*o,edit) ) { obj_edit(*o); -} -} + } + } sprite_flush(); fx_end(); @@ -379572,9 +379575,9 @@ void editor_frame( void (*game)(unsigned, float, double) ) { editor_end(EDITOR_WINDOW_NK_SMALL); } else { editor_setpopup(o, 0); + } + } } - } -} // draw subeditors diff --git a/engine/split/3rd_lightmapper.h b/engine/split/3rd_lightmapper.h index cf7cba1..ffcb2fe 100644 --- a/engine/split/3rd_lightmapper.h +++ b/engine/split/3rd_lightmapper.h @@ -751,7 +751,7 @@ static lm_bool lm_integrateHemisphereBatch(lm_context *ctx) int sx = ctx->hemisphere.storage.writePosition.x + x; unsigned int hemiIndex = y * ctx->hemisphere.fbHemiCountX + x; ctx->hemisphere.storage.toLightmapLocation[sy * ctx->hemisphere.storage.width + sx] = - (hemiIndex >= ctx->hemisphere.fbHemiIndex) ? + (hemiIndex >= ctx->hemisphere.fbHemiIndex) ? lm_i2(-1, -1) : ctx->hemisphere.fbHemiToLightmapLocation[hemiIndex]; } diff --git a/engine/split/3rd_nuklear_filebrowser.h b/engine/split/3rd_nuklear_filebrowser.h index 89cd2dd..8abc288 100644 --- a/engine/split/3rd_nuklear_filebrowser.h +++ b/engine/split/3rd_nuklear_filebrowser.h @@ -2,7 +2,7 @@ // - rlyeh, public domain // // changelog: -// - ported to FWK api +// - ported to V4K api // - namespaced symbols // - diverse win32 fixes // - adaptive cols/rows @@ -179,7 +179,7 @@ static void browser_reload_directory_content(struct browser *browser, const char // remove last '/' if present. ok to overwrite absolute var, file_*() API returns writeable strings. char *dir = absolute; if( dir[ strlen(dir) - 1 ] == '/' ) dir[ strlen(dir) - 1 ] = '\0'; - dir = file_name(dir); // /home/rlyeh/prj/fwk/art -> art + dir = file_name(dir); // /home/rlyeh/prj/v4k/art -> art BROWSER_PRINTF("%s\n", dir); if( dir[0] != '.' ) // skip special files, folders and internal files like .git or .art.zip diff --git a/engine/split/v4k_config.h b/engine/split/v4k_config.h index 9d42e20..2e993b4 100644 --- a/engine/split/v4k_config.h +++ b/engine/split/v4k_config.h @@ -37,6 +37,10 @@ #define COOK_DISABLED 0 // ifdef(nocook, 1, 0) ///+ #endif +#ifndef ENABLE_RPMALLOC +#define ENABLE_RPMALLOC 0 // ifdef(tcc, 0, 1) // forbidden on tcc because of lacking TLS support +#endif + // ----------------------------------------------------------------------------- // if/n/def hell diff --git a/engine/split/v4k_cook.c b/engine/split/v4k_cook.c index 4a18dd3..127ffae 100644 --- a/engine/split/v4k_cook.c +++ b/engine/split/v4k_cook.c @@ -830,8 +830,8 @@ void cook_stop() { int cook_progress() { int count = 0, sum = 0; for( int i = 0, end = cook_jobs(); i < end; ++i ) { - sum += jobs[i].progress; - ++count; + sum += jobs[i].progress; + ++count; } return cook_jobs() ? sum / (count+!count) : 100; } diff --git a/engine/split/v4k_editor.c b/engine/split/v4k_editor.c index 6648511..5848a6d 100644 --- a/engine/split/v4k_editor.c +++ b/engine/split/v4k_editor.c @@ -6,10 +6,10 @@ // - network replication can be done by external tools by comparing the filesystems and by sending the resulting diff zipped // // ## Editor roadmap -// - Gizmos?, scene tree, property editor?, load/save?, undo/redo?, copy/paste, on/off (vis,tick,ddraw,log), vcs. -// - Scenenode pass: node singleton display, node console, node labels, node outlines?. -// - Render pass: billboards?, materials, un/lit, cast shadows, wireframe, skybox?/mie?, fog/atmosphere -// - Level pass: volumes, triggers, platforms, level streaming, collide?, physics +// - Gizmos✱, scene tree, property editor✱, load/save✱, undo/redo✱, copy/paste, on/off (vis,tick,ddraw,log), vcs. +// - Scenenode pass: node singleton display, node console, node labels, node outlines✱. +// - Render pass: billboards✱, materials, un/lit, cast shadows, wireframe, skybox✱/mie✱, fog/atmosphere +// - Level pass: volumes, triggers, platforms, level streaming, collide✱, physics // - Edit pass: Procedural content, brushes, noise and CSG. // - GUI pass: timeline and data tracks, node graphs. @@ -194,20 +194,20 @@ int editor_filter() { if (nk_begin(ui_ctx, "Filter", nk_rect(window_width()-window_width()*0.33,32, window_width()*0.33, 40), NK_WINDOW_NO_SCROLLBAR)) { - char *bak = ui_filter; ui_filter = 0; - ui_string(ICON_MD_CLOSE " Filter " ICON_MD_SEARCH, &bak); - ui_filter = bak; + char *bak = ui_filter; ui_filter = 0; + ui_string(ICON_MD_CLOSE " Filter " ICON_MD_SEARCH, &bak); + ui_filter = bak; if( input(KEY_ESC) || ( ui_label_icon_clicked_L.x > 0 && ui_label_icon_clicked_L.x <= 24 )) { if( ui_filter ) ui_filter[0] = '\0'; editor.filter = 0; - } - } + } + } nk_end(ui_ctx); } return editor.filter; - } +} static int editor_select_(void *o, const char *mask) { @@ -231,7 +231,7 @@ void editor_unselect() { // same than editor_select("!**"); for each_map_ptr(*editor_selected_map(), void*,o, int, k) { if( *k ) *k = 0; } - } +} void editor_select_aabb(aabb box) { int is_inv = input_held(KEY_CTRL); @@ -271,8 +271,8 @@ void editor_selectgroup(obj *first, obj *last) { editor_selectgroup_(o, first, last); } } - } } +} static obj *find_any_selected_(obj *o) { if( editor_selected(o) ) return o; @@ -288,7 +288,7 @@ void* editor_first_selected() { obj *oo = find_any_selected_(o); // if( oo ) printf("1st found: %s\n", obj_name(oo)); if( oo ) return oo; -} + } return 0; } @@ -299,7 +299,7 @@ static obj *find_last_selected_(obj *o) { obj *ooo = find_last_selected_(oo); if( ooo ) last = ooo; -} + } return last; } void* editor_last_selected() { @@ -308,7 +308,7 @@ void* editor_last_selected() { obj *oo = find_last_selected_(o); // if( oo ) printf("last found: %s\n", obj_name(oo)); if( oo ) last = oo; -} + } return last; } @@ -318,7 +318,7 @@ void editor_addtoworld(obj *o) { set_find_or_add(editor.world, o); for each_objchild(o, obj*, oo) { editor_addtoworld(oo); -} + } } void editor_watch(const void *o) { @@ -499,9 +499,9 @@ void editor_pump() { if( (*cmd)[0] ) { (*cmd)[0] = '\0'; strcatf(&(*cmd), "\1%s\n", "Ok\n"); (*cmd)[0] = '\0'; + } } } - } } } @@ -650,8 +650,8 @@ void editor_frame( void (*game)(unsigned, float, double) ) { for each_set_ptr(editor.world,obj*,o) { if( obj_hasmethod(*o,edit) ) { obj_edit(*o); + } } -} // draw silhouettes sprite_flush(); @@ -663,8 +663,8 @@ void editor_frame( void (*game)(unsigned, float, double) ) { } if( obj_hasmethod(*o,edit) ) { obj_edit(*o); -} -} + } + } sprite_flush(); fx_end(); @@ -722,9 +722,9 @@ void editor_frame( void (*game)(unsigned, float, double) ) { editor_end(EDITOR_WINDOW_NK_SMALL); } else { editor_setpopup(o, 0); + } + } } - } -} // draw subeditors diff --git a/engine/split/v4k_gui.c b/engine/split/v4k_gui.c index 80d252b..3d9661c 100644 --- a/engine/split/v4k_gui.c +++ b/engine/split/v4k_gui.c @@ -126,7 +126,7 @@ vec2 gui_getskinsize(const char *skin, const char *fallback) { bool gui_ismouseinrect(const char *skin, const char *fallback, vec4 rect) { if (last_skin->ismouseinrect) return last_skin->ismouseinrect(last_skin->userdata, skin, fallback, rect); - return false; + return false; } vec4 gui_getscissorrect(const char *skin, const char *fallback, vec4 rect) { @@ -306,7 +306,7 @@ void skinned_free(void* userdata) { static atlas_slice_frame_t *skinned_getsliceframe(atlas_t *a, const char *name) { if (!name) return NULL; - for (int i = 0; i < array_count(a->slices); i++) + for (int i = 0; i < array_count(a->slices); i++) if (!strcmp(quark_string(&a->db, a->slices[i].name), name)) return &a->slice_frames[a->slices[i].frames[0]]; // PRINTF("slice name: '%s' is missing in atlas!\n", name); diff --git a/engine/split/v4k_obj.h b/engine/split/v4k_obj.h index d8efb20..d80a6d9 100644 --- a/engine/split/v4k_obj.h +++ b/engine/split/v4k_obj.h @@ -208,7 +208,6 @@ API extern int (*obj_init[256])(); ///- API extern int (*obj_quit[256])(); ///- API extern int (*obj_tick[256])(); ///- API extern int (*obj_draw[256])(); ///- - API extern int (*obj_lerp[256])(); ///- API extern int (*obj_aabb[256])(); ///- @@ -216,7 +215,7 @@ API extern int (*obj_edit[256])(); ///- API extern int (*obj_menu[256])(); ///- API extern char* (*obj_icon[256])(); ///- -API extern const char*OBJTYPES[256]; /// - +API extern const char*OBJTYPES[256]; ///- // ---------------------------------------------------------------------------- // core diff --git a/engine/split/v4k_scene.c b/engine/split/v4k_scene.c index 526ad99..0a5aabd 100644 --- a/engine/split/v4k_scene.c +++ b/engine/split/v4k_scene.c @@ -156,8 +156,8 @@ void camera_orbit( camera_t *cam, float yaw, float pitch, float inc_distance ) { cam->pitch += _mouse.y; cam->distance += _mouse.z; - // look: limit pitch angle [-89..89] - cam->pitch = cam->pitch > 89 ? 89 : cam->pitch < -89 ? -89 : cam->pitch; + // look: limit pitch angle [-89..89] + cam->pitch = cam->pitch > 89 ? 89 : cam->pitch < -89 ? -89 : cam->pitch; // compute view matrix float x = rad(cam->yaw), y = rad(-cam->pitch), cx = cosf(x), cy = cosf(y), sx = sinf(x), sy = sinf(y); diff --git a/engine/split/v4k_scene.h b/engine/split/v4k_scene.h index f17e8d9..d9cf41e 100644 --- a/engine/split/v4k_scene.h +++ b/engine/split/v4k_scene.h @@ -15,7 +15,7 @@ typedef struct camera_t { vec2 last_look; vec3 last_move; // used for friction and damping bool damping; - bool orthographic; // 0 perspective, 1 orthographic; when ortho: dimetric[if pitch == -30o], isometric[if pitch == 35.264o] + bool orthographic; // 0 perspective, 1 orthographic; when ortho: dimetric[if pitch == -30º], isometric[if pitch == 35.264º] float distance; // distance to pivot, when orbiting // vec2 polarity = { +1,-1 }; // @todo // vec2 sensitivity = { 2,2 }; // @todo diff --git a/engine/split/v4k_string.h b/engine/split/v4k_string.h index 8b8496f..df7d3a8 100644 --- a/engine/split/v4k_string.h +++ b/engine/split/v4k_string.h @@ -73,7 +73,7 @@ API array(char*) strsplit(const char *string, const char *delimiters); /// > char *joint = strjoin(tokens, "+"); // joint="hello+world" API char* strjoin(array(char*) list, const char *separator); -API char * string8(const wchar_t *str); /// convert from wchar16(win) to utf8/ascii +API char* string8(const wchar_t *str); /// convert from wchar16(win) to utf8/ascii API array(uint32_t) string32( const char *utf8 ); /// convert from utf8 to utf32 API const char* codepoint_to_utf8(unsigned cp); diff --git a/engine/v4k b/engine/v4k index b17dde4..01b1ebb 100644 --- a/engine/v4k +++ b/engine/v4k @@ -222477,7 +222477,7 @@ static char *ui_filter = 0; // - rlyeh, public domain // // changelog: -// - ported to FWK api +// - ported to V4K api // - namespaced symbols // - diverse win32 fixes // - adaptive cols/rows @@ -222654,7 +222654,7 @@ static void browser_reload_directory_content(struct browser *browser, const char // remove last '/' if present. ok to overwrite absolute var, file_*() API returns writeable strings. char *dir = absolute; if( dir[ strlen(dir) - 1 ] == '/' ) dir[ strlen(dir) - 1 ] = '\0'; - dir = file_name(dir); // /home/rlyeh/prj/fwk/art -> art + dir = file_name(dir); // /home/rlyeh/prj/v4k/art -> art BROWSER_PRINTF("%s\n", dir); if( dir[0] != '.' ) // skip special files, folders and internal files like .git or .art.zip @@ -329799,7 +329799,7 @@ static lm_bool lm_integrateHemisphereBatch(lm_context *ctx) int sx = ctx->hemisphere.storage.writePosition.x + x; unsigned int hemiIndex = y * ctx->hemisphere.fbHemiCountX + x; ctx->hemisphere.storage.toLightmapLocation[sy * ctx->hemisphere.storage.width + sx] = - (hemiIndex >= ctx->hemisphere.fbHemiIndex) ? + (hemiIndex >= ctx->hemisphere.fbHemiIndex) ? lm_i2(-1, -1) : ctx->hemisphere.fbHemiToLightmapLocation[hemiIndex]; } diff --git a/engine/v4k.c b/engine/v4k.c index b62a437..97bbfbb 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -6946,8 +6946,8 @@ void cook_stop() { int cook_progress() { int count = 0, sum = 0; for( int i = 0, end = cook_jobs(); i < end; ++i ) { - sum += jobs[i].progress; - ++count; + sum += jobs[i].progress; + ++count; } return cook_jobs() ? sum / (count+!count) : 100; } @@ -11155,7 +11155,7 @@ vec2 gui_getskinsize(const char *skin, const char *fallback) { bool gui_ismouseinrect(const char *skin, const char *fallback, vec4 rect) { if (last_skin->ismouseinrect) return last_skin->ismouseinrect(last_skin->userdata, skin, fallback, rect); - return false; + return false; } vec4 gui_getscissorrect(const char *skin, const char *fallback, vec4 rect) { @@ -11335,7 +11335,7 @@ void skinned_free(void* userdata) { static atlas_slice_frame_t *skinned_getsliceframe(atlas_t *a, const char *name) { if (!name) return NULL; - for (int i = 0; i < array_count(a->slices); i++) + for (int i = 0; i < array_count(a->slices); i++) if (!strcmp(quark_string(&a->db, a->slices[i].name), name)) return &a->slice_frames[a->slices[i].frames[0]]; // PRINTF("slice name: '%s' is missing in atlas!\n", name); @@ -21889,8 +21889,8 @@ void camera_orbit( camera_t *cam, float yaw, float pitch, float inc_distance ) { cam->pitch += _mouse.y; cam->distance += _mouse.z; - // look: limit pitch angle [-89..89] - cam->pitch = cam->pitch > 89 ? 89 : cam->pitch < -89 ? -89 : cam->pitch; + // look: limit pitch angle [-89..89] + cam->pitch = cam->pitch > 89 ? 89 : cam->pitch < -89 ? -89 : cam->pitch; // compute view matrix float x = rad(cam->yaw), y = rad(-cam->pitch), cx = cosf(x), cy = cosf(y), sx = sinf(x), sy = sinf(y); @@ -29188,10 +29188,10 @@ void v4k_init() { // - network replication can be done by external tools by comparing the filesystems and by sending the resulting diff zipped // // ## Editor roadmap -// - Gizmos?, scene tree, property editor?, load/save?, undo/redo?, copy/paste, on/off (vis,tick,ddraw,log), vcs. -// - Scenenode pass: node singleton display, node console, node labels, node outlines?. -// - Render pass: billboards?, materials, un/lit, cast shadows, wireframe, skybox?/mie?, fog/atmosphere -// - Level pass: volumes, triggers, platforms, level streaming, collide?, physics +// - Gizmos✱, scene tree, property editor✱, load/save✱, undo/redo✱, copy/paste, on/off (vis,tick,ddraw,log), vcs. +// - Scenenode pass: node singleton display, node console, node labels, node outlines✱. +// - Render pass: billboards✱, materials, un/lit, cast shadows, wireframe, skybox✱/mie✱, fog/atmosphere +// - Level pass: volumes, triggers, platforms, level streaming, collide✱, physics // - Edit pass: Procedural content, brushes, noise and CSG. // - GUI pass: timeline and data tracks, node graphs. @@ -29376,20 +29376,20 @@ int editor_filter() { if (nk_begin(ui_ctx, "Filter", nk_rect(window_width()-window_width()*0.33,32, window_width()*0.33, 40), NK_WINDOW_NO_SCROLLBAR)) { - char *bak = ui_filter; ui_filter = 0; - ui_string(ICON_MD_CLOSE " Filter " ICON_MD_SEARCH, &bak); - ui_filter = bak; + char *bak = ui_filter; ui_filter = 0; + ui_string(ICON_MD_CLOSE " Filter " ICON_MD_SEARCH, &bak); + ui_filter = bak; if( input(KEY_ESC) || ( ui_label_icon_clicked_L.x > 0 && ui_label_icon_clicked_L.x <= 24 )) { if( ui_filter ) ui_filter[0] = '\0'; editor.filter = 0; - } - } + } + } nk_end(ui_ctx); } return editor.filter; - } +} static int editor_select_(void *o, const char *mask) { @@ -29413,7 +29413,7 @@ void editor_unselect() { // same than editor_select("!**"); for each_map_ptr(*editor_selected_map(), void*,o, int, k) { if( *k ) *k = 0; } - } +} void editor_select_aabb(aabb box) { int is_inv = input_held(KEY_CTRL); @@ -29453,8 +29453,8 @@ void editor_selectgroup(obj *first, obj *last) { editor_selectgroup_(o, first, last); } } - } } +} static obj *find_any_selected_(obj *o) { if( editor_selected(o) ) return o; @@ -29470,7 +29470,7 @@ void* editor_first_selected() { obj *oo = find_any_selected_(o); // if( oo ) printf("1st found: %s\n", obj_name(oo)); if( oo ) return oo; -} + } return 0; } @@ -29481,7 +29481,7 @@ static obj *find_last_selected_(obj *o) { obj *ooo = find_last_selected_(oo); if( ooo ) last = ooo; -} + } return last; } void* editor_last_selected() { @@ -29490,7 +29490,7 @@ void* editor_last_selected() { obj *oo = find_last_selected_(o); // if( oo ) printf("last found: %s\n", obj_name(oo)); if( oo ) last = oo; -} + } return last; } @@ -29500,7 +29500,7 @@ void editor_addtoworld(obj *o) { set_find_or_add(editor.world, o); for each_objchild(o, obj*, oo) { editor_addtoworld(oo); -} + } } void editor_watch(const void *o) { @@ -29681,9 +29681,9 @@ void editor_pump() { if( (*cmd)[0] ) { (*cmd)[0] = '\0'; strcatf(&(*cmd), "\1%s\n", "Ok\n"); (*cmd)[0] = '\0'; + } } } - } } } @@ -29832,8 +29832,8 @@ void editor_frame( void (*game)(unsigned, float, double) ) { for each_set_ptr(editor.world,obj*,o) { if( obj_hasmethod(*o,edit) ) { obj_edit(*o); + } } -} // draw silhouettes sprite_flush(); @@ -29845,8 +29845,8 @@ void editor_frame( void (*game)(unsigned, float, double) ) { } if( obj_hasmethod(*o,edit) ) { obj_edit(*o); -} -} + } + } sprite_flush(); fx_end(); @@ -29904,9 +29904,9 @@ void editor_frame( void (*game)(unsigned, float, double) ) { editor_end(EDITOR_WINDOW_NK_SMALL); } else { editor_setpopup(o, 0); + } + } } - } -} // draw subeditors diff --git a/engine/v4k.h b/engine/v4k.h index 0a9b847..71e5c10 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -135,6 +135,10 @@ extern "C" { #define COOK_DISABLED 0 // ifdef(nocook, 1, 0) ///+ #endif +#ifndef ENABLE_RPMALLOC +#define ENABLE_RPMALLOC 0 // ifdef(tcc, 0, 1) // forbidden on tcc because of lacking TLS support +#endif + // ----------------------------------------------------------------------------- // if/n/def hell @@ -1435,7 +1439,6 @@ API extern int (*obj_init[256])(); ///- API extern int (*obj_quit[256])(); ///- API extern int (*obj_tick[256])(); ///- API extern int (*obj_draw[256])(); ///- - API extern int (*obj_lerp[256])(); ///- API extern int (*obj_aabb[256])(); ///- @@ -1443,7 +1446,7 @@ API extern int (*obj_edit[256])(); ///- API extern int (*obj_menu[256])(); ///- API extern char* (*obj_icon[256])(); ///- -API extern const char*OBJTYPES[256]; /// - +API extern const char*OBJTYPES[256]; ///- // ---------------------------------------------------------------------------- // core @@ -3802,7 +3805,7 @@ typedef struct camera_t { vec2 last_look; vec3 last_move; // used for friction and damping bool damping; - bool orthographic; // 0 perspective, 1 orthographic; when ortho: dimetric[if pitch == -30o], isometric[if pitch == 35.264o] + bool orthographic; // 0 perspective, 1 orthographic; when ortho: dimetric[if pitch == -30º], isometric[if pitch == 35.264º] float distance; // distance to pivot, when orbiting // vec2 polarity = { +1,-1 }; // @todo // vec2 sensitivity = { 2,2 }; // @todo @@ -4002,7 +4005,7 @@ API array(char*) strsplit(const char *string, const char *delimiters); /// > char *joint = strjoin(tokens, "+"); // joint="hello+world" API char* strjoin(array(char*) list, const char *separator); -API char * string8(const wchar_t *str); /// convert from wchar16(win) to utf8/ascii +API char* string8(const wchar_t *str); /// convert from wchar16(win) to utf8/ascii API array(uint32_t) string32( const char *utf8 ); /// convert from utf8 to utf32 API const char* codepoint_to_utf8(unsigned cp);