finish custom lua graphics functions
This commit is contained in:
parent
5edd224344
commit
bdc94208d2
@ -48,7 +48,7 @@ int luacon_mouseevent(int mx, int my, int mb, int event);
|
||||
int luacon_keyevent(int key, int modifier, int event);
|
||||
int luacon_eval(char *command);
|
||||
int luacon_part_update(int t, int i, int x, int y, int surround_space, int nt);
|
||||
int luacon_graphics_update(int t, int i);
|
||||
int luacon_graphics_update(int t, int i, int *pixel_mode, int *cola, int *colr, int *colg, int *colb, int *firea, int *firer, int *fireg, int *fireb);
|
||||
char *luacon_geterror();
|
||||
void luacon_close();
|
||||
int luacon_partsread(lua_State* l);
|
||||
|
@ -1860,7 +1860,19 @@ void render_parts(pixel *vid)
|
||||
#ifdef LUACONSOLE
|
||||
if (lua_gr_func[t])
|
||||
{
|
||||
colr = luacon_graphics_update(t,i);
|
||||
if (luacon_graphics_update(t,i, &pixel_mode, &cola, &colr, &colg, &colb, &firea, &firer, &fireg, &fireb))
|
||||
{
|
||||
graphicscache[t].isready = 1;
|
||||
graphicscache[t].pixel_mode = pixel_mode;
|
||||
graphicscache[t].cola = cola;
|
||||
graphicscache[t].colr = colr;
|
||||
graphicscache[t].colg = colg;
|
||||
graphicscache[t].colb = colb;
|
||||
graphicscache[t].firea = firea;
|
||||
graphicscache[t].firer = firer;
|
||||
graphicscache[t].fireg = fireg;
|
||||
graphicscache[t].fireb = fireb;
|
||||
}
|
||||
}
|
||||
else if (ptypes[t].graphics_func)
|
||||
{
|
||||
|
@ -788,19 +788,28 @@ int luacon_part_update(int t, int i, int x, int y, int surround_space, int nt)
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
int luacon_graphics_update(int t, int i)
|
||||
int luacon_graphics_update(int t, int i, int *pixel_mode, int *cola, int *colr, int *colg, int *colb, int *firea, int *firer, int *fireg, int *fireb)
|
||||
{
|
||||
int retval = 0;
|
||||
if(lua_gr_func[t]){
|
||||
lua_rawgeti(l, LUA_REGISTRYINDEX, lua_gr_func[t]);
|
||||
lua_pushinteger(l, i);
|
||||
lua_pcall(l, 1, 1, 0);
|
||||
if(lua_isnumber(l, -1)){
|
||||
retval = (int)lua_tonumber(l, -1);
|
||||
}
|
||||
lua_pop(l, 1);
|
||||
}
|
||||
return retval;
|
||||
int cache = 0;
|
||||
lua_rawgeti(l, LUA_REGISTRYINDEX, lua_gr_func[t]);
|
||||
lua_pushinteger(l, i);
|
||||
lua_pushinteger(l, *colr);
|
||||
lua_pushinteger(l, *colg);
|
||||
lua_pushinteger(l, *colb);
|
||||
lua_pcall(l, 4, 10, 0);
|
||||
|
||||
cache = luaL_optint(l, 2, 0);
|
||||
*pixel_mode = luaL_optint(l, 3, *pixel_mode);
|
||||
*cola = luaL_optint(l, 4, *cola);
|
||||
*colr = luaL_optint(l, 5, *colr);
|
||||
*colg = luaL_optint(l, 6, *colg);
|
||||
*colb = luaL_optint(l, 7, *colb);
|
||||
*firea = luaL_optint(l, 8, *firea);
|
||||
*firer = luaL_optint(l, 9, *firer);
|
||||
*fireg = luaL_optint(l, 10, *fireg);
|
||||
*fireb = luaL_optint(l, 11, *fireb);
|
||||
lua_pop(l, 10);
|
||||
return cache;
|
||||
}
|
||||
char *luacon_geterror(){
|
||||
char *error = lua_tostring(l, -1);
|
||||
|
Loading…
Reference in New Issue
Block a user