Compare commits

..

No commits in common. "c8c7fb1b522c17af6e57036a941630fcec70cbfa" and "efd52dae7d92e5fc895004a5f4ea783eaf8b7514" have entirely different histories.

9 changed files with 3 additions and 37 deletions

1
.gitignore vendored
View file

@ -7,4 +7,3 @@ raylib/
*.swp
*.tiled-session
map/maps_out.c
map/converter

View file

@ -3,7 +3,7 @@
OUTNAME = mtycoon
CFLAGS = -O2 -Wall -Wextra -g -I./raylib/include -I./lua/include -pipe
CFLAGS = -O0 -Wall -Wextra -g -I./raylib/include -I./lua/include -pipe
CC = gcc

BIN
map/converter Executable file

Binary file not shown.

View file

@ -22,8 +22,3 @@ end
function on_frame(game)
end
function on_load(game, map)
mtprint("loaded map :")
mtprint(map)
end

View file

@ -58,6 +58,8 @@ int init_game(Game *game){
return 1;
}
load_map(game, 0);
int c_worker = 0;
for(int k = 0; k < 16; k++){

View file

@ -258,29 +258,6 @@ void lua_onframe(Game *game){
lua_callloop(game, "on_frame");
}
void lua_onmapload(Game *game, int map){
gl_game = game;
for(int i = 0; i < lstate_n; i++){
lua_State *L = lstates[i];
lua_mkgame(L, game);
if(lua_getglobal(L, "on_load") == LUA_TNIL){
lua_pop(L, 2);
continue;
}
lua_pushvalue(L, -2);
lua_pushinteger(L, map);
int ret = lua_pcall(L, 2, 0, 0);
if(ret)
puts(lua_tostring(L, -1));
else{
lua_pushliteral(L, "cash");
lua_gettable(L, -2);
if(lua_isinteger(L, -1))
game->cash = lua_tointeger(L, -1);
}
}
}
void lua_mt_init(lua_State *L){
for(int i = 0; i < sizeof(exported_funcs)/sizeof(*exported_funcs); i++)
lua_register(L, exported_funcs[i].name, exported_funcs[i].fn);

View file

@ -7,8 +7,6 @@ void lua_ontick(Game *game);
void lua_onframe(Game *game);
void lua_onmapload(Game *game, int map);
void script_init();
void script_clean();

View file

@ -30,7 +30,6 @@ int init(Game *game){
err |= init_game(game);
init_ui();
script_init(game);
load_map(game, 0);
return err;
}

View file

@ -10,7 +10,6 @@
#include "types.h"
#include "draw.h"
#include "lua_inter.h"
extern MapCollec mapcollec;
@ -40,9 +39,6 @@ int load_map(Game *game, int mapn){
return 1;
if(generate_coll(game, mapn))
return 1;
lua_onmapload(game, mapn);
return 0;
}