Revise ctype-drawing (fixes #657)
This commit is contained in:
parent
a73d1f97f6
commit
de1fc0f906
@ -75,7 +75,7 @@ String *luacon_lastError;
|
||||
String lastCode;
|
||||
|
||||
int *lua_el_mode;
|
||||
LuaSmartRef *lua_el_func, *lua_gr_func;
|
||||
LuaSmartRef *lua_el_func, *lua_gr_func, *lua_cd_func;
|
||||
|
||||
int getPartIndex_curIdx;
|
||||
int tptProperties; //Table for some TPT properties
|
||||
@ -332,12 +332,14 @@ tpt.partsdata = nil");
|
||||
}
|
||||
lua_setfield(l, tptProperties, "eltransition");
|
||||
|
||||
lua_cd_func_v = std::vector<LuaSmartRef>(PT_NUM, l);
|
||||
lua_cd_func = &lua_cd_func_v[0];
|
||||
lua_gr_func_v = std::vector<LuaSmartRef>(PT_NUM, l);
|
||||
lua_gr_func = &lua_gr_func_v[0];
|
||||
lua_el_func_v = std::vector<LuaSmartRef>(PT_NUM, l);
|
||||
lua_el_func = &lua_el_func_v[0];
|
||||
lua_el_mode = new int[PT_NUM];
|
||||
std::fill(lua_el_mode, lua_el_mode + PT_NUM, 0);
|
||||
lua_el_mode_v = std::vector<int>(PT_NUM, 0);
|
||||
lua_el_mode = &lua_el_mode_v[0];
|
||||
|
||||
//make tpt.* a metatable
|
||||
lua_newtable(l);
|
||||
@ -2426,7 +2428,6 @@ void LuaScriptInterface::initElementsAPI()
|
||||
SETCONST(l, PROP_LIFE_KILL_DEC);
|
||||
SETCONST(l, PROP_SPARKSETTLE);
|
||||
SETCONST(l, PROP_NOAMBHEAT);
|
||||
SETCONST(l, PROP_DRAWONCTYPE);
|
||||
SETCONST(l, PROP_NOCTYPEDRAW);
|
||||
SETCONST(l, FLAG_STAGNANT);
|
||||
SETCONST(l, FLAG_SKIPMOVE);
|
||||
@ -2679,6 +2680,25 @@ int LuaScriptInterface::elements_allocate(lua_State * l)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool luaCtypeDrawWrapper(CTYPEDRAW_FUNC_ARGS)
|
||||
{
|
||||
bool ret = false;
|
||||
if (lua_cd_func[sim->parts[i].type])
|
||||
{
|
||||
lua_rawgeti(luacon_ci->l, LUA_REGISTRYINDEX, lua_cd_func[sim->parts[i].type]);
|
||||
lua_pushinteger(luacon_ci->l, i);
|
||||
lua_pushinteger(luacon_ci->l, t);
|
||||
lua_pushinteger(luacon_ci->l, v);
|
||||
if (lua_pcall(luacon_ci->l, 3, 1, 0))
|
||||
{
|
||||
luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
|
||||
}
|
||||
ret = luaL_optinteger(luacon_ci->l, -1, 0);
|
||||
lua_pop(luacon_ci->l, 1);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LuaScriptInterface::elements_element(lua_State * l)
|
||||
{
|
||||
int id = luaL_checkinteger(l, 1);
|
||||
@ -2712,7 +2732,7 @@ int LuaScriptInterface::elements_element(lua_State * l)
|
||||
{
|
||||
lua_el_func[id].Clear();
|
||||
lua_el_mode[id] = 0;
|
||||
luacon_sim->elements[id].Update = NULL;
|
||||
luacon_sim->elements[id].Update = nullptr;
|
||||
}
|
||||
lua_pop(l, 1);
|
||||
|
||||
@ -2724,7 +2744,20 @@ int LuaScriptInterface::elements_element(lua_State * l)
|
||||
else if (lua_type(l, -1) == LUA_TBOOLEAN && !lua_toboolean(l, -1))
|
||||
{
|
||||
lua_gr_func[id].Clear();
|
||||
luacon_sim->elements[id].Graphics = NULL;
|
||||
luacon_sim->elements[id].Graphics = nullptr;
|
||||
}
|
||||
lua_pop(l, 1);
|
||||
|
||||
lua_getfield(l, -1, "CtypeDraw");
|
||||
if (lua_type(l, -1) == LUA_TFUNCTION)
|
||||
{
|
||||
lua_cd_func[id].Assign(-1);
|
||||
luacon_sim->elements[id].CtypeDraw = luaCtypeDrawWrapper;
|
||||
}
|
||||
else if (lua_type(l, -1) == LUA_TBOOLEAN && !lua_toboolean(l, -1))
|
||||
{
|
||||
lua_cd_func[id].Clear();
|
||||
luacon_sim->elements[id].CtypeDraw = nullptr;
|
||||
}
|
||||
lua_pop(l, 1);
|
||||
|
||||
@ -2830,6 +2863,20 @@ int LuaScriptInterface::elements_property(lua_State * l)
|
||||
luacon_ren->graphicscache[id].isready = 0;
|
||||
return 0;
|
||||
}
|
||||
else if (propertyName == "CtypeDraw")
|
||||
{
|
||||
if (lua_type(l, 3) == LUA_TFUNCTION)
|
||||
{
|
||||
lua_cd_func[id].Assign(3);
|
||||
luacon_sim->elements[id].CtypeDraw = luaCtypeDrawWrapper;
|
||||
}
|
||||
else if (lua_type(l, 3) == LUA_TBOOLEAN && !lua_toboolean(l, -1))
|
||||
{
|
||||
lua_cd_func[id].Clear();
|
||||
luacon_sim->elements[id].CtypeDraw = nullptr;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return luaL_error(l, "Invalid element property");
|
||||
@ -3732,9 +3779,10 @@ LuaScriptInterface::~LuaScriptInterface() {
|
||||
component_and_ref.second.Clear();
|
||||
component_and_ref.first->owner_ref = component_and_ref.second;
|
||||
}
|
||||
delete[] lua_el_mode;
|
||||
lua_el_mode_v.clear();
|
||||
lua_el_func_v.clear();
|
||||
lua_gr_func_v.clear();
|
||||
lua_cd_func_v.clear();
|
||||
lua_close(l);
|
||||
delete legacy;
|
||||
}
|
||||
|
@ -180,7 +180,8 @@ class LuaScriptInterface: public CommandInterface
|
||||
static int event_unregister(lua_State * l);
|
||||
static int event_getmodifiers(lua_State * l);
|
||||
|
||||
std::vector<LuaSmartRef> lua_el_func_v, lua_gr_func_v;
|
||||
std::vector<LuaSmartRef> lua_el_func_v, lua_gr_func_v, lua_cd_func_v;
|
||||
std::vector<int> lua_el_mode_v;
|
||||
|
||||
public:
|
||||
int tpt_index(lua_State *l);
|
||||
|
@ -30,7 +30,6 @@
|
||||
#define PROP_LIFE_KILL_DEC 0x10000 //2^16 Kill when life value is decremented to <= zero
|
||||
#define PROP_SPARKSETTLE 0x20000 //2^17 Allow Sparks/Embers to settle
|
||||
#define PROP_NOAMBHEAT 0x40000 //2^18 Don't transfer or receive heat from ambient heat.
|
||||
#define PROP_DRAWONCTYPE 0x80000 //2^19 Set its ctype to another element if the element is drawn upon it (like what CLNE does)
|
||||
#define PROP_NOCTYPEDRAW 0x100000 // 2^20 When this element is drawn upon with, do not set ctype (like BCLN for CLNE)
|
||||
|
||||
#define FLAG_STAGNANT 0x1
|
||||
@ -46,6 +45,9 @@
|
||||
#define GRAPHICS_FUNC_ARGS Renderer * ren, Particle *cpart, int nx, int ny, int *pixel_mode, int* cola, int *colr, int *colg, int *colb, int *firea, int *firer, int *fireg, int *fireb
|
||||
#define GRAPHICS_FUNC_SUBCALL_ARGS ren, cpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb
|
||||
|
||||
#define CTYPEDRAW_FUNC_ARGS Simulation *sim, int i, int t, int v
|
||||
#define CTYPEDRAW_FUNC_SUBCALL_ARGS sim, i, t, v
|
||||
|
||||
#define BOUNDS_CHECK true
|
||||
|
||||
#define OLD_PT_WIND 147
|
||||
|
@ -3113,11 +3113,6 @@ int Simulation::create_part(int p, int x, int y, int t, int v)
|
||||
parts[index].ctype = PT_DUST;
|
||||
return index;
|
||||
}
|
||||
if (p==-2 && ((elements[type].Properties & PROP_DRAWONCTYPE) || type==PT_CRAY))
|
||||
{
|
||||
parts[index].ctype = PT_SPRK;
|
||||
return index;
|
||||
}
|
||||
if (!(type == PT_INST || (elements[type].Properties&PROP_CONDUCTS)) || parts[index].life!=0)
|
||||
return -1;
|
||||
if (p == -2 && type == PT_INST)
|
||||
@ -3163,44 +3158,10 @@ int Simulation::create_part(int p, int x, int y, int t, int v)
|
||||
{
|
||||
if (pmap[y][x])
|
||||
{
|
||||
//If an element has the PROP_DRAWONCTYPE property, and the element being drawn to it does not have PROP_NOCTYPEDRAW (Also some special cases), set the element's ctype
|
||||
int drawOn = TYP(pmap[y][x]);
|
||||
if (drawOn == t)
|
||||
return -1;
|
||||
if (((elements[drawOn].Properties & PROP_DRAWONCTYPE) ||
|
||||
(drawOn == PT_STOR && !(elements[t].Properties & TYPE_SOLID)) ||
|
||||
(drawOn == PT_PCLN && t != PT_PSCN && t != PT_NSCN) ||
|
||||
(drawOn == PT_PBCN && t != PT_PSCN && t != PT_NSCN))
|
||||
&& (!(elements[t].Properties & PROP_NOCTYPEDRAW)))
|
||||
if (elements[drawOn].CtypeDraw)
|
||||
{
|
||||
parts[ID(pmap[y][x])].ctype = t;
|
||||
if (t == PT_LIFE && v >= 0 && v < NGOL)
|
||||
{
|
||||
if (drawOn == PT_CONV)
|
||||
parts[ID(pmap[y][x])].ctype |= PMAPID(v);
|
||||
else if (drawOn != PT_STOR)
|
||||
parts[ID(pmap[y][x])].tmp = v;
|
||||
}
|
||||
}
|
||||
else if (drawOn == PT_DTEC || (drawOn == PT_PSTN && t != PT_FRME) || drawOn == PT_DRAY)
|
||||
{
|
||||
parts[ID(pmap[y][x])].ctype = t;
|
||||
if (t == PT_LIFE && v >= 0 && v < NGOL)
|
||||
{
|
||||
if (drawOn == PT_DTEC)
|
||||
parts[ID(pmap[y][x])].tmp = v;
|
||||
else if (drawOn == PT_DRAY)
|
||||
parts[ID(pmap[y][x])].ctype |= PMAPID(v);
|
||||
}
|
||||
}
|
||||
else if (drawOn == PT_CRAY)
|
||||
{
|
||||
parts[ID(pmap[y][x])].ctype = t;
|
||||
if (t == PT_LIFE && v >= 0 && v < NGOL)
|
||||
parts[ID(pmap[y][x])].ctype |= PMAPID(v);
|
||||
if (t == PT_LIGH)
|
||||
parts[ID(pmap[y][x])].ctype |= PMAPID(30);
|
||||
parts[ID(pmap[y][x])].temp = elements[t].Temperature;
|
||||
elements[drawOn].CtypeDraw(this, ID(pmap[y][x]), t, v);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ Element_BCLN::Element_BCLN()
|
||||
HeatConduct = 251;
|
||||
Description = "Breakable Clone.";
|
||||
|
||||
Properties = TYPE_SOLID|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC|PROP_DRAWONCTYPE|PROP_NOCTYPEDRAW;
|
||||
Properties = TYPE_SOLID | PROP_LIFE_DEC | PROP_LIFE_KILL_DEC | PROP_NOCTYPEDRAW;
|
||||
|
||||
LowPressure = IPL;
|
||||
LowPressureTransition = NT;
|
||||
@ -42,6 +42,7 @@ Element_BCLN::Element_BCLN()
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_BCLN::update;
|
||||
CtypeDraw = &Element::ctypeDrawVInTmp;
|
||||
}
|
||||
|
||||
#define ADVECTION 0.1f
|
||||
|
@ -30,7 +30,7 @@ Element_CLNE::Element_CLNE()
|
||||
HeatConduct = 251;
|
||||
Description = "Clone. Duplicates any particles it touches.";
|
||||
|
||||
Properties = TYPE_SOLID|PROP_DRAWONCTYPE|PROP_NOCTYPEDRAW;
|
||||
Properties = TYPE_SOLID | PROP_NOCTYPEDRAW;
|
||||
|
||||
LowPressure = IPL;
|
||||
LowPressureTransition = NT;
|
||||
@ -42,6 +42,7 @@ Element_CLNE::Element_CLNE()
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_CLNE::update;
|
||||
CtypeDraw = &Element::ctypeDrawVInTmp;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CLNE static int update(UPDATE_FUNC_ARGS)
|
||||
@ -87,5 +88,4 @@ int Element_CLNE::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_CLNE::~Element_CLNE() {}
|
||||
|
@ -30,7 +30,7 @@ Element_CONV::Element_CONV()
|
||||
HeatConduct = 251;
|
||||
Description = "Converter. Converts everything into whatever it first touches.";
|
||||
|
||||
Properties = TYPE_SOLID|PROP_DRAWONCTYPE|PROP_NOCTYPEDRAW;
|
||||
Properties = TYPE_SOLID | PROP_NOCTYPEDRAW;
|
||||
|
||||
LowPressure = IPL;
|
||||
LowPressureTransition = NT;
|
||||
@ -42,6 +42,7 @@ Element_CONV::Element_CONV()
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_CONV::update;
|
||||
CtypeDraw = &Element::ctypeDrawVInCtype;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CONV static int update(UPDATE_FUNC_ARGS)
|
||||
@ -93,5 +94,4 @@ int Element_CONV::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_CONV::~Element_CONV() {}
|
||||
|
@ -42,6 +42,7 @@ Element_CRAY::Element_CRAY()
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_CRAY::update;
|
||||
CtypeDraw = &Element_CRAY::ctypeDraw;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CRAY static int update(UPDATE_FUNC_ARGS)
|
||||
@ -154,5 +155,19 @@ unsigned int Element_CRAY::wavelengthToDecoColour(int wavelength)
|
||||
return (255<<24) | (colr<<16) | (colg<<8) | colb;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CRAY static bool ctypeDraw(CTYPEDRAW_FUNC_ARGS)
|
||||
bool Element_CRAY::ctypeDraw(CTYPEDRAW_FUNC_ARGS)
|
||||
{
|
||||
if (!Element::ctypeDrawVInCtype(CTYPEDRAW_FUNC_SUBCALL_ARGS))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (t == PT_LIGH)
|
||||
{
|
||||
sim->parts[i].ctype |= PMAPID(30);
|
||||
}
|
||||
sim->parts[i].temp = sim->elements[t].Temperature;
|
||||
return true;
|
||||
}
|
||||
|
||||
Element_CRAY::~Element_CRAY() {}
|
||||
|
@ -30,7 +30,7 @@ Element_DRAY::Element_DRAY()
|
||||
HeatConduct = 0;
|
||||
Description = "Duplicator ray. Replicates a line of particles in front of it.";
|
||||
|
||||
Properties = TYPE_SOLID|PROP_LIFE_DEC;
|
||||
Properties = TYPE_SOLID | PROP_LIFE_DEC;
|
||||
|
||||
LowPressure = IPL;
|
||||
LowPressureTransition = NT;
|
||||
@ -42,7 +42,8 @@ Element_DRAY::Element_DRAY()
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_DRAY::update;
|
||||
Graphics = NULL;
|
||||
Graphics = nullptr;
|
||||
CtypeDraw = &Element::ctypeDrawVInCtype;
|
||||
}
|
||||
|
||||
//should probably be in Simulation.h
|
||||
|
@ -42,6 +42,7 @@ Element_DTEC::Element_DTEC()
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_DTEC::update;
|
||||
CtypeDraw = &Element::ctypeDrawVInTmp;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_DTEC static int update(UPDATE_FUNC_ARGS)
|
||||
|
@ -42,9 +42,10 @@ Element::Element():
|
||||
HighTemperature(ITH),
|
||||
HighTemperatureTransition(NT),
|
||||
|
||||
Update(NULL),
|
||||
Update(nullptr),
|
||||
Graphics(&Element::defaultGraphics),
|
||||
IconGenerator(NULL)
|
||||
CtypeDraw(nullptr),
|
||||
IconGenerator(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -229,3 +230,39 @@ int Element::defaultGraphics(GRAPHICS_FUNC_ARGS)
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool Element::basicCtypeDraw(CTYPEDRAW_FUNC_ARGS)
|
||||
{
|
||||
if (sim->parts[i].type == t || sim->elements[t].Properties & PROP_NOCTYPEDRAW)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
sim->parts[i].ctype = t;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Element::ctypeDrawVInTmp(CTYPEDRAW_FUNC_ARGS)
|
||||
{
|
||||
if (!Element::basicCtypeDraw(CTYPEDRAW_FUNC_SUBCALL_ARGS))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (t == PT_LIFE && v >= 0 && v < NGOL)
|
||||
{
|
||||
sim->parts[i].tmp = v;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Element::ctypeDrawVInCtype(CTYPEDRAW_FUNC_ARGS)
|
||||
{
|
||||
if (!Element::basicCtypeDraw(CTYPEDRAW_FUNC_SUBCALL_ARGS))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (t == PT_LIFE && v >= 0 && v < NGOL)
|
||||
{
|
||||
sim->parts[i].ctype |= PMAPID(v);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -51,12 +51,17 @@ public:
|
||||
|
||||
int (*Update) (UPDATE_FUNC_ARGS);
|
||||
int (*Graphics) (GRAPHICS_FUNC_ARGS);
|
||||
bool (*CtypeDraw) (CTYPEDRAW_FUNC_ARGS);
|
||||
|
||||
VideoBuffer * (*IconGenerator)(int, int, int);
|
||||
|
||||
Element();
|
||||
virtual ~Element() {}
|
||||
static int defaultGraphics(GRAPHICS_FUNC_ARGS);
|
||||
static int legacyUpdate(UPDATE_FUNC_ARGS);
|
||||
static bool basicCtypeDraw(CTYPEDRAW_FUNC_ARGS);
|
||||
static bool ctypeDrawVInTmp(CTYPEDRAW_FUNC_ARGS);
|
||||
static bool ctypeDrawVInCtype(CTYPEDRAW_FUNC_ARGS);
|
||||
|
||||
/** Returns a list of properties, their type and offset within the structure that can be changed
|
||||
by higher-level processes referring to them by name such as Lua or the property tool **/
|
||||
|
@ -32,7 +32,7 @@ Element_LDTC::Element_LDTC()
|
||||
HeatConduct = 0;
|
||||
Description = "Linear detector. Scans in 8 directions for particles with its ctype and creates a spark on the opposite side.";
|
||||
|
||||
Properties = TYPE_SOLID | PROP_DRAWONCTYPE | PROP_NOCTYPEDRAW;
|
||||
Properties = TYPE_SOLID | PROP_NOCTYPEDRAW;
|
||||
|
||||
LowPressure = IPL;
|
||||
LowPressureTransition = NT;
|
||||
@ -44,6 +44,7 @@ Element_LDTC::Element_LDTC()
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_LDTC::update;
|
||||
CtypeDraw = &Element::ctypeDrawVInTmp;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_LDTC static const int FLAG_INVERT_FILTER
|
||||
|
@ -30,7 +30,7 @@ Element_PBCN::Element_PBCN()
|
||||
HeatConduct = 251;
|
||||
Description = "Powered breakable clone.";
|
||||
|
||||
Properties = TYPE_SOLID|PROP_NOCTYPEDRAW;
|
||||
Properties = TYPE_SOLID | PROP_NOCTYPEDRAW;
|
||||
|
||||
LowPressure = IPL;
|
||||
LowPressureTransition = NT;
|
||||
@ -43,6 +43,7 @@ Element_PBCN::Element_PBCN()
|
||||
|
||||
Update = &Element_PBCN::update;
|
||||
Graphics = &Element_PBCN::graphics;
|
||||
CtypeDraw = &Element_PCLN::ctypeDraw;
|
||||
}
|
||||
|
||||
#define ADVECTION 0.1f
|
||||
|
@ -30,7 +30,7 @@ Element_PCLN::Element_PCLN()
|
||||
HeatConduct = 251;
|
||||
Description = "Powered clone. When activated, duplicates any particles it touches.";
|
||||
|
||||
Properties = TYPE_SOLID|PROP_NOCTYPEDRAW;
|
||||
Properties = TYPE_SOLID | PROP_NOCTYPEDRAW;
|
||||
|
||||
LowPressure = IPL;
|
||||
LowPressureTransition = NT;
|
||||
@ -43,6 +43,7 @@ Element_PCLN::Element_PCLN()
|
||||
|
||||
Update = &Element_PCLN::update;
|
||||
Graphics = &Element_PCLN::graphics;
|
||||
CtypeDraw = &Element_PCLN::ctypeDraw;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_PCLN static int update(UPDATE_FUNC_ARGS)
|
||||
@ -147,5 +148,14 @@ int Element_PCLN::graphics(GRAPHICS_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_PCLN static bool ctypeDraw(CTYPEDRAW_FUNC_ARGS)
|
||||
bool Element_PCLN::ctypeDraw(CTYPEDRAW_FUNC_ARGS)
|
||||
{
|
||||
if (t == PT_PSCN || t == PT_NSCN)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Element::ctypeDrawVInTmp(CTYPEDRAW_FUNC_SUBCALL_ARGS);
|
||||
}
|
||||
|
||||
Element_PCLN::~Element_PCLN() {}
|
||||
|
@ -45,6 +45,7 @@ Element_PSTN::Element_PSTN()
|
||||
|
||||
Update = &Element_PSTN::update;
|
||||
Graphics = &Element_PSTN::graphics;
|
||||
CtypeDraw = &Element_PSTN::ctypeDraw;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_PSTN struct StackData
|
||||
@ -348,4 +349,14 @@ int Element_PSTN::graphics(GRAPHICS_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_PSTN static bool ctypeDraw(CTYPEDRAW_FUNC_ARGS)
|
||||
bool Element_PSTN::ctypeDraw(CTYPEDRAW_FUNC_ARGS)
|
||||
{
|
||||
if (t == PT_FRME)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Element::basicCtypeDraw(CTYPEDRAW_FUNC_SUBCALL_ARGS);
|
||||
}
|
||||
|
||||
Element_PSTN::~Element_PSTN() {}
|
||||
|
@ -30,7 +30,7 @@ Element_RPEL::Element_RPEL()
|
||||
HeatConduct = 0;
|
||||
Description = "Repels or attracts particles based on its temperature.";
|
||||
|
||||
Properties = TYPE_SOLID | PROP_DRAWONCTYPE;
|
||||
Properties = TYPE_SOLID;
|
||||
|
||||
LowPressure = IPL;
|
||||
LowPressureTransition = NT;
|
||||
@ -42,6 +42,7 @@ Element_RPEL::Element_RPEL()
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_RPEL::update;
|
||||
CtypeDraw = &Element::basicCtypeDraw;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_RPEL static int update(UPDATE_FUNC_ARGS)
|
||||
|
@ -30,7 +30,7 @@ Element_STOR::Element_STOR()
|
||||
HeatConduct = 0;
|
||||
Description = "Storage. Captures and stores a single particle. Releases when charged with PSCN, also passes to PIPE.";
|
||||
|
||||
Properties = TYPE_SOLID|PROP_NOCTYPEDRAW;
|
||||
Properties = TYPE_SOLID | PROP_NOCTYPEDRAW;
|
||||
|
||||
LowPressure = IPL;
|
||||
LowPressureTransition = NT;
|
||||
@ -43,6 +43,7 @@ Element_STOR::Element_STOR()
|
||||
|
||||
Update = &Element_STOR::update;
|
||||
Graphics = &Element_STOR::graphics;
|
||||
CtypeDraw = &Element_STOR::ctypeDraw;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_STOR static int update(UPDATE_FUNC_ARGS)
|
||||
@ -111,5 +112,14 @@ int Element_STOR::graphics(GRAPHICS_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_STOR static bool ctypeDraw(CTYPEDRAW_FUNC_ARGS)
|
||||
bool Element_STOR::ctypeDraw(CTYPEDRAW_FUNC_ARGS)
|
||||
{
|
||||
if (sim->elements[t].Properties & TYPE_SOLID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Element::basicCtypeDraw(CTYPEDRAW_FUNC_SUBCALL_ARGS);
|
||||
}
|
||||
|
||||
Element_STOR::~Element_STOR() {}
|
||||
|
Reference in New Issue
Block a user