[CHANGED] 'setmode' renamed to 'mode'

This commit is contained in:
2021-12-17 16:43:06 +01:00
parent fe9f4fed9c
commit 64bcedd82f
12 changed files with 19 additions and 16 deletions

3
.gitignore vendored
View File

@@ -3,3 +3,6 @@ ascii
.vscode/* .vscode/*
*.dll *.dll
wiki/* wiki/*
scr_min.c
tests.lua
fake_editor.lua

View File

@@ -189,7 +189,7 @@ int main(int argc,char*argv[]) {
while(!exit) { while(!exit) {
if (should_reset) { if (should_reset) {
should_reset = false; should_reset = false;
setmode(1); mode(1);
reinit(); reinit();
lua_init(lua_filename); lua_init(lua_filename);
lua_call_init(); lua_call_init();
@@ -629,8 +629,8 @@ void play(const char* str) {
audio_state = AUDIO_PLAY; audio_state = AUDIO_PLAY;
} }
void setmode(const uint8_t mode) { void mode(const uint8_t val) {
current_mode = mode; current_mode = val;
reinit(); reinit();
cls(); cls();
} }

View File

@@ -197,7 +197,7 @@ void sound(float freq, uint32_t len);
void nosound(); void nosound();
void play(const char* str); void play(const char* str);
void setmode(const uint8_t mode); void mode(const uint8_t val);
void load(const char* str); void load(const char* str);
void fileout(const char* str, uint16_t addr, uint16_t size); void fileout(const char* str, uint16_t addr, uint16_t size);

View File

@@ -1,5 +1,5 @@
function init() function init()
setmode(1) mode(1)
reset() reset()
end end

View File

@@ -1,5 +1,5 @@
function init() function init()
setmode(1) mode(1)
mountains = {} mountains = {}
local val = 2 local val = 2

View File

@@ -6,7 +6,7 @@
--]] --]]
function init() 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 color(0,0) -- tinta i fondo a negre
cls() -- borrem pantalla cls() -- borrem pantalla

View File

@@ -1,5 +1,5 @@
function init() function init()
setmode(1) mode(1)
setchar(94, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) setchar(94, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
piano = { "_____", "\143\143\143\154\154", " ", "\143\143\143\154\154", "^^^^^", "_____", 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", "^^^^^" } "\143\143\143\154\154", " ", "\143\143\143\154\154", " ", "\143\143\143\154\154", "^^^^^" }

View File

@@ -111,7 +111,7 @@ void print(int x, int y, const char* text, Uint8 color) {
--]] --]]
function init() function init()
setmode(1) mode(1)
current_piece = starting[rnd(7)+1] current_piece = starting[rnd(7)+1]
next_piece = starting[rnd(7)+1] next_piece = starting[rnd(7)+1]

View File

@@ -348,9 +348,9 @@ extern "C" {
return 0; return 0;
} }
static int cpp_setmode(lua_State *L) { static int cpp_mode(lua_State *L) {
int val = luaL_checkinteger(L, 1); int val = luaL_checkinteger(L, 1);
setmode(mid(0,val,3)); mode(mid(0,val,3));
return 0; return 0;
} }
@@ -407,7 +407,7 @@ bool lua_is_playing() {
return lua_state == STATE_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) { void lua_init(const char* filename, const bool start_playing) {
if (lua_state != STATE_STOPPED) lua_quit(); 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_sound); lua_setglobal(L, "sound");
lua_pushcfunction(L,cpp_nosound); lua_setglobal(L, "nosound"); lua_pushcfunction(L,cpp_nosound); lua_setglobal(L, "nosound");
lua_pushcfunction(L,cpp_play); lua_setglobal(L, "play"); 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_load); lua_setglobal(L, "load");
lua_pushcfunction(L,cpp_log); lua_setglobal(L, "log"); lua_pushcfunction(L,cpp_log); lua_setglobal(L, "log");

View File

@@ -1,6 +1,6 @@
ind = 22 ind = 22
function init() function init()
setmode(2) mode(2)
map = {} map = {}
col = {} col = {}
for i=0,299 do for i=0,299 do

View File

@@ -1,5 +1,5 @@
function init() function init()
setmode(1) mode(1)
setchar(94, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) setchar(94, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
piano = { "_____", "\143\143\143\154\154", " ", "\143\143\143\154\154", "^^^^^", "_____", 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", "^^^^^" } "\143\143\143\154\154", " ", "\143\143\143\154\154", " ", "\143\143\143\154\154", "^^^^^" }

View File

@@ -1,6 +1,6 @@
ind = 22 ind = 22
function init() function init()
setmode(1) mode(1)
map = {} map = {}
col = {} col = {}
for i=0,1199 do for i=0,1199 do