summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2011-03-10 20:43:27 (GMT)
committer Cracker64 <cracker642@gmail.com>2011-03-10 20:43:27 (GMT)
commit3b048f8a0634973e45703373d22bd9360a6c170c (patch)
treea4fac03f3d2ca057b1a1604ece16bf84215c2826
parentca1cd0da065a1774dbeeba161139f580ab7f711a (diff)
downloadpowder-3b048f8a0634973e45703373d22bd9360a6c170c.zip
powder-3b048f8a0634973e45703373d22bd9360a6c170c.tar.gz
merge merge merge
-rw-r--r--Makefile33
-rw-r--r--build/ext_chat.py211
-rw-r--r--build/ext_fun.py9
-rw-r--r--includes/defines.h6
-rw-r--r--includes/interface.h2
-rw-r--r--includes/powder.h22
-rw-r--r--includes/pyconsole.h2
-rw-r--r--src/elements/glow.c4
-rw-r--r--src/elements/sprk.c21
-rw-r--r--src/graphics.c40
-rw-r--r--src/interface.c90
-rw-r--r--src/main.c2091
-rw-r--r--src/powder.c16
-rw-r--r--src/python/tpt_console.py116
14 files changed, 1748 insertions, 915 deletions
diff --git a/Makefile b/Makefile
index 3a61b11..a68d753 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
SOURCES := src/*.c src/elements/*.c
-CFLAGS := -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/
+CFLAGS := -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/
OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations
-LFLAGS := -lSDL -lm -lbz2
+LFLAGS := -lSDL -lm -lbz2 -lpython2.7 -lm -L/usr/lib/python2.7/config -I/usr/include/python2.7
LFLAGS_X := -lm -lbz2 -lSDLmain
MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3
MFLAGS_SSE2 := -march=native -DX86 -DX86_SSE2 -msse2
@@ -11,67 +11,84 @@ FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -DX86 -DX86_SSE3 -mss
COMPILER := gcc
LINUX_TARG := powder-64-sse2 powder-sse powder-sse2
WIN32_TARG := powder-sse.exe powder-sse2.exe
+PYCOMMAND := python2 getheader.py
powder: $(SOURCES)
+ $(PYCOMMAND)
$(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64
mv $@ build
powder-debug-64: $(SOURCES)
+ $(PYCOMMAND)
$(COMPILER) -m64 -o$@ $(FLAGS_DBUG) -DLIN64 $(SOURCES) -Iincludes/
mv $@ build
powder-debug: $(SOURCES)
+ $(PYCOMMAND)
$(COMPILER) -m32 -o$@ $(FLAGS_DBUG) -DLIN32 $(SOURCES) -Iincludes/
mv $@ build
powder-sse3: $(SOURCES)
+ $(PYCOMMAND)
$(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32
strip $@
mv $@ build
powder-sse2: $(SOURCES)
+ $(PYCOMMAND)
$(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN32
strip $@
mv $@ build
powder-sse: $(SOURCES)
+ $(PYCOMMAND)
$(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE) $(SOURCES) -DLIN32
strip $@
mv $@ build
powder-64-sse3-opengl: $(SOURCES)
+ $(PYCOMMAND)
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 -lGL -lGLU -DOpenGL
strip $@
mv $@ build
powder-64-sse3: $(SOURCES)
+ $(PYCOMMAND)
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64
strip $@
mv $@ build
powder-64-sse2: $(SOURCES)
+ $(PYCOMMAND)
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN64
strip $@
mv $@ build
powder-icc: $(SOURCES)
- /opt/intel/Compiler/11.1/073/bin/intel64/icc -m64 -o$@ -Iincludes/ -O2 -march=core2 -msse3 -mfpmath=sse -lSDL -lbz2 -lm -xW $(SOURCES) -std=c99 -D_POSIX_C_SOURCE=200112L
+ $(PYCOMMAND)
+ /opt/intel/Compiler/11.1/073/bin/intel64/icc -m64 -o$@ -Iincludes/ -O2 -march=core2 -msse3 -mfpmath=sse -lSDL -lbz2 -lm -xW $(SOURCES) -std=c99 -D_POSIX_C_SOURCE=200112L
powder-res.o: powder-res.rc powder.ico
+ $(PYCOMMAND)
i586-mingw32msvc-windres powder-res.rc powder-res.o
powder-sse3.exe: $(SOURCES) powder-res.o
- i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
+ $(PYCOMMAND)
+ i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -llibregex -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
strip $@
chmod 0644 $@
mv $@ build
powder-sse2.exe: $(SOURCES) powder-res.o
- i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
+ $(PYCOMMAND)
+ i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) powder-res.o -lmingw32 -llibregex -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
strip $@
chmod 0644 $@
mv $@ build
powder-sse.exe: $(SOURCES) powder-res.o
- i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
+ $(PYCOMMAND)
+ i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -llibregex -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
strip $@
chmod 0644 $@
mv $@ build
powder-x: $(SOURCES)
- gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_X) $(MFLAGS) $(SOURCES) -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -framework SDL
+ $(PYCOMMAND)
+ gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_X) $(MFLAGS) $(SOURCES) -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -framework SDL -framework Python
strip $@
mv $@ build
powder-x-ogl: $(SOURCES)
- gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_X) $(MFLAGS) $(SOURCES) -DOpenGL -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -framework SDL -framework OpenGL
+ $(PYCOMMAND)
+ gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_X) $(MFLAGS) $(SOURCES) -DOpenGL -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -framework SDL -framework OpenGL -framework Python
strip $@
mv $@ build
diff --git a/build/ext_chat.py b/build/ext_chat.py
new file mode 100644
index 0000000..8daa7ca
--- /dev/null
+++ b/build/ext_chat.py
@@ -0,0 +1,211 @@
+import tpt
+import sys
+import time
+import socket
+import tpt_console
+
+HOST="irc.freenode.net"
+PORT=6667
+name=tpt.get_name()
+print "name is %s"%repr(name)
+if(name==""):
+ #fuck. abort?
+ raise SystemExit("please log in!")
+
+def raw(s,st):
+ s.send("%s\n\r"%st)
+
+def init():
+ global frame,s,rec,readbuffer,namelist,typing,typed,IDENT,NICK
+ global REALNAME,CHANNEL
+ frame=0
+ s=None
+ rec=([("",0,0,0,255)]*20)+[("connected.",255,0,0,128)]
+ readbuffer=""
+ namelist=[]
+ typing=False
+ typed=""
+ NICK=name+"[tpt]"
+ IDENT=name+"[tpt]"
+ REALNAME=name
+ CHANNEL="#foobar7"
+ readbuffer=""
+
+def exit():
+ raw(s,"QUIT")
+ s.close()
+
+def console_handle(txt):
+ """
+ :doxin!~lieuwe@unaffiliated/lieuwe JOIN :#foobar7
+ :doxin!~lieuwe@unaffiliated/lieuwe PRIVMSG #foobar7 :there
+ :doxin!~lieuwe@unaffiliated/lieuwe PRIVMSG #foobar7 :ACTION is fat
+ """
+ lst=txt.split(" ")
+ if(lst[0]=="/me"):
+ rec.append(("%s %s"%(NICK,txt[4:]),255,0,255,128))
+ raw(s,"PRIVMSG %s :\x01ACTION %s\x01"%(CHANNEL,txt[4:]))
+ tpt.console_close()
+ else:
+ rec.append(("<%s>: %s"%(NICK,txt),255,255,0,128))
+ raw(s,"PRIVMSG %s :%s"%(CHANNEL,txt))
+ tpt.console_close()
+
+def key(keyy) :
+ try:
+ a=key.pmod
+ except:
+ key.pmod=(False,False,False)
+ global typing,typed
+ print "got %s"%repr(keyy)
+ ctrl1,ctrl2,alt1,alt2,shift1,shift2=tpt.get_modifier()
+ mod=(ctrl1 or ctrl2,alt1 or alt2,shift1 or shift2)
+ skip=False
+ if(not key.pmod[0] and mod[0]):
+ skip=True
+ if(not key.pmod[1] and mod[1]):
+ skip=True
+ if(not key.pmod[2] and mod[2]):
+ skip=True
+ key.pmod=mod
+ if(skip):
+ return
+
+ if(typing and ord(keyy)>=32 and ord(keyy)<=126):
+ if(mod[2]):
+ typed+=keyy.upper()#needs to be fixed for special chars
+ else:
+ typed+=keyy
+ if(keyy=="\x1b" and typing):
+ typing=False
+ typed=""
+ tpt.shortcuts_enable()
+ if(keyy=="t" and typing==False):
+ typing=True
+ tpt.shortcuts_disable()
+ if(keyy=="\r" and typing==True):
+ console_handle(typed)
+ typed=""
+ typing=False
+ tpt.shortcuts_enable()
+ #got '\t'
+ #got '\x08'
+ if(keyy=="\x08"):
+ typed=typed[:-1]
+ #if(keyy=="\t"):
+ # startswith=
+
+
+def step():
+ global frame,s,rec,readbuffer,namelist
+ frame+=1
+ if(frame==1):
+ tpt.console_close()
+ #lets see if we can seize the console:
+ tpt_console._handle=console_handle
+ if(frame==2):
+ tpt.draw_fillrect(0,0,612,384,0,0,0,128)
+ tpt.draw_text(32,32,"opening connection\nhold on to your pants.",255,255,255)
+ if(frame==3):
+ s=socket.socket()
+ s.settimeout(5)
+ s.connect((HOST, PORT))
+ raw(s,"NICK %s" % NICK)
+ raw(s,"USER %s %s bla :%s" % (IDENT, HOST, REALNAME))
+ s.settimeout(0)
+ if(frame==120):
+ raw(s,"JOIN %s"%CHANNEL)
+ rec.append(("joined",255,0,0,255))
+ if(frame>=3):
+ try:
+ readbuffer=readbuffer+s.recv(1024)
+ except IOError:
+ pass
+ else:
+ temp=readbuffer.split("\n")
+ readbuffer=temp.pop()
+
+ for line in temp:
+ line=line.strip()
+ #print repr(line)
+ line=line.split()
+ if(line[1]=="PRIVMSG"):
+ #:doxin!~lieuwe@unaffiliated/lieuwe PRIVMSG doxin[tpt] :some shit
+ frm=line[0][1:].partition("!")[0]
+ msg=' '.join(line[3:])[1:]
+ tmp=["<",frm,"> ",msg]
+ if(msg[0]=="\x01" and msg[-1]=="\x01"):
+ msg=msg[8:-1]#ACTION
+ tmp=[frm," ",msg]
+ if(line[2]==NICK):
+ rec.append((''.join(tmp),255,255,255,255))
+ else:
+ rec.append((''.join(tmp),255,255,255,128))
+ elif(line[0]=="PING"):
+ raw(s,"PONG %s"%line[1])
+ elif(line[1]=="353"):
+ #:leguin.freenode.net 353 doxin[tpt] = #powder :doxin[tpt] ZebraineZ _-_Rafael_-_ doxin bildramer BlueMaxima TheRazorsEDGE raj-k webb|AP where @devast8a Merbo FrozenKnight EppyMoon EvilJStoker Mortvert SpitfireWP @frankbro Ares
+ names=line[4:]
+ namelist=[]
+ for item in names:
+ item=item.strip()
+ r=255
+ g=255
+ b=255
+ if(item[0]==":"):
+ item=item[1:]
+ elif(item[0]=="@"):
+ g=0
+ b=0
+ namelist.append((item,r,g,b,128))
+ elif(line[1]=="JOIN"):
+ #':savask!~savask@95-190-25-195-xdsl-dynamic.kuzbass.net JOIN :#powder'
+ tmp=line[0][1:].partition("!")[0]
+ namelist.append((tmp,255,255,255,128))
+ rec.append(("%s joined"%name,0,255,0,128))
+ elif(line[1]=="PART"):
+ #':savask!~savask@95-190-25-195-xdsl-dynamic.kuzbass.net PART #powder :"Leaving."'
+ tmp=line[0][1:].partition("!")[0]
+ msg=' '.join(line[2:])[1:]
+ rem=None
+ for item in namelist:
+ if(item[0]==tmp or item[0]=="@"+tmp):
+ rem=item
+ rec.append(("%s parted: %s"%(name,msg),0,255,0,128))
+ if(rem!=None):
+ namelist.remove(rem)
+ elif(line[1]=="NICK"):
+ #:doxin!~lieuwe@unaffiliated/lieuwe NICK :d0x1n
+ tmp=line[0][1:].partition("!")[0]
+ rem=None
+ for item in namelist:
+ if(item[0]==tmp or item[0]=="@"+tmp):
+ rem=item
+ rec.append(("%s is now known as %s"%(name,line[2]),0,255,0,128))
+ if(rem!=None):
+ if(rem[0][0]=="@"):
+ namelist.append(("@"+line[2][1:],rem[1],rem[2],rem[3],rem[4]))
+ else:
+ namelist.append((line[2][1:],rem[1],rem[2],rem[3],rem[4]))
+ namelist.remove(rem)
+
+
+
+
+ yy=32
+ if(len(rec)>20):
+ rec=rec[-20:]
+ for item in rec:
+ tpt.draw_text(8,yy,item[0],item[1],item[2],item[3],item[4])
+ yy+=8
+ if(typing):
+ if(frame%30<15):
+ tpt.draw_text(8,yy,typed+"|",255,255,255,255)
+ else:
+ tpt.draw_text(8,yy,typed,255,255,255,255)
+ #print namelist
+ yy=32
+ for item in namelist:
+ tpt.draw_text(604-tpt.get_width(item[0]),yy,item[0],item[1],item[2],item[3],item[4])
+ yy+=8
+
diff --git a/build/ext_fun.py b/build/ext_fun.py
new file mode 100644
index 0000000..35c93a1
--- /dev/null
+++ b/build/ext_fun.py
@@ -0,0 +1,9 @@
+import tpt
+def init():
+ pass
+def key(keyy):
+ pass
+def step():
+ tpt.draw_text(100,100,"FUCK YEAH!",255,255,255,255)
+def exit():
+ pass
diff --git a/includes/defines.h b/includes/defines.h
index 01c2812..5a55a9d 100644
--- a/includes/defines.h
+++ b/includes/defines.h
@@ -8,7 +8,7 @@
#endif
#define SAVE_VERSION 46
-#define MINOR_VERSION 3
+#define MINOR_VERSION 4
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
//#define BETA
@@ -16,6 +16,8 @@
#define THUMB_CACHE_SIZE 256
+//#define pyconsole
+
#define IMGCONNS 3
#define TIMEOUT 100
#define HTTP_TIMEOUT 10
@@ -65,6 +67,8 @@ extern unsigned char ZSIZE;
#define SQUARE_BRUSH 1
#define BRUSH_NUM 2
+#define PYCONSOLE
+
#ifdef PIX16
typedef unsigned short pixel;
#else
diff --git a/includes/interface.h b/includes/interface.h
index ea1f9a5..d63770a 100644
--- a/includes/interface.h
+++ b/includes/interface.h
@@ -225,7 +225,7 @@ void open_link(char *uri);
int report_ui(pixel *vid_buf, char *save_id);
-char *console_ui(pixel *vid_buf, char error[255]);
+char *console_ui(pixel *vid_buf, char error[255],char console_more);
int console_parse_coords(char *txt, int *x, int *y, char *err);
int console_parse_type(char *txt, int *element, char *err);
int console_parse_partref(char *txt, int *which, char *err);
diff --git a/includes/powder.h b/includes/powder.h
index a78d35f..f12e8ec 100644
--- a/includes/powder.h
+++ b/includes/powder.h
@@ -49,15 +49,15 @@
-#define PT_NONE 0
-#define PT_DUST 1
-#define PT_WATR 2
+#define PT_NONE 0
+#define PT_DUST 1
+#define PT_WATR 2
#define PT_OIL 3
#define PT_FIRE 4
#define PT_STNE 5
#define PT_LAVA 6
-#define PT_GUNP 7
-#define PT_NITR 8
+#define PT_GUNP 7
+#define PT_NITR 8
#define PT_CLNE 9
#define PT_GAS 10
#define PT_PLEX 11
@@ -165,7 +165,7 @@
#define PT_ANAR 113
#define PT_VINE 114
#define PT_INVIS 115
-#define PT_EQUALVEL 116//all particles equal their velocities
+#define PT_EQUALVEL 116 //all particles equal their velocities
#define PT_SPAWN2 117
#define PT_SPAWN 118
#define PT_SHLD1 119
@@ -436,9 +436,9 @@ static const part_type ptypes[PT_NUM] =
{"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C).", ST_SOLID, TYPE_PART, &update_YEST},
{"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Dead Yeast.", ST_SOLID, TYPE_PART, NULL},
{"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremely high temperature.", ST_SOLID, TYPE_PART, &update_THRM},
- {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure", ST_LIQUID, TYPE_LIQUID, &update_GLOW},
+ {"GLOW", PIXPACK(0x445464), 0.3f, 0.02f * CFDS, 0.98f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure", ST_LIQUID, TYPE_LIQUID, &update_GLOW},
{"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material.", ST_SOLID, TYPE_SOLID|PROP_HOT_GLOW, NULL},
- {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame.", ST_LIQUID, TYPE_GAS, NULL},
+ {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, 0.0f, 88, "Sub-zero flame.", ST_LIQUID, TYPE_GAS, NULL},
{"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!", ST_SOLID, TYPE_PART, &update_FIRW},
{"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity.", ST_SOLID, TYPE_SOLID, &update_FUSE},
{"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE.", ST_SOLID, TYPE_PART, &update_FSEP},
@@ -517,8 +517,8 @@ static const part_type ptypes[PT_NUM] =
{"STAR", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Like Star Wars rule S3456/B278/6", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"FROG", PIXPACK(0x00AA00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Frogs S12/B34/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"BRAN", PIXPACK(0xCCCC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Brian 6 S6/B246/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
- {"WIND", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, 0.0f, 40, "Drag tool", ST_NONE, ST_NONE, NULL},
-//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description
+ {"WIND", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, 0.0f, 40, "Drag tool", ST_NONE, ST_NONE, NULL},
+ //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description
};
// temporarily define abbreviations for impossible p/t values
@@ -680,7 +680,7 @@ static part_transition ptransitions[PT_NUM] =
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
- /* WIND */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
+ /* WIND */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
};
#undef IPL
#undef IPH
diff --git a/includes/pyconsole.h b/includes/pyconsole.h
new file mode 100644
index 0000000..765e63d
--- /dev/null
+++ b/includes/pyconsole.h
@@ -0,0 +1,2 @@
+#include <Python.h>
+unsigned char tpt_console_pyc[] = {0x3,0xf3,0xd,0xa,0xde,0x1,0x75,0x4d,0x63,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x73,0xf1,0x4,0x0,0x0,0x64,0x0,0x0,0x64,0x1,0x0,0x6c,0x0,0x0,0x5a,0x0,0x0,0x64,0x0,0x0,0x64,0x2,0x0,0x6c,0x0,0x0,0x54,0x64,0x0,0x0,0x64,0x1,0x0,0x6c,0x1,0x0,0x5a,0x1,0x0,0x64,0x0,0x0,0x64,0x1,0x0,0x6c,0x2,0x0,0x5a,0x2,0x0,0x64,0x0,0x0,0x64,0x1,0x0,0x6c,0x3,0x0,0x5a,0x3,0x0,0x64,0x0,0x0,0x64,0x1,0x0,0x6c,0x4,0x0,0x5a,0x4,0x0,0x65,0x5,0x0,0x5a,0x6,0x0,0x64,0x3,0x0,0x64,0x37,0x1,0x64,0x4,0x0,0x84,0x0,0x0,0x83,0x0,0x0,0x59,0x5a,0x7,0x0,0x65,0x6,0x0,0x65,0x5,0x0,0x6b,0x2,0x0,0x72,0x86,0x0,0x65,0x7,0x0,0x83,0x0,0x0,0x65,0x1,0x0,0x5f,0x8,0x0,0x65,0x7,0x0,0x83,0x0,0x0,0x65,0x1,0x0,0x5f,0x9,0x0,0x6e,0x0,0x0,0x69,0x95,0x0,0x64,0x5,0x0,0x64,0x6,0x0,0x36,0x64,0x7,0x0,0x64,0x8,0x0,0x36,0x64,0x9,0x0,0x64,0xa,0x0,0x36,0x64,0xb,0x0,0x64,0xc,0x0,0x36,0x64,0xd,0x0,0x64,0xe,0x0,0x36,0x64,0xf,0x0,0x64,0x10,0x0,0x36,0x64,0x11,0x0,0x64,0x12,0x0,0x36,0x64,0x13,0x0,0x64,0x14,0x0,0x36,0x64,0x15,0x0,0x64,0x16,0x0,0x36,0x64,0x17,0x0,0x64,0x18,0x0,0x36,0x64,0x19,0x0,0x64,0x1a,0x0,0x36,0x64,0x1b,0x0,0x64,0x1c,0x0,0x36,0x64,0x1d,0x0,0x64,0x1e,0x0,0x36,0x64,0x1f,0x0,0x64,0x20,0x0,0x36,0x64,0x21,0x0,0x64,0x22,0x0,0x36,0x64,0x23,0x0,0x64,0x24,0x0,0x36,0x64,0x25,0x0,0x64,0x26,0x0,0x36,0x64,0x27,0x0,0x64,0x28,0x0,0x36,0x64,0x29,0x0,0x64,0x2a,0x0,0x36,0x64,0x2b,0x0,0x64,0x2c,0x0,0x36,0x64,0x2d,0x0,0x64,0x2e,0x0,0x36,0x64,0x2f,0x0,0x64,0x30,0x0,0x36,0x64,0x31,0x0,0x64,0x32,0x0,0x36,0x64,0x33,0x0,0x64,0x34,0x0,0x36,0x64,0x35,0x0,0x64,0x36,0x0,0x36,0x64,0x37,0x0,0x64,0x38,0x0,0x36,0x64,0x39,0x0,0x64,0x3a,0x0,0x36,0x64,0x3b,0x0,0x64,0x3c,0x0,0x36,0x64,0x3d,0x0,0x64,0x3e,0x0,0x36,0x64,0x3f,0x0,0x64,0x40,0x0,0x36,0x64,0x41,0x0,0x64,0x42,0x0,0x36,0x64,0x43,0x0,0x64,0x44,0x0,0x36,0x64,0x45,0x0,0x64,0x46,0x0,0x36,0x64,0x47,0x0,0x64,0x48,0x0,0x36,0x64,0x49,0x0,0x64,0x4a,0x0,0x36,0x64,0x4b,0x0,0x64,0x4c,0x0,0x36,0x64,0x4d,0x0,0x64,0x4e,0x0,0x36,0x64,0x4f,0x0,0x64,0x50,0x0,0x36,0x64,0x51,0x0,0x64,0x52,0x0,0x36,0x64,0x53,0x0,0x64,0x54,0x0,0x36,0x64,0x55,0x0,0x64,0x56,0x0,0x36,0x64,0x57,0x0,0x64,0x58,0x0,0x36,0x64,0x59,0x0,0x64,0x5a,0x0,0x36,0x64,0x5b,0x0,0x64,0x5c,0x0,0x36,0x64,0x5d,0x0,0x64,0x5e,0x0,0x36,0x64,0x5f,0x0,0x64,0x60,0x0,0x36,0x64,0x61,0x0,0x64,0x62,0x0,0x36,0x64,0x63,0x0,0x64,0x64,0x0,0x36,0x64,0x65,0x0,0x64,0x66,0x0,0x36,0x64,0x67,0x0,0x64,0x68,0x0,0x36,0x64,0x69,0x0,0x64,0x6a,0x0,0x36,0x64,0x6b,0x0,0x64,0x6c,0x0,0x36,0x64,0x6d,0x0,0x64,0x6e,0x0,0x36,0x64,0x6f,0x0,0x64,0x70,0x0,0x36,0x64,0x71,0x0,0x64,0x72,0x0,0x36,0x64,0x73,0x0,0x64,0x74,0x0,0x36,0x64,0x75,0x0,0x64,0x76,0x0,0x36,0x64,0x77,0x0,0x64,0x78,0x0,0x36,0x64,0x79,0x0,0x64,0x7a,0x0,0x36,0x64,0x7b,0x0,0x64,0x7c,0x0,0x36,0x64,0x7d,0x0,0x64,0x7e,0x0,0x36,0x64,0x7f,0x0,0x64,0x80,0x0,0x36,0x64,0x81,0x0,0x64,0x82,0x0,0x36,0x64,0x83,0x0,0x64,0x84,0x0,0x36,0x64,0x85,0x0,0x64,0x86,0x0,0x36,0x64,0x87,0x0,0x64,0x88,0x0,0x36,0x64,0x89,0x0,0x64,0x8a,0x0,0x36,0x64,0x8b,0x0,0x64,0x8c,0x0,0x36,0x64,0x8d,0x0,0x64,0x8e,0x0,0x36,0x64,0x8f,0x0,0x64,0x90,0x0,0x36,0x64,0x91,0x0,0x64,0x92,0x0,0x36,0x64,0x93,0x0,0x64,0x94,0x0,0x36,0x64,0x95,0x0,0x64,0x96,0x0,0x36,0x64,0x97,0x0,0x64,0x98,0x0,0x36,0x64,0x99,0x0,0x64,0x9a,0x0,0x36,0x64,0x9b,0x0,0x64,0x9c,0x0,0x36,0x64,0x9d,0x0,0x64,0x9e,0x0,0x36,0x64,0x9f,0x0,0x64,0xa0,0x0,0x36,0x64,0xa1,0x0,0x64,0xa2,0x0,0x36,0x64,0xa3,0x0,0x64,0xa4,0x0,0x36,0x64,0xa5,0x0,0x64,0xa6,0x0,0x36,0x64,0xa7,0x0,0x64,0xa8,0x0,0x36,0x64,0xa9,0x0,0x64,0xaa,0x0,0x36,0x64,0xab,0x0,0x64,0xac,0x0,0x36,0x64,0xad,0x0,0x64,0xae,0x0,0x36,0x64,0xaf,0x0,0x64,0xb0,0x0,0x36,0x64,0xb1,0x0,0x64,0xb2,0x0,0x36,0x64,0xb3,0x0,0x64,0xb4,0x0,0x36,0x64,0xb5,0x0,0x64,0xb6,0x0,0x36,0x64,0xb7,0x0,0x64,0xb8,0x0,0x36,0x64,0xb9,0x0,0x64,0xba,0x0,0x36,0x64,0xbb,0x0,0x64,0xbc,0x0,0x36,0x64,0xbd,0x0,0x64,0xbe,0x0,0x36,0x64,0xbf,0x0,0x64,0xc0,0x0,0x36,0x64,0xc1,0x0,0x64,0xc2,0x0,0x36,0x64,0xc3,0x0,0x64,0xc4,0x0,0x36,0x64,0xc5,0x0,0x64,0xc6,0x0,0x36,0x64,0xc7,0x0,0x64,0xc8,0x0,0x36,0x64,0xc9,0x0,0x64,0xca,0x0,0x36,0x64,0xcb,0x0,0x64,0xcc,0x0,0x36,0x64,0xcd,0x0,0x64,0xce,0x0,0x36,0x64,0xcf,0x0,0x64,0xd0,0x0,0x36,0x64,0xd1,0x0,0x64,0xd2,0x0,0x36,0x64,0xd3,0x0,0x64,0xd4,0x0,0x36,0x64,0xd5,0x0,0x64,0xd6,0x0,0x36,0x64,0xd7,0x0,0x64,0xd8,0x0,0x36,0x64,0xd9,0x0,0x64,0xda,0x0,0x36,0x64,0xdb,0x0,0x64,0xdc,0x0,0x36,0x64,0xdd,0x0,0x64,0xde,0x0,0x36,0x64,0xdf,0x0,0x64,0xe0,0x0,0x36,0x64,0xe1,0x0,0x64,0xe2,0x0,0x36,0x64,0xe3,0x0,0x64,0xe4,0x0,0x36,0x64,0xe5,0x0,0x64,0xe6,0x0,0x36,0x64,0xe7,0x0,0x64,0xe8,0x0,0x36,0x64,0xe9,0x0,0x64,0xea,0x0,0x36,0x64,0xeb,0x0,0x64,0xec,0x0,0x36,0x64,0xed,0x0,0x64,0xee,0x0,0x36,0x64,0xef,0x0,0x64,0xf0,0x0,0x36,0x64,0xf1,0x0,0x64,0xf2,0x0,0x36,0x64,0xf3,0x0,0x64,0xf4,0x0,0x36,0x64,0xf5,0x0,0x64,0xf6,0x0,0x36,0x64,0xf7,0x0,0x64,0xf8,0x0,0x36,0x64,0xf9,0x0,0x64,0xfa,0x0,0x36,0x64,0xfb,0x0,0x64,0xfc,0x0,0x36,0x64,0xfd,0x0,0x64,0xfe,0x0,0x36,0x64,0xff,0x0,0x64,0x0,0x1,0x36,0x64,0x1,0x1,0x64,0x2,0x1,0x36,0x64,0x3,0x1,0x64,0x4,0x1,0x36,0x64,0x5,0x1,0x64,0x6,0x1,0x36,0x64,0x7,0x1,0x64,0x8,0x1,0x36,0x64,0x9,0x1,0x64,0xa,0x1,0x36,0x64,0xb,0x1,0x64,0xc,0x1,0x36,0x64,0xd,0x1,0x64,0xe,0x1,0x36,0x64,0xf,0x1,0x64,0x10,0x1,0x36,0x64,0x11,0x1,0x64,0x12,0x1,0x36,0x64,0x13,0x1,0x64,0x14,0x1,0x36,0x64,0x15,0x1,0x64,0x16,0x1,0x36,0x64,0x17,0x1,0x64,0x18,0x1,0x36,0x64,0x19,0x1,0x64,0x1a,0x1,0x36,0x64,0x1b,0x1,0x64,0x1c,0x1,0x36,0x64,0x1d,0x1,0x64,0x1e,0x1,0x36,0x64,0x1f,0x1,0x64,0x20,0x1,0x36,0x64,0x21,0x1,0x64,0x22,0x1,0x36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0x67,0x69,0x69,0x0,0x0,0x0,0x74,0x5,0x0,0x0,0x0,0x62,0x69,0x7a,0x72,0x73,0x69,0x6a,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x69,0x6e,0x73,0x74,0x69,0x6b,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x69,0x73,0x6f,0x7a,0x69,0x6c,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x69,0x73,0x7a,0x73,0x69,0x6d,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x70,0x72,0x74,0x69,0x69,0x6e,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x70,0x72,0x74,0x6f,0x69,0x6f,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x70,0x73,0x74,0x65,0x69,0x70,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x70,0x73,0x74,0x73,0x69,0x71,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x61,0x6e,0x61,0x72,0x69,0x72,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x76,0x69,0x6e,0x65,0x69,0x73,0x0,0x0,0x0,0x74,0x5,0x0,0x0,0x0,0x69,0x6e,0x76,0x69,0x73,0x69,0x74,0x0,0x0,0x0,0x74,0x8,0x0,0x0,0x0,0x65,0x71,0x75,0x61,0x6c,0x76,0x65,0x6c,0x69,0x75,0x0,0x0,0x0,0x74,0x6,0x0,0x0,0x0,0x73,0x70,0x61,0x77,0x6e,0x32,0x69,0x76,0x0,0x0,0x0,0x74,0x5,0x0,0x0,0x0,0x73,0x70,0x61,0x77,0x6e,0x69,0x77,0x0,0x0,0x0,0x74,0x5,0x0,0x0,0x0,0x73,0x68,0x6c,0x64,0x31,0x69,0x78,0x0,0x0,0x0,0x74,0x5,0x0,0x0,0x0,0x73,0x68,0x6c,0x64,0x32,0x69,0x79,0x0,0x0,0x0,0x74,0x5,0x0,0x0,0x0,0x73,0x68,0x6c,0x64,0x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0,0x0,0x74,0x1,0x0,0x5f,0x2,0x0,0x64,0x1,0x0,0x74,0x1,0x0,0x5f,0x3,0x0,0x64,0x2,0x0,0x53,0x28,0x3,0x0,0x0,0x0,0x73,0xde,0x0,0x0,0x0,0x63,0x6f,0x70,0x79,0x3d,0x5b,0x22,0x5f,0x5f,0x62,0x75,0x69,0x6c,0x74,0x69,0x6e,0x73,0x5f,0x5f,0x22,0x2c,0x22,0x5f,0x5f,0x6e,0x61,0x6d,0x65,0x5f,0x5f,0x22,0x2c,0x22,0x5f,0x5f,0x64,0x6f,0x63,0x5f,0x5f,0x22,0x2c,0x22,0x5f,0x5f,0x70,0x61,0x63,0x6b,0x61,0x67,0x65,0x5f,0x5f,0x22,0x2c,0x27,0x74,0x70,0x74,0x27,0x2c,0x27,0x63,0x6c,0x65,0x61,0x6e,0x27,0x2c,0xa,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x27,0x65,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x27,0x2c,0x27,0x66,0x6f,0x72,0x6b,0x27,0x2c,0x27,0x5f,0x66,0x6f,0x72,0x6b,0x27,0x2c,0x27,0x66,0x6f,0x72,0x6b,0x5f,0x73,0x74,0x61,0x74,0x75,0x73,0x27,0x2c,0x27,0x66,0x6f,0x72,0x6b,0x5f,0x75,0x6e,0x62,0x6c,0x6f,0x63,0x6b,0x27,0x2c,0x27,0x73,0x79,0x73,0x27,0x5d,0xa,0x20,0x20,0x20,0x20,0x68,0x61,0x6e,0x64,0x6c,0x65,0x2e,0x67,0x6c,0x6f,0x62,0x3d,0x7b,0x7d,0xa,0x20,0x20,0x20,0x20,0x66,0x6f,0x72,0x20,0x69,0x74,0x65,0x6d,0x20,0x69,0x6e,0x20,0x63,0x6f,0x70,0x79,0x3a,0xa,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x61,0x6e,0x64,0x6c,0x65,0x2e,0x67,0x6c,0x6f,0x62,0x5b,0x69,0x74,0x65,0x6d,0x5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,0x74,0x8,0x0,0x0,0x0,0x3c,0x6d,0x6f,0x64,0x75,0x6c,0x65,0x3e,0x1,0x0,0x0,0x0,0x73,0x54,0x0,0x0,0x0,0xc,0x1,0xa,0x1,0xc,0x1,0xc,0x1,0xc,0x1,0xc,0x1,0x6,0x4,0x13,0x5,0xc,0x1,0xc,0x1,0xf,0x3,0x3b,0x1,0x38,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x2a,0x1,0x2a,0x1,0x2a,0x1,0x2a,0x1,0x2a,0x1,0x2a,0x1,0x2a,0x1,0x2a,0x1,0xa,0x3,0x9,0x2,0x9,0x5,0x9,0xa,0x9,0xa,0x9,0xb,0x6,0x1,0x9,0x5,0x9,0xd}; \ No newline at end of file
diff --git a/src/elements/glow.c b/src/elements/glow.c
index 621e5b1..d692233 100644
--- a/src/elements/glow.c
+++ b/src/elements/glow.c
@@ -16,6 +16,10 @@ int update_GLOW(UPDATE_FUNC_ARGS) {
parts[r>>8].life = 10;
}
}
+ parts[i].ctype = pv[y/CELL][x/CELL]*16;
+
+ parts[i].tmp = abs((int)((vx[y/CELL][x/CELL]+vy[y/CELL][x/CELL])*16.0f)) + abs((int)((parts[i].vx+parts[i].vy)*64.0f));
+ //printf("%f %f\n", parts[i].vx, parts[i].vy);
if (parts[i].type==PT_NONE) {
kill_part(i);
return 1;
diff --git a/src/elements/sprk.c b/src/elements/sprk.c
index f107b9a..89480ad 100644
--- a/src/elements/sprk.c
+++ b/src/elements/sprk.c
@@ -120,7 +120,7 @@ int update_SPRK(UPDATE_FUNC_ARGS) {
conduct_sprk = 0;
if (ct==PT_NSCN && rt==PT_PSCN)
conduct_sprk = 0;
- if (ct==PT_ETRD && (parts[i].life!=5||!(rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN)))
+ if (ct==PT_ETRD && !(rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN))
conduct_sprk = 0;
if (ct==PT_INST&&rt!=PT_NSCN) conduct_sprk = 0;
if (ct==PT_SWCH && (rt==PT_PSCN||rt==PT_NSCN||rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR))
@@ -137,15 +137,7 @@ int update_SPRK(UPDATE_FUNC_ARGS) {
conduct_sprk = 0;
if (conduct_sprk) {
- if (ct==PT_ETRD) {
- part_change_type(i,x,y,PT_ETRD);
- parts[i].ctype = PT_NONE;
- parts[i].life = 20;
- part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
- parts[r>>8].life = 4;
- parts[r>>8].ctype = rt;
- }
- else if (rt==PT_WATR||rt==PT_SLTW) {
+ if (rt==PT_WATR||rt==PT_SLTW) {
if (parts[r>>8].life==0 && (parts[i].life<2 || ((r>>8)<i && parts[i].life<3)))
{
part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
@@ -167,6 +159,15 @@ int update_SPRK(UPDATE_FUNC_ARGS) {
if (parts[r>>8].temp+10.0f<673.0f&&!legacy_enable&&(rt==PT_METL||rt==PT_BMTL||rt==PT_BRMT||rt==PT_PSCN||rt==PT_NSCN||rt==PT_ETRD||rt==PT_NBLE||rt==PT_IRON))
parts[r>>8].temp = parts[r>>8].temp+10.0f;
}
+ else if (ct==PT_ETRD && parts[i].life==5)
+ {
+ part_change_type(i,x,y,ct);
+ parts[i].ctype = PT_NONE;
+ parts[i].life = 20;
+ parts[r>>8].life = 4;
+ parts[r>>8].ctype = rt;
+ part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
+ }
}
}
return 0;
diff --git a/src/graphics.c b/src/graphics.c
index ea8d0d5..cea2ba7 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -2370,15 +2370,15 @@ void draw_parts(pixel *vid)
}
else if (t==PT_GLOW)
{
- fg = 0;
- fb = 0;
- fr = 0;
- if (pv[ny/CELL][nx/CELL]>0) {
- fg = 6 * pv[ny/CELL][nx/CELL];
- fb = 4 * pv[ny/CELL][nx/CELL];
- fr = 2 * pv[ny/CELL][nx/CELL];
- }
- vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(0x44 + fr*8, 0, 255), (int)restrict_flt(0x88 + fg*8, 0, 255), (int)restrict_flt(0x44 + fb*8, 0, 255));
+ fr = restrict_flt(parts[i].temp-(275.13f+32.0f), 0, 128)/50.0f;
+ fg = restrict_flt(parts[i].ctype, 0, 128)/50.0f;
+ fb = restrict_flt(parts[i].tmp, 0, 128)/50.0f;
+
+ cr = restrict_flt(64.0f+parts[i].temp-(275.13f+32.0f), 0, 255);
+ cg = restrict_flt(64.0f+parts[i].ctype, 0, 255);
+ cb = restrict_flt(64.0f+parts[i].tmp, 0, 255);
+
+ vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(cr, cg, cb);
if (cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
x = nx/CELL;
@@ -2394,19 +2394,15 @@ void draw_parts(pixel *vid)
fire_r[y][x] = fr;
}
if (cmode == CM_BLOB) {
- uint8 R = (int)restrict_flt(0x44 + fr*8, 0, 255);
- uint8 G = (int)restrict_flt(0x88 + fg*8, 0, 255);
- uint8 B = (int)restrict_flt(0x44 + fb*8, 0, 255);
-
- blendpixel(vid, nx+1, ny, R, G, B, 223);
- blendpixel(vid, nx-1, ny, R, G, B, 223);
- blendpixel(vid, nx, ny+1, R, G, B, 223);
- blendpixel(vid, nx, ny-1, R, G, B, 223);
-
- blendpixel(vid, nx+1, ny-1, R, G, B, 112);
- blendpixel(vid, nx-1, ny-1, R, G, B, 112);
- blendpixel(vid, nx+1, ny+1, R, G, B, 112);
- blendpixel(vid, nx-1, ny+1, R, G, B, 112);
+ blendpixel(vid, nx+1, ny, cr, cg, cb, 223);
+ blendpixel(vid, nx-1, ny, cr, cg, cb, 223);
+ blendpixel(vid, nx, ny+1, cr, cg, cb, 223);
+ blendpixel(vid, nx, ny-1, cr, cg, cb, 223);
+
+ blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112);
+ blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112);
+ blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112);
+ blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112);
}
}
else if (t==PT_LCRY)
diff --git a/src/interface.c b/src/interface.c
index 5e8eed4..6382ed0 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -2549,7 +2549,8 @@ int search_ui(pixel *vid_buf)
memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE);
}
is_p1 = (exp_res < GRID_X*GRID_Y);
- free(results);
+ if (results)
+ free(results);
active = 0;
}
@@ -2824,6 +2825,10 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
data = http_async_req_stop(http, &status, &data_size);
if (status == 200)
{
+ if (!data||!data_size) {
+ error_ui(vid_buf, 0, "Save data is empty (may be corrupt)");
+ break;
+ }
pixel *full_save = prerender_save(data, data_size, &imgw, &imgh);
if (full_save!=NULL) {
save_pic = rescale_img(full_save, imgw, imgh, &thumb_w, &thumb_h, 2);
@@ -2842,15 +2847,16 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
{
http_last_use_2 = time(NULL);
info_data = http_async_req_stop(http_2, &status_2, NULL);
- if (status_2 == 200)
+ if (status_2 == 200 || !info_data)
{
info_ready = info_parse(info_data, info);
- if (info_ready==-1) {
- error_ui(vid_buf, 0, "Not found");
+ if (info_ready<=0) {
+ error_ui(vid_buf, 0, "Save info not found");
break;
}
}
- free(info_data);
+ if (info_data)
+ free(info_data);
active_2 = 0;
free(http_2);
http_2 = NULL;
@@ -3546,7 +3552,7 @@ int execute_tagop(pixel *vid_buf, char *op, char *tag)
return 1;
}
- if (result[2])
+ if (result && result[2])
{
strncpy(svf_tags, result+3, 255);
svf_id[15] = 0;
@@ -3604,14 +3610,16 @@ void execute_save(pixel *vid_buf)
free(result);
return;
}
- if (result && strncmp(result, "OK", 2))
+ if (!result || strncmp(result, "OK", 2))
{
+ if (!result)
+ result = mystrdup("Could not save - no reply from server");
error_ui(vid_buf, 0, result);
free(result);
return;
}
- if (result[2])
+ if (result && result[2])
{
strncpy(svf_id, result+3, 15);
svf_id[15] = 0;
@@ -3839,13 +3847,15 @@ struct command_history {
};
typedef struct command_history command_history;
command_history *last_command = NULL;
-char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show previous commands
+command_history *last_command2 = NULL;
+char *console_ui(pixel *vid_buf,char error[255],char console_more) {
int mx,my,b,cc,ci = -1;
pixel *old_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
command_history *currentcommand;
+ command_history *currentcommand2;
ui_edit ed;
ed.x = 15;
- ed.y = 210;
+ ed.y = 207;
ed.w = XRES;
ed.nx = 1;
ed.def = "";
@@ -3854,9 +3864,22 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
ed.hide = 0;
ed.multiline = 0;
ed.cursor = 0;
+ //fillrect(vid_buf, -1, -1, XRES, 220, 0, 0, 0, 190);
memcpy(old_buf,vid_buf,(XRES+BARSIZE)*YRES*PIXELSIZE);
- fillrect(old_buf, -1, -1, XRES, 220, 0, 0, 0, 190);
-
+ fillrect(old_buf, -1, -1, XRES+1, 220, 0, 0, 0, 190);
+
+ currentcommand2 = malloc(sizeof(command_history));
+ memset(currentcommand2, 0, sizeof(command_history));
+ currentcommand2->prev_command = last_command2;
+ currentcommand2->command = mystrdup(error);
+ last_command2 = currentcommand2;
+
+ SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
+ cc = 0;
+ while(cc < 80){
+ fillrect(old_buf, -1, -1+cc, XRES+BARSIZE, 2, 0, 0, 0, 160-(cc*2));
+ cc++;
+ }
while (!sdl_poll())
{
b = SDL_GetMouseState(&mx, &my);
@@ -3866,11 +3889,10 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
//clearrect(vid_buf, 0, 0, XRES+BARSIZE, 220);//anyway to make it transparent?
memcpy(vid_buf,old_buf,(XRES+BARSIZE)*YRES*PIXELSIZE);
- draw_line(vid_buf, 1, 219, XRES, 219, 228, 228, 228, XRES+BARSIZE);
- drawtext(vid_buf, 100, 15, "Welcome to The Powder Toy console v.3 (by cracker64)\n"
- "Current commands are quit, set, reset, load, create, file, kill, sound\n" //TODO: help command
- ,255, 187, 187, 255);
-
+ draw_line(vid_buf, 0, 219, XRES+BARSIZE-1, 219, 228, 228, 228, XRES+BARSIZE);
+ drawtext(vid_buf, 15, 15, "Welcome to The Powder Toy console v.3 (by cracker64, python by Doxin)" //TODO: help command
+ ,255, 255, 255, 255);
+
cc = 0;
currentcommand = last_command;
while(cc < 10)
@@ -3893,9 +3915,36 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
break;
}
}
+ cc = 0;
+ currentcommand2 = last_command2;
+ while(cc < 10)
+ {
+ if(currentcommand2==NULL)
+ break;
+ drawtext(vid_buf, 215, 175-(cc*12), currentcommand2->command, 255, 225, 225, 255);
+ if(currentcommand2->prev_command!=NULL)
+ {
+ if(cc<9) {
+ currentcommand2 = currentcommand2->prev_command;
+ } else if(currentcommand2->prev_command!=NULL) {
+ free(currentcommand2->prev_command);
+ currentcommand2->prev_command = NULL;
+ }
+ cc++;
+ }
+ else
+ {
+ break;
+ }
+ }
- if(error)
- drawtext(vid_buf, 15, 190, error,255, 187, 187, 255);
+ //if(error && ed.str[0]=='\0')
+ //drawtext(vid_buf, 20, 207, error, 255, 127, 127, 200);
+ if(console_more==0)
+ drawtext(vid_buf, 5, 207, ">", 255, 255, 255, 240);
+ else
+ drawtext(vid_buf, 5, 207, "...", 255, 255, 255, 240);
+
ui_edit_draw(vid_buf, &ed);
ui_edit_process(mx, my, b, &ed);
sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));
@@ -3907,12 +3956,14 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
currentcommand->command = mystrdup(ed.str);
last_command = currentcommand;
free(old_buf);
+ SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL);
return currentcommand->command;
}
if (sdl_key==SDLK_ESCAPE || sdl_key==SDLK_BACKQUOTE)
{
console_mode = 0;
free(old_buf);
+ SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL);
return NULL;
}
if(sdl_key==SDLK_UP || sdl_key==SDLK_DOWN)
@@ -3949,6 +4000,7 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
}
console_mode = 0;
free(old_buf);
+ SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL);
return NULL;
}
diff --git a/src/main.c b/src/main.c
index 6795f51..2323b97 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,12 +1,13 @@
/**
* Powder Toy - Main source
*
- * Copyright (c) 2008 - 2010 Stanislaw Skowronek.
- * Copyright (c) 2010 Simon Robertshaw
- * Copyright (c) 2010 Skresanov Savely
- * Copyright (c) 2010 Bryan Hoyle
- * Copyright (c) 2010 Nathan Cousins
- * Copyright (c) 2010 cracker64
+ * Copyright (c) 2008 - 2011 Stanislaw Skowronek.
+ * Copyright (c) 2010 - 2011 Simon Robertshaw
+ * Copyright (c) 2010 - 2011 Skresanov Savely
+ * Copyright (c) 2010 - 2011 Bryan Hoyle
+ * Copyright (c) 2010 - 2011 Nathan Cousins
+ * Copyright (c) 2010 - 2011 cracker64
+ * Copyright (c) 2011 jacksonmj
*
* 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
@@ -23,6 +24,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#include <defines.h>
+
+#ifdef PYCONSOLE
+#include "Python.h"
+#include "pyconsole.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -41,7 +49,6 @@
#include <misc.h>
#include <font.h>
-#include <defines.h>
#include <powder.h>
#include <graphics.h>
#include <version.h>
@@ -52,6 +59,8 @@
#include <air.h>
#include <icon.h>
+pixel *vid_buf;
+
#define NUM_SOUNDS 2
struct sample {
Uint8 *data;
@@ -118,7 +127,7 @@ void play_sound(char *file)
}
static const char *it_msg =
- "\brThe Powder Toy - http://powdertoy.co.uk/\n"
+ "\brThe Powder Toy - http://powdertoy.co.uk, irc.freenode.net #powder\n"
"\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n"
"\n"
"\bgControl+C/V/X are Copy, Paste and cut respectively.\n"
@@ -138,12 +147,8 @@ static const char *it_msg =
"The spacebar can be used to pause physics.\n"
"'P' will take a screenshot and save it into the current directory.\n"
"\n"
- "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n"
- "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n"
- "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n"
- "\bgCopyright (c) 2010 cracker64\n"
- "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n"
- "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n"
+ "\bgCopyright (c) 2008-11 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n"
+ "\bgCopyright (c) 2010-11 Simon Robertshaw, Skresanov Savely, cracker64, Bryan Hoyle, Nathan Cousins, jacksonmj\n"
"\n"
"\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html"
;
@@ -162,6 +167,7 @@ float mheat = 0.0f;
int do_open = 0;
int sys_pause = 0;
+int sys_shortcuts = 1;
int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save.
int death = 0, framerender = 0;
int amd = 1;
@@ -1174,6 +1180,746 @@ char my_uri[] = "http://" SERVER "/Update.api?Action=Download&Architecture="
"SSE"
#endif
;
+
+
+char console_error[255] = "";
+
+#ifdef PYCONSOLE
+/*
+ * PYTHON FUNCTIONS
+ * instructions on making a function callable from python:
+ * first you make a function that accepts (PyObject *self, PyObject *args) as arguments
+ * then you use PyArg_ParseTuple to parse the arguments, handle everything the function should do.
+ * register the function by adding a line to static PyMethodDef EmbMethods[] = {
+ * the line should look like this:
+ * {"PyFunctionname", Functionname, METH_VARARGS,"short help string"},
+ * for more information on the PyWhatever functions look here:
+ * http://docs.python.org/extending/extending.html
+ */
+
+//functions callable from python:
+
+static PyObject*
+emb_create(PyObject *self, PyObject *args, PyObject *keywds)
+{
+ int x,y,t;
+ char *name = "";
+ char *kwlist[] = {"x","y","t","name", NULL};
+ if(!PyArg_ParseTupleAndKeywords(args, keywds, "II|Is:create",kwlist, &x,&y,&t,&name))
+ return NULL;
+ //
+ if(strcmp(name,"")!=0)
+ console_parse_type(name, &t, console_error);
+ return Py_BuildValue("i",create_part(-1,x,y,t));
+}
+//sys_pause = !sys_pause
+emb_pause(PyObject *self, PyObject *args)
+{
+ int x,y,t;
+ if(!PyArg_ParseTuple(args, ":unpause"))
+ return NULL;
+ //
+ sys_pause=1;
+ return Py_BuildValue("i",1);
+}
+
+emb_unpause(PyObject *self, PyObject *args)
+{
+ int x,y,t;
+ if(!PyArg_ParseTuple(args, ":pause"))
+ return NULL;
+ //
+ sys_pause=0;
+ return Py_BuildValue("i",1);
+}
+
+emb_toggle_pause(PyObject *self, PyObject *args)
+{
+ int x,y,t;
+ if(!PyArg_ParseTuple(args, ":toggle_pause"))
+ return NULL;
+ //
+ sys_pause=!sys_pause;
+ return Py_BuildValue("i",1);
+}
+
+//console_mode
+
+emb_toggle_console(PyObject *self, PyObject *args)
+{
+ int x,y,t;
+ if(!PyArg_ParseTuple(args, ":toggle_console"))
+ return NULL;
+ //
+ console_mode=!console_mode;
+ return Py_BuildValue("i",1);
+}
+
+emb_open_console(PyObject *self, PyObject *args)
+{
+ int x,y,t;
+ if(!PyArg_ParseTuple(args, ":toggle_console"))
+ return NULL;
+ //
+ console_mode=1;
+ return Py_BuildValue("i",1);
+}
+
+emb_close_console(PyObject *self, PyObject *args)
+{
+ int x,y,t;
+ if(!PyArg_ParseTuple(args, ":toggle_console"))
+ return NULL;
+ //
+ console_mode=0;
+ return Py_BuildValue("i",1);
+}
+
+
+emb_log(PyObject *self, PyObject *args)
+{
+ char *buffer;
+ if(!PyArg_ParseTuple(args, "s:log",&buffer))
+ return NULL;
+ //
+ strcpy(console_error,buffer);
+ puts(buffer);
+ return Py_BuildValue("i",1);
+}
+
+char console_more=0;
+
+emb_console_more(PyObject *self, PyObject *args)
+{
+ if(!PyArg_ParseTuple(args, ":log"))
+ return NULL;
+ //
+ console_more=1;
+ return Py_BuildValue("i",1);
+}
+
+emb_console_less(PyObject *self, PyObject *args)
+{
+ if(!PyArg_ParseTuple(args, ":log"))
+ return NULL;
+ //
+ console_more=0;
+ return Py_BuildValue("i",1);
+}
+
+//drawtext(vid_buf, 15, 175-(cc*12), currentcommand->command, 255, 255, 255, 255);
+
+
+emb_reset_pressure(PyObject *self, PyObject *args)
+{
+ if(!PyArg_ParseTuple(args, ":reset_pressure"))
+ return NULL;
+ //
+ for (int nx = 0; nx<XRES/CELL; nx++)
+ for (int ny = 0; ny<YRES/CELL; ny++)
+ {
+ pv[ny][nx] = 0;
+ }
+ return Py_BuildValue("i",1);
+}
+
+emb_reset_velocity(PyObject *self, PyObject *args)
+{
+ if(!PyArg_ParseTuple(args, ":reset_velocity"))
+ return NULL;
+ //
+ for (int nx = 0; nx<XRES/CELL; nx++)
+ for (int ny = 0; ny<YRES/CELL; ny++)
+ {
+ vx[ny][nx] = 0;
+ vy[ny][nx] = 0;
+ }
+ return Py_BuildValue("i",1);
+}
+
+emb_reset_sparks(PyObject *self, PyObject *args)
+{
+ if(!PyArg_ParseTuple(args, ":reset_sparks"))
+ return NULL;
+ //
+ for(int i=0; i<NPART; i++)
+ {
+ if(parts[i].type==PT_SPRK)
+ {
+ parts[i].type = parts[i].ctype;
+ parts[i].life = 4;
+ }
+ }
+ return Py_BuildValue("i",1);
+}
+
+emb_set_life(PyObject *self, PyObject *args, PyObject *keywds)
+{
+ int i = -1,life,j,x=-1,y=-1;
+ char *name = "";
+ char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
+ if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y))
+ return NULL;
+ //
+ if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1)
+ return Py_BuildValue("s","Need more args(coords,i,or a particle name)");
+ if(strcmp(name,"all")==0)
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type)
+ parts[i].life = life;
+ }
+ }
+ else if(console_parse_type(name, &j, console_error))
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type == j)
+ parts[i].life = life;
+ }
+ }
+ else if(i!=-1)
+ {
+ if(parts[i].type != PT_NONE)
+ parts[i].life = life;
+
+ }
+ else if(x!=-1 && y!=-1 && x>=0 && x<XRES && y>=0 && y<YRES)
+ {
+ if(parts[pmap[y][x]>>8].type != PT_NONE)
+ parts[pmap[y][x]>>8].life = life;
+ }
+ return Py_BuildValue("i",1);
+}
+
+emb_set_type(PyObject *self, PyObject *args, PyObject *keywds)
+{
+ int i = -1,life,j=-1,x=-1,y=-1;
+ char *name = "";
+ char *type = "";
+ char *kwlist[] = {"setto", "settoint", "from", "i", "x", "y", NULL};
+ if(!PyArg_ParseTupleAndKeywords(args, keywds, "|sIsIII:set_type",kwlist ,&type,&life,&name,&i,&x,&y))
+ return NULL;
+ //
+ if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1 && j==-1)
+ return Py_BuildValue("s","Need more args(coords,i,or a particle name)");
+ console_parse_type(type, &life, console_error);
+ if(strcmp(name,"all")==0)
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type)
+ parts[i].type = life;
+ }
+ }
+ else if(console_parse_type(name, &j, console_error))
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type == j)
+ parts[i].type = life;
+ }
+ }
+ else if(i!=-1)
+ {
+ if(parts[i].type != PT_NONE)
+ parts[i].type = life;
+
+ }
+ else if(x!=-1 && y!=-1 && x>=0 && x<XRES && y>=0 && y<YRES)
+ {
+ if(parts[pmap[y][x]>>8].type != PT_NONE)
+ parts[pmap[y][x]>>8].type = life;
+ }
+ return Py_BuildValue("i",1);
+}
+
+emb_set_temp(PyObject *self, PyObject *args, PyObject *keywds)
+{
+ int i = -1,life,j,x=-1,y=-1;
+ char *name = "";
+ char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
+ if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y))
+ return NULL;
+ //
+ if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1)
+ return Py_BuildValue("s","Need more args(coords,i,or a particle name)");
+ if(strcmp(name,"all")==0)
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type)
+ parts[i].temp = life;
+ }
+ }
+ else if(console_parse_type(name, &j, console_error))
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type == j)
+ parts[i].temp = life;
+ }
+ }
+ else if(i!=-1)
+ {
+ if(parts[i].type != PT_NONE)
+ parts[i].temp = life;
+
+ }
+ else if(x!=-1 && y!=-1 && x>=0 && x<XRES && y>=0 && y<YRES)
+ {
+ if(parts[pmap[y][x]>>8].type != PT_NONE)
+ parts[pmap[y][x]>>8].temp = life;
+ }
+ return Py_BuildValue("i",1);
+}
+
+emb_set_tmp(PyObject *self, PyObject *args, PyObject *keywds)
+{
+ int i = -1,life,j,x=-1,y=-1;
+ char *name = "";
+ char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
+ if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y))
+ return NULL;
+ //
+ if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1)
+ return Py_BuildValue("s","Need more args(coords,i,or a particle name)");
+ if(strcmp(name,"all")==0)
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type)
+ parts[i].tmp = life;
+ }
+ }
+ else if(console_parse_type(name, &j, console_error))
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type == j)
+ parts[i].tmp = life;
+ }
+ }
+ else if(i!=-1)
+ {
+ if(parts[i].type != PT_NONE)
+ parts[i].tmp = life;
+
+ }
+ else if(x!=-1 && y!=-1 && x>=0 && x<XRES && y>=0 && y<YRES)
+ {
+ if(parts[pmap[y][x]>>8].type != PT_NONE)
+ parts[pmap[y][x]>>8].tmp = life;
+ }
+ return Py_BuildValue("i",1);
+}
+
+emb_set_x(PyObject *self, PyObject *args, PyObject *keywds)
+{
+ int i = -1,life,j,x=-1,y=-1;
+ char *name = "";
+ char *type = "";
+ char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
+ if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y))
+ return NULL;
+ //
+ if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1)
+ return Py_BuildValue("s","Need more args(coords,i,or a particle name)");
+ if(strcmp(name,"all")==0)
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type)
+ parts[i].x = life;
+ }
+ }
+ else if(console_parse_type(name, &j, console_error))
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type == j)
+ parts[i].x = life;
+ }
+ }
+ else if(i!=-1)
+ {
+ if(parts[i].type != PT_NONE)
+ parts[i].x = life;
+
+ }
+ else if(x!=-1 && y!=-1 && x>=0 && x<XRES && y>=0 && y<YRES)
+ {
+ if(parts[pmap[y][x]>>8].type != PT_NONE)
+ parts[pmap[y][x]>>8].x = life;
+ }
+ return Py_BuildValue("i",1);
+}
+
+emb_set_y(PyObject *self, PyObject *args, PyObject *keywds)
+{
+ int i = -1,life,j,x=-1,y=-1;
+ char *name = "";
+ char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
+ if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y))
+ return NULL;
+ //
+ if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1)
+ return Py_BuildValue("s","Need more args(coords,i,or a particle name)");
+ if(strcmp(name,"all")==0)
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type)
+ parts[i].y = life;
+ }
+ }
+ else if(console_parse_type(name, &j, console_error))
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type == j)
+ parts[i].y = life;
+ }
+ }
+ else if(i!=-1)
+ {
+ if(parts[i].type != PT_NONE)
+ parts[i].y = life;
+
+ }
+ else if(x!=-1 && y!=-1 && x>=0 && x<XRES && y>=0 && y<YRES)
+ {
+ if(parts[pmap[y][x]>>8].type != PT_NONE)
+ parts[pmap[y][x]>>8].y = life;
+ }
+ return Py_BuildValue("i",1);
+}
+
+emb_set_ctype(PyObject *self, PyObject *args, PyObject *keywds)
+{
+ int i = -1,life,j,x=-1,y=-1;
+ char *name = "";
+ char *type = "";
+ char *kwlist[] = {"setto", "toctypeint", "from", "i", "x", "y", NULL};
+ if(!PyArg_ParseTupleAndKeywords(args, keywds, "s|IsIII:set_type",kwlist ,&type, &life, &name,&i,&x,&y))
+ return NULL;
+ //
+ if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1)
+ return Py_BuildValue("s","Need more args(coords,i,or a particle name)");
+ if(!life)
+ console_parse_type(type, &life, console_error);
+ if(strcmp(name,"all")==0)
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type)
+ parts[i].ctype = life;
+ }
+ }
+ else if(console_parse_type(name, &j, console_error))
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type == j)
+ parts[i].ctype = life;
+ }
+ }
+ else if(i!=-1)
+ {
+ if(parts[i].type != PT_NONE)
+ parts[i].ctype = life;
+
+ }
+ else if(x!=-1 && y!=-1 && x>=0 && x<XRES && y>=0 && y<YRES)
+ {
+ if(parts[pmap[y][x]>>8].type != PT_NONE)
+ parts[pmap[y][x]>>8].ctype = life;
+ }
+ return Py_BuildValue("i",1);
+}
+
+emb_set_vx(PyObject *self, PyObject *args, PyObject *keywds)
+{
+ int i = -1,life,j,x=-1,y=-1;
+ char *name = "";
+ char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
+ if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y))
+ return NULL;
+ //
+ if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1)
+ return Py_BuildValue("s","Need more args(coords,i,or a particle name)");
+ if(strcmp(name,"all")==0)
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type)
+ parts[i].vx = life;
+ }
+ }
+ else if(console_parse_type(name, &j, console_error))
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type == j)
+ parts[i].vx = life;
+ }
+ }
+ else if(i!=-1)
+ {
+ if(parts[i].type != PT_NONE)
+ parts[i].vx = life;
+
+ }
+ else if(x!=-1 && y!=-1 && x>=0 && x<XRES && y>=0 && y<YRES)
+ {
+ if(parts[pmap[y][x]>>8].type != PT_NONE)
+ parts[pmap[y][x]>>8].vx = life;
+ }
+ return Py_BuildValue("i",1);
+}
+
+emb_set_vy(PyObject *self, PyObject *args, PyObject *keywds)
+{
+ int i = -1,life,j,x=-1,y=-1;
+ char *name = "";
+ char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
+ if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y))
+ return NULL;
+ //
+ if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1)
+ return Py_BuildValue("s","Need more args(coords,i,or a particle name)");
+ if(strcmp(name,"all")==0)
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type)
+ parts[i].vy = life;
+ }
+ }
+ else if(console_parse_type(name, &j, console_error))
+ {
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type == j)
+ parts[i].vy = life;
+ }
+ }
+ else if(i!=-1)
+ {
+ if(parts[i].type != PT_NONE)
+ parts[i].vy = life;
+
+ }
+ else if(x!=-1 && y!=-1 && x>=0 && x<XRES && y>=0 && y<YRES)
+ {
+ if(parts[pmap[y][x]>>8].type != PT_NONE)
+ parts[pmap[y][x]>>8].vy = life;
+ }
+ return Py_BuildValue("i",1);
+}
+emb_get_pmap(PyObject *self, PyObject *args)
+{
+ int x,y;
+ if(!PyArg_ParseTuple(args, "II:get_pmap",&x,&y))
+ return NULL;
+ //
+ if(x<0 || y<0 || x>=XRES || y>=YRES)
+ return Py_BuildValue("i",-1);
+
+ return Py_BuildValue("I",pmap[y][x]);
+}
+emb_get_prop(PyObject *self, PyObject *args)
+{
+ int i;
+ char *prop = "";
+ if(!PyArg_ParseTuple(args, "Is:get_pmap",&i,&prop))
+ return NULL;
+ //
+ if(parts[i].type)
+ {
+ if(strcmp(prop,"type")==0)
+ return Py_BuildValue("i",parts[i].type);
+ if(strcmp(prop,"life")==0)
+ return Py_BuildValue("i",parts[i].life);
+ if(strcmp(prop,"ctype")==0)
+ return Py_BuildValue("i",parts[i].ctype);
+ if(strcmp(prop,"temp")==0)
+ return Py_BuildValue("i",parts[i].temp);
+ if(strcmp(prop,"tmp")==0)
+ return Py_BuildValue("i",parts[i].tmp);
+ if(strcmp(prop,"vy")==0)
+ return Py_BuildValue("f",parts[i].vy);
+ if(strcmp(prop,"vx")==0)
+ return Py_BuildValue("f",parts[i].vx);
+ if(strcmp(prop,"x")==0)
+ return Py_BuildValue("i",parts[i].x);
+ if(strcmp(prop,"y")==0)
+ return Py_BuildValue("i",parts[i].y);
+ }
+
+ return Py_BuildValue("i",-1);
+}
+
+emb_draw_pixel(PyObject *self, PyObject *args)
+{
+ int x,y,r,g,b,a;
+ a=255;
+ if(!PyArg_ParseTuple(args, "IIIII|I:draw_pixel",&x,&y,&r,&g,&b,&a))
+ return NULL;
+
+ if(vid_buf!=NULL)
+ {
+ drawpixel(vid_buf,x,y,r,g,b,a);
+ return Py_BuildValue("i",1);
+ }
+ return Py_BuildValue("i",-1);
+
+}
+
+//drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a)
+emb_draw_text(PyObject *self, PyObject *args)
+{
+ int x,y,r,g,b,a;
+ char *txt;
+ a=255;
+ if(!PyArg_ParseTuple(args, "IIsIII|I:draw_text",&x,&y,&txt,&r,&g,&b,&a))
+ return NULL;
+ if(vid_buf!=NULL)
+ {
+ drawtext(vid_buf,x,y,txt,r,g,b,a);
+ return Py_BuildValue("i",1);
+ }
+ return Py_BuildValue("i",-1);
+}
+
+//drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a)
+emb_draw_rect(PyObject *self, PyObject *args)
+{
+ int x,y,w,h,r,g,b,a;
+ a=255;
+ if(!PyArg_ParseTuple(args, "IIIIIII|I:draw_rect",&x,&y,&w,&h,&r,&g,&b,&a))
+ return NULL;
+ if(vid_buf!=NULL)
+ {
+ drawrect(vid_buf,x,y,w,h,r,g,b,a);
+ //fillrect
+ return Py_BuildValue("i",1);
+ }
+ return Py_BuildValue("i",-1);
+}
+
+emb_draw_fillrect(PyObject *self, PyObject *args)
+{
+ int x,y,w,h,r,g,b,a;
+ a=255;
+ if(!PyArg_ParseTuple(args, "IIIIIII|I:draw_fillrect",&x,&y,&w,&h,&r,&g,&b,&a))
+ return NULL;
+ if(vid_buf!=NULL)
+ {
+ fillrect(vid_buf,x,y,w,h,r,g,b,a);
+ //fillrect
+ return Py_BuildValue("i",1);
+ }
+ return Py_BuildValue("i",-1);
+}
+//int textwidth(char *s)
+emb_get_width(PyObject *self, PyObject *args)
+{
+ char *txt;
+ if(!PyArg_ParseTuple(args, "s:get_width",&txt))
+ return NULL;
+ return Py_BuildValue("i",textwidth(txt));
+}
+
+//SDL_GetMouseState(&x, &y)
+emb_get_mouse(PyObject *self, PyObject *args)
+{
+ int x,y,mask,b1,b2,b3;
+ if(!PyArg_ParseTuple(args, ":get_mouse"))
+ return NULL;
+ mask=SDL_GetMouseState(&x, &y);
+ b1=mask&SDL_BUTTON(1);
+ b2=mask&SDL_BUTTON(2);
+ b3=mask&SDL_BUTTON(3);
+ return Py_BuildValue("(ii(iii))",x,y,b1,b2,b3);
+}
+
+//svf_name
+emb_get_name(PyObject *self, PyObject *args)
+{
+ if(!PyArg_ParseTuple(args, ":get_name"))
+ return NULL;
+ if(svf_login)
+ return Py_BuildValue("s",svf_user);
+ else
+ return Py_BuildValue("s","");
+}
+
+emb_shortcuts_disable(PyObject *self, PyObject *args)
+{
+ if(!PyArg_ParseTuple(args, ":shortcuts_disable"))
+ return NULL;
+ //
+ sys_shortcuts=0;
+ return Py_BuildValue("i",1);
+}
+
+emb_shortcuts_enable(PyObject *self, PyObject *args)
+{
+ if(!PyArg_ParseTuple(args, ":shortcuts_enable"))
+ return NULL;
+ //
+ sys_shortcuts=1;
+ return Py_BuildValue("i",1);
+}
+
+emb_get_modifier(PyObject *self, PyObject *args)
+{
+ if(!PyArg_ParseTuple(args, ":get_modifier"))
+ return NULL;
+ return Py_BuildValue("(iiiiii)",sdl_mod&KMOD_LCTRL,sdl_mod&KMOD_RCTRL,sdl_mod&KMOD_LALT,sdl_mod&KMOD_RALT,sdl_mod&KMOD_LSHIFT,sdl_mod&KMOD_RSHIFT);
+}
+
+static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your function here!
+ {"create", emb_create, METH_VARARGS|METH_KEYWORDS, "create a particle."},
+ {"log", emb_log, METH_VARARGS, "logs an error string to the console."},
+ {"reset_pressure", emb_reset_pressure, METH_VARARGS, "resets all the pressure."},
+ {"reset_velocity", emb_reset_velocity, METH_VARARGS, "resets all the velocity."},
+ {"reset_sparks", 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_type", 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_tmp", 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_y", 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_vx", 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."},
+ {"pause", emb_pause, METH_VARARGS, "pause the game."},
+ {"unpause", emb_unpause, METH_VARARGS, "unpause the game."},
+ {"pause_toggle", emb_toggle_pause, METH_VARARGS, "toggle game pause."},
+ {"console_open", emb_open_console, METH_VARARGS, "open the game console."},
+ {"console_close", emb_close_console, METH_VARARGS, "close the game console."},
+ {"console_toggle", emb_toggle_console, METH_VARARGS, "toggle the game console."},
+ {"console_more", emb_console_more, METH_VARARGS, "turns the more indicator on."},
+ {"console_less", emb_console_less, METH_VARARGS, "turns the more indicator off."},
+ {"get_pmap", emb_get_pmap, METH_VARARGS, "get the pmap value."},
+ {"get_prop", emb_get_prop, METH_VARARGS, "get some properties."},
+ {"draw_pixel", emb_draw_pixel, METH_VARARGS, "draw a pixel."},
+ {"draw_text", emb_draw_text, METH_VARARGS, "draw some text."},
+ {"draw_rect", emb_draw_rect, METH_VARARGS, "draw a rect."},
+ {"draw_fillrect", emb_draw_fillrect, METH_VARARGS, "draw a rect."},
+ {"get_width", emb_get_width, METH_VARARGS, "get string width."},
+ {"get_mouse", emb_get_mouse, METH_VARARGS, "get mouse status."},
+ {"get_name", emb_get_name, METH_VARARGS, "get name of logged in user"},
+ {"shortcuts_disable", emb_shortcuts_disable, METH_VARARGS, "disable keyboard shortcuts"},
+ {"shortcuts_enable", emb_shortcuts_enable, METH_VARARGS, "enable keyboard shortcuts"},
+ {"get_modifier", emb_get_modifier, METH_VARARGS, "get pressed modifier keys"},
+ {NULL, NULL, 0, NULL}
+};
+#endif
+
int main(int argc, char *argv[])
{
int hud_enable = 1;
@@ -1188,11 +1934,11 @@ int main(int argc, char *argv[])
int FPS = 0;
int pastFPS = 0;
int past = 0;
- pixel *vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
void *http_ver_check;
void *http_session_check = NULL;
+ vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
char *ver_data=NULL, *check_data=NULL, *tmp;
- char console_error[255] = "";
+ //char console_error[255] = "";
int i, j, bq, fire_fc=0, do_check=0, do_s_check=0, old_version=0, http_ret=0,http_s_ret=0, major, minor, old_ver_len;
#ifdef INTERNAL
int vs = 0;
@@ -1207,6 +1953,9 @@ int main(int argc, char *argv[])
SDL_AudioSpec fmt;
int username_flash = 0, username_flash_t = 1;
GSPEED = 1;
+ #ifdef PYCONSOLE
+ PyObject *pname,*pmodule,*pfunc,*pvalue,*pargs,*pstep,*pkey;
+ #endif
/* Set 16-bit stereo audio at 22Khz */
fmt.freq = 22050;
@@ -1216,6 +1965,61 @@ int main(int argc, char *argv[])
fmt.callback = mixaudio;
fmt.userdata = NULL;
+ #ifdef PYCONSOLE
+ //initialise python console
+ Py_Initialize();
+ Py_InitModule("tpt", EmbMethods);
+ //change the path to find all the correct modules
+ PyRun_SimpleString("import sys\nsys.path.append('.')");
+ PyRun_SimpleString("print 'python present.'");
+ //load the console module and whatnot
+ PyObject *tpt_console_obj = PyMarshal_ReadObjectFromString(tpt_console_pyc+8, sizeof(tpt_console_pyc)-8);
+ pmodule=PyImport_ExecCodeModule("tpt_console", tpt_console_obj);
+ if(pmodule!=NULL)
+ {
+ pfunc=PyObject_GetAttrString(pmodule,"handle");//get the handler function
+ if(pfunc && PyCallable_Check(pfunc))//check if it's really a function
+ {
+ printf("python console ready to go.\n");
+ }
+ else
+ {
+ PyErr_Print();
+ printf("unable to find handle function, mangled console.py?\n");
+ return -1;
+ }
+
+ pstep=PyObject_GetAttrString(pmodule,"step");//get the handler function
+ if(pstep && PyCallable_Check(pstep))//check if it's really a function
+ {
+ printf("step function found.\n");
+ }
+ else
+ {
+ printf("unable to find step function. ignoring.\n");
+ }
+
+ pkey=PyObject_GetAttrString(pmodule,"keypress");//get the handler function
+ if(pstep && PyCallable_Check(pkey))//check if it's really a function
+ {
+ printf("key function found.\n");
+ }
+ else
+ {
+ printf("unable to find key function. ignoring.\n");
+ }
+ }
+ else
+ {
+ //sys.stderr
+ PyErr_Print();
+ printf("unable to find console module, missing file or mangled console.py?\n");
+ return -1;
+ }
+#else
+ printf("python console disabled at compile time.");
+#endif
+
#ifdef MT
numCores = core_count();
#endif
@@ -1479,363 +2283,380 @@ int main(int argc, char *argv[])
}
do_s_check = (do_s_check+1) & 15;
}
-
- if (sdl_key=='q' || sdl_key==SDLK_ESCAPE)
- {
- if (confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit"))
- {
- break;
- }
- }
- //if(sdl_key=='d' && isplayer)
- //{
- // death = 1;
- // //death = !(death);
- //}
- if (sdl_key=='f')
- {
- framerender = 1;
- }
- if ((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0])
- {
- if (load_mode)
- {
- free(load_img);
- free(load_data);
- load_mode = 0;
- load_data = NULL;
- load_img = NULL;
- }
- if (it > 50)
- it = 50;
- if (sdl_key=='k' && stamps[1].name[0])
- {
- j = stamp_ui(vid_buf);
- if (j>=0)
- load_data = stamp_load(j, &load_size);
- else
- load_data = NULL;
- }
- else
- load_data = stamp_load(0, &load_size);
- if (load_data)
- {
- load_img = prerender_save(load_data, load_size, &load_w, &load_h);
- if (load_img)
- load_mode = 1;
- else
- free(load_data);
- }
- }
- if (sdl_key=='s' && (sdl_mod & (KMOD_CTRL)) || (sdl_key=='s' && !isplayer2))
- {
- if (it > 50)
- it = 50;
- save_mode = 1;
- }
- if (sdl_key=='1')
- {
- set_cmode(CM_VEL);
- }
- if (sdl_key=='2')
- {
- set_cmode(CM_PRESS);
- }
- if (sdl_key=='3')
- {
- set_cmode(CM_PERS);
- }
- if (sdl_key=='4')
- {
- set_cmode(CM_FIRE);
- }
- if (sdl_key=='5')
- {
- set_cmode(CM_BLOB);
- }
- if (sdl_key=='6')
- {
- set_cmode(CM_HEAT);
- }
- if (sdl_key=='7')
- {
- set_cmode(CM_FANCY);
- }
- if (sdl_key=='8')
- {
- set_cmode(CM_NOTHING);
- }
- if (sdl_key=='9')
- {
- set_cmode(CM_GRAD);
- }
- if (sdl_key=='0')
- {
- set_cmode(CM_CRACK);
- }
- if (sdl_key=='1'&& (sdl_mod & (KMOD_SHIFT)) && DEBUG_MODE)
- {
- set_cmode(CM_LIFE);
- }
- if (sdl_key==SDLK_TAB)
- {
- CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ;
- }
- if (sdl_key==SDLK_LEFTBRACKET) {
- if (sdl_zoom_trig==1)
- {
- ZSIZE -= 1;
- if (ZSIZE>60)
- ZSIZE = 60;
- if (ZSIZE<2)
- ZSIZE = 2;
- ZFACTOR = 256/ZSIZE;
- }
- else
- {
- if (sdl_mod & (KMOD_LALT|KMOD_RALT) && !(sdl_mod & (KMOD_SHIFT|KMOD_CTRL)))
- {
- bsx -= 1;
- bsy -= 1;
- }
- else if (sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL)))
- {
- bsx -= 1;
- }
- else if (sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT)))
- {
- bsy -= 1;
- }
- else
- {
- bsx -= ceil((bsx/5)+0.5f);
- bsy -= ceil((bsy/5)+0.5f);
- }
- if (bsx>1180)
- bsx = 1180;
- if (bsy>1180)
- bsy = 1180;
- if (bsx<0)
- bsx = 0;
- if (bsy<0)
- bsy = 0;
- }
- }
- if (sdl_key==SDLK_RIGHTBRACKET) {
- if (sdl_zoom_trig==1)
- {
- ZSIZE += 1;
- if (ZSIZE>60)
- ZSIZE = 60;
- if (ZSIZE<2)
- ZSIZE = 2;
- ZFACTOR = 256/ZSIZE;
- }
- else
- {
- if (sdl_mod & (KMOD_LALT|KMOD_RALT) && !(sdl_mod & (KMOD_SHIFT|KMOD_CTRL)))
- {
- bsx += 1;
- bsy += 1;
- }
- else if (sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL)))
- {
- bsx += 1;
- }
- else if (sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT)))
- {
- bsy += 1;
- }
- else
- {
- bsx += ceil((bsx/5)+0.5f);
- bsy += ceil((bsy/5)+0.5f);
- }
- if (bsx>1180)
- bsx = 1180;
- if (bsy>1180)
- bsy = 1180;
- if (bsx<0)
- bsx = 0;
- if (bsy<0)
- bsy = 0;
- }
- }
- if (sdl_key=='d'&&(sdl_mod & (KMOD_CTRL)) || (sdl_key=='d' && !isplayer2))
- DEBUG_MODE = !DEBUG_MODE;
- if (sdl_key=='i')
- {
- int nx, ny;
- for (nx = 0; nx<XRES/CELL; nx++)
- for (ny = 0; ny<YRES/CELL; ny++)
- {
- pv[ny][nx] = -pv[ny][nx];
- vx[ny][nx] = -vx[ny][nx];
- vy[ny][nx] = -vy[ny][nx];
- }
- }
- if ((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT)))
- active_menu = 11;
- if (sdl_key==SDLK_INSERT)// || sdl_key==SDLK_BACKQUOTE)
- REPLACE_MODE = !REPLACE_MODE;
- if (sdl_key==SDLK_BACKQUOTE)
- {
- console_mode = !console_mode;
- hud_enable = !console_mode;
- }
- if (sdl_key=='g')
- {
- if (sdl_mod & (KMOD_SHIFT))
- GRID_MODE = (GRID_MODE+9)%10;
- else
- GRID_MODE = (GRID_MODE+1)%10;
- }
- if (sdl_key=='=')
- {
- int nx, ny;
- if(sdl_mod & (KMOD_CTRL))
- {
- for(i=0; i<NPART; i++)
- if(parts[i].type==PT_SPRK)
- {
- parts[i].type = parts[i].ctype;
- parts[i].life = 0;
- }
- }
- else
- {
- for (nx = 0; nx<XRES/CELL; nx++)
- for (ny = 0; ny<YRES/CELL; ny++)
- {
- pv[ny][nx] = 0;
- vx[ny][nx] = 0;
- vy[ny][nx] = 0;
- }
- }
- }
-
- if (sdl_key=='w' && (!isplayer2 || (sdl_mod & (KMOD_SHIFT)))) //Gravity, by Moach
- {
- ++gravityMode; // cycle gravity mode
- itc = 51;
-
- switch (gravityMode)
- {
- default:
- gravityMode = 0;
- case 0:
- strcpy(itc_msg, "Gravity: Vertical");
- break;
- case 1:
- strcpy(itc_msg, "Gravity: Off");
- break;
- case 2:
- strcpy(itc_msg, "Gravity: Radial");
- break;
-
- }
- }
- if (sdl_key=='y')
- {
- ++airMode;
- itc = 52;
-
- switch (airMode)
- {
- default:
- airMode = 0;
- case 0:
- strcpy(itc_msg, "Air: On");
- break;
- case 1:
- strcpy(itc_msg, "Air: Pressure Off");
- break;
- case 2:
- strcpy(itc_msg, "Air: Velocity Off");
- break;
- case 3:
- strcpy(itc_msg, "Air: Off");
- break;
- case 4:
- strcpy(itc_msg, "Air: No Update");
- break;
- }
- }
-
- if (sdl_key=='t')
- VINE_MODE = !VINE_MODE;
- if (sdl_key==SDLK_SPACE)
- sys_pause = !sys_pause;
- if (sdl_key=='h')
- hud_enable = !hud_enable;
- if (sdl_key=='p')
- dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE);
- if (sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
- {
- if (clipboard_ready==1)
- {
- load_data = malloc(clipboard_length);
- memcpy(load_data, clipboard_data, clipboard_length);
- load_size = clipboard_length;
- if (load_data)
- {
- load_img = prerender_save(load_data, load_size, &load_w, &load_h);
- if (load_img)
- load_mode = 1;
- else
- free(load_data);
- }
- }
- }
- if (sdl_key=='r'&&(sdl_mod & (KMOD_CTRL))&&(sdl_mod & (KMOD_SHIFT)))
- {
- save_mode = 1;
- copy_mode = 4;//invert
- }
- else if (sdl_key=='r'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
- {
- save_mode = 1;
- copy_mode = 3;//rotate
- }
- else if (sdl_key=='r')
- GENERATION = 0;
- if (sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
- {
- save_mode = 1;
- copy_mode = 2;
- }
- if (sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
- {
- save_mode = 1;
- copy_mode = 1;
- }
- else if (sdl_key=='c')
- {
- set_cmode((cmode+1) % CM_COUNT);
- if (it > 50)
- it = 50;
- }
- if (sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo
- {
- int cbx, cby, cbi;
-
- for (cbi=0; cbi<NPART; cbi++)
- parts[cbi] = cb_parts[cbi];
-
- for (cby = 0; cby<YRES; cby++)
- for (cbx = 0; cbx<XRES; cbx++)
- pmap[cby][cbx] = cb_pmap[cby][cbx];
-
- for (cby = 0; cby<(YRES/CELL); cby++)
- for (cbx = 0; cbx<(XRES/CELL); cbx++)
- {
- vx[cby][cbx] = cb_vx[cby][cbx];
- vy[cby][cbx] = cb_vy[cby][cbx];
- pv[cby][cbx] = cb_pv[cby][cbx];
- bmap[cby][cbx] = cb_bmap[cby][cbx];
- emap[cby][cbx] = cb_emap[cby][cbx];
- }
- }
+
+ if(sys_shortcuts==1)
+ {
+ if (sdl_key=='q' || sdl_key==SDLK_ESCAPE)
+ {
+ if (confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit"))
+ {
+ break;
+ }
+ }
+ //if(sdl_key=='d' && isplayer)
+ //{
+ // death = 1;
+ // //death = !(death);
+ //}
+ if (sdl_key=='f')
+ {
+ framerender = 1;
+ }
+ if ((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0])
+ {
+ if (load_mode)
+ {
+ free(load_img);
+ free(load_data);
+ load_mode = 0;
+ load_data = NULL;
+ load_img = NULL;
+ }
+ if (it > 50)
+ it = 50;
+ if (sdl_key=='k' && stamps[1].name[0])
+ {
+ j = stamp_ui(vid_buf);
+ if (j>=0)
+ load_data = stamp_load(j, &load_size);
+ else
+ load_data = NULL;
+ }
+ else
+ load_data = stamp_load(0, &load_size);
+ if (load_data)
+ {
+ load_img = prerender_save(load_data, load_size, &load_w, &load_h);
+ if (load_img)
+ load_mode = 1;
+ else
+ free(load_data);
+ }
+ }
+ if (sdl_key=='s' && (sdl_mod & (KMOD_CTRL)) || (sdl_key=='s' && !isplayer2))
+ {
+ if (it > 50)
+ it = 50;
+ save_mode = 1;
+ }
+ if (sdl_key=='1')
+ {
+ set_cmode(CM_VEL);
+ }
+ if (sdl_key=='2')
+ {
+ set_cmode(CM_PRESS);
+ }
+ if (sdl_key=='3')
+ {
+ set_cmode(CM_PERS);
+ }
+ if (sdl_key=='4')
+ {
+ set_cmode(CM_FIRE);
+ }
+ if (sdl_key=='5')
+ {
+ set_cmode(CM_BLOB);
+ }
+ if (sdl_key=='6')
+ {
+ set_cmode(CM_HEAT);
+ }
+ if (sdl_key=='7')
+ {
+ set_cmode(CM_FANCY);
+ }
+ if (sdl_key=='8')
+ {
+ set_cmode(CM_NOTHING);
+ }
+ if (sdl_key=='9')
+ {
+ set_cmode(CM_GRAD);
+ }
+ if (sdl_key=='0')
+ {
+ set_cmode(CM_CRACK);
+ }
+ if (sdl_key=='1'&& (sdl_mod & (KMOD_SHIFT)) && DEBUG_MODE)
+ {
+ set_cmode(CM_LIFE);
+ }
+ if (sdl_key==SDLK_TAB)
+ {
+ CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ;
+ }
+ if (sdl_key==SDLK_LEFTBRACKET) {
+ if (sdl_zoom_trig==1)
+ {
+ ZSIZE -= 1;
+ if (ZSIZE>60)
+ ZSIZE = 60;
+ if (ZSIZE<2)
+ ZSIZE = 2;
+ ZFACTOR = 256/ZSIZE;
+ }
+ else
+ {
+ if (sdl_mod & (KMOD_LALT|KMOD_RALT) && !(sdl_mod & (KMOD_SHIFT|KMOD_CTRL)))
+ {
+ bsx -= 1;
+ bsy -= 1;
+ }
+ else if (sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL)))
+ {
+ bsx -= 1;
+ }
+ else if (sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT)))
+ {
+ bsy -= 1;
+ }
+ else
+ {
+ bsx -= ceil((bsx/5)+0.5f);
+ bsy -= ceil((bsy/5)+0.5f);
+ }
+ if (bsx>1180)
+ bsx = 1180;
+ if (bsy>1180)
+ bsy = 1180;
+ if (bsx<0)
+ bsx = 0;
+ if (bsy<0)
+ bsy = 0;
+ }
+ }
+ if (sdl_key==SDLK_RIGHTBRACKET) {
+ if (sdl_zoom_trig==1)
+ {
+ ZSIZE += 1;
+ if (ZSIZE>60)
+ ZSIZE = 60;
+ if (ZSIZE<2)
+ ZSIZE = 2;
+ ZFACTOR = 256/ZSIZE;
+ }
+ else
+ {
+ if (sdl_mod & (KMOD_LALT|KMOD_RALT) && !(sdl_mod & (KMOD_SHIFT|KMOD_CTRL)))
+ {
+ bsx += 1;
+ bsy += 1;
+ }
+ else if (sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL)))
+ {
+ bsx += 1;
+ }
+ else if (sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT)))
+ {
+ bsy += 1;
+ }
+ else
+ {
+ bsx += ceil((bsx/5)+0.5f);
+ bsy += ceil((bsy/5)+0.5f);
+ }
+ if (bsx>1180)
+ bsx = 1180;
+ if (bsy>1180)
+ bsy = 1180;
+ if (bsx<0)
+ bsx = 0;
+ if (bsy<0)
+ bsy = 0;
+ }
+ }
+ if (sdl_key=='d'&&(sdl_mod & (KMOD_CTRL)) || (sdl_key=='d' && !isplayer2))
+ DEBUG_MODE = !DEBUG_MODE;
+ if (sdl_key=='i')
+ {
+ int nx, ny;
+ for (nx = 0; nx<XRES/CELL; nx++)
+ for (ny = 0; ny<YRES/CELL; ny++)
+ {
+ pv[ny][nx] = -pv[ny][nx];
+ vx[ny][nx] = -vx[ny][nx];
+ vy[ny][nx] = -vy[ny][nx];
+ }
+ }
+ if ((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT)))
+ active_menu = 11;
+ if (sdl_key==SDLK_INSERT)// || sdl_key==SDLK_BACKQUOTE)
+ REPLACE_MODE = !REPLACE_MODE;
+ if (sdl_key==SDLK_BACKQUOTE)
+ {
+ console_mode = !console_mode;
+ //hud_enable = !console_mode;
+ }
+ if (sdl_key=='g')
+ {
+ if (sdl_mod & (KMOD_SHIFT))
+ GRID_MODE = (GRID_MODE+9)%10;
+ else
+ GRID_MODE = (GRID_MODE+1)%10;
+ }
+ if (sdl_key=='=')
+ {
+ int nx, ny;
+ if(sdl_mod & (KMOD_CTRL))
+ {
+ for(i=0; i<NPART; i++)
+ if(parts[i].type==PT_SPRK)
+ {
+ parts[i].type = parts[i].ctype;
+ parts[i].life = 0;
+ }
+ }
+ else
+ {
+ for (nx = 0; nx<XRES/CELL; nx++)
+ for (ny = 0; ny<YRES/CELL; ny++)
+ {
+ pv[ny][nx] = 0;
+ vx[ny][nx] = 0;
+ vy[ny][nx] = 0;
+ }
+ }
+ }
+
+ if (sdl_key=='w' && (!isplayer2 || (sdl_mod & (KMOD_SHIFT)))) //Gravity, by Moach
+ {
+ ++gravityMode; // cycle gravity mode
+ itc = 51;
+
+ switch (gravityMode)
+ {
+ default:
+ gravityMode = 0;
+ case 0:
+ strcpy(itc_msg, "Gravity: Vertical");
+ break;
+ case 1:
+ strcpy(itc_msg, "Gravity: Off");
+ break;
+ case 2:
+ strcpy(itc_msg, "Gravity: Radial");
+ break;
+
+ }
+ }
+ if (sdl_key=='y')
+ {
+ ++airMode;
+ itc = 52;
+
+ switch (airMode)
+ {
+ default:
+ airMode = 0;
+ case 0:
+ strcpy(itc_msg, "Air: On");
+ break;
+ case 1:
+ strcpy(itc_msg, "Air: Pressure Off");
+ break;
+ case 2:
+ strcpy(itc_msg, "Air: Velocity Off");
+ break;
+ case 3:
+ strcpy(itc_msg, "Air: Off");
+ break;
+ case 4:
+ strcpy(itc_msg, "Air: No Update");
+ break;
+ }
+ }
+
+ if (sdl_key=='t')
+ VINE_MODE = !VINE_MODE;
+ if (sdl_key==SDLK_SPACE)
+ sys_pause = !sys_pause;
+ if (sdl_key=='h')
+ hud_enable = !hud_enable;
+ if (sdl_key=='p')
+ dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE);
+ if (sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
+ {
+ if (clipboard_ready==1)
+ {
+ load_data = malloc(clipboard_length);
+ memcpy(load_data, clipboard_data, clipboard_length);
+ load_size = clipboard_length;
+ if (load_data)
+ {
+ load_img = prerender_save(load_data, load_size, &load_w, &load_h);
+ if (load_img)
+ load_mode = 1;
+ else
+ free(load_data);
+ }
+ }
+ }
+ if (sdl_key=='r'&&(sdl_mod & (KMOD_CTRL))&&(sdl_mod & (KMOD_SHIFT)))
+ {
+ save_mode = 1;
+ copy_mode = 4;//invert
+ }
+ else if (sdl_key=='r'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
+ {
+ save_mode = 1;
+ copy_mode = 3;//rotate
+ }
+ else if (sdl_key=='r')
+ GENERATION = 0;
+ if (sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
+ {
+ save_mode = 1;
+ copy_mode = 2;
+ }
+ if (sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
+ {
+ save_mode = 1;
+ copy_mode = 1;
+ }
+ else if (sdl_key=='c')
+ {
+ set_cmode((cmode+1) % CM_COUNT);
+ if (it > 50)
+ it = 50;
+ }
+ if (sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo
+ {
+ int cbx, cby, cbi;
+
+ for (cbi=0; cbi<NPART; cbi++)
+ parts[cbi] = cb_parts[cbi];
+
+ for (cby = 0; cby<YRES; cby++)
+ for (cbx = 0; cbx<XRES; cbx++)
+ pmap[cby][cbx] = cb_pmap[cby][cbx];
+
+ for (cby = 0; cby<(YRES/CELL); cby++)
+ for (cbx = 0; cbx<(XRES/CELL); cbx++)
+ {
+ vx[cby][cbx] = cb_vx[cby][cbx];
+ vy[cby][cbx] = cb_vy[cby][cbx];
+ pv[cby][cbx] = cb_pv[cby][cbx];
+ bmap[cby][cbx] = cb_bmap[cby][cbx];
+ emap[cby][cbx] = cb_emap[cby][cbx];
+ }
+ }
+ }
+ #ifdef PYCONSOLE
+ if(pkey!=NULL && sdl_key!=NULL)
+ {
+ pargs=Py_BuildValue("(c)",sdl_key);
+ pvalue = PyObject_CallObject(pkey, pargs);
+ Py_DECREF(pargs);
+ pargs=NULL;
+ if(pvalue==NULL)
+ strcpy(console_error,"failed to execute key code.");
+ //Py_DECREF(pvalue);
+ //puts("a");
+ pvalue=NULL;
+ }
+ #endif
#ifdef INTERNAL
int counterthing;
if (sdl_key=='v'&&!(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
@@ -1910,23 +2731,6 @@ int main(int argc, char *argv[])
}*/
}
}
- if(console_mode)
- {
- char *console;
- //char error[255] = "error!";
- sys_pause = 1;
- console = console_ui(vid_buf,console_error);
- console = mystrdup(console);
- strcpy(console_error,"");
- if(process_command(vid_buf,console,&console_error)==-1)
- {
- free(console);
- break;
- }
- free(console);
- if(!console_mode)
- hud_enable = 1;
- }
bq = b;
b = SDL_GetMouseState(&x, &y);
@@ -1986,6 +2790,7 @@ int main(int argc, char *argv[])
}
}
}
+
mx = x;
my = y;
if (update_flag)
@@ -2135,7 +2940,7 @@ int main(int argc, char *argv[])
if (!sdl_zoom_trig && zoom_en==1)
zoom_en = 0;
- if (sdl_key=='z' && zoom_en==2)
+ if (sdl_key=='z' && zoom_en==2 && sys_shortcuts==1)
zoom_en = 1;
if (load_mode)
@@ -2440,7 +3245,7 @@ int main(int argc, char *argv[])
{
for (j=-bsy; j<=bsy; j++)
for (i=-bsx; i<=bsx; i++)
- if (x+i>0 && y+j>0 && x+i<XRES && y+j<YRES && ((CURRENT_BRUSH==CIRCLE_BRUSH && (pow(i,2))/(pow(bsx,2))+(pow(j,2))/(pow(bsy,2))<=1)||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=bsy*bsx)))
+ if ((CURRENT_BRUSH==CIRCLE_BRUSH && (pow(i,2))/(pow(bsx,2))+(pow(j,2))/(pow(bsy,2))<=1)||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=bsy*bsx))
{
vx[(y+j)/CELL][(x+i)/CELL] += (x-lx)*0.01f;
vy[(y+j)/CELL][(x+i)/CELL] += (y-ly)*0.01f;
@@ -2745,7 +3550,46 @@ int main(int argc, char *argv[])
}
fillrect(vid_buf, 12, 12, textwidth(uitext)+8, 15, 0, 0, 0, 140);
drawtext(vid_buf, 16, 16, uitext, 32, 216, 255, 200);
+
}
+
+ if(console_mode)
+ {
+ #ifdef PYCONSOLE
+ char *console;
+ //char error[255] = "error!";
+ sys_pause = 1;
+ console = console_ui(vid_buf,console_error,console_more);
+ console = mystrdup(console);
+ strcpy(console_error,"");
+ if(process_command(vid_buf,console,&console_error,pfunc)==-1)
+ {
+ free(console);
+ break;
+ }
+ free(console);
+ if(!console_mode)
+ hud_enable = 1;
+ #else
+ console_mode=0;
+ #endif
+ }
+
+ //execute python step hook
+ #ifdef PYCONSOLE
+ if(pstep!=NULL)
+ {
+ pargs=Py_BuildValue("()");
+ pvalue = PyObject_CallObject(pstep, pargs);
+ Py_DECREF(pargs);
+ pargs=NULL;
+ if(pvalue==NULL)
+ strcpy(console_error,"failed to execute step code.");
+ //Py_DECREF(pvalue);
+ //puts("a");
+ pvalue=NULL;
+ }
+ #endif
sdl_blit(0, 0, XRES+BARSIZE, YRES+MENUSIZE, vid_buf, XRES+BARSIZE);
//Setting an element for the stick man
@@ -2763,13 +3607,14 @@ int main(int argc, char *argv[])
else
player2[2] = PT_DUST;
}
-
}
SDL_CloseAudio();
http_done();
+ Py_Finalize();//cleanup any python stuff.
return 0;
}
-int process_command(pixel *vid_buf,char *console,char *console_error) {
+#ifdef PYCONSOLE
+int process_command(pixel *vid_buf,char *console,char *console_error,PyObject *pfunc) {
int y,x,nx,ny,i,j,k,m;
int do_next = 1;
char xcoord[10];
@@ -2778,6 +3623,7 @@ int process_command(pixel *vid_buf,char *console,char *console_error) {
char console3[15];
char console4[15];
char console5[15];
+ PyObject *pvalue,*pargs;
//sprintf(console_error, "%s", console);
if(console && strcmp(console, "")!=0 && strncmp(console, " ", 1)!=0)
{
@@ -2786,450 +3632,21 @@ int process_command(pixel *vid_buf,char *console,char *console_error) {
{
return -1;
}
- else if(strcmp(console2, "file")==0 && console3)
- {
- if(file_script){
- FILE *f=fopen(console3, "r");
- if(f)
- {
- char fileread[5000];//TODO: make this change with file size
- char pch[5000];
- char tokens[10];
- int tokensize;
- nx = 0;
- ny = 0;
- j = 0;
- m = 0;
- if(console4)
- console_parse_coords(console4, &nx , &ny, console_error);
- memset(pch,0,sizeof(pch));
- memset(fileread,0,sizeof(fileread));
- fread(fileread,1,5000,f);
- for(i=0; i<strlen(fileread); i++)
- {
- if(fileread[i] != '\n')
- {
- pch[i-j] = fileread[i];
- if(fileread[i] != ' ')
- tokens[i-m] = fileread[i];
- }
- if(fileread[i] == ' ' || fileread[i] == '\n')
- {
- if(sregexp(tokens,"^x.[0-9],y.[0-9]")==0)//TODO: fix regex matching to work with x,y ect, right now it has to have a +0 or -0
- {
- char temp[5];
- int starty = 0;
- tokensize = strlen(tokens);
- x = 0;
- y = 0;
- sscanf(tokens,"x%d,y%d",&x,&y);
- sscanf(tokens,"%9s,%9s",xcoord,ycoord);
- x += nx;
- y += ny;
- sprintf(xcoord,"%d",x);
- sprintf(ycoord,"%d",y);
- for(k = 0; k<strlen(xcoord);k++)//rewrite pch with numbers
- {
- pch[i-j-tokensize+k] = xcoord[k];
- starty = k+1;
- }
- pch[i-j-tokensize+starty] = ',';
- starty++;
- for(k=0;k<strlen(ycoord);k++)
- {
- pch[i-j-tokensize+starty+k] = ycoord[k];
-
- }
- pch[i-j-tokensize +strlen(xcoord) +1 +strlen(ycoord)] = ' ';
- j = j -tokensize +strlen(xcoord) +1 +strlen(ycoord);
- }
- memset(tokens,0,sizeof(tokens));
- m = i+1;
- }
- if(fileread[i] == '\n')
- {
-
- if(do_next)
- {
- if(strcmp(pch,"else")==0)
- do_next = 0;
- else
- do_next = process_command(vid_buf, pch, console_error);
- }
- else if(strcmp(pch,"endif")==0 || strcmp(pch,"else")==0)
- do_next = 1;
- memset(pch,0,sizeof(pch));
- j = i+1;
- }
- }
- //sprintf(console_error, "%s exists", console3);
- fclose(f);
- }
- else
- {
- sprintf(console_error, "%s does not exist", console3);
- }
- }
- else
- {
- sprintf(console_error, "Scripts are not enabled");
- }
-
- }
- else if(strcmp(console2, "sound")==0 && console3)
- {
- if (sound_enable) play_sound(console3);
- else strcpy(console_error, "Audio device not available - cannot play sounds");
- }
- else if(strcmp(console2, "load")==0 && console3)
- {
- j = atoi(console3);
- if(j)
- {
- open_ui(vid_buf, console3, NULL);
- console_mode = 0;
- }
- }
- else if(strcmp(console2, "if")==0 && console3)
- {
- if(strcmp(console3, "type")==0)//TODO: add more than just type, and be able to check greater/less than
- {
- if (console_parse_partref(console4, &i, console_error)
- && console_parse_type(console5, &j, console_error))
- {
- if(parts[i].type==j)
- return 1;
- else
- return 0;
- }
- else
- return 0;
- }
- }
- else if (strcmp(console2, "create")==0 && console3 && console4)
- {
- if (console_parse_type(console3, &j, console_error)
- && console_parse_coords(console4, &nx, &ny, console_error))
- {
- if (!j)
- strcpy(console_error, "Cannot create particle with type NONE");
- else if (create_part(-1,nx,ny,j)<0)
- strcpy(console_error, "Could not create particle");
- }
- }
- else if ((strcmp(console2, "delete")==0 || strcmp(console2, "kill")==0) && console3)
- {
- if (console_parse_partref(console3, &i, console_error))
- kill_part(i);
- }
- else if(strcmp(console2, "reset")==0 && console3)
- {
- if(strcmp(console3, "pressure")==0)
- {
- for (nx = 0; nx<XRES/CELL; nx++)
- for (ny = 0; ny<YRES/CELL; ny++)
- {
- pv[ny][nx] = 0;
- }
- }
- else if(strcmp(console3, "velocity")==0)
- {
- for (nx = 0; nx<XRES/CELL; nx++)
- for (ny = 0; ny<YRES/CELL; ny++)
- {
- vx[ny][nx] = 0;
- vy[ny][nx] = 0;
- }
- }
- else if(strcmp(console3, "sparks")==0)
- {
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type==PT_SPRK)
- {
- parts[i].type = parts[i].ctype;
- parts[i].life = 4;
- }
- }
- }
- else if(strcmp(console3, "temp")==0)
- {
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type)
- {
- parts[i].temp = ptypes[parts[i].type].heat;
- }
- }
- }
- }
- else if(strcmp(console2, "set")==0 && console3 && console4 && console5)
- {
- if(strcmp(console3, "life")==0)
- {
- if(strcmp(console4, "all")==0)
- {
- j = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type)
- parts[i].life = j;
- }
- }
- else if (console_parse_type(console4, &j, console_error))
- {
- k = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type == j)
- parts[i].life = k;
- }
- }
- else
- {
- if (console_parse_partref(console4, &i, console_error))
- {
- j = atoi(console5);
- parts[i].life = j;
- }
- }
- }
- if(strcmp(console3, "type")==0)
- {
- if(strcmp(console4, "all")==0)
- {
- if (console_parse_type(console5, &j, console_error))
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type)
- parts[i].type = j;
- }
- }
- else if (console_parse_type(console4, &j, console_error)
- && console_parse_type(console5, &k, console_error))
- {
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type == j)
- parts[i].type = k;
- }
- }
- else
- {
- if (console_parse_partref(console4, &i, console_error)
- && console_parse_type(console5, &j, console_error))
- {
- parts[i].type = j;
- }
- }
- }
- if(strcmp(console3, "temp")==0)
- {
- if(strcmp(console4, "all")==0)
- {
- j = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type)
- parts[i].temp = j;
- }
- }
- else if (console_parse_type(console4, &j, console_error))
- {
- k = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type == j)
- parts[i].temp= k;
- }
- }
- else
- {
- if (console_parse_partref(console4, &i, console_error))
- {
- j = atoi(console5);
- parts[i].temp = j;
- }
- }
- }
- if(strcmp(console3, "tmp")==0)
- {
- if(strcmp(console4, "all")==0)
- {
- j = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type)
- parts[i].tmp = j;
- }
- }
- else if (console_parse_type(console4, &j, console_error))
- {
- k = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type == j)
- parts[i].tmp = k;
- }
- }
- else
- {
- if (console_parse_partref(console4, &i, console_error))
- {
- j = atoi(console5);
- parts[i].tmp = j;
- }
- }
- }
- if(strcmp(console3, "x")==0)
- {
- if(strcmp(console4, "all")==0)
- {
- j = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type)
- parts[i].x = j;
- }
- }
- else if (console_parse_type(console4, &j, console_error))
- {
- k = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type == j)
- parts[i].x = k;
- }
- }
- else
- {
- if (console_parse_partref(console4, &i, console_error))
- {
- j = atoi(console5);
- parts[i].x = j;
- }
- }
- }
- if(strcmp(console3, "y")==0)
- {
- if(strcmp(console4, "all")==0)
- {
- j = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type)
- parts[i].y = j;
- }
- }
- else if (console_parse_type(console4, &j, console_error))
- {
- k = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type == j)
- parts[i].y = k;
- }
- }
- else
- {
- if (console_parse_partref(console4, &i, console_error))
- {
- j = atoi(console5);
- parts[i].y = j;
- }
- }
- }
- if(strcmp(console3, "ctype")==0)
- {
- if(strcmp(console4, "all")==0)
- {
- if (console_parse_type(console5, &j, console_error))
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type)
- parts[i].ctype = j;
- }
- }
- else if (console_parse_type(console4, &j, console_error)
- && console_parse_type(console5, &k, console_error))
- {
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type == j)
- parts[i].ctype = k;
- }
- }
- else
- {
- if (console_parse_partref(console4, &i, console_error)
- && console_parse_type(console5, &j, console_error))
- {
- parts[i].ctype = j;
- }
- }
- }
- if(strcmp(console3, "vx")==0)
- {
- if(strcmp(console4, "all")==0)
- {
- j = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type)
- parts[i].vx = j;
- }
- }
- else if (console_parse_type(console4, &j, console_error))
- {
- k = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type == j)
- parts[i].vx = k;
- }
- }
- else
- {
- if (console_parse_partref(console4, &i, console_error))
- {
- j = atoi(console5);
- parts[i].vx = j;
- }
- }
- }
- if(strcmp(console3, "vy")==0)
- {
- if(strcmp(console4, "all")==0)
- {
- j = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type)
- parts[i].vy = j;
- }
- }
- else if (console_parse_type(console4, &j, console_error))
- {
- k = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type == j)
- parts[i].vy = k;
- }
- }
- else
- {
- if (console_parse_partref(console4, &i, console_error))
- {
- j = atoi(console5);
- parts[i].vy = j;
- }
- }
- }
- }
else
- sprintf(console_error, "Invalid Command", console2);
+ {
+ // sprintf(console_error, "Invalid Command", console2);
+ //handle them command
+ pargs=Py_BuildValue("(s)",console);
+ pvalue = PyObject_CallObject(pfunc, pargs);
+ Py_DECREF(pargs);
+ pargs=NULL;
+ if(pvalue==NULL)
+ strcpy(console_error,"failed to execute code.");
+ //Py_DECREF(pvalue);
+ //puts("a");
+ pvalue=NULL;
+ }
}
return 1;
}
-
+#endif
diff --git a/src/powder.c b/src/powder.c
index af91808..e15565b 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1575,10 +1575,12 @@ void update_particles_i(pixel *vid, int start, int inc)
}
else if (t==PT_LAVA) {
if (parts[i].ctype && parts[i].ctype<PT_NUM && parts[i].ctype!=PT_LAVA) {
- if (ptransitions[parts[i].ctype].tht==PT_LAVA&&pt>=ptransitions[parts[i].ctype].thv) s = 0;
- else if (parts[i].ctype==PT_THRM&&pt>=ptransitions[PT_BMTL].thv) s = 0;
+ if (parts[i].ctype==PT_THRM&&pt>=ptransitions[PT_BMTL].thv) s = 0;
+ else if (ptransitions[parts[i].ctype].tht==PT_LAVA) {
+ if (pt>=ptransitions[parts[i].ctype].thv) s = 0;
+ }
else if (pt>=973.0f) s = 0; // freezing point for lava with any other (not listed in ptransitions as turning into lava) ctype
- else {
+ if (s) {
t = parts[i].ctype;
parts[i].ctype = PT_NONE;
if (t==PT_THRM) {
@@ -1995,7 +1997,9 @@ killed:
if (try_move(i, x, y, j, clear_y))
{
parts[i].x = clear_xf+(j-clear_x);
+ parts[i].y = clear_yf;
nx = j;
+ ny = clear_y;
s = 1;
break;
}
@@ -2007,11 +2011,11 @@ killed:
else
r = -1;
if (s)
- for (j=clear_y+r; j>=0 && j<YRES && j>=clear_y-rt && j<clear_y+rt; j+=r)
+ for (j=ny+r; j>=0 && j<YRES && j>=ny-rt && j<ny+rt; j+=r)
{
- if (try_move(i, x, y, nx, j))
+ if (try_move(i, nx, ny, nx, j))
{
- parts[i].y = clear_yf+(j-clear_y);
+ parts[i].y += j-ny;
break;
}
if ((pmap[j][nx]&255)!=t || (bmap[j/CELL][nx/CELL] && bmap[j/CELL][nx/CELL]!=WL_STREAM))
diff --git a/src/python/tpt_console.py b/src/python/tpt_console.py
new file mode 100644
index 0000000..b26ecef
--- /dev/null
+++ b/src/python/tpt_console.py
@@ -0,0 +1,116 @@
+import tpt
+from tpt import *
+import sys
+import code
+import ctypes
+import traceback
+DEBUG=False
+
+#print "console module loaded."
+#redirect stdout like this:
+class logger:
+ def write(self,txt):
+ txt=txt.strip().split("\n")[-1]
+ repr(txt)
+ tpt.log(txt)
+if(DEBUG==False):
+ sys.stdout=logger()
+ sys.stderr=logger()
+
+
+element={"none":0,"dust":1,"watr":2,"oil":3,"fire":4,"stne":5,"lava":6,"gunp":7,
+ "nitr":8,"clne":9,"gas":10,"plex":11,"goo":12,"icei":13,"metl":14,"sprk":15,
+ "snow":16,"wood":17,"neut":18,"plut":19,"plnt":20,"acid":21,"void":22,
+ "wtrv":23,"cnct":24,"dstw":25,"salt":26,"sltw":27,"dmnd":28,"bmtl":29,
+ "brmt":30,"phot":31,"uran":32,"wax":33,"mwax":34,"pscn":35,"nscn":36,
+ "lntg":37,"insl":38,"bhol":39,"whol":40,"rbdm":41,"lrbd":42,"ntct":43,
+ "sand":44,"glas":45,"ptct":46,"bgla":47,"thdr":48,"plsm":49,"etrd":50,
+ "nice":51,"nble":52,"btry":53,"lcry":54,"stkm":55,"swch":56,"smke":57,
+ "desl":58,"coal":59,"lo2":60,"o2":61,"inwr":62,"yest":63,"dyst":64,
+ "thrm":65,"glow":66,"brck":67,"hflm":68,"firw":69,"fuse":70,"fsep":71,
+ "amtr":72,"bcol":73,"pcln":74,"hswc":75,"iron":76,"mort":77,"gol":78,
+ "hlif":79,"asim":80,"2x2":81,"dani":82,"amoe":83,"move":84,"pgol":85,
+ "dmoe":86,"34":87,"llif":88,"stan":89,"spng":90,"rime":91,"fog":92,
+ "bcln":93,"love":94,"deut":95,"warp":96,"pump":97,"fwrk":98,"pipe":99,
+ "frzz":100,"frzw":101,"grav":102,"bizr":103,"bizrg":104,"bizrs":105,
+ "inst":106,"isoz":107,"iszs":108,"prti":109,"prto":110,"pste":111,
+ "psts":112,"anar":113,"vine":114,"invis":115,"equalvel":116,"spawn2":117,
+ "spawn":118,"shld1":119,"shld2":120,"shld3":121,"shld4":122,"lolz":123,
+ "wifi":124,"filt":125,"aray":126,"bray":127,"stkm2":128,"bomb":129,
+ "c5":130,"sing":131,"qrtz":132,"pqrt":133,"seed":134,"maze":135,
+ "coag":136,"wall":137,"gnar":138,"repl":139,"myst":140,"boyl":141,
+ "lote":142,"frg2":143,"star":144,"frog":145,"bran":146,"wind":147,
+ "num":148}
+
+
+def fork_unblock():
+ pass#i need to implement this some day.
+def error(ex):
+ traceback.print_exc()
+ err=traceback.format_exc()
+ sys.stdout.write(err)
+
+def clean():
+ #add any functions that must be reachable here.
+ """copy=["__builtins__","__name__","__doc__","__package__",'tpt','clean',
+ 'element','fork','_fork','fork_status','fork_unblock','sys']
+ handle.glob={}
+ for item in copy:
+ handle.glob[item]=globals()[item]"""
+ handle.glob=globals()
+ handle.buf=""
+
+def handle(txt):
+ try:
+ a=handle.glob
+ except:
+ clean()
+ try:
+ _handle(txt)
+ except Exception as ex:
+ error(ex)
+
+def _handle(txt):
+ #print "handling '%s'"%txt
+ try:
+ sys.stdout.write(repr(eval(txt,handle.glob)))
+ except:
+ try:
+ exec txt in handle.glob
+ except Exception as ex:
+ error(ex)
+
+
+_extensions=[]
+def loadext(fname):
+ ext=__import__(fname)
+ ext.init()
+ _extensions.append(ext)
+
+def keypress(key):
+ unload=[]
+ for item in _extensions:
+ try:
+ item.key(key)
+ except Exception as ex:
+ error(ex)
+ unload.append(item)
+ for item in unload:
+ item.exit()
+ _extensions.remove(item)
+
+
+def step():
+ unload=[]
+ for item in _extensions:
+ try:
+ item.step()
+ except Exception as ex:
+ error(ex)
+ unload.append(item)
+ for item in unload:
+ try:
+ item.exit()
+ except Exception as ex:
+ error(ex)
+ _extensions.remove(item)