diff --git a/.gitignore b/.gitignore index 60cbd42..d5aba9c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ ascii .vscode/* *.dll wiki/* +scr_min.c +tests.lua +fake_editor.lua diff --git a/ascii.cpp b/ascii.cpp index 8290d5d..05d3ecd 100644 --- a/ascii.cpp +++ b/ascii.cpp @@ -189,7 +189,7 @@ int main(int argc,char*argv[]) { while(!exit) { if (should_reset) { should_reset = false; - setmode(1); + mode(1); reinit(); lua_init(lua_filename); lua_call_init(); @@ -629,8 +629,8 @@ void play(const char* str) { audio_state = AUDIO_PLAY; } -void setmode(const uint8_t mode) { - current_mode = mode; +void mode(const uint8_t val) { + current_mode = val; reinit(); cls(); } diff --git a/ascii.h b/ascii.h index 5a8ffc4..e8fe2a9 100644 --- a/ascii.h +++ b/ascii.h @@ -197,7 +197,7 @@ void sound(float freq, uint32_t len); void nosound(); void play(const char* str); -void setmode(const uint8_t mode); +void mode(const uint8_t val); void load(const char* str); void fileout(const char* str, uint16_t addr, uint16_t size); diff --git a/demos/breakout.lua b/demos/breakout.lua index d073a5d..3423da7 100644 --- a/demos/breakout.lua +++ b/demos/breakout.lua @@ -1,5 +1,5 @@ function init() - setmode(1) + mode(1) reset() end diff --git a/tools/defender.lua b/demos/defender.lua similarity index 98% rename from tools/defender.lua rename to demos/defender.lua index 6676b37..056fe04 100644 --- a/tools/defender.lua +++ b/demos/defender.lua @@ -1,5 +1,5 @@ function init() - setmode(1) + mode(1) mountains = {} local val = 2 diff --git a/demos/matrix.lua b/demos/matrix.lua index 4ea815e..30343af 100644 --- a/demos/matrix.lua +++ b/demos/matrix.lua @@ -6,7 +6,7 @@ --]] function init() - setmode(1) -- fiquem el mode multicolor de 40x30 caracters + mode(1) -- fiquem el mode multicolor de 40x30 caracters color(0,0) -- tinta i fondo a negre cls() -- borrem pantalla diff --git a/demos/pong.lua b/demos/pong.lua index 2d827b7..5247ce4 100644 --- a/demos/pong.lua +++ b/demos/pong.lua @@ -1,5 +1,5 @@ function init() - setmode(1) + mode(1) setchar(94, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) piano = { "_____", "\143\143\143\154\154", " ", "\143\143\143\154\154", "^^^^^", "_____", "\143\143\143\154\154", " ", "\143\143\143\154\154", " ", "\143\143\143\154\154", "^^^^^" } diff --git a/demos/tetris.lua b/demos/tetris.lua index 306255d..30e5b1f 100644 --- a/demos/tetris.lua +++ b/demos/tetris.lua @@ -111,7 +111,7 @@ void print(int x, int y, const char* text, Uint8 color) { --]] function init() - setmode(1) + mode(1) current_piece = starting[rnd(7)+1] next_piece = starting[rnd(7)+1] diff --git a/lua.cpp b/lua.cpp index d7b021d..d2e5f00 100644 --- a/lua.cpp +++ b/lua.cpp @@ -348,9 +348,9 @@ extern "C" { return 0; } - static int cpp_setmode(lua_State *L) { + static int cpp_mode(lua_State *L) { int val = luaL_checkinteger(L, 1); - setmode(mid(0,val,3)); + mode(mid(0,val,3)); return 0; } @@ -407,7 +407,7 @@ bool lua_is_playing() { return lua_state == STATE_PLAYING; } -const char boot[] = "function init()setmode(1)cls()play('o5l0v5cegv4cegv3cegv2cegv1ceg')memcpy(360,4608,240)memcpy(1560,4848,240)ink(1)print('G A M E',8,16)ink(4)print('S Y S T E M',20,16)ink(7)print('mini',9,8)ink(8)print('v0.5.4',34,29)w=0 end function update()w=w+1 if w>90 then cls()load()end end"; +const char boot[] = "function init()mode(1)cls()play('o5l0v5cegv4cegv3cegv2cegv1ceg')memcpy(360,4608,240)memcpy(1560,4848,240)ink(1)print('G A M E',8,16)ink(4)print('S Y S T E M',20,16)ink(7)print('mini',9,8)ink(8)print('v0.5.4',34,29)w=0 end function update()w=w+1 if w>90 then cls()load()end end"; void lua_init(const char* filename, const bool start_playing) { if (lua_state != STATE_STOPPED) lua_quit(); @@ -476,7 +476,7 @@ void lua_init(const char* filename, const bool start_playing) { lua_pushcfunction(L,cpp_sound); lua_setglobal(L, "sound"); lua_pushcfunction(L,cpp_nosound); lua_setglobal(L, "nosound"); lua_pushcfunction(L,cpp_play); lua_setglobal(L, "play"); - lua_pushcfunction(L,cpp_setmode); lua_setglobal(L, "setmode"); + lua_pushcfunction(L,cpp_mode); lua_setglobal(L, "mode"); lua_pushcfunction(L,cpp_load); lua_setglobal(L, "load"); lua_pushcfunction(L,cpp_log); lua_setglobal(L, "log"); diff --git a/tools/mapedit.lua b/tools/mapedit.lua index ec9f54c..ddb400f 100644 --- a/tools/mapedit.lua +++ b/tools/mapedit.lua @@ -1,6 +1,6 @@ ind = 22 function init() - setmode(2) + mode(2) map = {} col = {} for i=0,299 do diff --git a/tools/music.lua b/tools/music.lua index ba564ec..9453b89 100644 --- a/tools/music.lua +++ b/tools/music.lua @@ -1,5 +1,5 @@ function init() - setmode(1) + mode(1) setchar(94, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) piano = { "_____", "\143\143\143\154\154", " ", "\143\143\143\154\154", "^^^^^", "_____", "\143\143\143\154\154", " ", "\143\143\143\154\154", " ", "\143\143\143\154\154", "^^^^^" } diff --git a/tools/scredit.lua b/tools/scredit.lua index 6161af7..7ccf015 100644 --- a/tools/scredit.lua +++ b/tools/scredit.lua @@ -1,6 +1,6 @@ ind = 22 function init() - setmode(1) + mode(1) map = {} col = {} for i=0,1199 do