mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-29 02:40:47 +02:00
COMMIT DAMNIT
This commit is contained in:
File diff suppressed because one or more lines are too long
60
src/main.c
60
src/main.c
@@ -163,6 +163,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;
|
||||
@@ -1849,6 +1850,31 @@ emb_get_name(PyObject *self, PyObject *args)
|
||||
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."},
|
||||
@@ -1881,6 +1907,9 @@ static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your fun
|
||||
{"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}
|
||||
};
|
||||
|
||||
@@ -1948,6 +1977,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_Print();
|
||||
printf("unable to find handle function, mangled console.py?\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -1974,6 +2004,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
//sys.stderr
|
||||
PyErr_Print();
|
||||
printf("unable to find console module, missing file or mangled console.py?\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -2242,19 +2274,8 @@ int main(int argc, char *argv[])
|
||||
do_s_check = (do_s_check+1) & 15;
|
||||
}
|
||||
|
||||
if(pkey!=NULL && sdl_key!=NULL)
|
||||
if(sys_shortcuts==1)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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"))
|
||||
@@ -2611,6 +2632,19 @@ int main(int argc, char *argv[])
|
||||
emap[cby][cbx] = cb_emap[cby][cbx];
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
#ifdef INTERNAL
|
||||
int counterthing;
|
||||
if (sdl_key=='v'&&!(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
|
||||
@@ -2894,7 +2928,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)
|
||||
|
@@ -4,6 +4,8 @@ import sys
|
||||
import code
|
||||
import ctypes
|
||||
import traceback
|
||||
DEBUG=False
|
||||
|
||||
#print "console module loaded."
|
||||
#redirect stdout like this:
|
||||
class logger:
|
||||
@@ -11,9 +13,11 @@ class logger:
|
||||
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,
|
||||
|
Reference in New Issue
Block a user