add tween; fix collision js ref bug

This commit is contained in:
2023-12-28 13:57:22 +00:00
parent 2195f9f5db
commit c4b2b23941
6 changed files with 201 additions and 14 deletions

View File

@@ -525,7 +525,7 @@ static struct postphys_cb *begins = NULL;
void flush_collide_cbs() {
for (int i = 0; i < arrlen(begins); i++) {
script_callee(begins[i].c, 1, &begins[i].send);
// JS_FreeValue(js, begins[i].send);
JS_FreeValue(js, begins[i].send);
}
arrsetlen(begins,0);
@@ -538,7 +538,7 @@ void duk_call_phys_cb(HMM_Vec2 norm, struct callee c, gameobject *hit, cpArbiter
JSValue obj = JS_NewObject(js);
JS_SetPropertyStr(js, obj, "normal", vec2js(norm));
JS_SetPropertyStr(js, obj, "obj", hit->ref);
JS_SetPropertyStr(js, obj, "obj", JS_DupValue(js,hit->ref));
JS_SetPropertyStr(js, obj, "sensor", JS_NewBool(js, cpShapeGetSensor(shape2)));
HMM_Vec2 srfv;
srfv.cp = cpArbiterGetSurfaceVelocity(arb);

View File

@@ -73,10 +73,8 @@ void script_stop()
{
script_evalf("Event.notify('quit');");
send_signal("quit",0,NULL);
for (int i = 0; i < shlen(jsstrs); i++)
JS_FreeValue(js,jsstrs[i].value);
JS_FreeContext(js);
JS_FreeRuntime(rt);
}
@@ -185,6 +183,7 @@ time_t jso_file(const char *file)
JSValue ret = JS_EvalFunction(js, obj);
js_print_exception(ret);
JS_FreeValue(js,ret);
JS_FreeValue(js,obj);
free(byte);
return file_mod_secs(file);
}

View File

@@ -276,12 +276,12 @@ int main(int argc, char **argv) {
snprintf(fname, 100, "yugine-%ld.log", now);
log_setfile(fname);
}
/*
signal(SIGSEGV, seghandle);
signal(SIGABRT, seghandle);
signal(SIGFPE, seghandle);
signal(SIGBUS, seghandle);
*/
#endif
#ifdef STEAM