MERGE
This commit is contained in:
commit
f7bd1198b1
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,8 +3,8 @@
|
|||||||
powder.def
|
powder.def
|
||||||
gmon.out
|
gmon.out
|
||||||
*.*.orig
|
*.*.orig
|
||||||
build/powder*
|
|
||||||
build/stamps/*
|
build/stamps/*
|
||||||
*~
|
*~
|
||||||
*.pyc
|
*.pyc
|
||||||
utils/*
|
utils/*
|
||||||
|
*.log
|
2
Makefile
2
Makefile
@ -23,7 +23,7 @@ powder-debug-64: $(SOURCES)
|
|||||||
mv $@ build
|
mv $@ build
|
||||||
powder-debug: $(SOURCES)
|
powder-debug: $(SOURCES)
|
||||||
$(PYCOMMAND)
|
$(PYCOMMAND)
|
||||||
$(COMPILER) -m32 -o$@ $(FLAGS_DBUG) -DLIN32 $(SOURCES) -Iincludes/
|
$(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 $(FLAGS_DBUG)
|
||||||
mv $@ build
|
mv $@ build
|
||||||
powder-sse3: $(SOURCES)
|
powder-sse3: $(SOURCES)
|
||||||
$(PYCOMMAND)
|
$(PYCOMMAND)
|
||||||
|
@ -28,7 +28,7 @@ def init():
|
|||||||
NICK=name+"[tpt]"
|
NICK=name+"[tpt]"
|
||||||
IDENT=name+"[tpt]"
|
IDENT=name+"[tpt]"
|
||||||
REALNAME=name
|
REALNAME=name
|
||||||
CHANNEL="#foobar7"
|
CHANNEL="#powder"
|
||||||
readbuffer=""
|
readbuffer=""
|
||||||
|
|
||||||
def exit():
|
def exit():
|
||||||
@ -57,7 +57,7 @@ def key(keyy) :
|
|||||||
except:
|
except:
|
||||||
key.pmod=(False,False,False)
|
key.pmod=(False,False,False)
|
||||||
global typing,typed
|
global typing,typed
|
||||||
print "got %s"%repr(keyy)
|
#print "got %s"%repr(keyy)
|
||||||
ctrl1,ctrl2,alt1,alt2,shift1,shift2=tpt.get_modifier()
|
ctrl1,ctrl2,alt1,alt2,shift1,shift2=tpt.get_modifier()
|
||||||
mod=(ctrl1 or ctrl2,alt1 or alt2,shift1 or shift2)
|
mod=(ctrl1 or ctrl2,alt1 or alt2,shift1 or shift2)
|
||||||
skip=False
|
skip=False
|
||||||
|
BIN
build/powder
Executable file
BIN
build/powder
Executable file
Binary file not shown.
27
getheader.py
27
getheader.py
@ -13,6 +13,33 @@ args="-lpython%s -lm -L%s"%(sys.version[:3],os.path.join(sys.exec_prefix,"lib","
|
|||||||
print "\n windows args are"
|
print "\n windows args are"
|
||||||
print args,"-I%s"%path
|
print args,"-I%s"%path
|
||||||
|
|
||||||
|
ext=False
|
||||||
|
#see if we're on 64bit.
|
||||||
|
with open("./includes/defines.h") as fid:
|
||||||
|
for line in fid:
|
||||||
|
if(line.startswith("#define") and line.count("PYEXT")>0):
|
||||||
|
print "using external console.py"
|
||||||
|
ext=True
|
||||||
|
|
||||||
|
if(ext):
|
||||||
|
print "external"
|
||||||
|
with open("./src/python/tpt_console.py") as fid:
|
||||||
|
consolepy=fid.read()
|
||||||
|
script="""
|
||||||
|
import tempfile,os.path,sys
|
||||||
|
dir=tempfile.gettempdir()
|
||||||
|
sys.path.append(dir)
|
||||||
|
tmp=%s
|
||||||
|
print "making console.py @ %%s"%%os.path.join(dir,"tpt_console.py")
|
||||||
|
with open(os.path.join(dir,"tpt_console.py"),"w") as fid:
|
||||||
|
fid.write(tmp)
|
||||||
|
"""%repr(consolepy)
|
||||||
|
tmp=[hex(ord(char)) for char in script]
|
||||||
|
out=["unsigned char tpt_console_py[] = {",','.join(tmp),"};"]
|
||||||
|
with open("./includes/pyconsole.h","w") as fid:
|
||||||
|
fid.write(''.join(out))
|
||||||
|
else:
|
||||||
|
print "internal"
|
||||||
#unsigned char tpt_console_pyc[] = { 0x1B, 0x57};
|
#unsigned char tpt_console_pyc[] = { 0x1B, 0x57};
|
||||||
lst=[]
|
lst=[]
|
||||||
compileall.compile_dir("./src/python", force=1)
|
compileall.compile_dir("./src/python", force=1)
|
||||||
|
@ -68,6 +68,9 @@ extern unsigned char ZSIZE;
|
|||||||
#define BRUSH_NUM 2
|
#define BRUSH_NUM 2
|
||||||
|
|
||||||
#define PYCONSOLE
|
#define PYCONSOLE
|
||||||
|
//#define PYEXT
|
||||||
|
//WARNING pyext must be defined on 64bit!
|
||||||
|
//also, don't add a comment on that line, it breaks.
|
||||||
|
|
||||||
#ifdef PIX16
|
#ifdef PIX16
|
||||||
typedef unsigned short pixel;
|
typedef unsigned short pixel;
|
||||||
|
File diff suppressed because one or more lines are too long
118
src/main.c
118
src/main.c
@ -1213,6 +1213,7 @@ emb_create(PyObject *self, PyObject *args, PyObject *keywds)
|
|||||||
return Py_BuildValue("i",create_part(-1,x,y,t));
|
return Py_BuildValue("i",create_part(-1,x,y,t));
|
||||||
}
|
}
|
||||||
//sys_pause = !sys_pause
|
//sys_pause = !sys_pause
|
||||||
|
static PyObject*
|
||||||
emb_pause(PyObject *self, PyObject *args)
|
emb_pause(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int x,y,t;
|
int x,y,t;
|
||||||
@ -1223,6 +1224,7 @@ emb_pause(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_unpause(PyObject *self, PyObject *args)
|
emb_unpause(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int x,y,t;
|
int x,y,t;
|
||||||
@ -1233,6 +1235,7 @@ emb_unpause(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_toggle_pause(PyObject *self, PyObject *args)
|
emb_toggle_pause(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int x,y,t;
|
int x,y,t;
|
||||||
@ -1245,6 +1248,7 @@ emb_toggle_pause(PyObject *self, PyObject *args)
|
|||||||
|
|
||||||
//console_mode
|
//console_mode
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_toggle_console(PyObject *self, PyObject *args)
|
emb_toggle_console(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int x,y,t;
|
int x,y,t;
|
||||||
@ -1255,6 +1259,7 @@ emb_toggle_console(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_open_console(PyObject *self, PyObject *args)
|
emb_open_console(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int x,y,t;
|
int x,y,t;
|
||||||
@ -1265,6 +1270,7 @@ emb_open_console(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_close_console(PyObject *self, PyObject *args)
|
emb_close_console(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int x,y,t;
|
int x,y,t;
|
||||||
@ -1275,7 +1281,7 @@ emb_close_console(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_log(PyObject *self, PyObject *args)
|
emb_log(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
char *buffer;
|
char *buffer;
|
||||||
@ -1289,6 +1295,7 @@ emb_log(PyObject *self, PyObject *args)
|
|||||||
|
|
||||||
char console_more=0;
|
char console_more=0;
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_console_more(PyObject *self, PyObject *args)
|
emb_console_more(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
if(!PyArg_ParseTuple(args, ":log"))
|
if(!PyArg_ParseTuple(args, ":log"))
|
||||||
@ -1298,6 +1305,7 @@ emb_console_more(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_console_less(PyObject *self, PyObject *args)
|
emb_console_less(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
if(!PyArg_ParseTuple(args, ":log"))
|
if(!PyArg_ParseTuple(args, ":log"))
|
||||||
@ -1309,7 +1317,7 @@ emb_console_less(PyObject *self, PyObject *args)
|
|||||||
|
|
||||||
//drawtext(vid_buf, 15, 175-(cc*12), currentcommand->command, 255, 255, 255, 255);
|
//drawtext(vid_buf, 15, 175-(cc*12), currentcommand->command, 255, 255, 255, 255);
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_reset_pressure(PyObject *self, PyObject *args)
|
emb_reset_pressure(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
if(!PyArg_ParseTuple(args, ":reset_pressure"))
|
if(!PyArg_ParseTuple(args, ":reset_pressure"))
|
||||||
@ -1323,6 +1331,7 @@ emb_reset_pressure(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_reset_velocity(PyObject *self, PyObject *args)
|
emb_reset_velocity(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
if(!PyArg_ParseTuple(args, ":reset_velocity"))
|
if(!PyArg_ParseTuple(args, ":reset_velocity"))
|
||||||
@ -1337,6 +1346,7 @@ emb_reset_velocity(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_reset_sparks(PyObject *self, PyObject *args)
|
emb_reset_sparks(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
if(!PyArg_ParseTuple(args, ":reset_sparks"))
|
if(!PyArg_ParseTuple(args, ":reset_sparks"))
|
||||||
@ -1353,6 +1363,7 @@ emb_reset_sparks(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_set_life(PyObject *self, PyObject *args, PyObject *keywds)
|
emb_set_life(PyObject *self, PyObject *args, PyObject *keywds)
|
||||||
{
|
{
|
||||||
int i = -1,life,j,x=-1,y=-1;
|
int i = -1,life,j,x=-1,y=-1;
|
||||||
@ -1393,6 +1404,7 @@ emb_set_life(PyObject *self, PyObject *args, PyObject *keywds)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_set_type(PyObject *self, PyObject *args, PyObject *keywds)
|
emb_set_type(PyObject *self, PyObject *args, PyObject *keywds)
|
||||||
{
|
{
|
||||||
int i = -1,life,j=-1,x=-1,y=-1;
|
int i = -1,life,j=-1,x=-1,y=-1;
|
||||||
@ -1435,6 +1447,7 @@ emb_set_type(PyObject *self, PyObject *args, PyObject *keywds)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_set_temp(PyObject *self, PyObject *args, PyObject *keywds)
|
emb_set_temp(PyObject *self, PyObject *args, PyObject *keywds)
|
||||||
{
|
{
|
||||||
int i = -1,life,j,x=-1,y=-1;
|
int i = -1,life,j,x=-1,y=-1;
|
||||||
@ -1475,6 +1488,7 @@ emb_set_temp(PyObject *self, PyObject *args, PyObject *keywds)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_set_tmp(PyObject *self, PyObject *args, PyObject *keywds)
|
emb_set_tmp(PyObject *self, PyObject *args, PyObject *keywds)
|
||||||
{
|
{
|
||||||
int i = -1,life,j,x=-1,y=-1;
|
int i = -1,life,j,x=-1,y=-1;
|
||||||
@ -1515,6 +1529,7 @@ emb_set_tmp(PyObject *self, PyObject *args, PyObject *keywds)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_set_x(PyObject *self, PyObject *args, PyObject *keywds)
|
emb_set_x(PyObject *self, PyObject *args, PyObject *keywds)
|
||||||
{
|
{
|
||||||
int i = -1,life,j,x=-1,y=-1;
|
int i = -1,life,j,x=-1,y=-1;
|
||||||
@ -1556,6 +1571,7 @@ emb_set_x(PyObject *self, PyObject *args, PyObject *keywds)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_set_y(PyObject *self, PyObject *args, PyObject *keywds)
|
emb_set_y(PyObject *self, PyObject *args, PyObject *keywds)
|
||||||
{
|
{
|
||||||
int i = -1,life,j,x=-1,y=-1;
|
int i = -1,life,j,x=-1,y=-1;
|
||||||
@ -1596,6 +1612,7 @@ emb_set_y(PyObject *self, PyObject *args, PyObject *keywds)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_set_ctype(PyObject *self, PyObject *args, PyObject *keywds)
|
emb_set_ctype(PyObject *self, PyObject *args, PyObject *keywds)
|
||||||
{
|
{
|
||||||
int i = -1,life,j,x=-1,y=-1;
|
int i = -1,life,j,x=-1,y=-1;
|
||||||
@ -1639,6 +1656,7 @@ emb_set_ctype(PyObject *self, PyObject *args, PyObject *keywds)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_set_vx(PyObject *self, PyObject *args, PyObject *keywds)
|
emb_set_vx(PyObject *self, PyObject *args, PyObject *keywds)
|
||||||
{
|
{
|
||||||
int i = -1,life,j,x=-1,y=-1;
|
int i = -1,life,j,x=-1,y=-1;
|
||||||
@ -1679,6 +1697,7 @@ emb_set_vx(PyObject *self, PyObject *args, PyObject *keywds)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_set_vy(PyObject *self, PyObject *args, PyObject *keywds)
|
emb_set_vy(PyObject *self, PyObject *args, PyObject *keywds)
|
||||||
{
|
{
|
||||||
int i = -1,life,j,x=-1,y=-1;
|
int i = -1,life,j,x=-1,y=-1;
|
||||||
@ -1718,6 +1737,8 @@ emb_set_vy(PyObject *self, PyObject *args, PyObject *keywds)
|
|||||||
}
|
}
|
||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_get_pmap(PyObject *self, PyObject *args)
|
emb_get_pmap(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int x,y;
|
int x,y;
|
||||||
@ -1729,6 +1750,8 @@ emb_get_pmap(PyObject *self, PyObject *args)
|
|||||||
|
|
||||||
return Py_BuildValue("I",pmap[y][x]);
|
return Py_BuildValue("I",pmap[y][x]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_get_prop(PyObject *self, PyObject *args)
|
emb_get_prop(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -1761,6 +1784,7 @@ emb_get_prop(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("i",-1);
|
return Py_BuildValue("i",-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_draw_pixel(PyObject *self, PyObject *args)
|
emb_draw_pixel(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int x,y,r,g,b,a;
|
int x,y,r,g,b,a;
|
||||||
@ -1778,6 +1802,7 @@ emb_draw_pixel(PyObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a)
|
//drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a)
|
||||||
|
static PyObject*
|
||||||
emb_draw_text(PyObject *self, PyObject *args)
|
emb_draw_text(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int x,y,r,g,b,a;
|
int x,y,r,g,b,a;
|
||||||
@ -1794,6 +1819,7 @@ emb_draw_text(PyObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a)
|
//drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a)
|
||||||
|
static PyObject*
|
||||||
emb_draw_rect(PyObject *self, PyObject *args)
|
emb_draw_rect(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int x,y,w,h,r,g,b,a;
|
int x,y,w,h,r,g,b,a;
|
||||||
@ -1809,6 +1835,7 @@ emb_draw_rect(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("i",-1);
|
return Py_BuildValue("i",-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_draw_fillrect(PyObject *self, PyObject *args)
|
emb_draw_fillrect(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int x,y,w,h,r,g,b,a;
|
int x,y,w,h,r,g,b,a;
|
||||||
@ -1823,7 +1850,9 @@ emb_draw_fillrect(PyObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
return Py_BuildValue("i",-1);
|
return Py_BuildValue("i",-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//int textwidth(char *s)
|
//int textwidth(char *s)
|
||||||
|
static PyObject*
|
||||||
emb_get_width(PyObject *self, PyObject *args)
|
emb_get_width(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
char *txt;
|
char *txt;
|
||||||
@ -1833,6 +1862,7 @@ emb_get_width(PyObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//SDL_GetMouseState(&x, &y)
|
//SDL_GetMouseState(&x, &y)
|
||||||
|
static PyObject*
|
||||||
emb_get_mouse(PyObject *self, PyObject *args)
|
emb_get_mouse(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int x,y,mask,b1,b2,b3;
|
int x,y,mask,b1,b2,b3;
|
||||||
@ -1846,6 +1876,7 @@ emb_get_mouse(PyObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//svf_name
|
//svf_name
|
||||||
|
static PyObject*
|
||||||
emb_get_name(PyObject *self, PyObject *args)
|
emb_get_name(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
if(!PyArg_ParseTuple(args, ":get_name"))
|
if(!PyArg_ParseTuple(args, ":get_name"))
|
||||||
@ -1856,6 +1887,7 @@ emb_get_name(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("s","");
|
return Py_BuildValue("s","");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_shortcuts_disable(PyObject *self, PyObject *args)
|
emb_shortcuts_disable(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
if(!PyArg_ParseTuple(args, ":shortcuts_disable"))
|
if(!PyArg_ParseTuple(args, ":shortcuts_disable"))
|
||||||
@ -1865,6 +1897,7 @@ emb_shortcuts_disable(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_shortcuts_enable(PyObject *self, PyObject *args)
|
emb_shortcuts_enable(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
if(!PyArg_ParseTuple(args, ":shortcuts_enable"))
|
if(!PyArg_ParseTuple(args, ":shortcuts_enable"))
|
||||||
@ -1874,6 +1907,7 @@ emb_shortcuts_enable(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("i",1);
|
return Py_BuildValue("i",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
emb_get_modifier(PyObject *self, PyObject *args)
|
emb_get_modifier(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
if(!PyArg_ParseTuple(args, ":get_modifier"))
|
if(!PyArg_ParseTuple(args, ":get_modifier"))
|
||||||
@ -1882,40 +1916,40 @@ emb_get_modifier(PyObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your function here!
|
static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your function here!
|
||||||
{"create", emb_create, METH_VARARGS|METH_KEYWORDS, "create a particle."},
|
{"create", (PyCFunction)emb_create, METH_VARARGS|METH_KEYWORDS, "create a particle."},
|
||||||
{"log", emb_log, METH_VARARGS, "logs an error string to the console."},
|
{"log", (PyCFunction)emb_log, METH_VARARGS, "logs an error string to the console."},
|
||||||
{"reset_pressure", emb_reset_pressure, METH_VARARGS, "resets all the pressure."},
|
{"reset_pressure", (PyCFunction)emb_reset_pressure, METH_VARARGS, "resets all the pressure."},
|
||||||
{"reset_velocity", emb_reset_velocity, METH_VARARGS, "resets all the velocity."},
|
{"reset_velocity", (PyCFunction)emb_reset_velocity, METH_VARARGS, "resets all the velocity."},
|
||||||
{"reset_sparks", emb_reset_sparks, METH_VARARGS, "resets all the sparks."},
|
{"reset_sparks", (PyCFunction)emb_reset_sparks, METH_VARARGS, "resets all the sparks."},
|
||||||
{"set_life", emb_set_life, METH_VARARGS|METH_KEYWORDS, "sets life of a specified particle."},
|
{"set_life", (PyCFunction)emb_set_life, METH_VARARGS|METH_KEYWORDS, "sets life of a specified particle."},
|
||||||
{"set_type", emb_set_type, METH_VARARGS|METH_KEYWORDS, "sets type of a specified particle."},
|
{"set_type", (PyCFunction)emb_set_type, METH_VARARGS|METH_KEYWORDS, "sets type of a specified particle."},
|
||||||
{"set_temp", emb_set_temp, METH_VARARGS|METH_KEYWORDS, "sets temp of a specified particle."},
|
{"set_temp", (PyCFunction)emb_set_temp, METH_VARARGS|METH_KEYWORDS, "sets temp of a specified particle."},
|
||||||
{"set_tmp", emb_set_tmp, METH_VARARGS|METH_KEYWORDS, "sets tmp of a specified particle."},
|
{"set_tmp", (PyCFunction)emb_set_tmp, METH_VARARGS|METH_KEYWORDS, "sets tmp of a specified particle."},
|
||||||
{"set_x", emb_set_x, METH_VARARGS|METH_KEYWORDS, "sets x of a specified particle."},
|
{"set_x", (PyCFunction)emb_set_x, METH_VARARGS|METH_KEYWORDS, "sets x of a specified particle."},
|
||||||
{"set_y", emb_set_y, METH_VARARGS|METH_KEYWORDS, "sets y of a specified particle."},
|
{"set_y", (PyCFunction)emb_set_y, METH_VARARGS|METH_KEYWORDS, "sets y of a specified particle."},
|
||||||
{"set_ctype", emb_set_y, METH_VARARGS|METH_KEYWORDS, "sets ctype of a specified particle."},
|
{"set_ctype", (PyCFunction)emb_set_y, METH_VARARGS|METH_KEYWORDS, "sets ctype of a specified particle."},
|
||||||
{"set_vx", emb_set_vx, METH_VARARGS|METH_KEYWORDS, "sets vx of a specified particle."},
|
{"set_vx", (PyCFunction)emb_set_vx, METH_VARARGS|METH_KEYWORDS, "sets vx of a specified particle."},
|
||||||
{"set_vy", emb_set_vy, METH_VARARGS|METH_KEYWORDS, "sets vy of a specified particle."},
|
{"set_vy", (PyCFunction)emb_set_vy, METH_VARARGS|METH_KEYWORDS, "sets vy of a specified particle."},
|
||||||
{"pause", emb_pause, METH_VARARGS, "pause the game."},
|
{"pause", (PyCFunction)emb_pause, METH_VARARGS, "pause the game."},
|
||||||
{"unpause", emb_unpause, METH_VARARGS, "unpause the game."},
|
{"unpause", (PyCFunction)emb_unpause, METH_VARARGS, "unpause the game."},
|
||||||
{"pause_toggle", emb_toggle_pause, METH_VARARGS, "toggle game pause."},
|
{"pause_toggle", (PyCFunction)emb_toggle_pause, METH_VARARGS, "toggle game pause."},
|
||||||
{"console_open", emb_open_console, METH_VARARGS, "open the game console."},
|
{"console_open", (PyCFunction)emb_open_console, METH_VARARGS, "open the game console."},
|
||||||
{"console_close", emb_close_console, METH_VARARGS, "close the game console."},
|
{"console_close", (PyCFunction)emb_close_console, METH_VARARGS, "close the game console."},
|
||||||
{"console_toggle", emb_toggle_console, METH_VARARGS, "toggle the game console."},
|
{"console_toggle", (PyCFunction)emb_toggle_console, METH_VARARGS, "toggle the game console."},
|
||||||
{"console_more", emb_console_more, METH_VARARGS, "turns the more indicator on."},
|
{"console_more", (PyCFunction)emb_console_more, METH_VARARGS, "turns the more indicator on."},
|
||||||
{"console_less", emb_console_less, METH_VARARGS, "turns the more indicator off."},
|
{"console_less", (PyCFunction)emb_console_less, METH_VARARGS, "turns the more indicator off."},
|
||||||
{"get_pmap", emb_get_pmap, METH_VARARGS, "get the pmap value."},
|
{"get_pmap", (PyCFunction)emb_get_pmap, METH_VARARGS, "get the pmap value."},
|
||||||
{"get_prop", emb_get_prop, METH_VARARGS, "get some properties."},
|
{"get_prop", (PyCFunction)emb_get_prop, METH_VARARGS, "get some properties."},
|
||||||
{"draw_pixel", emb_draw_pixel, METH_VARARGS, "draw a pixel."},
|
{"draw_pixel", (PyCFunction)emb_draw_pixel, METH_VARARGS, "draw a pixel."},
|
||||||
{"draw_text", emb_draw_text, METH_VARARGS, "draw some text."},
|
{"draw_text", (PyCFunction)emb_draw_text, METH_VARARGS, "draw some text."},
|
||||||
{"draw_rect", emb_draw_rect, METH_VARARGS, "draw a rect."},
|
{"draw_rect", (PyCFunction)emb_draw_rect, METH_VARARGS, "draw a rect."},
|
||||||
{"draw_fillrect", emb_draw_fillrect, METH_VARARGS, "draw a rect."},
|
{"draw_fillrect", (PyCFunction)emb_draw_fillrect, METH_VARARGS, "draw a rect."},
|
||||||
{"get_width", emb_get_width, METH_VARARGS, "get string width."},
|
{"get_width", (PyCFunction)emb_get_width, METH_VARARGS, "get string width."},
|
||||||
{"get_mouse", emb_get_mouse, METH_VARARGS, "get mouse status."},
|
{"get_mouse", (PyCFunction)emb_get_mouse, METH_VARARGS, "get mouse status."},
|
||||||
{"get_name", emb_get_name, METH_VARARGS, "get name of logged in user"},
|
{"get_name", (PyCFunction)emb_get_name, METH_VARARGS, "get name of logged in user"},
|
||||||
{"shortcuts_disable", emb_shortcuts_disable, METH_VARARGS, "disable keyboard shortcuts"},
|
{"shortcuts_disable", (PyCFunction)emb_shortcuts_disable, METH_VARARGS, "disable keyboard shortcuts"},
|
||||||
{"shortcuts_enable", emb_shortcuts_enable, METH_VARARGS, "enable keyboard shortcuts"},
|
{"shortcuts_enable", (PyCFunction)emb_shortcuts_enable, METH_VARARGS, "enable keyboard shortcuts"},
|
||||||
{"get_modifier", emb_get_modifier, METH_VARARGS, "get pressed modifier keys"},
|
{"get_modifier", (PyCFunction)emb_get_modifier, METH_VARARGS, "get pressed modifier keys"},
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@ -1973,8 +2007,16 @@ int main(int argc, char *argv[])
|
|||||||
PyRun_SimpleString("import sys\nsys.path.append('.')");
|
PyRun_SimpleString("import sys\nsys.path.append('.')");
|
||||||
PyRun_SimpleString("print 'python present.'");
|
PyRun_SimpleString("print 'python present.'");
|
||||||
//load the console module and whatnot
|
//load the console module and whatnot
|
||||||
|
#ifdef PYEXT
|
||||||
|
PyRun_SimpleString(tpt_console_py);
|
||||||
|
printf("using external python console file.\n");
|
||||||
|
pname=PyString_FromString("tpt_console");//create string object
|
||||||
|
pmodule = PyImport_Import(pname);//import module
|
||||||
|
Py_DECREF(pname);//throw away string
|
||||||
|
#else
|
||||||
PyObject *tpt_console_obj = PyMarshal_ReadObjectFromString(tpt_console_pyc+8, sizeof(tpt_console_pyc)-8);
|
PyObject *tpt_console_obj = PyMarshal_ReadObjectFromString(tpt_console_pyc+8, sizeof(tpt_console_pyc)-8);
|
||||||
pmodule=PyImport_ExecCodeModule("tpt_console", tpt_console_obj);
|
pmodule=PyImport_ExecCodeModule("tpt_console", tpt_console_obj);
|
||||||
|
#endif
|
||||||
if(pmodule!=NULL)
|
if(pmodule!=NULL)
|
||||||
{
|
{
|
||||||
pfunc=PyObject_GetAttrString(pmodule,"handle");//get the handler function
|
pfunc=PyObject_GetAttrString(pmodule,"handle");//get the handler function
|
||||||
@ -3610,6 +3652,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
SDL_CloseAudio();
|
SDL_CloseAudio();
|
||||||
http_done();
|
http_done();
|
||||||
|
PyRun_SimpleString("import os,tempfile,os.path\ntry:\n os.remove(os.path.join(tempfile.gettempdir(),'tpt_console.py'))\nexcept:\n pass");
|
||||||
|
PyRun_SimpleString("import os,tempfile,os.path\ntry:\n os.remove(os.path.join(tempfile.gettempdir(),'tpt_console.pyo'))\nexcept:\n pass");
|
||||||
|
PyRun_SimpleString("import os,tempfile,os.path\ntry:\n os.remove(os.path.join(tempfile.gettempdir(),'tpt_console.pyc'))\nexcept:\n pass");
|
||||||
|
|
||||||
Py_Finalize();//cleanup any python stuff.
|
Py_Finalize();//cleanup any python stuff.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
18
syntaxcheck.py
Normal file
18
syntaxcheck.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
if len(sys.argv)<2:
|
||||||
|
print("usage: syntaxcheck.py <filename>")
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
|
fname=sys.argv[1]
|
||||||
|
cppargs=["-E"]+sys.argv[2:]
|
||||||
|
|
||||||
|
p=subprocess.Popen(["gcc",fname]+cppargs,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
|
||||||
|
ret=p.communicate()
|
||||||
|
if len(ret[1])>0:
|
||||||
|
print("errors hapened!")
|
||||||
|
print(repr(ret[1].decode()))
|
||||||
|
raise SystemExit(-1)
|
||||||
|
|
||||||
|
print(len(ret[0].decode()))
|
||||||
|
#python syntaxcheck.py ./src/main.c -DINTERNAL -opowder -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/ -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations -lSDL -lm -lbz2 -lpython2.7 -lm -L/usr/lib/python2.7/config -I/usr/include/python2.7 -march=native -DX86 -DX86_SSE3 -msse3 src/*.c src/elements/*.c -DLIN64
|
Reference in New Issue
Block a user