[FEAT] All screen modes implemented
This commit is contained in:
13
lua.cpp
13
lua.cpp
@@ -167,7 +167,7 @@ extern "C" {
|
||||
lua_pushinteger(L, strlen(str));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int cpp_setchar(lua_State *L) {
|
||||
int index = luaL_checkinteger(L, 1);
|
||||
int b0 = luaL_checkinteger(L, 2);
|
||||
@@ -206,6 +206,12 @@ extern "C" {
|
||||
nosound();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_setmode(lua_State *L) {
|
||||
int val = luaL_checkinteger(L, 1);
|
||||
setmode(val);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
lua_State *L;
|
||||
@@ -224,6 +230,7 @@ void lua_init() {
|
||||
debug("error loading game");
|
||||
debug(lua_tostring(L, -1));
|
||||
lua_pop(L,1);
|
||||
setmode(0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -265,6 +272,7 @@ void lua_init() {
|
||||
lua_pushcfunction(L,cpp_poke); lua_setglobal(L, "poke");
|
||||
lua_pushcfunction(L,cpp_sound); lua_setglobal(L, "sound");
|
||||
lua_pushcfunction(L,cpp_nosound); lua_setglobal(L, "nosound");
|
||||
lua_pushcfunction(L,cpp_setmode); lua_setglobal(L, "setmode");
|
||||
|
||||
lua_pushinteger(L, 0); lua_setglobal(L, "KEY_UNKNOWN");
|
||||
lua_pushinteger(L, 4); lua_setglobal(L, "KEY_A");
|
||||
@@ -395,6 +403,7 @@ void lua_init() {
|
||||
debug("runtime error");
|
||||
debug(lua_tostring(L, -1));
|
||||
lua_pop(L,1);
|
||||
setmode(0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -416,6 +425,7 @@ void lua_call_init() {
|
||||
debug("runtime error");
|
||||
debug(lua_tostring(L, -1));
|
||||
lua_pop(L,1);
|
||||
setmode(0);
|
||||
is_playing = false;
|
||||
}
|
||||
}
|
||||
@@ -427,6 +437,7 @@ void lua_call_update() {
|
||||
debug("runtime error");
|
||||
debug(lua_tostring(L, -1));
|
||||
lua_pop(L,1);
|
||||
setmode(0);
|
||||
is_playing = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user