remove undefined; only use null now
This commit is contained in:
@@ -445,10 +445,10 @@ static BufferCheckResult get_or_extend_buffer(
|
||||
int copy,
|
||||
int index
|
||||
) {
|
||||
BufferCheckResult res = { JS_UNDEFINED, NULL, 0, 0 };
|
||||
if (!JS_IsUndefined(old_mesh)) {
|
||||
BufferCheckResult res = { JS_NULL, NULL, 0, 0 };
|
||||
if (!JS_IsNull(old_mesh)) {
|
||||
JSValue old_buf = JS_GetPropertyStr(js, old_mesh, prop);
|
||||
if (!JS_IsUndefined(old_buf)) {
|
||||
if (!JS_IsNull(old_buf)) {
|
||||
size_t old_size;
|
||||
void *data = get_gpu_buffer(js, old_buf, NULL, &old_size);
|
||||
if (data && old_size >= needed_size) {
|
||||
@@ -520,7 +520,7 @@ JSC_CCALL(gpu_make_sprite_mesh,
|
||||
}
|
||||
|
||||
// Check old mesh
|
||||
JSValue old_mesh = JS_UNDEFINED;
|
||||
JSValue old_mesh = JS_NULL;
|
||||
if (argc > 1)
|
||||
old_mesh = argv[1];
|
||||
|
||||
@@ -577,9 +577,9 @@ JSC_CCALL(gpu_make_sprite_mesh,
|
||||
free(colordata);
|
||||
|
||||
// Free old buffer values if they were fetched
|
||||
if (!JS_IsUndefined(pos_chk.val)) JS_FreeValue(js, pos_chk.val);
|
||||
if (!JS_IsUndefined(uv_chk.val)) JS_FreeValue(js, uv_chk.val);
|
||||
if (!JS_IsUndefined(color_chk.val)) JS_FreeValue(js, color_chk.val);
|
||||
if (!JS_IsNull(pos_chk.val)) JS_FreeValue(js, pos_chk.val);
|
||||
if (!JS_IsNull(uv_chk.val)) JS_FreeValue(js, uv_chk.val);
|
||||
if (!JS_IsNull(color_chk.val)) JS_FreeValue(js, color_chk.val);
|
||||
|
||||
return ret;
|
||||
)
|
||||
@@ -685,11 +685,11 @@ JSC_CCALL(gpu_make_sprite_queue,
|
||||
|
||||
rect uv;
|
||||
rect uv_px;
|
||||
JSValue cur_img = JS_UNDEFINED;
|
||||
JSValue cur_img = JS_NULL;
|
||||
|
||||
for (size_t i = 0; i < quads; i++) {
|
||||
sprite *s = &sprites[i];
|
||||
if (JS_IsUndefined(cur_img) || !JS_StrictEq(js, s->image, cur_img)) {
|
||||
if (JS_IsNull(cur_img) || !JS_StrictEq(js, s->image, cur_img)) {
|
||||
cur_img = s->image;
|
||||
JS_GETATOM(js, uv, cur_img, rect, rect)
|
||||
JS_GETATOM(js, uv_px, cur_img, rect_px, rect)
|
||||
@@ -732,7 +732,7 @@ JSC_CCALL(gpu_make_sprite_queue,
|
||||
int first_index = 0;
|
||||
int count = 0;
|
||||
int n = 0;
|
||||
JSValue img = JS_UNDEFINED;
|
||||
JSValue img = JS_NULL;
|
||||
|
||||
for (int i = 0; i < quads; i++) {
|
||||
if (!JS_SameValue(js, sprites[i].image, img)) {
|
||||
@@ -832,7 +832,7 @@ JSC_CCALL(geometry_tilemap_to_data,
|
||||
int col_len = JS_ArrayLength(js, col);
|
||||
for (int y = 0; y < col_len; y++) {
|
||||
JSValue tile = JS_GetPropertyUint32(js, col, y);
|
||||
if (!JS_IsUndefined(tile) && !JS_IsNull(tile)) {
|
||||
if (!JS_IsNull(tile) && !JS_IsNull(tile)) {
|
||||
tile_count++;
|
||||
}
|
||||
JS_FreeValue(js, tile);
|
||||
@@ -865,7 +865,7 @@ JSC_CCALL(geometry_tilemap_to_data,
|
||||
int col_len = JS_ArrayLength(js, col);
|
||||
for (int y = 0; y < col_len; y++) {
|
||||
JSValue tile = JS_GetPropertyUint32(js, col, y);
|
||||
if (!JS_IsUndefined(tile) && !JS_IsNull(tile)) {
|
||||
if (!JS_IsNull(tile) && !JS_IsNull(tile)) {
|
||||
// Calculate world position
|
||||
float world_x = (x + offset_x) * size_x;
|
||||
float world_y = (y + offset_y) * size_y;
|
||||
@@ -895,7 +895,7 @@ JSC_CCALL(geometry_tilemap_to_data,
|
||||
SDL_FColor default_color = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
if (JS_IsObject(tile)) {
|
||||
JSValue color_val = JS_GetPropertyStr(js, tile, "color");
|
||||
if (!JS_IsUndefined(color_val)) {
|
||||
if (!JS_IsNull(color_val)) {
|
||||
HMM_Vec4 color = js2color(js, color_val);
|
||||
default_color.r = color.r;
|
||||
default_color.g = color.g;
|
||||
|
||||
Reference in New Issue
Block a user