Special functions should have common formatting #503
This commit is contained in:
parent
607515947c
commit
e0cc606d2c
14
src/jsapi.c
14
src/jsapi.c
|
@ -899,14 +899,12 @@ static void callJavascriptTick(tic_mem* tic)
|
|||
}
|
||||
}
|
||||
|
||||
static void callJavascriptScanline(tic_mem* memory, s32 row, void* data)
|
||||
static void callJavascriptScanlineName(tic_mem* memory, s32 row, void* data, const char* name)
|
||||
{
|
||||
tic_machine* machine = (tic_machine*)memory;
|
||||
duk_context* duk = machine->js;
|
||||
|
||||
const char* ScanlineFunc = ApiKeywords[1];
|
||||
|
||||
if(duk_get_global_string(duk, ScanlineFunc))
|
||||
if(duk_get_global_string(duk, name))
|
||||
{
|
||||
duk_push_int(duk, row);
|
||||
|
||||
|
@ -917,6 +915,14 @@ static void callJavascriptScanline(tic_mem* memory, s32 row, void* data)
|
|||
duk_pop(duk);
|
||||
}
|
||||
|
||||
static void callJavascriptScanline(tic_mem* memory, s32 row, void* data)
|
||||
{
|
||||
callJavascriptScanlineName(memory, row, data, ApiKeywords[1]);
|
||||
|
||||
// try to call old scanline
|
||||
callJavascriptScanlineName(memory, row, data, "scanline");
|
||||
}
|
||||
|
||||
static void callJavascriptOverlap(tic_mem* memory, void* data)
|
||||
{
|
||||
tic_machine* machine = (tic_machine*)memory;
|
||||
|
|
14
src/luaapi.c
14
src/luaapi.c
|
@ -1335,16 +1335,14 @@ static void callLuaTick(tic_mem* tic)
|
|||
}
|
||||
}
|
||||
|
||||
static void callLuaScanline(tic_mem* memory, s32 row, void* data)
|
||||
static void callLuaScanlineName(tic_mem* memory, s32 row, void* data, const char* name)
|
||||
{
|
||||
tic_machine* machine = (tic_machine*)memory;
|
||||
lua_State* lua = machine->lua;
|
||||
|
||||
if (lua)
|
||||
{
|
||||
const char* ScanlineFunc = ApiKeywords[1];
|
||||
|
||||
lua_getglobal(lua, ScanlineFunc);
|
||||
lua_getglobal(lua, name);
|
||||
if(lua_isfunction(lua, -1))
|
||||
{
|
||||
lua_pushinteger(lua, row);
|
||||
|
@ -1355,6 +1353,14 @@ static void callLuaScanline(tic_mem* memory, s32 row, void* data)
|
|||
}
|
||||
}
|
||||
|
||||
static void callLuaScanline(tic_mem* memory, s32 row, void* data)
|
||||
{
|
||||
callLuaScanlineName(memory, row, data, ApiKeywords[1]);
|
||||
|
||||
// try to call old scanline
|
||||
callLuaScanlineName(memory, row, data, "scanline");
|
||||
}
|
||||
|
||||
static void callLuaOverlap(tic_mem* memory, void* data)
|
||||
{
|
||||
tic_machine* machine = (tic_machine*)memory;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#define SFX_DEF_SPEED (1 << SFX_SPEED_BITS)
|
||||
|
||||
#define API_KEYWORDS {"TIC", "scanline", "OVR", "print", "cls", "pix", "line", "rect", "rectb", \
|
||||
#define API_KEYWORDS {"TIC", "SCN", "OVR", "print", "cls", "pix", "line", "rect", "rectb", \
|
||||
"spr", "btn", "btnp", "sfx", "map", "mget", "mset", "peek", "poke", "peek4", "poke4", \
|
||||
"memcpy", "memset", "trace", "pmem", "time", "exit", "font", "mouse", "circ", "circb", "tri", "textri", \
|
||||
"clip", "music", "sync", "reset", "key", "keyp"}
|
||||
|
|
Loading…
Reference in New Issue