[NEW] Multiple lua files

This commit is contained in:
2022-09-19 17:28:43 +02:00
parent 664710d59a
commit aad3ba639a
4 changed files with 41 additions and 20 deletions

View File

@@ -27,6 +27,8 @@ surface_t *map_surface = NULL;
FILE *file = NULL;
bool file_ignore_comma=true;
char *lua_files=NULL;
#define DEST(x, y) dest_surface->p[x+y*dest_surface->w]
#define SOURCE(x, y) source_surface->p[x+y*source_surface->w]
#define TILES(x, y) map_surface->p[x+y*map_surface->w]
@@ -113,6 +115,10 @@ void read_ini() {
else if (strcmp(line, "width") == 0) screen_width = atoi(value);
else if (strcmp(line, "height") == 0) screen_height = atoi(value);
else if (strcmp(line, "zoom") == 0) screen_zoom = atoi(value);
else if (strcmp(line, "files") == 0) {
lua_files = (char*)malloc(strlen(value));
strcpy(lua_files, value);
}
}
}
fclose(f);
@@ -267,7 +273,7 @@ int main(int argc,char*argv[]){
reinit();
debug("MINI SYSTEM BOOTING...");
lua_init();
lua_init(lua_files);
lua_call_init();
while(!exit) {
@@ -281,13 +287,13 @@ int main(int argc,char*argv[]){
lua_quit();
reinit();
} else {
lua_init();
lua_init(lua_files);
lua_call_init();
}
} else if (mini_eve.key.keysym.scancode == SDL_SCANCODE_F5) {
lua_quit();
reinit();
lua_init();
lua_init(lua_files);
lua_call_init();
} else {
key_just_pressed = mini_eve.key.keysym.scancode;