2012-05-05 20:06:34 -05:00
|
|
|
/**
|
|
|
|
* Powder Toy - Lua console (header)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2011-05-30 10:22:39 -05:00
|
|
|
#ifndef LUACONSOLEH
|
|
|
|
#define LUACONSOLEH
|
2011-06-15 12:33:33 -05:00
|
|
|
#ifdef LUA_R_INCL
|
|
|
|
#include <lua.h>
|
|
|
|
#include <lauxlib.h>
|
|
|
|
#include <lualib.h>
|
|
|
|
#else
|
2011-05-30 10:22:39 -05:00
|
|
|
#include <lua5.1/lua.h>
|
|
|
|
#include <lua5.1/lauxlib.h>
|
|
|
|
#include <lua5.1/lualib.h>
|
2011-06-15 12:33:33 -05:00
|
|
|
#endif
|
2011-05-30 10:22:39 -05:00
|
|
|
#include <defines.h>
|
|
|
|
|
2011-10-26 08:55:26 -05:00
|
|
|
#define LOCAL_LUA_DIR "Lua"
|
|
|
|
|
2011-08-20 12:18:09 -05:00
|
|
|
#define LUACON_MDOWN 1
|
|
|
|
#define LUACON_MUP 2
|
|
|
|
#define LUACON_MPRESS 3
|
|
|
|
#define LUACON_KDOWN 1
|
|
|
|
#define LUACON_KUP 2
|
|
|
|
|
2011-12-24 17:44:00 -06:00
|
|
|
//Bitmasks for things that might need recalculating after changes to tpt.el
|
|
|
|
#define LUACON_EL_MODIFIED_CANMOVE 0x1
|
|
|
|
#define LUACON_EL_MODIFIED_GRAPHICS 0x2
|
|
|
|
#define LUACON_EL_MODIFIED_MENUS 0x4
|
|
|
|
|
2012-05-24 12:08:55 -05:00
|
|
|
int *lua_el_func, *lua_el_mode, *lua_gr_func;
|
2011-11-18 13:38:08 -06:00
|
|
|
|
2011-05-30 10:22:39 -05:00
|
|
|
void luacon_open();
|
2012-07-07 23:00:47 -05:00
|
|
|
int luacon_step(int mx, int my, int selectl, int selectr, int bsx, int bsy);
|
|
|
|
int luacon_mouseevent(int mx, int my, int mb, int event, int mouse_wheel);
|
2011-08-22 15:22:21 -05:00
|
|
|
int luacon_keyevent(int key, int modifier, int event);
|
2011-05-30 10:22:39 -05:00
|
|
|
int luacon_eval(char *command);
|
2011-11-18 13:38:08 -06:00
|
|
|
int luacon_part_update(int t, int i, int x, int y, int surround_space, int nt);
|
2012-05-10 16:44:43 -05:00
|
|
|
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);
|
2011-05-30 12:15:56 -05:00
|
|
|
char *luacon_geterror();
|
2011-05-30 10:22:39 -05:00
|
|
|
void luacon_close();
|
2011-12-08 06:16:50 -06:00
|
|
|
int luacon_partsread(lua_State* l);
|
|
|
|
int luacon_partswrite(lua_State* l);
|
|
|
|
int luacon_partread(lua_State* l);
|
|
|
|
int luacon_partwrite(lua_State* l);
|
2011-12-08 03:52:44 -06:00
|
|
|
int luacon_elementread(lua_State* l);
|
|
|
|
int luacon_elementwrite(lua_State* l);
|
2011-12-09 10:30:33 -06:00
|
|
|
int luacon_transitionread(lua_State* l);
|
|
|
|
int luacon_transitionwrite(lua_State* l);
|
2011-12-08 06:16:50 -06:00
|
|
|
int luacon_particle_getproperty(char * key, int * format);
|
2011-12-09 10:30:33 -06:00
|
|
|
int luacon_transition_getproperty(char * key, int * format);
|
2011-12-24 17:44:00 -06:00
|
|
|
int luacon_element_getproperty(char * key, int * format, unsigned int * modified_stuff);
|
2011-05-30 10:22:39 -05:00
|
|
|
int process_command_lua(pixel *vid_buf, char *console, char *console_error);
|
2012-05-23 19:08:53 -05:00
|
|
|
void lua_hook(lua_State *L, lua_Debug *ar);
|
2011-05-30 10:22:39 -05:00
|
|
|
|
2011-06-25 00:32:54 -05:00
|
|
|
int getPartIndex_curIdx;
|
|
|
|
|
2011-05-30 10:22:39 -05:00
|
|
|
//TPT Interface
|
|
|
|
int luatpt_test(lua_State* l);
|
2011-11-18 13:38:08 -06:00
|
|
|
int luatpt_getelement(lua_State *l);
|
|
|
|
int luatpt_element_func(lua_State *l);
|
2012-05-24 12:08:55 -05:00
|
|
|
int luatpt_graphics_func(lua_State *l);
|
2011-05-30 10:45:39 -05:00
|
|
|
int luatpt_drawtext(lua_State* l);
|
2011-05-30 13:44:17 -05:00
|
|
|
int luatpt_create(lua_State* l);
|
|
|
|
int luatpt_setpause(lua_State* l);
|
|
|
|
int luatpt_togglepause(lua_State* l);
|
2011-09-21 17:36:35 -05:00
|
|
|
int luatpt_togglewater(lua_State* l);
|
2011-05-30 13:44:17 -05:00
|
|
|
int luatpt_setconsole(lua_State* l);
|
|
|
|
int luatpt_log(lua_State* l);
|
2011-06-01 06:16:33 -05:00
|
|
|
int luatpt_set_pressure(lua_State* l);
|
|
|
|
int luatpt_set_gravity(lua_State* l);
|
|
|
|
int luatpt_reset_gravity_field(lua_State* l);
|
2011-05-30 13:44:17 -05:00
|
|
|
int luatpt_reset_velocity(lua_State* l);
|
|
|
|
int luatpt_reset_spark(lua_State* l);
|
|
|
|
int luatpt_set_property(lua_State* l);
|
|
|
|
int luatpt_get_property(lua_State* l);
|
2012-02-20 06:02:52 -06:00
|
|
|
int luatpt_set_wallmap(lua_State* l);
|
|
|
|
int luatpt_get_wallmap(lua_State* l);
|
|
|
|
int luatpt_set_elecmap(lua_State* l);
|
|
|
|
int luatpt_get_elecmap(lua_State* l);
|
2011-05-30 13:44:17 -05:00
|
|
|
int luatpt_drawpixel(lua_State* l);
|
|
|
|
int luatpt_drawrect(lua_State* l);
|
|
|
|
int luatpt_fillrect(lua_State* l);
|
2011-10-03 13:34:30 -05:00
|
|
|
int luatpt_drawline(lua_State* l);
|
2011-05-30 13:44:17 -05:00
|
|
|
int luatpt_textwidth(lua_State* l);
|
|
|
|
int luatpt_get_name(lua_State* l);
|
|
|
|
int luatpt_set_shortcuts(lua_State* l);
|
|
|
|
int luatpt_delete(lua_State* l);
|
2011-05-30 14:11:34 -05:00
|
|
|
int luatpt_register_step(lua_State* l);
|
2011-06-03 08:21:46 -05:00
|
|
|
int luatpt_unregister_step(lua_State* l);
|
2011-08-05 08:54:24 -05:00
|
|
|
int luatpt_register_mouseclick(lua_State* l);
|
|
|
|
int luatpt_unregister_mouseclick(lua_State* l);
|
|
|
|
int luatpt_register_keypress(lua_State* l);
|
|
|
|
int luatpt_unregister_keypress(lua_State* l);
|
2011-06-08 10:30:36 -05:00
|
|
|
int luatpt_input(lua_State* l);
|
|
|
|
int luatpt_message_box(lua_State* l);
|
2011-06-25 00:32:54 -05:00
|
|
|
int luatpt_get_numOfParts(lua_State* l);
|
|
|
|
int luatpt_start_getPartIndex(lua_State* l);
|
|
|
|
int luatpt_getPartIndex(lua_State* l);
|
|
|
|
int luatpt_next_getPartIndex(lua_State* l);
|
2011-07-22 08:55:43 -05:00
|
|
|
int luatpt_hud(lua_State* l);
|
|
|
|
int luatpt_gravity(lua_State* l);
|
|
|
|
int luatpt_airheat(lua_State* l);
|
|
|
|
int luatpt_active_menu(lua_State* l);
|
|
|
|
int luatpt_decorations_enable(lua_State* l);
|
|
|
|
int luatpt_cmode_set(lua_State* l);
|
2011-07-30 19:31:34 -05:00
|
|
|
int luatpt_error(lua_State* l);
|
|
|
|
int luatpt_heat(lua_State* l);
|
2011-08-11 07:02:00 -05:00
|
|
|
int luatpt_setfire(lua_State* l);
|
2011-08-11 14:12:52 -05:00
|
|
|
int luatpt_setdebug(lua_State* l);
|
2011-08-16 11:45:44 -05:00
|
|
|
int luatpt_setfpscap(lua_State* l);
|
2011-08-25 06:20:00 -05:00
|
|
|
int luatpt_getscript(lua_State* l);
|
2011-08-30 04:26:42 -05:00
|
|
|
int luatpt_setwindowsize(lua_State* l);
|
2011-10-21 11:37:26 -05:00
|
|
|
int luatpt_screenshot(lua_State* l);
|
2011-05-30 10:22:39 -05:00
|
|
|
#endif
|