Ditch element and tool classes
This commit is contained in:
parent
78203fc219
commit
4d52531889
@ -170,7 +170,7 @@ if GetOption('universal'):
|
||||
env.Append(CCFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
|
||||
env.Append(LINKFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
|
||||
|
||||
env.Append(CPPPATH=['src/', 'data/', 'generated/'])
|
||||
env.Append(CPPPATH=['src/', 'data/'])
|
||||
if GetOption("msvc"):
|
||||
if GetOption("static"):
|
||||
env.Append(LIBPATH=['StaticLibs/'])
|
||||
@ -385,11 +385,7 @@ def findLibs(env, conf):
|
||||
FatalError("Cocoa framework not found or not installed")
|
||||
|
||||
if GetOption('clean'):
|
||||
import shutil
|
||||
try:
|
||||
shutil.rmtree("generated/")
|
||||
except:
|
||||
print("couldn't remove build/generated/")
|
||||
pass
|
||||
elif not GetOption('help'):
|
||||
conf = Configure(env)
|
||||
conf.AddTest('CheckFramework', CheckFramework)
|
||||
|
10
SConstruct
10
SConstruct
@ -1,13 +1,3 @@
|
||||
import sys
|
||||
#run generator.py
|
||||
if not GetOption('clean'):
|
||||
if sys.version_info[0] < 3:
|
||||
execfile("generator.py")
|
||||
else:
|
||||
with open("generator.py") as f:
|
||||
code = compile(f.read(), "generator.py", 'exec')
|
||||
exec(code)
|
||||
|
||||
AddOption('--builddir',dest="builddir",default="build",help="Directory to build to.")
|
||||
SConscript('SConscript', variant_dir=GetOption('builddir'), duplicate=0)
|
||||
if GetOption('clean'):
|
||||
|
237
generator.py
237
generator.py
@ -1,237 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import re, os, shutil, string, sys
|
||||
|
||||
def generateElements(elementFiles, outputCpp, outputH):
|
||||
|
||||
elementClasses = {}
|
||||
baseClasses = {}
|
||||
|
||||
elementHeader = """// This file is automatically generated by generator.py
|
||||
|
||||
#ifndef ELEMENTCLASSES_H
|
||||
#define ELEMENTCLASSES_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "simulation/SimulationData.h"
|
||||
#include "simulation/elements/Element.h"
|
||||
|
||||
"""
|
||||
|
||||
directives = []
|
||||
|
||||
for elementFile in elementFiles:
|
||||
try:
|
||||
f = open(elementFile, "r")
|
||||
except:
|
||||
f = open("src/simulation/elements/"+elementFile, "r")
|
||||
|
||||
fileData = f.read()
|
||||
f.close()
|
||||
|
||||
directiveMatcher = '//#TPT-Directive\s+([^\r\n]+)'
|
||||
matcher = re.compile(directiveMatcher)
|
||||
directiveMatches = matcher.findall(fileData)
|
||||
|
||||
for match in directiveMatches:
|
||||
directives.append(match.split(" "))
|
||||
|
||||
classDirectives = []
|
||||
usedIDs = []
|
||||
for d in directives:
|
||||
if d[0] == "ElementClass":
|
||||
d[3] = int(d[3])
|
||||
classDirectives.append(d)
|
||||
if d[3] in usedIDs:
|
||||
print("WARNING: duplicate element ID {} ({})".format(d[3],d[2]))
|
||||
usedIDs.append(d[3])
|
||||
|
||||
elementIDs = sorted(classDirectives, key=lambda directive: directive[3])
|
||||
|
||||
for d in elementIDs:
|
||||
tmpClass = d[1]
|
||||
newClass = ""
|
||||
baseClass = "Element"
|
||||
if ':' in tmpClass:
|
||||
classBits = tmpClass.split(':')
|
||||
newClass = classBits[0]
|
||||
baseClass = classBits[1]
|
||||
else:
|
||||
newClass = tmpClass
|
||||
|
||||
elementClasses[newClass] = []
|
||||
baseClasses[newClass] = baseClass
|
||||
elementHeader += "#define %s %s\n" % (d[2], d[3])
|
||||
|
||||
for d in directives:
|
||||
if d[0] == "ElementHeader":
|
||||
tmpClass = d[1]
|
||||
newClass = ""
|
||||
baseClass = "Element"
|
||||
if ':' in tmpClass:
|
||||
classBits = tmpClass.split(':')
|
||||
newClass = classBits[0]
|
||||
baseClass = classBits[1]
|
||||
else:
|
||||
newClass = tmpClass
|
||||
elementClasses[newClass].append(" ".join(d[2:])+";")
|
||||
|
||||
#for className, classMembers in elementClasses.items():
|
||||
for d in elementIDs:
|
||||
tmpClass = d[1]
|
||||
newClass = ""
|
||||
baseClass = "Element"
|
||||
if ':' in tmpClass:
|
||||
classBits = tmpClass.split(':')
|
||||
newClass = classBits[0]
|
||||
baseClass = classBits[1]
|
||||
else:
|
||||
newClass = tmpClass
|
||||
|
||||
className = newClass
|
||||
classMembers = elementClasses[newClass]
|
||||
elementBase = baseClass
|
||||
elementHeader += """
|
||||
class {0}: public {1}
|
||||
{{
|
||||
public:
|
||||
{0}();
|
||||
virtual ~{0}();
|
||||
{2}
|
||||
}};
|
||||
""".format(className, elementBase, str.join("\n\t", classMembers))
|
||||
|
||||
elementHeader += """
|
||||
std::vector<Element> GetElements();
|
||||
|
||||
#endif
|
||||
"""
|
||||
|
||||
elementContent = """#include "simulation/ElementDefs.h"
|
||||
#include "ElementClasses.h"
|
||||
|
||||
std::vector<Element> GetElements()
|
||||
{
|
||||
std::vector<Element> elements;
|
||||
""";
|
||||
|
||||
for d in elementIDs:
|
||||
tmpClass = d[1]
|
||||
newClass = ""
|
||||
baseClass = "Element"
|
||||
if ':' in tmpClass:
|
||||
classBits = tmpClass.split(':')
|
||||
newClass = classBits[0]
|
||||
baseClass = classBits[1]
|
||||
else:
|
||||
newClass = tmpClass
|
||||
elementContent += """elements.push_back(%s());
|
||||
""" % (newClass)
|
||||
|
||||
elementContent += """return elements;
|
||||
}
|
||||
""";
|
||||
|
||||
outputPath, outputFile = os.path.split(outputH)
|
||||
if not os.path.exists(outputPath):
|
||||
os.makedirs(outputPath)
|
||||
|
||||
f = open(outputH, "w")
|
||||
f.write(elementHeader)
|
||||
f.close()
|
||||
|
||||
f = open(outputCpp, "w")
|
||||
f.write(elementContent)
|
||||
f.close()
|
||||
|
||||
def generateTools(toolFiles, outputCpp, outputH):
|
||||
toolClasses = {}
|
||||
|
||||
toolHeader = """#ifndef TOOLCLASSES_H
|
||||
#define TOOLCLASSES_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "simulation/simtools/SimTool.h"
|
||||
|
||||
"""
|
||||
|
||||
directives = []
|
||||
|
||||
for toolFile in toolFiles:
|
||||
try:
|
||||
f = open(toolFile, "r")
|
||||
except:
|
||||
f = open("src/simulation/simtools/"+toolFile, "r")
|
||||
fileData = f.read()
|
||||
f.close()
|
||||
|
||||
directiveMatcher = '//#TPT-Directive\s+([^\r\n]+)'
|
||||
matcher = re.compile(directiveMatcher)
|
||||
directiveMatches = matcher.findall(fileData)
|
||||
|
||||
for match in directiveMatches:
|
||||
directives.append(match.split(" "))
|
||||
|
||||
classDirectives = []
|
||||
usedIDs = []
|
||||
for d in directives:
|
||||
if d[0] == "ToolClass":
|
||||
toolClasses[d[1]] = []
|
||||
toolHeader += "#define %s %s\n" % (d[2], d[3])
|
||||
d[3] = int(d[3])
|
||||
classDirectives.append(d)
|
||||
if d[3] in usedIDs:
|
||||
print("WARNING: duplicate tool ID {} ({})".format(d[3],d[2]))
|
||||
usedIDs.append(d[3])
|
||||
|
||||
for d in directives:
|
||||
if d[0] == "ToolHeader":
|
||||
toolClasses[d[1]].append(" ".join(d[2:])+";")
|
||||
|
||||
for className, classMembers in list(toolClasses.items()):
|
||||
toolHeader += """
|
||||
class {0}: public SimTool
|
||||
{{
|
||||
public:
|
||||
{0}();
|
||||
virtual ~{0}();
|
||||
int Perform(Simulation * sim, Particle * cpart, int x, int y, int brushX, int brushY, float strength) override;
|
||||
}};
|
||||
""".format(className, str.join("\n", classMembers))
|
||||
|
||||
toolHeader += """
|
||||
std::vector<SimTool*> GetTools();
|
||||
|
||||
#endif
|
||||
"""
|
||||
|
||||
toolContent = """#include "ToolClasses.h"
|
||||
std::vector<SimTool*> GetTools()
|
||||
{
|
||||
std::vector<SimTool*> tools;
|
||||
""";
|
||||
|
||||
toolIDs = sorted(classDirectives, key=lambda directive: directive[3])
|
||||
for d in toolIDs:
|
||||
toolContent += """ tools.push_back(new %s());
|
||||
""" % (d[1])
|
||||
|
||||
toolContent += """ return tools;
|
||||
}
|
||||
""";
|
||||
|
||||
outputPath, outputFile = os.path.split(outputH)
|
||||
if not os.path.exists(outputPath):
|
||||
os.makedirs(outputPath)
|
||||
|
||||
f = open(outputH, "w")
|
||||
f.write(toolHeader)
|
||||
f.close()
|
||||
|
||||
f = open(outputCpp, "w")
|
||||
f.write(toolContent)
|
||||
f.close()
|
||||
|
||||
generateElements(os.listdir("src/simulation/elements"), "generated/ElementClasses.cpp", "generated/ElementClasses.h")
|
||||
generateTools(os.listdir("src/simulation/simtools"), "generated/ToolClasses.cpp", "generated/ToolClasses.h")
|
@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import re
|
||||
import os
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
name = input('element name: ')
|
||||
@ -13,24 +12,30 @@ if re.search('[^A-Z0-9-]', name):
|
||||
|
||||
path = 'src/simulation/elements/' + name + '.cpp'
|
||||
|
||||
if os.path.isfile(path):
|
||||
def get_elements():
|
||||
elements = dict()
|
||||
with open('src/simulation/ElementNumbers.h', 'r') as numbers:
|
||||
for nm, pt in re.findall('ELEMENT_DEFINE\\s*\\(\\s*(\\S+)\\s*,\\s*(\\d+)\\s*\\)', numbers.read()):
|
||||
elements[nm] = int(pt)
|
||||
return elements
|
||||
|
||||
elements = get_elements()
|
||||
if name in elements:
|
||||
sys.exit('element already exists')
|
||||
|
||||
with open("generator.py") as f:
|
||||
exec(compile(f.read(), "generator.py", 'exec'))
|
||||
|
||||
max_id = 0
|
||||
with open('generated/ElementClasses.h', 'r') as classes:
|
||||
for pt in re.findall('#define PT_\\S+ (\\d+)', classes.read()):
|
||||
pt_id = int(pt)
|
||||
if max_id < pt_id:
|
||||
max_id = pt_id
|
||||
for nm, pt in elements.items():
|
||||
pt_id = int(pt)
|
||||
if max_id < pt_id:
|
||||
max_id = pt_id
|
||||
new_id = max_id + 1
|
||||
|
||||
with open(path, 'w') as elem:
|
||||
elem.write(r"""#include "simulation/ElementCommon.h"
|
||||
|
||||
//#TPT-Directive ElementClass Element_{0} PT_{0} {1}
|
||||
Element_{0}::Element_{0}()
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_{0}()
|
||||
{{
|
||||
Identifier = "DEFAULT_PT_{0}";
|
||||
Name = "{0}";
|
||||
@ -41,20 +46,18 @@ Element_{0}::Element_{0}()
|
||||
|
||||
// element properties here
|
||||
|
||||
Update = &Element_{0}::update;
|
||||
Graphics = &Element_{0}::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_{0} static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_{0}::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{{
|
||||
// update code here
|
||||
|
||||
return 0;
|
||||
}}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_{0} static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_{0}::graphics(GRAPHICS_FUNC_ARGS)
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{{
|
||||
// graphics code here
|
||||
// return 1 if nothing dymanic happens here
|
||||
@ -62,9 +65,13 @@ int Element_{0}::graphics(GRAPHICS_FUNC_ARGS)
|
||||
return 0;
|
||||
}}
|
||||
|
||||
Element_{0}::~Element_{0}() {{}}
|
||||
""".format(name, str(max_id + 1)))
|
||||
""".format(name))
|
||||
elem.close()
|
||||
|
||||
with open("generator.py") as f:
|
||||
exec(compile(f.read(), "generator.py", 'exec'))
|
||||
print('element file \'{0}\' successfully created '.format(path))
|
||||
input('now add \'ELEMENT_DEFINE({0}, {1});\' to \'src/simulation/ElementNumbers.h\', then press enter'.format(name, str(new_id)))
|
||||
while True:
|
||||
elements = get_elements()
|
||||
if name in elements and elements[name] == new_id:
|
||||
break
|
||||
input('nope; try doing that again, then press enter')
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "hmap.h"
|
||||
|
||||
#include "simulation/Simulation.h"
|
||||
#include "ElementClasses.h"
|
||||
#include "simulation/ElementClasses.h"
|
||||
|
||||
GameSave::GameSave(GameSave & save):
|
||||
majorVersion(save.majorVersion),
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "simulation/ElementGraphics.h"
|
||||
#include "simulation/Air.h"
|
||||
#include "simulation/Gravity.h"
|
||||
#include "ElementClasses.h"
|
||||
#include "simulation/ElementClasses.h"
|
||||
|
||||
#ifdef LUACONSOLE
|
||||
#include "lua/LuaScriptInterface.h"
|
||||
@ -1201,7 +1201,7 @@ void Renderer::render_parts()
|
||||
if(!sim)
|
||||
return;
|
||||
parts = sim->parts;
|
||||
elements = sim->elements;
|
||||
elements = sim->elements.data();
|
||||
#ifdef OGLR
|
||||
float fnx, fny;
|
||||
int cfireV = 0, cfireC = 0, cfire = 0;
|
||||
|
@ -72,7 +72,7 @@
|
||||
#include "simulation/SimulationData.h"
|
||||
#include "simulation/Air.h"
|
||||
#include "simulation/Snapshot.h"
|
||||
#include "ElementClasses.h"
|
||||
#include "simulation/ElementClasses.h"
|
||||
|
||||
#ifdef GetUserName
|
||||
# undef GetUserName // dammit windows
|
||||
@ -930,10 +930,11 @@ void GameController::Update()
|
||||
rightSelected = sr;
|
||||
}
|
||||
|
||||
void Element_STKM_set_element(Simulation *sim, playerst *playerp, int element);
|
||||
if (!sim->player.spwn)
|
||||
Element_STKM::STKM_set_element(sim, &sim->player, rightSelected);
|
||||
Element_STKM_set_element(sim, &sim->player, rightSelected);
|
||||
if (!sim->player2.spwn)
|
||||
Element_STKM::STKM_set_element(sim, &sim->player2, rightSelected);
|
||||
Element_STKM_set_element(sim, &sim->player2, rightSelected);
|
||||
}
|
||||
if(renderOptions && renderOptions->HasExited)
|
||||
{
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "GameView.h"
|
||||
#include "GameController.h"
|
||||
|
||||
#include "ToolClasses.h"
|
||||
#include "simulation/ToolClasses.h"
|
||||
#include "EllipseBrush.h"
|
||||
#include "TriangleBrush.h"
|
||||
#include "BitmapBrush.h"
|
||||
@ -26,7 +26,7 @@
|
||||
#include "simulation/Snapshot.h"
|
||||
#include "simulation/Gravity.h"
|
||||
#include "simulation/ElementGraphics.h"
|
||||
#include "ElementClasses.h"
|
||||
#include "simulation/ElementClasses.h"
|
||||
|
||||
#include "gui/game/DecorationTool.h"
|
||||
#include "gui/interface/Engine.h"
|
||||
@ -339,8 +339,15 @@ void GameModel::BuildMenus()
|
||||
//Build menu for tools
|
||||
for (size_t i = 0; i < sim->tools.size(); i++)
|
||||
{
|
||||
Tool * tempTool;
|
||||
tempTool = new Tool(i, sim->tools[i]->Name, sim->tools[i]->Description, PIXR(sim->tools[i]->Colour), PIXG(sim->tools[i]->Colour), PIXB(sim->tools[i]->Colour), sim->tools[i]->Identifier);
|
||||
Tool *tempTool = new Tool(
|
||||
i,
|
||||
sim->tools[i].Name,
|
||||
sim->tools[i].Description,
|
||||
PIXR(sim->tools[i].Colour),
|
||||
PIXG(sim->tools[i].Colour),
|
||||
PIXB(sim->tools[i].Colour),
|
||||
sim->tools[i].Identifier
|
||||
);
|
||||
menuList[SC_TOOL]->AddTool(tempTool);
|
||||
}
|
||||
//Add special sign and prop tools
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "simulation/SaveRenderer.h"
|
||||
#include "simulation/SimulationData.h"
|
||||
#include "simulation/ElementDefs.h"
|
||||
#include "ElementClasses.h"
|
||||
#include "simulation/ElementClasses.h"
|
||||
|
||||
#ifdef GetUserName
|
||||
# undef GetUserName // dammit windows
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "gui/interface/Colour.h"
|
||||
|
||||
#include "simulation/Simulation.h"
|
||||
#include "ElementClasses.h"
|
||||
#include "simulation/ElementClasses.h"
|
||||
|
||||
#include "Menu.h"
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "simulation/Simulation.h"
|
||||
#include "simulation/SimulationData.h"
|
||||
#include "ElementClasses.h"
|
||||
#include "simulation/ElementClasses.h"
|
||||
|
||||
Tool::Tool(int id, String name, String description, int r, int g, int b, ByteString identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
||||
textureGen(textureGen),
|
||||
|
@ -37,8 +37,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
#include "simulation/Air.h"
|
||||
|
||||
#include "ToolClasses.h"
|
||||
#include "ElementClasses.h"
|
||||
#include "simulation/ToolClasses.h"
|
||||
#include "simulation/ElementClasses.h"
|
||||
|
||||
#include "client/GameSave.h"
|
||||
#include "client/SaveFile.h"
|
||||
@ -2582,7 +2582,7 @@ int LuaScriptInterface::elements_loadDefault(lua_State * l)
|
||||
lua_pushnil(l);
|
||||
lua_setfield(l, -2, luacon_sim->elements[id].Identifier.c_str());
|
||||
|
||||
std::vector<Element> elementList = GetElements();
|
||||
auto const &elementList = GetElements();
|
||||
if (id < (int)elementList.size())
|
||||
luacon_sim->elements[id] = elementList[id];
|
||||
else
|
||||
@ -2594,7 +2594,7 @@ int LuaScriptInterface::elements_loadDefault(lua_State * l)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<Element> elementList = GetElements();
|
||||
auto const &elementList = GetElements();
|
||||
for (int i = 0; i < PT_NUM; i++)
|
||||
{
|
||||
if (i < (int)elementList.size())
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "simulation/Simulation.h"
|
||||
#include "simulation/Air.h"
|
||||
#include "ElementClasses.h"
|
||||
#include "simulation/ElementClasses.h"
|
||||
|
||||
#include "gui/game/GameController.h"
|
||||
#include "gui/game/GameModel.h"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
#include "simulation/StructProperty.h"
|
||||
#include "ElementCommon.h"
|
||||
#include "StructProperty.h"
|
||||
|
||||
Element::Element():
|
||||
Identifier("DEFAULT_INVALID"),
|
@ -74,6 +74,10 @@ public:
|
||||
/** 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 **/
|
||||
static std::vector<StructProperty> const &GetProperties();
|
||||
|
||||
#define ELEMENT_NUMBERS_DECLARE
|
||||
#include "ElementNumbers.h"
|
||||
#undef ELEMENT_NUMBERS_DECLARE
|
||||
};
|
||||
|
||||
#endif
|
19
src/simulation/ElementClasses.cpp
Normal file
19
src/simulation/ElementClasses.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include "ElementCommon.h"
|
||||
|
||||
std::vector<Element> const &GetElements()
|
||||
{
|
||||
struct DoOnce
|
||||
{
|
||||
std::vector<Element> elements;
|
||||
|
||||
DoOnce() : elements(PT_NUM)
|
||||
{
|
||||
#define ELEMENT_NUMBERS_CALL
|
||||
#include "ElementNumbers.h"
|
||||
#undef ELEMENT_NUMBERS_CALL
|
||||
}
|
||||
};
|
||||
|
||||
static DoOnce doOnce;
|
||||
return doOnce.elements;
|
||||
}
|
15
src/simulation/ElementClasses.h
Normal file
15
src/simulation/ElementClasses.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef ELEMENTCLASSES_H
|
||||
#define ELEMENTCLASSES_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "SimulationData.h"
|
||||
#include "Element.h"
|
||||
|
||||
#define ELEMENT_NUMBERS_ENUMERATE
|
||||
#include "ElementNumbers.h"
|
||||
#undef ELEMENT_NUMBERS_ENUMERATE
|
||||
|
||||
std::vector<Element> const &GetElements();
|
||||
|
||||
#endif
|
199
src/simulation/ElementNumbers.h
Normal file
199
src/simulation/ElementNumbers.h
Normal file
@ -0,0 +1,199 @@
|
||||
#ifdef ELEMENT_NUMBERS_CALL
|
||||
# define ELEMENT_DEFINE(name, id) elements[id].Element_ ## name ()
|
||||
#endif
|
||||
#ifdef ELEMENT_NUMBERS_DECLARE
|
||||
# define ELEMENT_DEFINE(name, id) void Element_ ## name ()
|
||||
#endif
|
||||
#ifdef ELEMENT_NUMBERS_ENUMERATE
|
||||
# define ELEMENT_DEFINE(name, id) constexpr int PT_ ## name = id
|
||||
#endif
|
||||
|
||||
ELEMENT_DEFINE(NONE, 0);
|
||||
ELEMENT_DEFINE(DUST, 1);
|
||||
ELEMENT_DEFINE(WATR, 2);
|
||||
ELEMENT_DEFINE(OIL, 3);
|
||||
ELEMENT_DEFINE(FIRE, 4);
|
||||
ELEMENT_DEFINE(STNE, 5);
|
||||
ELEMENT_DEFINE(LAVA, 6);
|
||||
ELEMENT_DEFINE(GUNP, 7);
|
||||
ELEMENT_DEFINE(NITR, 8);
|
||||
ELEMENT_DEFINE(CLNE, 9);
|
||||
ELEMENT_DEFINE(GAS, 10);
|
||||
ELEMENT_DEFINE(PLEX, 11);
|
||||
ELEMENT_DEFINE(GOO, 12);
|
||||
ELEMENT_DEFINE(ICEI, 13);
|
||||
ELEMENT_DEFINE(METL, 14);
|
||||
ELEMENT_DEFINE(SPRK, 15);
|
||||
ELEMENT_DEFINE(SNOW, 16);
|
||||
ELEMENT_DEFINE(WOOD, 17);
|
||||
ELEMENT_DEFINE(NEUT, 18);
|
||||
ELEMENT_DEFINE(PLUT, 19);
|
||||
ELEMENT_DEFINE(PLNT, 20);
|
||||
ELEMENT_DEFINE(ACID, 21);
|
||||
ELEMENT_DEFINE(VOID, 22);
|
||||
ELEMENT_DEFINE(WTRV, 23);
|
||||
ELEMENT_DEFINE(CNCT, 24);
|
||||
ELEMENT_DEFINE(DSTW, 25);
|
||||
ELEMENT_DEFINE(SALT, 26);
|
||||
ELEMENT_DEFINE(SLTW, 27);
|
||||
ELEMENT_DEFINE(DMND, 28);
|
||||
ELEMENT_DEFINE(BMTL, 29);
|
||||
ELEMENT_DEFINE(BRMT, 30);
|
||||
ELEMENT_DEFINE(PHOT, 31);
|
||||
ELEMENT_DEFINE(URAN, 32);
|
||||
ELEMENT_DEFINE(WAX, 33);
|
||||
ELEMENT_DEFINE(MWAX, 34);
|
||||
ELEMENT_DEFINE(PSCN, 35);
|
||||
ELEMENT_DEFINE(NSCN, 36);
|
||||
ELEMENT_DEFINE(LNTG, 37);
|
||||
ELEMENT_DEFINE(INSL, 38);
|
||||
ELEMENT_DEFINE(BHOL, 39);
|
||||
ELEMENT_DEFINE(WHOL, 40);
|
||||
ELEMENT_DEFINE(RBDM, 41);
|
||||
ELEMENT_DEFINE(LRBD, 42);
|
||||
ELEMENT_DEFINE(NTCT, 43);
|
||||
ELEMENT_DEFINE(SAND, 44);
|
||||
ELEMENT_DEFINE(GLAS, 45);
|
||||
ELEMENT_DEFINE(PTCT, 46);
|
||||
ELEMENT_DEFINE(BGLA, 47);
|
||||
ELEMENT_DEFINE(THDR, 48);
|
||||
ELEMENT_DEFINE(PLSM, 49);
|
||||
ELEMENT_DEFINE(ETRD, 50);
|
||||
ELEMENT_DEFINE(NICE, 51);
|
||||
ELEMENT_DEFINE(NBLE, 52);
|
||||
ELEMENT_DEFINE(BTRY, 53);
|
||||
ELEMENT_DEFINE(LCRY, 54);
|
||||
ELEMENT_DEFINE(STKM, 55);
|
||||
ELEMENT_DEFINE(SWCH, 56);
|
||||
ELEMENT_DEFINE(SMKE, 57);
|
||||
ELEMENT_DEFINE(DESL, 58);
|
||||
ELEMENT_DEFINE(COAL, 59);
|
||||
ELEMENT_DEFINE(LO2, 60);
|
||||
ELEMENT_DEFINE(O2, 61);
|
||||
ELEMENT_DEFINE(INWR, 62);
|
||||
ELEMENT_DEFINE(YEST, 63);
|
||||
ELEMENT_DEFINE(DYST, 64);
|
||||
ELEMENT_DEFINE(THRM, 65);
|
||||
ELEMENT_DEFINE(GLOW, 66);
|
||||
ELEMENT_DEFINE(BRCK, 67);
|
||||
ELEMENT_DEFINE(CFLM, 68);
|
||||
ELEMENT_DEFINE(FIRW, 69);
|
||||
ELEMENT_DEFINE(FUSE, 70);
|
||||
ELEMENT_DEFINE(FSEP, 71);
|
||||
ELEMENT_DEFINE(AMTR, 72);
|
||||
ELEMENT_DEFINE(BCOL, 73);
|
||||
ELEMENT_DEFINE(PCLN, 74);
|
||||
ELEMENT_DEFINE(HSWC, 75);
|
||||
ELEMENT_DEFINE(IRON, 76);
|
||||
ELEMENT_DEFINE(MORT, 77);
|
||||
ELEMENT_DEFINE(LIFE, 78);
|
||||
ELEMENT_DEFINE(DLAY, 79);
|
||||
ELEMENT_DEFINE(CO2, 80);
|
||||
ELEMENT_DEFINE(DRIC, 81);
|
||||
ELEMENT_DEFINE(CBNW, 82);
|
||||
ELEMENT_DEFINE(STOR, 83);
|
||||
ELEMENT_DEFINE(PVOD, 84);
|
||||
ELEMENT_DEFINE(CONV, 85);
|
||||
ELEMENT_DEFINE(CAUS, 86);
|
||||
ELEMENT_DEFINE(LIGH, 87);
|
||||
ELEMENT_DEFINE(TESC, 88);
|
||||
ELEMENT_DEFINE(DEST, 89);
|
||||
ELEMENT_DEFINE(SPNG, 90);
|
||||
ELEMENT_DEFINE(RIME, 91);
|
||||
ELEMENT_DEFINE(FOG, 92);
|
||||
ELEMENT_DEFINE(BCLN, 93);
|
||||
ELEMENT_DEFINE(LOVE, 94);
|
||||
ELEMENT_DEFINE(DEUT, 95);
|
||||
ELEMENT_DEFINE(WARP, 96);
|
||||
ELEMENT_DEFINE(PUMP, 97);
|
||||
ELEMENT_DEFINE(FWRK, 98);
|
||||
ELEMENT_DEFINE(PIPE, 99);
|
||||
ELEMENT_DEFINE(FRZZ, 100);
|
||||
ELEMENT_DEFINE(FRZW, 101);
|
||||
ELEMENT_DEFINE(GRAV, 102);
|
||||
ELEMENT_DEFINE(BIZR, 103);
|
||||
ELEMENT_DEFINE(BIZRG, 104);
|
||||
ELEMENT_DEFINE(BIZRS, 105);
|
||||
ELEMENT_DEFINE(INST, 106);
|
||||
ELEMENT_DEFINE(ISOZ, 107);
|
||||
ELEMENT_DEFINE(ISZS, 108);
|
||||
ELEMENT_DEFINE(PRTI, 109);
|
||||
ELEMENT_DEFINE(PRTO, 110);
|
||||
ELEMENT_DEFINE(PSTE, 111);
|
||||
ELEMENT_DEFINE(PSTS, 112);
|
||||
ELEMENT_DEFINE(ANAR, 113);
|
||||
ELEMENT_DEFINE(VINE, 114);
|
||||
ELEMENT_DEFINE(INVIS, 115);
|
||||
ELEMENT_DEFINE(E116, 116);
|
||||
ELEMENT_DEFINE(SPAWN2, 117);
|
||||
ELEMENT_DEFINE(SPAWN, 118);
|
||||
ELEMENT_DEFINE(SHLD1, 119);
|
||||
ELEMENT_DEFINE(SHLD2, 120);
|
||||
ELEMENT_DEFINE(SHLD3, 121);
|
||||
ELEMENT_DEFINE(SHLD4, 122);
|
||||
ELEMENT_DEFINE(LOLZ, 123);
|
||||
ELEMENT_DEFINE(WIFI, 124);
|
||||
ELEMENT_DEFINE(FILT, 125);
|
||||
ELEMENT_DEFINE(ARAY, 126);
|
||||
ELEMENT_DEFINE(BRAY, 127);
|
||||
ELEMENT_DEFINE(STKM2, 128);
|
||||
ELEMENT_DEFINE(BOMB, 129);
|
||||
ELEMENT_DEFINE(C5, 130);
|
||||
ELEMENT_DEFINE(SING, 131);
|
||||
ELEMENT_DEFINE(QRTZ, 132);
|
||||
ELEMENT_DEFINE(PQRT, 133);
|
||||
ELEMENT_DEFINE(EMP, 134);
|
||||
ELEMENT_DEFINE(BREC, 135);
|
||||
ELEMENT_DEFINE(ELEC, 136);
|
||||
ELEMENT_DEFINE(ACEL, 137);
|
||||
ELEMENT_DEFINE(DCEL, 138);
|
||||
ELEMENT_DEFINE(BANG, 139);
|
||||
ELEMENT_DEFINE(IGNT, 140);
|
||||
ELEMENT_DEFINE(BOYL, 141);
|
||||
ELEMENT_DEFINE(GEL, 142);
|
||||
ELEMENT_DEFINE(TRON, 143);
|
||||
ELEMENT_DEFINE(TTAN, 144);
|
||||
ELEMENT_DEFINE(EXOT, 145);
|
||||
ELEMENT_DEFINE(E146, 146);
|
||||
ELEMENT_DEFINE(EMBR, 147);
|
||||
ELEMENT_DEFINE(H2, 148);
|
||||
ELEMENT_DEFINE(SOAP, 149);
|
||||
ELEMENT_DEFINE(NBHL, 150);
|
||||
ELEMENT_DEFINE(NWHL, 151);
|
||||
ELEMENT_DEFINE(MERC, 152);
|
||||
ELEMENT_DEFINE(PBCN, 153);
|
||||
ELEMENT_DEFINE(GPMP, 154);
|
||||
ELEMENT_DEFINE(CLST, 155);
|
||||
ELEMENT_DEFINE(WIRE, 156);
|
||||
ELEMENT_DEFINE(GBMB, 157);
|
||||
ELEMENT_DEFINE(FIGH, 158);
|
||||
ELEMENT_DEFINE(FRAY, 159);
|
||||
ELEMENT_DEFINE(RPEL, 160);
|
||||
ELEMENT_DEFINE(PPIP, 161);
|
||||
ELEMENT_DEFINE(DTEC, 162);
|
||||
ELEMENT_DEFINE(DMG, 163);
|
||||
ELEMENT_DEFINE(TSNS, 164);
|
||||
ELEMENT_DEFINE(VIBR, 165);
|
||||
ELEMENT_DEFINE(BVBR, 166);
|
||||
ELEMENT_DEFINE(CRAY, 167);
|
||||
ELEMENT_DEFINE(PSTN, 168);
|
||||
ELEMENT_DEFINE(FRME, 169);
|
||||
ELEMENT_DEFINE(GOLD, 170);
|
||||
ELEMENT_DEFINE(TUNG, 171);
|
||||
ELEMENT_DEFINE(PSNS, 172);
|
||||
ELEMENT_DEFINE(PROT, 173);
|
||||
ELEMENT_DEFINE(VIRS, 174);
|
||||
ELEMENT_DEFINE(VRSS, 175);
|
||||
ELEMENT_DEFINE(VRSG, 176);
|
||||
ELEMENT_DEFINE(GRVT, 177);
|
||||
ELEMENT_DEFINE(DRAY, 178);
|
||||
ELEMENT_DEFINE(CRMC, 179);
|
||||
ELEMENT_DEFINE(HEAC, 180);
|
||||
ELEMENT_DEFINE(SAWD, 181);
|
||||
ELEMENT_DEFINE(POLO, 182);
|
||||
ELEMENT_DEFINE(RFRG, 183);
|
||||
ELEMENT_DEFINE(RFGL, 184);
|
||||
ELEMENT_DEFINE(LSNS, 185);
|
||||
ELEMENT_DEFINE(LDTC, 186);
|
||||
|
||||
#undef ELEMENT_DEFINE
|
@ -14,9 +14,13 @@ public:
|
||||
pixel Colour;
|
||||
String Description;
|
||||
|
||||
int (*Perform)(Simulation * sim, Particle * cpart, int x, int y, int brushX, int brushY, float strength);
|
||||
|
||||
SimTool();
|
||||
virtual ~SimTool() {}
|
||||
virtual int Perform(Simulation * sim, Particle * cpart, int x, int y, int brushX, int brushY, float strength) { return 0; }
|
||||
|
||||
#define TOOL_NUMBERS_DECLARE
|
||||
#include "ToolNumbers.h"
|
||||
#undef TOOL_NUMBERS_DECLARE
|
||||
};
|
||||
|
||||
#endif
|
@ -35,6 +35,12 @@
|
||||
#include "lua/LuaScriptHelper.h"
|
||||
#endif
|
||||
|
||||
extern int Element_PPIP_ppip_changed;
|
||||
extern int Element_LOLZ_RuleTable[9][9];
|
||||
extern int Element_LOLZ_lolz[XRES/9][YRES/9];
|
||||
extern int Element_LOVE_RuleTable[9][9];
|
||||
extern int Element_LOVE_love[XRES/9][YRES/9];
|
||||
|
||||
int Simulation::Load(GameSave * save, bool includePressure)
|
||||
{
|
||||
return Load(save, includePressure, 0, 0);
|
||||
@ -110,7 +116,8 @@ int Simulation::Load(GameSave * save, bool includePressure, int fullX, int fullY
|
||||
continue;
|
||||
if ((tempPart.type == PT_SPAWN && elementCount[PT_SPAWN]) || (tempPart.type == PT_SPAWN2 && elementCount[PT_SPAWN2]))
|
||||
continue;
|
||||
if (tempPart.type == PT_FIGH && !Element_FIGH::CanAlloc(this))
|
||||
bool Element_FIGH_CanAlloc(Simulation *sim);
|
||||
if (tempPart.type == PT_FIGH && !Element_FIGH_CanAlloc(this))
|
||||
continue;
|
||||
if (!elements[tempPart.type].Enabled)
|
||||
continue;
|
||||
@ -169,10 +176,11 @@ int Simulation::Load(GameSave * save, bool includePressure, int fullX, int fullY
|
||||
elementCount[tempPart.type]++;
|
||||
}
|
||||
|
||||
void Element_STKM_init_legs(Simulation * sim, playerst *playerp, int i);
|
||||
switch (parts[i].type)
|
||||
{
|
||||
case PT_STKM:
|
||||
Element_STKM::STKM_init_legs(this, &player, i);
|
||||
Element_STKM_init_legs(this, &player, i);
|
||||
player.spwn = 1;
|
||||
player.elem = PT_DUST;
|
||||
|
||||
@ -187,7 +195,7 @@ int Simulation::Load(GameSave * save, bool includePressure, int fullX, int fullY
|
||||
player.fan = true;
|
||||
break;
|
||||
case PT_STKM2:
|
||||
Element_STKM::STKM_init_legs(this, &player2, i);
|
||||
Element_STKM_init_legs(this, &player2, i);
|
||||
player2.spwn = 1;
|
||||
player2.elem = PT_DUST;
|
||||
if ((save->majorVersion < 93 && parts[i].ctype == SPC_AIR) ||
|
||||
@ -209,7 +217,8 @@ int Simulation::Load(GameSave * save, bool includePressure, int fullX, int fullY
|
||||
case PT_FIGH:
|
||||
{
|
||||
unsigned int oldTmp = parts[i].tmp;
|
||||
parts[i].tmp = Element_FIGH::Alloc(this);
|
||||
int Element_FIGH_Alloc(Simulation *sim);
|
||||
parts[i].tmp = Element_FIGH_Alloc(this);
|
||||
if (parts[i].tmp >= 0)
|
||||
{
|
||||
bool fan = false;
|
||||
@ -219,7 +228,8 @@ int Simulation::Load(GameSave * save, bool includePressure, int fullX, int fullY
|
||||
fan = true;
|
||||
parts[i].ctype = 0;
|
||||
}
|
||||
Element_FIGH::NewFighter(this, parts[i].tmp, i, parts[i].ctype);
|
||||
void Element_FIGH_NewFighter(Simulation *sim, int fighterID, int i, int elem);
|
||||
Element_FIGH_NewFighter(this, parts[i].tmp, i, parts[i].ctype);
|
||||
if (fan)
|
||||
fighters[parts[i].tmp].fan = true;
|
||||
for (unsigned int fighNum : save->stkm.rocketBootsFigh)
|
||||
@ -260,7 +270,7 @@ int Simulation::Load(GameSave * save, bool includePressure, int fullX, int fullY
|
||||
}
|
||||
parts_lastActiveIndex = NPART-1;
|
||||
force_stacking_check = true;
|
||||
Element_PPIP::ppip_changed = 1;
|
||||
Element_PPIP_ppip_changed = 1;
|
||||
RecalcFreeParticles(false);
|
||||
|
||||
// fix SOAP links using soapList, a map of old particle ID -> new particle ID
|
||||
@ -1324,17 +1334,13 @@ void Simulation::ApplyDecorationFill(Renderer *ren, int x, int y, int colR, int
|
||||
|
||||
int Simulation::Tool(int x, int y, int tool, int brushX, int brushY, float strength)
|
||||
{
|
||||
if(tools[tool])
|
||||
{
|
||||
Particle * cpart = NULL;
|
||||
int r;
|
||||
if ((r = pmap[y][x]))
|
||||
cpart = &(parts[ID(r)]);
|
||||
else if ((r = photons[y][x]))
|
||||
cpart = &(parts[ID(r)]);
|
||||
return tools[tool]->Perform(this, cpart, x, y, brushX, brushY, strength);
|
||||
}
|
||||
return 0;
|
||||
Particle * cpart = NULL;
|
||||
int r;
|
||||
if ((r = pmap[y][x]))
|
||||
cpart = &(parts[ID(r)]);
|
||||
else if ((r = photons[y][x]))
|
||||
cpart = &(parts[ID(r)]);
|
||||
return tools[tool].Perform(this, cpart, x, y, brushX, brushY, strength);
|
||||
}
|
||||
|
||||
int Simulation::ToolBrush(int positionX, int positionY, int tool, Brush * cBrush, float strength)
|
||||
@ -2583,6 +2589,7 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Element_FILT_interactWavelengths(Particle* cpart, int origWl);
|
||||
if (e == 2) //if occupy same space
|
||||
{
|
||||
switch (parts[i].type)
|
||||
@ -2599,7 +2606,7 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
|
||||
}
|
||||
break;
|
||||
case PT_FILT:
|
||||
parts[i].ctype = Element_FILT::interactWavelengths(&parts[ID(r)], parts[i].ctype);
|
||||
parts[i].ctype = Element_FILT_interactWavelengths(&parts[ID(r)], parts[i].ctype);
|
||||
break;
|
||||
case PT_C5:
|
||||
if (parts[ID(r)].life > 0 && (parts[ID(r)].ctype & parts[i].ctype & 0xFFFFFFC0))
|
||||
@ -2698,7 +2705,7 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
|
||||
case PT_BIZR:
|
||||
case PT_BIZRG:
|
||||
if (TYP(r) == PT_FILT)
|
||||
parts[i].ctype = Element_FILT::interactWavelengths(&parts[ID(r)], parts[i].ctype);
|
||||
parts[i].ctype = Element_FILT_interactWavelengths(&parts[ID(r)], parts[i].ctype);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
@ -5002,11 +5009,11 @@ void Simulation::BeforeSim()
|
||||
kill_part(ID(r));
|
||||
else if (parts[ID(r)].type==PT_LOVE)
|
||||
{
|
||||
Element_LOVE::love[nx/9][ny/9] = 1;
|
||||
Element_LOVE_love[nx/9][ny/9] = 1;
|
||||
}
|
||||
else if (parts[ID(r)].type==PT_LOLZ)
|
||||
{
|
||||
Element_LOLZ::lolz[nx/9][ny/9] = 1;
|
||||
Element_LOLZ_lolz[nx/9][ny/9] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5014,7 +5021,7 @@ void Simulation::BeforeSim()
|
||||
{
|
||||
for (ny=9; ny<=YRES-7; ny++)
|
||||
{
|
||||
if (Element_LOVE::love[nx/9][ny/9]==1)
|
||||
if (Element_LOVE_love[nx/9][ny/9]==1)
|
||||
{
|
||||
for ( nnx=0; nnx<9; nnx++)
|
||||
for ( nny=0; nny<9; nny++)
|
||||
@ -5022,17 +5029,17 @@ void Simulation::BeforeSim()
|
||||
if (ny+nny>0&&ny+nny<YRES&&nx+nnx>=0&&nx+nnx<XRES)
|
||||
{
|
||||
rt=pmap[ny+nny][nx+nnx];
|
||||
if (!rt&&Element_LOVE::RuleTable[nnx][nny]==1)
|
||||
if (!rt&&Element_LOVE_RuleTable[nnx][nny]==1)
|
||||
create_part(-1,nx+nnx,ny+nny,PT_LOVE);
|
||||
else if (!rt)
|
||||
continue;
|
||||
else if (parts[ID(rt)].type==PT_LOVE&&Element_LOVE::RuleTable[nnx][nny]==0)
|
||||
else if (parts[ID(rt)].type==PT_LOVE&&Element_LOVE_RuleTable[nnx][nny]==0)
|
||||
kill_part(ID(rt));
|
||||
}
|
||||
}
|
||||
}
|
||||
Element_LOVE::love[nx/9][ny/9]=0;
|
||||
if (Element_LOLZ::lolz[nx/9][ny/9]==1)
|
||||
Element_LOVE_love[nx/9][ny/9]=0;
|
||||
if (Element_LOLZ_lolz[nx/9][ny/9]==1)
|
||||
{
|
||||
for ( nnx=0; nnx<9; nnx++)
|
||||
for ( nny=0; nny<9; nny++)
|
||||
@ -5040,17 +5047,17 @@ void Simulation::BeforeSim()
|
||||
if (ny+nny>0&&ny+nny<YRES&&nx+nnx>=0&&nx+nnx<XRES)
|
||||
{
|
||||
rt=pmap[ny+nny][nx+nnx];
|
||||
if (!rt&&Element_LOLZ::RuleTable[nny][nnx]==1)
|
||||
if (!rt&&Element_LOLZ_RuleTable[nny][nnx]==1)
|
||||
create_part(-1,nx+nnx,ny+nny,PT_LOLZ);
|
||||
else if (!rt)
|
||||
continue;
|
||||
else if (parts[ID(rt)].type==PT_LOLZ&&Element_LOLZ::RuleTable[nny][nnx]==0)
|
||||
else if (parts[ID(rt)].type==PT_LOLZ&&Element_LOLZ_RuleTable[nny][nnx]==0)
|
||||
kill_part(ID(rt));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Element_LOLZ::lolz[nx/9][ny/9]=0;
|
||||
Element_LOLZ_lolz[nx/9][ny/9]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5072,7 +5079,7 @@ void Simulation::BeforeSim()
|
||||
}
|
||||
|
||||
// update PPIP tmp?
|
||||
if (Element_PPIP::ppip_changed)
|
||||
if (Element_PPIP_ppip_changed)
|
||||
{
|
||||
for (int i = 0; i <= parts_lastActiveIndex; i++)
|
||||
{
|
||||
@ -5082,7 +5089,7 @@ void Simulation::BeforeSim()
|
||||
parts[i].tmp &= ~0xE0000000;
|
||||
}
|
||||
}
|
||||
Element_PPIP::ppip_changed = 0;
|
||||
Element_PPIP_ppip_changed = 0;
|
||||
}
|
||||
|
||||
// Simulate GoL
|
||||
@ -5117,7 +5124,9 @@ void Simulation::AfterSim()
|
||||
{
|
||||
if (emp_trigger_count)
|
||||
{
|
||||
Element_EMP::Trigger(this, emp_trigger_count);
|
||||
// pitiful attempt at trying to keep code relating to a given element in the same file
|
||||
void Element_EMP_Trigger(Simulation *sim, int triggerCount);
|
||||
Element_EMP_Trigger(this, emp_trigger_count);
|
||||
emp_trigger_count = 0;
|
||||
}
|
||||
}
|
||||
@ -5126,8 +5135,6 @@ Simulation::~Simulation()
|
||||
{
|
||||
delete grav;
|
||||
delete air;
|
||||
for (size_t i = 0; i < tools.size(); i++)
|
||||
delete tools[i];
|
||||
}
|
||||
|
||||
Simulation::Simulation():
|
||||
@ -5189,24 +5196,11 @@ Simulation::Simulation():
|
||||
hv = air->hv;
|
||||
|
||||
msections = LoadMenus();
|
||||
|
||||
wtypes = LoadWalls();
|
||||
|
||||
platent = LoadLatent();
|
||||
|
||||
std::vector<Element> elementList = GetElements();
|
||||
for(int i = 0; i < PT_NUM; i++)
|
||||
{
|
||||
if (i < (int)elementList.size())
|
||||
elements[i] = elementList[i];
|
||||
else
|
||||
elements[i] = Element();
|
||||
}
|
||||
|
||||
std::copy(GetElements().begin(), GetElements().end(), elements.begin());
|
||||
tools = GetTools();
|
||||
|
||||
grule = LoadGOLRules();
|
||||
|
||||
gmenu = LoadGOLMenu();
|
||||
|
||||
player.comm = 0;
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <cstring>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
|
||||
#include "Particle.h"
|
||||
#include "Stickman.h"
|
||||
@ -15,7 +16,7 @@
|
||||
|
||||
#include "CoordStack.h"
|
||||
|
||||
#include "elements/Element.h"
|
||||
#include "Element.h"
|
||||
|
||||
#define CHANNELS ((int)(MAX_TEMP-73)/100+2)
|
||||
|
||||
@ -40,9 +41,9 @@ public:
|
||||
Air * air;
|
||||
|
||||
std::vector<sign> signs;
|
||||
Element elements[PT_NUM];
|
||||
std::array<Element, PT_NUM> elements;
|
||||
//Element * elements;
|
||||
std::vector<SimTool*> tools;
|
||||
std::vector<SimTool> tools;
|
||||
std::vector<unsigned int> platent;
|
||||
std::vector<wall_type> wtypes;
|
||||
std::vector<gol_menu> gmenu;
|
||||
|
19
src/simulation/ToolClasses.cpp
Normal file
19
src/simulation/ToolClasses.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include "ToolClasses.h"
|
||||
|
||||
std::vector<SimTool> const &GetTools()
|
||||
{
|
||||
struct DoOnce
|
||||
{
|
||||
std::vector<SimTool> tools;
|
||||
|
||||
DoOnce()
|
||||
{
|
||||
#define TOOL_NUMBERS_CALL
|
||||
#include "ToolNumbers.h"
|
||||
#undef TOOL_NUMBERS_CALL
|
||||
}
|
||||
};
|
||||
|
||||
static DoOnce doOnce;
|
||||
return doOnce.tools;
|
||||
}
|
15
src/simulation/ToolClasses.h
Normal file
15
src/simulation/ToolClasses.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef TOOLCLASSES_H
|
||||
#define TOOLCLASSES_H
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include "SimTool.h"
|
||||
|
||||
#define TOOL_NUMBERS_ENUMERATE
|
||||
#include "ToolNumbers.h"
|
||||
#undef TOOL_NUMBERS_ENUMERATE
|
||||
|
||||
std::vector<SimTool> const &GetTools();
|
||||
|
||||
#endif
|
20
src/simulation/ToolNumbers.h
Normal file
20
src/simulation/ToolNumbers.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifdef TOOL_NUMBERS_CALL
|
||||
# define TOOL_DEFINE(name, id) tools.push_back(SimTool()), tools.back().Tool_ ## name ()
|
||||
#endif
|
||||
#ifdef TOOL_NUMBERS_DECLARE
|
||||
# define TOOL_DEFINE(name, id) void Tool_ ## name ()
|
||||
#endif
|
||||
#ifdef TOOL_NUMBERS_ENUMERATE
|
||||
# define TOOL_DEFINE(name, id) constexpr int TOOL_ ## name = id
|
||||
#endif
|
||||
|
||||
TOOL_DEFINE(HEAT, 0);
|
||||
TOOL_DEFINE(COOL, 1);
|
||||
TOOL_DEFINE(AIR, 2);
|
||||
TOOL_DEFINE(VAC, 3);
|
||||
TOOL_DEFINE(PGRV, 4);
|
||||
TOOL_DEFINE(NGRV, 5);
|
||||
TOOL_DEFINE(MIX, 6);
|
||||
TOOL_DEFINE(CYCL, 7);
|
||||
|
||||
#undef TOOL_DEFINE
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_ACEL PT_ACEL 137
|
||||
Element_ACEL::Element_ACEL()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_ACEL()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_ACEL";
|
||||
Name = "ACEL";
|
||||
@ -40,12 +43,11 @@ Element_ACEL::Element_ACEL()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_ACEL::update;
|
||||
Graphics = &Element_ACEL::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_ACEL static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_ACEL::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
float multiplier;
|
||||
@ -78,16 +80,9 @@ int Element_ACEL::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_ACEL static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_ACEL::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
if(cpart->tmp)
|
||||
*pixel_mode |= PMODE_GLOW;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_ACEL::~Element_ACEL() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_ACID PT_ACID 21
|
||||
Element_ACID::Element_ACID()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_ACID()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_ACID";
|
||||
Name = "ACID";
|
||||
@ -43,12 +46,11 @@ Element_ACID::Element_ACID()
|
||||
|
||||
DefaultProperties.life = 75;
|
||||
|
||||
Update = &Element_ACID::update;
|
||||
Graphics = &Element_ACID::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_ACID static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_ACID::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, trade;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
@ -125,9 +127,7 @@ int Element_ACID::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_ACID static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_ACID::graphics(GRAPHICS_FUNC_ARGS)
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
int s = cpart->life;
|
||||
if (s>75) s = 75; //These two should not be here.
|
||||
@ -140,5 +140,3 @@ int Element_ACID::graphics(GRAPHICS_FUNC_ARGS)
|
||||
*pixel_mode |= PMODE_BLUR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Element_ACID::~Element_ACID() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_AMTR PT_AMTR 72
|
||||
Element_AMTR::Element_AMTR()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_AMTR()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_AMTR";
|
||||
Name = "AMTR";
|
||||
@ -40,12 +43,11 @@ Element_AMTR::Element_AMTR()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_AMTR::update;
|
||||
Graphics = &Element_AMTR::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_AMTR static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_AMTR::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, rt;
|
||||
for (rx=-1; rx<2; rx++)
|
||||
@ -74,13 +76,9 @@ int Element_AMTR::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_AMTR static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_AMTR::graphics(GRAPHICS_FUNC_ARGS)
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
// don't render AMTR as a gas
|
||||
// this function just overrides the default graphics
|
||||
return 1;
|
||||
}
|
||||
|
||||
Element_AMTR::~Element_AMTR() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_ANAR PT_ANAR 113
|
||||
Element_ANAR::Element_ANAR()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_ANAR()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_ANAR";
|
||||
Name = "ANAR";
|
||||
@ -41,11 +43,10 @@ Element_ANAR::Element_ANAR()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_ANAR::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_ANAR static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_ANAR::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
|
||||
@ -68,6 +69,3 @@ int Element_ANAR::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_ANAR::~Element_ANAR() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_ARAY PT_ARAY 126
|
||||
Element_ARAY::Element_ARAY()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_ARAY()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_ARAY";
|
||||
Name = "ARAY";
|
||||
@ -40,11 +42,10 @@ Element_ARAY::Element_ARAY()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_ARAY::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_ARAY static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_ARAY::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
if (!parts[i].life)
|
||||
{
|
||||
@ -122,7 +123,8 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
if (parts[r].tmp != 6)
|
||||
{
|
||||
colored = Element_FILT::interactWavelengths(&parts[r], colored);
|
||||
int Element_FILT_interactWavelengths(Particle* cpart, int origWl);
|
||||
colored = Element_FILT_interactWavelengths(&parts[r], colored);
|
||||
if (!colored)
|
||||
break;
|
||||
}
|
||||
@ -206,6 +208,3 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_ARAY::~Element_ARAY() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BANG PT_BANG 139
|
||||
Element_BANG::Element_BANG()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BANG()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BANG";
|
||||
Name = "TNT";
|
||||
@ -40,11 +42,10 @@ Element_BANG::Element_BANG()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_BANG::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_BANG static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_BANG::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
if(parts[i].tmp==0)
|
||||
@ -119,6 +120,3 @@ int Element_BANG::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_BANG::~Element_BANG() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BCLN PT_BCLN 93
|
||||
Element_BCLN::Element_BCLN()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BCLN()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BCLN";
|
||||
Name = "BCLN";
|
||||
@ -40,14 +42,13 @@ Element_BCLN::Element_BCLN()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_BCLN::update;
|
||||
Update = &update;
|
||||
CtypeDraw = &Element::ctypeDrawVInTmp;
|
||||
}
|
||||
|
||||
#define ADVECTION 0.1f
|
||||
constexpr float ADVECTION = 0.1f;
|
||||
|
||||
//#TPT-Directive ElementHeader Element_BCLN static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_BCLN::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
if (!parts[i].life && sim->pv[y/CELL][x/CELL]>4.0f)
|
||||
parts[i].life = RNG::Ref().between(80, 119);
|
||||
@ -95,6 +96,3 @@ int Element_BCLN::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_BCLN::~Element_BCLN() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BCOL PT_BCOL 73
|
||||
Element_BCOL::Element_BCOL()
|
||||
|
||||
int Element_COAL_update(UPDATE_FUNC_ARGS);
|
||||
int Element_COAL_graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BCOL()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BCOL";
|
||||
Name = "BCOL";
|
||||
@ -43,8 +46,6 @@ Element_BCOL::Element_BCOL()
|
||||
|
||||
DefaultProperties.life = 110;
|
||||
|
||||
Update = &Element_COAL::update;
|
||||
Graphics = &Element_COAL::graphics;
|
||||
Update = &Element_COAL_update;
|
||||
Graphics = &Element_COAL_graphics;
|
||||
}
|
||||
|
||||
Element_BCOL::~Element_BCOL() {}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BGLA PT_BGLA 47
|
||||
Element_BGLA::Element_BGLA()
|
||||
|
||||
void Element::Element_BGLA()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BGLA";
|
||||
Name = "BGLA";
|
||||
@ -39,8 +39,4 @@ Element_BGLA::Element_BGLA()
|
||||
LowTemperatureTransition = NT;
|
||||
HighTemperature = 1973.0f;
|
||||
HighTemperatureTransition = PT_LAVA;
|
||||
|
||||
Update = NULL;
|
||||
}
|
||||
|
||||
Element_BGLA::~Element_BGLA() {}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BHOL PT_BHOL 39
|
||||
Element_BHOL::Element_BHOL()
|
||||
|
||||
void Element::Element_BHOL()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BHOL";
|
||||
Name = "VACU";
|
||||
@ -40,8 +40,4 @@ Element_BHOL::Element_BHOL()
|
||||
LowTemperatureTransition = NT;
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = NULL;
|
||||
}
|
||||
|
||||
Element_BHOL::~Element_BHOL() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BIZR PT_BIZR 103
|
||||
Element_BIZR::Element_BIZR()
|
||||
|
||||
int Element_BIZR_update(UPDATE_FUNC_ARGS);
|
||||
int Element_BIZR_graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BIZR()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BIZR";
|
||||
Name = "BIZR";
|
||||
@ -42,14 +45,13 @@ Element_BIZR::Element_BIZR()
|
||||
|
||||
DefaultProperties.ctype = 0x47FFFF;
|
||||
|
||||
Update = &Element_BIZR::update;
|
||||
Graphics = &Element_BIZR::graphics;
|
||||
Update = &Element_BIZR_update;
|
||||
Graphics = &Element_BIZR_graphics;
|
||||
}
|
||||
|
||||
#define BLEND 0.95f
|
||||
constexpr float BLEND = 0.95f;
|
||||
|
||||
//#TPT-Directive ElementHeader Element_BIZR static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_BIZR::update(UPDATE_FUNC_ARGS)
|
||||
int Element_BIZR_update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, nr, ng, nb, na;
|
||||
float tr, tg, tb, ta, mr, mg, mb, ma;
|
||||
@ -85,9 +87,7 @@ int Element_BIZR::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_BIZR static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_BIZR::graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_BIZR_graphics(GRAPHICS_FUNC_ARGS)
|
||||
//BIZR, BIZRG, BIZRS
|
||||
{
|
||||
int x = 0;
|
||||
@ -121,6 +121,3 @@ int Element_BIZR::graphics(GRAPHICS_FUNC_ARGS)
|
||||
*pixel_mode |= PMODE_BLUR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_BIZR::~Element_BIZR() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BIZRG PT_BIZRG 104
|
||||
Element_BIZRG::Element_BIZRG()
|
||||
|
||||
int Element_BIZR_update(UPDATE_FUNC_ARGS);
|
||||
int Element_BIZR_graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BIZRG()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BIZRG";
|
||||
Name = "BIZG";
|
||||
@ -43,8 +46,6 @@ Element_BIZRG::Element_BIZRG()
|
||||
|
||||
DefaultProperties.ctype = 0x47FFFF;
|
||||
|
||||
Update = &Element_BIZR::update;
|
||||
Graphics = &Element_BIZR::graphics;
|
||||
Update = &Element_BIZR_update;
|
||||
Graphics = &Element_BIZR_graphics;
|
||||
}
|
||||
//BIZRG update is in BIZR.cpp
|
||||
Element_BIZRG::~Element_BIZRG() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BIZRS PT_BIZRS 105
|
||||
Element_BIZRS::Element_BIZRS()
|
||||
|
||||
int Element_BIZR_update(UPDATE_FUNC_ARGS);
|
||||
int Element_BIZR_graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BIZRS()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BIZRS";
|
||||
Name = "BIZS";
|
||||
@ -43,8 +46,6 @@ Element_BIZRS::Element_BIZRS()
|
||||
|
||||
DefaultProperties.ctype = 0x47FFFF;
|
||||
|
||||
Update = &Element_BIZR::update;
|
||||
Graphics = &Element_BIZR::graphics;
|
||||
Update = &Element_BIZR_update;
|
||||
Graphics = &Element_BIZR_graphics;
|
||||
}
|
||||
//BIZRS update is in BIZR.cpp
|
||||
Element_BIZRS::~Element_BIZRS() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BMTL PT_BMTL 29
|
||||
Element_BMTL::Element_BMTL()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BMTL()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BMTL";
|
||||
Name = "BMTL";
|
||||
@ -40,11 +42,10 @@ Element_BMTL::Element_BMTL()
|
||||
HighTemperature = 1273.0f;
|
||||
HighTemperatureTransition = PT_LAVA;
|
||||
|
||||
Update = &Element_BMTL::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_BMTL static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_BMTL::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
if (parts[i].tmp>1)
|
||||
@ -71,6 +72,3 @@ int Element_BMTL::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_BMTL::~Element_BMTL() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BOMB PT_BOMB 129
|
||||
Element_BOMB::Element_BOMB()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BOMB()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BOMB";
|
||||
Name = "BOMB";
|
||||
@ -41,12 +44,11 @@ Element_BOMB::Element_BOMB()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_BOMB::update;
|
||||
Graphics = &Element_BOMB::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_BOMB static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_BOMB::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, rt, nb;
|
||||
|
||||
@ -108,14 +110,8 @@ int Element_BOMB::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_BOMB static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_BOMB::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
*pixel_mode |= PMODE_FLARE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Element_BOMB::~Element_BOMB() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BOYL PT_BOYL 141
|
||||
Element_BOYL::Element_BOYL()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BOYL()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BOYL";
|
||||
Name = "BOYL";
|
||||
@ -41,11 +43,10 @@ Element_BOYL::Element_BOYL()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_BOYL::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_BOYL static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_BOYL::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
float limit = parts[i].temp / 100;
|
||||
@ -85,6 +86,3 @@ int Element_BOYL::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_BOYL::~Element_BOYL() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BRAY PT_BRAY 127
|
||||
Element_BRAY::Element_BRAY()
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BRAY()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BRAY";
|
||||
Name = "BRAY";
|
||||
@ -42,13 +44,10 @@ Element_BRAY::Element_BRAY()
|
||||
|
||||
DefaultProperties.life = 30;
|
||||
|
||||
Update = NULL;
|
||||
Graphics = &Element_BRAY::graphics;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_BRAY static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_BRAY::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
int x, trans = 255;
|
||||
if(cpart->tmp==0)
|
||||
@ -104,6 +103,3 @@ int Element_BRAY::graphics(GRAPHICS_FUNC_ARGS)
|
||||
*pixel_mode |= PMODE_BLEND | PMODE_GLOW;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_BRAY::~Element_BRAY() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BRCK PT_BRCK 67
|
||||
Element_BRCK::Element_BRCK()
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BRCK()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BRCK";
|
||||
Name = "BRCK";
|
||||
@ -40,12 +42,10 @@ Element_BRCK::Element_BRCK()
|
||||
HighTemperature = 1223.0f;
|
||||
HighTemperatureTransition = PT_LAVA;
|
||||
|
||||
Update = NULL;
|
||||
Graphics = &Element_BRCK::graphics;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_BRCK static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_BRCK::graphics(GRAPHICS_FUNC_ARGS)
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
if (cpart->tmp == 1)
|
||||
{
|
||||
@ -59,5 +59,3 @@ int Element_BRCK::graphics(GRAPHICS_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Element_BRCK::~Element_BRCK() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BREC PT_BREC 135
|
||||
Element_BREC::Element_BREC()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BREC()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BREC";
|
||||
Name = "BREL";
|
||||
@ -40,11 +42,10 @@ Element_BREC::Element_BREC()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_BREC::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_BREC static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_BREC::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
if (parts[i].life)
|
||||
{
|
||||
@ -61,5 +62,3 @@ int Element_BREC::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Element_BREC::~Element_BREC() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BRMT PT_BRMT 30
|
||||
Element_BRMT::Element_BRMT()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BRMT()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BRMT";
|
||||
Name = "BRMT";
|
||||
@ -40,11 +42,10 @@ Element_BRMT::Element_BRMT()
|
||||
HighTemperature = 1273.0f;
|
||||
HighTemperatureTransition = ST;
|
||||
|
||||
Update = &Element_BRMT::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_BRMT static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_BRMT::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, tempFactor;
|
||||
if (parts[i].temp > 523.15f)//250.0f+273.15f
|
||||
@ -72,6 +73,3 @@ int Element_BRMT::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_BRMT::~Element_BRMT() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BTRY PT_BTRY 53
|
||||
Element_BTRY::Element_BTRY()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BTRY()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BTRY";
|
||||
Name = "BTRY";
|
||||
@ -40,11 +42,10 @@ Element_BTRY::Element_BTRY()
|
||||
HighTemperature = 2273.0f;
|
||||
HighTemperatureTransition = PT_PLSM;
|
||||
|
||||
Update = &Element_BTRY::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_BTRY static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_BTRY::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, rt;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
@ -67,6 +68,3 @@ int Element_BTRY::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_BTRY::~Element_BTRY() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_BVBR PT_BVBR 166
|
||||
Element_BVBR::Element_BVBR()
|
||||
|
||||
int Element_VIBR_update(UPDATE_FUNC_ARGS);
|
||||
int Element_VIBR_graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_BVBR()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_BVBR";
|
||||
Name = "BVBR";
|
||||
@ -41,8 +44,6 @@ Element_BVBR::Element_BVBR()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_VIBR::update;
|
||||
Graphics = &Element_VIBR::graphics;
|
||||
Update = &Element_VIBR_update;
|
||||
Graphics = &Element_VIBR_graphics;
|
||||
}
|
||||
|
||||
Element_BVBR::~Element_BVBR() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_C5 PT_C5 130
|
||||
Element_C5::Element_C5()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_C5()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_C5";
|
||||
Name = "C-5";
|
||||
@ -40,12 +43,11 @@ Element_C5::Element_C5()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_C5::update;
|
||||
Graphics = &Element_C5::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_C5 static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_C5::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
@ -89,9 +91,7 @@ int Element_C5::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_C5 static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_C5::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
if(!cpart->ctype)
|
||||
return 0;
|
||||
@ -118,5 +118,3 @@ int Element_C5::graphics(GRAPHICS_FUNC_ARGS)
|
||||
*pixel_mode |= FIRE_ADD | PMODE_ADD | NO_DECO;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Element_C5::~Element_C5() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_CAUS PT_CAUS 86
|
||||
Element_CAUS::Element_CAUS()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_CAUS()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_CAUS";
|
||||
Name = "CAUS";
|
||||
@ -42,11 +44,10 @@ Element_CAUS::Element_CAUS()
|
||||
|
||||
DefaultProperties.life = 75;
|
||||
|
||||
Update = &Element_CAUS::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CAUS static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_CAUS::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
for (int rx = -2; rx <= 2; rx++)
|
||||
for (int ry = -2; ry <= 2; ry++)
|
||||
@ -87,6 +88,3 @@ int Element_CAUS::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_CAUS::~Element_CAUS() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_CBNW PT_CBNW 82
|
||||
Element_CBNW::Element_CBNW()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_CBNW()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_CBNW";
|
||||
Name = "BUBW";
|
||||
@ -41,12 +44,11 @@ Element_CBNW::Element_CBNW()
|
||||
HighTemperature = 373.0f;
|
||||
HighTemperatureTransition = PT_WTRV;
|
||||
|
||||
Update = &Element_CBNW::update;
|
||||
Graphics = &Element_CBNW::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CBNW static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_CBNW::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
if (sim->pv[y/CELL][x/CELL]<=3)
|
||||
@ -134,10 +136,7 @@ int Element_CBNW::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CBNW static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_CBNW::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
int z = cpart->tmp2 - 20;//speckles!
|
||||
*colr += z * 1;
|
||||
@ -145,6 +144,3 @@ int Element_CBNW::graphics(GRAPHICS_FUNC_ARGS)
|
||||
*colb += z * 8;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_CBNW::~Element_CBNW() {}
|
||||
|
@ -1,8 +1,10 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
#include "hmap.h"
|
||||
|
||||
//#TPT-Directive ElementClass Element_CFLM PT_CFLM 68
|
||||
Element_CFLM::Element_CFLM()
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_CFLM()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_HFLM";
|
||||
Name = "CFLM";
|
||||
@ -43,14 +45,11 @@ Element_CFLM::Element_CFLM()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = NULL;
|
||||
Graphics = &Element_CFLM::graphics;
|
||||
Create = &Element_CFLM::create;
|
||||
Graphics = &graphics;
|
||||
Create = &create;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CFLM static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_CFLM::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
int caddress = restrict_flt(restrict_flt((float)((int)(cpart->life/2)), 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
|
||||
*colr = hflm_data[caddress];
|
||||
@ -68,10 +67,7 @@ int Element_CFLM::graphics(GRAPHICS_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CFLM static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
void Element_CFLM::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
{
|
||||
sim->parts[i].life = RNG::Ref().between(50, 199);
|
||||
}
|
||||
|
||||
Element_CFLM::~Element_CFLM() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_CLNE PT_CLNE 9
|
||||
Element_CLNE::Element_CLNE()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_CLNE()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_CLNE";
|
||||
Name = "CLNE";
|
||||
@ -40,12 +42,11 @@ Element_CLNE::Element_CLNE()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_CLNE::update;
|
||||
Update = &update;
|
||||
CtypeDraw = &Element::ctypeDrawVInTmp;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CLNE static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_CLNE::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !sim->elements[parts[i].ctype].Enabled || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOL)))
|
||||
{
|
||||
@ -86,5 +87,3 @@ int Element_CLNE::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Element_CLNE::~Element_CLNE() {}
|
||||
|
@ -1,6 +1,10 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_CLST PT_CLST 155
|
||||
Element_CLST::Element_CLST()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_CLST()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_CLST";
|
||||
Name = "CLST";
|
||||
@ -40,13 +44,12 @@ Element_CLST::Element_CLST()
|
||||
HighTemperature = 1256.0f;
|
||||
HighTemperatureTransition = PT_LAVA;
|
||||
|
||||
Update = &Element_CLST::update;
|
||||
Graphics = &Element_CLST::graphics;
|
||||
Create = &Element_CLST::create;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
Create = &create;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CLST static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_CLST::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
float cxy = 0;
|
||||
@ -87,10 +90,7 @@ int Element_CLST::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CLST static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_CLST::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
int z = (cpart->tmp - 5) * 16;//speckles!
|
||||
*colr += z;
|
||||
@ -99,10 +99,7 @@ int Element_CLST::graphics(GRAPHICS_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CLST static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
void Element_CLST::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
{
|
||||
sim->parts[i].tmp = RNG::Ref().between(0, 6);
|
||||
}
|
||||
|
||||
Element_CLST::~Element_CLST() {}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_CNCT PT_CNCT 24
|
||||
Element_CNCT::Element_CNCT()
|
||||
|
||||
void Element::Element_CNCT()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_CNCT";
|
||||
Name = "CNCT";
|
||||
@ -39,8 +39,4 @@ Element_CNCT::Element_CNCT()
|
||||
LowTemperatureTransition = NT;
|
||||
HighTemperature = 1123.0f;
|
||||
HighTemperatureTransition = PT_LAVA;
|
||||
|
||||
Update = NULL;
|
||||
}
|
||||
|
||||
Element_CNCT::~Element_CNCT() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_CO2 PT_CO2 80
|
||||
Element_CO2::Element_CO2()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_CO2()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_CO2";
|
||||
Name = "CO2";
|
||||
@ -40,11 +42,10 @@ Element_CO2::Element_CO2()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_CO2::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CO2 static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_CO2::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
for (rx=-1; rx<2; rx++)
|
||||
@ -106,6 +107,3 @@ int Element_CO2::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_CO2::~Element_CO2() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_COAL PT_COAL 59
|
||||
Element_COAL::Element_COAL()
|
||||
|
||||
int Element_COAL_update(UPDATE_FUNC_ARGS);
|
||||
int Element_COAL_graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_COAL()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_COAL";
|
||||
Name = "COAL";
|
||||
@ -44,12 +47,11 @@ Element_COAL::Element_COAL()
|
||||
DefaultProperties.life = 110;
|
||||
DefaultProperties.tmp = 50;
|
||||
|
||||
Update = &Element_COAL::update;
|
||||
Graphics = &Element_COAL::graphics;
|
||||
Update = &Element_COAL_update;
|
||||
Graphics = &Element_COAL_graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_COAL static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_COAL::update(UPDATE_FUNC_ARGS)
|
||||
int Element_COAL_update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
if (parts[i].life<=0) {
|
||||
sim->create_part(i, x, y, PT_FIRE);
|
||||
@ -74,10 +76,9 @@ int Element_COAL::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define FREQUENCY 3.1415/(2*300.0f-(300.0f-200.0f))
|
||||
constexpr float FREQUENCY = 3.1415/(2*300.0f-(300.0f-200.0f));
|
||||
|
||||
//#TPT-Directive ElementHeader Element_COAL static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_COAL::graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_COAL_graphics(GRAPHICS_FUNC_ARGS)
|
||||
//Both COAL and Broken Coal
|
||||
{
|
||||
*colr += (cpart->tmp2-295.15f)/3;
|
||||
@ -101,7 +102,3 @@ int Element_COAL::graphics(GRAPHICS_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Element_COAL::~Element_COAL() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_CONV PT_CONV 85
|
||||
Element_CONV::Element_CONV()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_CONV()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_CONV";
|
||||
Name = "CONV";
|
||||
@ -40,12 +42,11 @@ Element_CONV::Element_CONV()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_CONV::update;
|
||||
Update = &update;
|
||||
CtypeDraw = &Element::ctypeDrawVInCtype;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CONV static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_CONV::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
int ctype = TYP(parts[i].ctype), ctypeExtra = ID(parts[i].ctype);
|
||||
@ -92,5 +93,3 @@ int Element_CONV::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Element_CONV::~Element_CONV() {}
|
||||
|
@ -1,6 +1,10 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_CRAY PT_CRAY 167
|
||||
Element_CRAY::Element_CRAY()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static bool ctypeDraw(CTYPEDRAW_FUNC_ARGS);
|
||||
static unsigned int wavelengthToDecoColour(int wavelength);
|
||||
|
||||
void Element::Element_CRAY()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_CRAY";
|
||||
Name = "CRAY";
|
||||
@ -40,12 +44,11 @@ Element_CRAY::Element_CRAY()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_CRAY::update;
|
||||
CtypeDraw = &Element_CRAY::ctypeDraw;
|
||||
Update = &update;
|
||||
CtypeDraw = &ctypeDraw;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CRAY static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_CRAY::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int nxx, nyy, docontinue, nxi, nyi;
|
||||
// set ctype to things that touch it if it doesn't have one already
|
||||
@ -107,7 +110,8 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
|
||||
colored = 0xFF000000;
|
||||
else if (parts[ID(r)].tmp==0)
|
||||
{
|
||||
colored = wavelengthToDecoColour(Element_FILT::getWavelengths(&parts[ID(r)]));
|
||||
int Element_FILT_getWavelengths(Particle* cpart);
|
||||
colored = wavelengthToDecoColour(Element_FILT_getWavelengths(&parts[ID(r)]));
|
||||
}
|
||||
else if (colored==0xFF000000)
|
||||
colored = 0;
|
||||
@ -129,8 +133,8 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//#TPT-Directive ElementHeader Element_CRAY static unsigned int wavelengthToDecoColour(int wavelength)
|
||||
unsigned int Element_CRAY::wavelengthToDecoColour(int wavelength)
|
||||
|
||||
static unsigned int wavelengthToDecoColour(int wavelength)
|
||||
{
|
||||
int colr = 0, colg = 0, colb = 0, x;
|
||||
for (x=0; x<12; x++) {
|
||||
@ -154,8 +158,7 @@ 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)
|
||||
static bool ctypeDraw(CTYPEDRAW_FUNC_ARGS)
|
||||
{
|
||||
if (!Element::ctypeDrawVInCtype(CTYPEDRAW_FUNC_SUBCALL_ARGS))
|
||||
{
|
||||
@ -168,5 +171,3 @@ bool Element_CRAY::ctypeDraw(CTYPEDRAW_FUNC_ARGS)
|
||||
sim->parts[i].temp = sim->elements[t].DefaultProperties.temp;
|
||||
return true;
|
||||
}
|
||||
|
||||
Element_CRAY::~Element_CRAY() {}
|
||||
|
@ -1,6 +1,10 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_CRMC PT_CRMC 179
|
||||
Element_CRMC::Element_CRMC()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_CRMC()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_CRMC";
|
||||
Name = "CRMC";
|
||||
@ -40,21 +44,19 @@ Element_CRMC::Element_CRMC()
|
||||
HighTemperature = 2887.15f;
|
||||
HighTemperatureTransition = ST;
|
||||
|
||||
Update = &Element_CRMC::update;
|
||||
Graphics = &Element_CRMC::graphics;
|
||||
Create = &Element_CRMC::create;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
Create = &create;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CRMC static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_CRMC::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
if (sim->pv[y/CELL][x/CELL] < -30.0f)
|
||||
sim->create_part(i, x, y, PT_CLST);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CRMC static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_CRMC::graphics(GRAPHICS_FUNC_ARGS)
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
int z = (cpart->tmp2 - 2) * 8;
|
||||
*colr += z;
|
||||
@ -63,11 +65,7 @@ int Element_CRMC::graphics(GRAPHICS_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CRMC static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
void Element_CRMC::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
{
|
||||
sim->parts[i].tmp2 = RNG::Ref().between(0, 4);
|
||||
}
|
||||
|
||||
Element_CRMC::~Element_CRMC() {}
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_DCEL PT_DCEL 138
|
||||
Element_DCEL::Element_DCEL()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_DCEL()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_DCEL";
|
||||
Name = "DCEL";
|
||||
@ -40,12 +43,11 @@ Element_DCEL::Element_DCEL()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_DCEL::update;
|
||||
Graphics = &Element_DCEL::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_DCEL static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_DCEL::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
float multiplier = 1.0f/1.1f;
|
||||
@ -73,16 +75,9 @@ int Element_DCEL::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_DCEL static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_DCEL::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
if(cpart->tmp)
|
||||
*pixel_mode |= PMODE_GLOW;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_DCEL::~Element_DCEL() {}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_DESL PT_DESL 58
|
||||
Element_DESL::Element_DESL()
|
||||
|
||||
void Element::Element_DESL()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_DESL";
|
||||
Name = "DESL";
|
||||
@ -39,8 +39,4 @@ Element_DESL::Element_DESL()
|
||||
LowTemperatureTransition = NT;
|
||||
HighTemperature = 335.0f;
|
||||
HighTemperatureTransition = PT_FIRE;
|
||||
|
||||
Update = NULL;
|
||||
}
|
||||
|
||||
Element_DESL::~Element_DESL() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_DEST PT_DEST 89
|
||||
Element_DEST::Element_DEST()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_DEST()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_DEST";
|
||||
Name = "DEST";
|
||||
@ -40,12 +43,11 @@ Element_DEST::Element_DEST()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_DEST::update;
|
||||
Graphics = &Element_DEST::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_DEST static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_DEST::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int rx = RNG::Ref().between(-2, 2);
|
||||
int ry = RNG::Ref().between(-2, 2);
|
||||
@ -90,10 +92,7 @@ int Element_DEST::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_DEST static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_DEST::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
if(cpart->life)
|
||||
{
|
||||
@ -105,6 +104,3 @@ int Element_DEST::graphics(GRAPHICS_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_DEST::~Element_DEST() {}
|
||||
|
@ -1,7 +1,10 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
#include "common/tpt-minmax.h"
|
||||
//#TPT-Directive ElementClass Element_DEUT PT_DEUT 95
|
||||
Element_DEUT::Element_DEUT()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_DEUT()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_DEUT";
|
||||
Name = "DEUT";
|
||||
@ -44,12 +47,11 @@ Element_DEUT::Element_DEUT()
|
||||
|
||||
DefaultProperties.life = 10;
|
||||
|
||||
Update = &Element_DEUT::update;
|
||||
Graphics = &Element_DEUT::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_DEUT static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_DEUT::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, trade, np;
|
||||
float gravtot = fabs(sim->gravy[(y/CELL)*(XRES/CELL)+(x/CELL)])+fabs(sim->gravx[(y/CELL)*(XRES/CELL)+(x/CELL)]);
|
||||
@ -129,11 +131,7 @@ trade:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_DEUT static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_DEUT::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
if(cpart->life>=240)
|
||||
{
|
||||
@ -156,6 +154,3 @@ int Element_DEUT::graphics(GRAPHICS_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_DEUT::~Element_DEUT() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_DLAY PT_DLAY 79
|
||||
Element_DLAY::Element_DLAY()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_DLAY()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_DLAY";
|
||||
Name = "DLAY";
|
||||
@ -41,12 +44,11 @@ Element_DLAY::Element_DLAY()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_DLAY::update;
|
||||
Graphics = &Element_DLAY::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_DLAY static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_DLAY::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, oldl;
|
||||
oldl = parts[i].life;
|
||||
@ -92,10 +94,7 @@ int Element_DLAY::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_DLAY static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_DLAY::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
int stage = (int)(((float)cpart->life/(cpart->temp-273.15))*100.0f);
|
||||
*colr += stage;
|
||||
@ -103,6 +102,3 @@ int Element_DLAY::graphics(GRAPHICS_FUNC_ARGS)
|
||||
*colb += stage;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_DLAY::~Element_DLAY() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_DMG PT_DMG 163
|
||||
Element_DMG::Element_DMG()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_DMG()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_DMG";
|
||||
Name = "DMG";
|
||||
@ -41,12 +44,11 @@ Element_DMG::Element_DMG()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_DMG::update;
|
||||
Graphics = &Element_DMG::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_DMG static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_DMG::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rr, rx, ry, nxi, nxj, t, dist;
|
||||
int rad = 25;
|
||||
@ -107,14 +109,8 @@ int Element_DMG::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_DMG static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_DMG::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
*pixel_mode |= PMODE_FLARE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Element_DMG::~Element_DMG() {}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_DMND PT_DMND 28
|
||||
Element_DMND::Element_DMND()
|
||||
|
||||
void Element::Element_DMND()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_DMND";
|
||||
Name = "DMND";
|
||||
@ -39,8 +39,4 @@ Element_DMND::Element_DMND()
|
||||
LowTemperatureTransition = NT;
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = NULL;
|
||||
}
|
||||
|
||||
Element_DMND::~Element_DMND() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_DRAY PT_DRAY 178
|
||||
Element_DRAY::Element_DRAY()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_DRAY()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_DRAY";
|
||||
Name = "DRAY";
|
||||
@ -40,19 +42,18 @@ Element_DRAY::Element_DRAY()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_DRAY::update;
|
||||
Graphics = nullptr;
|
||||
Update = &update;
|
||||
Graphics = nullptr; // is this needed?
|
||||
CtypeDraw = &Element::ctypeDrawVInCtype;
|
||||
}
|
||||
|
||||
//should probably be in Simulation.h
|
||||
bool InBounds(int x, int y)
|
||||
static bool InBounds(int x, int y)
|
||||
{
|
||||
return (x>=0 && y>=0 && x<XRES && y<YRES);
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_DRAY static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_DRAY::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int ctype = TYP(parts[i].ctype), ctypeExtra = ID(parts[i].ctype), copyLength = parts[i].tmp, copySpaces = parts[i].tmp2;
|
||||
if (copySpaces < 0)
|
||||
@ -167,5 +168,3 @@ int Element_DRAY::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Element_DRAY::~Element_DRAY() {}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_DRIC PT_DRIC 81
|
||||
Element_DRIC::Element_DRIC()
|
||||
|
||||
void Element::Element_DRIC()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_DRIC";
|
||||
Name = "DRIC";
|
||||
@ -40,8 +40,4 @@ Element_DRIC::Element_DRIC()
|
||||
LowTemperatureTransition = NT;
|
||||
HighTemperature = 195.65f;
|
||||
HighTemperatureTransition = PT_CO2;
|
||||
|
||||
Update = NULL;
|
||||
}
|
||||
|
||||
Element_DRIC::~Element_DRIC() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_DSTW PT_DSTW 25
|
||||
Element_DSTW::Element_DSTW()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_DSTW()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_DSTW";
|
||||
Name = "DSTW";
|
||||
@ -41,11 +43,10 @@ Element_DSTW::Element_DSTW()
|
||||
HighTemperature = 373.0f;
|
||||
HighTemperatureTransition = PT_WTRV;
|
||||
|
||||
Update = &Element_DSTW::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_DSTW static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_DSTW::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
for (rx=-1; rx<2; rx++)
|
||||
@ -98,6 +99,3 @@ int Element_DSTW::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_DSTW::~Element_DSTW() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_DTEC PT_DTEC 162
|
||||
Element_DTEC::Element_DTEC()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_DTEC()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_DTEC";
|
||||
Name = "DTEC";
|
||||
@ -42,12 +44,11 @@ Element_DTEC::Element_DTEC()
|
||||
|
||||
DefaultProperties.tmp2 = 2;
|
||||
|
||||
Update = &Element_DTEC::update;
|
||||
Update = &update;
|
||||
CtypeDraw = &Element::ctypeDrawVInTmp;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_DTEC static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_DTEC::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, rt, rd = parts[i].tmp2;
|
||||
if (rd > 25) parts[i].tmp2 = rd = 25;
|
||||
@ -117,7 +118,3 @@ int Element_DTEC::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Element_DTEC::~Element_DTEC() {}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_DUST PT_DUST 1
|
||||
Element_DUST::Element_DUST()
|
||||
|
||||
void Element::Element_DUST()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_DUST";
|
||||
Name = "DUST";
|
||||
@ -41,8 +41,5 @@ Element_DUST::Element_DUST()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = NULL;
|
||||
Graphics = NULL;
|
||||
Graphics = NULL; // it this needed?
|
||||
}
|
||||
|
||||
Element_DUST::~Element_DUST() {}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_DYST PT_DYST 64
|
||||
Element_DYST::Element_DYST()
|
||||
|
||||
void Element::Element_DYST()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_DYST";
|
||||
Name = "DYST";
|
||||
@ -39,8 +39,4 @@ Element_DYST::Element_DYST()
|
||||
LowTemperatureTransition = NT;
|
||||
HighTemperature = 473.0f;
|
||||
HighTemperatureTransition = PT_DUST;
|
||||
|
||||
Update = NULL;
|
||||
}
|
||||
|
||||
Element_DYST::~Element_DYST() {}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_116 PT_116 116
|
||||
Element_116::Element_116()
|
||||
|
||||
void Element::Element_E116()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_116";
|
||||
Name = "EQVE";
|
||||
@ -39,8 +39,4 @@ Element_116::Element_116()
|
||||
LowTemperatureTransition = NT;
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = NULL;
|
||||
}
|
||||
|
||||
Element_116::~Element_116() {}
|
@ -1,6 +1,6 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_146 PT_146 146
|
||||
Element_146::Element_146()
|
||||
|
||||
void Element::Element_E146()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_146";
|
||||
Name = "BRAN";
|
||||
@ -40,8 +40,4 @@ Element_146::Element_146()
|
||||
LowTemperatureTransition = NT;
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = NULL;
|
||||
}
|
||||
|
||||
Element_146::~Element_146() {}
|
@ -1,6 +1,10 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_ELEC PT_ELEC 136
|
||||
Element_ELEC::Element_ELEC()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_ELEC()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_ELEC";
|
||||
Name = "ELEC";
|
||||
@ -41,13 +45,12 @@ Element_ELEC::Element_ELEC()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_ELEC::update;
|
||||
Graphics = &Element_ELEC::graphics;
|
||||
Create = &Element_ELEC::create;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
Create = &create;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_ELEC static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_ELEC::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rt, rx, ry, nb, rrx, rry;
|
||||
for (rx=-2; rx<=2; rx++)
|
||||
@ -123,9 +126,7 @@ int Element_ELEC::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_ELEC static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_ELEC::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
*firea = 70;
|
||||
*firer = *colr;
|
||||
@ -136,13 +137,10 @@ int Element_ELEC::graphics(GRAPHICS_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_ELEC static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
void Element_ELEC::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
{
|
||||
float a = RNG::Ref().between(0, 359) * 3.14159f / 180.0f;
|
||||
sim->parts[i].life = 680;
|
||||
sim->parts[i].vx = 2.0f * cosf(a);
|
||||
sim->parts[i].vy = 2.0f * sinf(a);
|
||||
}
|
||||
|
||||
Element_ELEC::~Element_ELEC() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_EMBR PT_EMBR 147
|
||||
Element_EMBR::Element_EMBR()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_EMBR()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_EMBR";
|
||||
Name = "EMBR";
|
||||
@ -43,12 +46,12 @@ Element_EMBR::Element_EMBR()
|
||||
|
||||
DefaultProperties.life = 50;
|
||||
|
||||
Update = &Element_EMBR::update;
|
||||
Graphics = &Element_EMBR::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_EMBR static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_EMBR::update(UPDATE_FUNC_ARGS) {
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
@ -66,8 +69,7 @@ int Element_EMBR::update(UPDATE_FUNC_ARGS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_EMBR static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_EMBR::graphics(GRAPHICS_FUNC_ARGS)
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
if (cpart->ctype&0xFFFFFF)
|
||||
{
|
||||
@ -120,5 +122,3 @@ int Element_EMBR::graphics(GRAPHICS_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Element_EMBR::~Element_EMBR() {}
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
#include "Probability.h"
|
||||
|
||||
//#TPT-Directive ElementClass Element_EMP PT_EMP 134
|
||||
Element_EMP::Element_EMP()
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_EMP()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_EMP";
|
||||
Name = "EMP";
|
||||
@ -42,8 +43,7 @@ Element_EMP::Element_EMP()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = NULL;
|
||||
Graphics = &Element_EMP::graphics;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
class DeltaTempGenerator
|
||||
@ -70,8 +70,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
//#TPT-Directive ElementHeader Element_EMP static int Trigger(Simulation *sim, int triggerCount)
|
||||
int Element_EMP::Trigger(Simulation *sim, int triggerCount)
|
||||
void Element_EMP_Trigger(Simulation *sim, int triggerCount)
|
||||
{
|
||||
/* Known differences from original one-particle-at-a-time version:
|
||||
* - SPRK that disappears during a frame (such as SPRK with life==0 on that frame) will not cause destruction around it.
|
||||
@ -205,13 +204,9 @@ int Element_EMP::Trigger(Simulation *sim, int triggerCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_EMP static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_EMP::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
if(cpart->life)
|
||||
{
|
||||
@ -221,6 +216,3 @@ int Element_EMP::graphics(GRAPHICS_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_EMP::~Element_EMP() {}
|
||||
|
@ -1,8 +1,10 @@
|
||||
#include <algorithm>
|
||||
#include "simulation/ElementCommon.h"
|
||||
|
||||
//#TPT-Directive ElementClass Element_ETRD PT_ETRD 50
|
||||
Element_ETRD::Element_ETRD()
|
||||
static void initDeltaPos();
|
||||
static void changeType(ELEMENT_CHANGETYPE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_ETRD()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_ETRD";
|
||||
Name = "ETRD";
|
||||
@ -42,14 +44,12 @@ Element_ETRD::Element_ETRD()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = NULL;
|
||||
ChangeType = &Element_ETRD::changeType;
|
||||
ChangeType = &changeType;
|
||||
|
||||
Element_ETRD::initDeltaPos();
|
||||
initDeltaPos();
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_ETRD static void changeType(ELEMENT_CHANGETYPE_FUNC_ARGS)
|
||||
void Element_ETRD::changeType(ELEMENT_CHANGETYPE_FUNC_ARGS)
|
||||
static void changeType(ELEMENT_CHANGETYPE_FUNC_ARGS)
|
||||
{
|
||||
if (sim->etrd_count_valid)
|
||||
{
|
||||
@ -77,13 +77,7 @@ public:
|
||||
const int maxLength = 12;
|
||||
std::vector<ETRD_deltaWithLength> deltaPos;
|
||||
|
||||
bool compareFunc(const ETRD_deltaWithLength &a, const ETRD_deltaWithLength &b)
|
||||
{
|
||||
return a.length < b.length;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_ETRD static void initDeltaPos()
|
||||
void Element_ETRD::initDeltaPos()
|
||||
static void initDeltaPos()
|
||||
{
|
||||
deltaPos.clear();
|
||||
for (int ry = -maxLength; ry <= maxLength; ry++)
|
||||
@ -93,11 +87,12 @@ void Element_ETRD::initDeltaPos()
|
||||
if (std::abs(d.X) + std::abs(d.Y) <= maxLength)
|
||||
deltaPos.push_back(ETRD_deltaWithLength(d, std::abs(d.X) + std::abs(d.Y)));
|
||||
}
|
||||
std::stable_sort(deltaPos.begin(), deltaPos.end(), compareFunc);
|
||||
std::stable_sort(deltaPos.begin(), deltaPos.end(), [](const ETRD_deltaWithLength &a, const ETRD_deltaWithLength &b) {
|
||||
return a.length < b.length;
|
||||
});
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_ETRD static int nearestSparkablePart(Simulation *sim, int targetId)
|
||||
int Element_ETRD::nearestSparkablePart(Simulation *sim, int targetId)
|
||||
int Element_ETRD_nearestSparkablePart(Simulation *sim, int targetId)
|
||||
{
|
||||
if (!sim->elementCount[PT_ETRD])
|
||||
return -1;
|
||||
@ -180,5 +175,3 @@ int Element_ETRD::nearestSparkablePart(Simulation *sim, int targetId)
|
||||
}
|
||||
return foundI;
|
||||
}
|
||||
|
||||
Element_ETRD::~Element_ETRD() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_EXOT PT_EXOT 145
|
||||
Element_EXOT::Element_EXOT()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_EXOT()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_EXOT";
|
||||
Name = "EXOT";
|
||||
@ -44,12 +47,11 @@ Element_EXOT::Element_EXOT()
|
||||
DefaultProperties.life = 1000;
|
||||
DefaultProperties.tmp = 244;
|
||||
|
||||
Update = &Element_EXOT::update;
|
||||
Graphics = &Element_EXOT::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_EXOT static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_EXOT::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rt, rx, ry, trade, tym;
|
||||
for (rx=-2; rx<=2; rx++)
|
||||
@ -178,11 +180,9 @@ int Element_EXOT::update(UPDATE_FUNC_ARGS)
|
||||
parts[i].tmp--;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_EXOT static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_EXOT::graphics(GRAPHICS_FUNC_ARGS)
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
int q = cpart->temp;
|
||||
int b = cpart->tmp;
|
||||
@ -237,5 +237,3 @@ int Element_EXOT::graphics(GRAPHICS_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Element_EXOT::~Element_EXOT() {}
|
||||
|
@ -1,6 +1,17 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_FIGH PT_FIGH 158
|
||||
Element_FIGH::Element_FIGH()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static bool createAllowed(ELEMENT_CREATE_ALLOWED_FUNC_ARGS);
|
||||
static void changeType(ELEMENT_CHANGETYPE_FUNC_ARGS);
|
||||
static void Free(Simulation *sim, unsigned char i);
|
||||
bool Element_FIGH_CanAlloc(Simulation *sim);
|
||||
int Element_FIGH_Alloc(Simulation *sim);
|
||||
void Element_FIGH_NewFighter(Simulation *sim, int fighterID, int i, int elem);
|
||||
int Element_STKM_graphics(GRAPHICS_FUNC_ARGS);
|
||||
void Element_STKM_init_legs(Simulation * sim, playerst *playerp, int i);
|
||||
int Element_STKM_run_stickman(playerst *playerp, UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_FIGH()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_FIGH";
|
||||
Name = "FIGH";
|
||||
@ -44,14 +55,13 @@ Element_FIGH::Element_FIGH()
|
||||
|
||||
DefaultProperties.life = 100;
|
||||
|
||||
Update = &Element_FIGH::update;
|
||||
Graphics = &Element_STKM::graphics;
|
||||
CreateAllowed = &Element_FIGH::createAllowed;
|
||||
ChangeType = &Element_FIGH::changeType;
|
||||
Update = &update;
|
||||
Graphics = &Element_STKM_graphics;
|
||||
CreateAllowed = &createAllowed;
|
||||
ChangeType = &changeType;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FIGH static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_FIGH::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
if (parts[i].tmp < 0 || parts[i].tmp >= MAX_FIGHTERS)
|
||||
{
|
||||
@ -141,24 +151,22 @@ int Element_FIGH::update(UPDATE_FUNC_ARGS)
|
||||
|
||||
figh->pcomm = figh->comm;
|
||||
|
||||
Element_STKM::run_stickman(figh, UPDATE_FUNC_SUBCALL_ARGS);
|
||||
Element_STKM_run_stickman(figh, UPDATE_FUNC_SUBCALL_ARGS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FIGH static bool createAllowed(ELEMENT_CREATE_ALLOWED_FUNC_ARGS)
|
||||
bool Element_FIGH::createAllowed(ELEMENT_CREATE_ALLOWED_FUNC_ARGS)
|
||||
static bool createAllowed(ELEMENT_CREATE_ALLOWED_FUNC_ARGS)
|
||||
{
|
||||
return CanAlloc(sim);
|
||||
return Element_FIGH_CanAlloc(sim);
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FIGH static void changeType(ELEMENT_CHANGETYPE_FUNC_ARGS)
|
||||
void Element_FIGH::changeType(ELEMENT_CHANGETYPE_FUNC_ARGS)
|
||||
static void changeType(ELEMENT_CHANGETYPE_FUNC_ARGS)
|
||||
{
|
||||
if (to == PT_FIGH)
|
||||
{
|
||||
sim->parts[i].tmp = Alloc(sim);
|
||||
sim->parts[i].tmp = Element_FIGH_Alloc(sim);
|
||||
if (sim->parts[i].tmp >= 0)
|
||||
NewFighter(sim, sim->parts[i].tmp, i, PT_DUST);
|
||||
Element_FIGH_NewFighter(sim, sim->parts[i].tmp, i, PT_DUST);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -166,14 +174,12 @@ void Element_FIGH::changeType(ELEMENT_CHANGETYPE_FUNC_ARGS)
|
||||
}
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FIGH static bool CanAlloc(Simulation *sim)
|
||||
bool Element_FIGH::CanAlloc(Simulation *sim)
|
||||
bool Element_FIGH_CanAlloc(Simulation *sim)
|
||||
{
|
||||
return sim->fighcount < MAX_FIGHTERS;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FIGH static int Alloc(Simulation *sim)
|
||||
int Element_FIGH::Alloc(Simulation *sim)
|
||||
int Element_FIGH_Alloc(Simulation *sim)
|
||||
{
|
||||
if (sim->fighcount >= MAX_FIGHTERS)
|
||||
return -1;
|
||||
@ -190,8 +196,7 @@ int Element_FIGH::Alloc(Simulation *sim)
|
||||
else return -1;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FIGH static void Free(Simulation *sim, unsigned char i)
|
||||
void Element_FIGH::Free(Simulation *sim, unsigned char i)
|
||||
static void Free(Simulation *sim, unsigned char i)
|
||||
{
|
||||
if (sim->fighters[i].spwn)
|
||||
{
|
||||
@ -200,13 +205,10 @@ void Element_FIGH::Free(Simulation *sim, unsigned char i)
|
||||
}
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FIGH static void NewFighter(Simulation *sim, int fighterID, int i, int elem)
|
||||
void Element_FIGH::NewFighter(Simulation *sim, int fighterID, int i, int elem)
|
||||
void Element_FIGH_NewFighter(Simulation *sim, int fighterID, int i, int elem)
|
||||
{
|
||||
Element_STKM::STKM_init_legs(sim, &sim->fighters[fighterID], i);
|
||||
Element_STKM_init_legs(sim, &sim->fighters[fighterID], i);
|
||||
if (elem >= 0 && elem < PT_NUM)
|
||||
sim->fighters[fighterID].elem = elem;
|
||||
sim->fighters[fighterID].spwn = 1;
|
||||
}
|
||||
|
||||
Element_FIGH::~Element_FIGH() {}
|
||||
|
@ -1,6 +1,11 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_FILT PT_FILT 125
|
||||
Element_FILT::Element_FILT()
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||
int Element_FILT_interactWavelengths(Particle* cpart, int origWl);
|
||||
int Element_FILT_getWavelengths(Particle* cpart);
|
||||
|
||||
void Element::Element_FILT()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_FILT";
|
||||
Name = "FILT";
|
||||
@ -40,15 +45,13 @@ Element_FILT::Element_FILT()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = NULL;
|
||||
Graphics = &Element_FILT::graphics;
|
||||
Create = &Element_FILT::create;
|
||||
Graphics = &graphics;
|
||||
Create = &create;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FILT static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_FILT::graphics(GRAPHICS_FUNC_ARGS)
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
int x, wl = Element_FILT::getWavelengths(cpart);
|
||||
int x, wl = Element_FILT_getWavelengths(cpart);
|
||||
*colg = 0;
|
||||
*colb = 0;
|
||||
*colr = 0;
|
||||
@ -71,19 +74,17 @@ int Element_FILT::graphics(GRAPHICS_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FILT static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
void Element_FILT::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
{
|
||||
sim->parts[i].tmp = v;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FILT static int interactWavelengths(Particle* cpart, int origWl)
|
||||
// Returns the wavelengths in a particle after FILT interacts with it (e.g. a photon)
|
||||
// cpart is the FILT particle, origWl the original wavelengths in the interacting particle
|
||||
int Element_FILT::interactWavelengths(Particle* cpart, int origWl)
|
||||
int Element_FILT_interactWavelengths(Particle* cpart, int origWl)
|
||||
{
|
||||
const int mask = 0x3FFFFFFF;
|
||||
int filtWl = getWavelengths(cpart);
|
||||
int filtWl = Element_FILT_getWavelengths(cpart);
|
||||
switch (cpart->tmp)
|
||||
{
|
||||
case 0:
|
||||
@ -134,8 +135,7 @@ int Element_FILT::interactWavelengths(Particle* cpart, int origWl)
|
||||
}
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FILT static int getWavelengths(Particle* cpart)
|
||||
int Element_FILT::getWavelengths(Particle* cpart)
|
||||
int Element_FILT_getWavelengths(Particle* cpart)
|
||||
{
|
||||
if (cpart->ctype&0x3FFFFFFF)
|
||||
{
|
||||
@ -149,5 +149,3 @@ int Element_FILT::getWavelengths(Particle* cpart)
|
||||
return (0x1F << temp_bin);
|
||||
}
|
||||
}
|
||||
|
||||
Element_FILT::~Element_FILT() {}
|
||||
|
@ -1,8 +1,12 @@
|
||||
#include "common/tpt-minmax.h"
|
||||
#include "simulation/ElementCommon.h"
|
||||
|
||||
//#TPT-Directive ElementClass Element_FIRE PT_FIRE 4
|
||||
Element_FIRE::Element_FIRE()
|
||||
int Element_FIRE_update(UPDATE_FUNC_ARGS);
|
||||
static int updateLegacy(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_FIRE()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_FIRE";
|
||||
Name = "FIRE";
|
||||
@ -43,13 +47,12 @@ Element_FIRE::Element_FIRE()
|
||||
HighTemperature = 2773.0f;
|
||||
HighTemperatureTransition = PT_PLSM;
|
||||
|
||||
Update = &Element_FIRE::update;
|
||||
Graphics = &Element_FIRE::graphics;
|
||||
Create = &Element_FIRE::create;
|
||||
Update = &Element_FIRE_update;
|
||||
Graphics = &graphics;
|
||||
Create = &create;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FIRE static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_FIRE::update(UPDATE_FUNC_ARGS)
|
||||
int Element_FIRE_update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, rt, t = parts[i].type;
|
||||
switch (t)
|
||||
@ -173,8 +176,8 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FIRE static int updateLegacy(UPDATE_FUNC_ARGS)
|
||||
int Element_FIRE::updateLegacy(UPDATE_FUNC_ARGS) {
|
||||
static int updateLegacy(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, rt, lpv, t = parts[i].type;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
@ -246,9 +249,7 @@ int Element_FIRE::updateLegacy(UPDATE_FUNC_ARGS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FIRE static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_FIRE::graphics(GRAPHICS_FUNC_ARGS)
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
int caddress = restrict_flt(restrict_flt((float)cpart->life, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
|
||||
*colr = (unsigned char)ren->flm_data[caddress];
|
||||
@ -266,10 +267,7 @@ int Element_FIRE::graphics(GRAPHICS_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FIRE static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
void Element_FIRE::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
{
|
||||
sim->parts[i].life = RNG::Ref().between(120, 169);
|
||||
}
|
||||
|
||||
Element_FIRE::~Element_FIRE() {}
|
||||
|
@ -1,7 +1,10 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
#include "hmap.h"
|
||||
//#TPT-Directive ElementClass Element_FIRW PT_FIRW 69
|
||||
Element_FIRW::Element_FIRW()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_FIRW()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_FIRW";
|
||||
Name = "FIRW";
|
||||
@ -41,12 +44,11 @@ Element_FIRW::Element_FIRW()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_FIRW::update;
|
||||
Graphics = &Element_FIRW::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FIRW static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_FIRW::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, rt, np;
|
||||
if (parts[i].tmp<=0) {
|
||||
@ -113,10 +115,7 @@ int Element_FIRW::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FIRW static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_FIRW::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
if(cpart->tmp > 0)
|
||||
{
|
||||
@ -124,6 +123,3 @@ int Element_FIRW::graphics(GRAPHICS_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_FIRW::~Element_FIRW() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_FOG PT_FOG 92
|
||||
Element_FOG::Element_FOG()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_FOG()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_FOG";
|
||||
Name = "FOG";
|
||||
@ -41,11 +43,10 @@ Element_FOG::Element_FOG()
|
||||
HighTemperature = 373.15f;
|
||||
HighTemperatureTransition = PT_WTRV;
|
||||
|
||||
Update = &Element_FOG::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FOG static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_FOG::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
for (rx=-1; rx<2; rx++)
|
||||
@ -66,6 +67,3 @@ int Element_FOG::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_FOG::~Element_FOG() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_FRAY PT_FRAY 159
|
||||
Element_FRAY::Element_FRAY()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_FRAY()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_FRAY";
|
||||
Name = "FRAY";
|
||||
@ -41,11 +43,10 @@ Element_FRAY::Element_FRAY()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_FRAY::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FRAY static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_FRAY::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int curlen;
|
||||
if (parts[i].tmp > 0)
|
||||
@ -77,6 +78,3 @@ int Element_FRAY::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_FRAY::~Element_FRAY() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_FRME PT_FRME 169
|
||||
Element_FRME::Element_FRME()
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_FRME()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_FRME";
|
||||
Name = "FRME";
|
||||
@ -40,11 +42,10 @@ Element_FRME::Element_FRME()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Graphics = &Element_FRME::graphics;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FRME static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_FRME::graphics(GRAPHICS_FUNC_ARGS)
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
if(cpart->tmp)
|
||||
{
|
||||
@ -54,5 +55,3 @@ int Element_FRME::graphics(GRAPHICS_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Element_FRME::~Element_FRME() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_FRZW PT_FRZW 101
|
||||
Element_FRZW::Element_FRZW()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_FRZW()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_FRZW";
|
||||
Name = "FRZW";
|
||||
@ -43,11 +45,10 @@ Element_FRZW::Element_FRZW()
|
||||
|
||||
DefaultProperties.life = 100;
|
||||
|
||||
Update = &Element_FRZW::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FRZW static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_FRZW::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
for (rx=-1; rx<2; rx++)
|
||||
@ -70,6 +71,3 @@ int Element_FRZW::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_FRZW::~Element_FRZW() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_FRZZ PT_FRZZ 100
|
||||
Element_FRZZ::Element_FRZZ()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_FRZZ()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_FRZZ";
|
||||
Name = "FRZZ";
|
||||
@ -41,11 +43,10 @@ Element_FRZZ::Element_FRZZ()
|
||||
HighTemperature = 273.15;
|
||||
HighTemperatureTransition = PT_FRZW;
|
||||
|
||||
Update = &Element_FRZZ::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FRZZ static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_FRZZ::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
for (rx=-1; rx<2; rx++)
|
||||
@ -65,6 +66,3 @@ int Element_FRZZ::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_FRZZ::~Element_FRZZ() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_FSEP PT_FSEP 71
|
||||
Element_FSEP::Element_FSEP()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_FSEP()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_FSEP";
|
||||
Name = "FSEP";
|
||||
@ -42,11 +44,10 @@ Element_FSEP::Element_FSEP()
|
||||
|
||||
DefaultProperties.life = 50;
|
||||
|
||||
Update = &Element_FSEP::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FSEP static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_FSEP::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
if (parts[i].life<=0) {
|
||||
@ -79,6 +80,3 @@ int Element_FSEP::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_FSEP::~Element_FSEP() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_FUSE PT_FUSE 70
|
||||
Element_FUSE::Element_FUSE()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_FUSE()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_FUSE";
|
||||
Name = "FUSE";
|
||||
@ -43,11 +45,10 @@ Element_FUSE::Element_FUSE()
|
||||
DefaultProperties.life = 50;
|
||||
DefaultProperties.tmp = 50;
|
||||
|
||||
Update = &Element_FUSE::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FUSE static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_FUSE::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
if (parts[i].life<=0) {
|
||||
@ -88,6 +89,3 @@ int Element_FUSE::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_FUSE::~Element_FUSE() {}
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "common/tpt-minmax.h"
|
||||
#include "simulation/ElementCommon.h"
|
||||
|
||||
//#TPT-Directive ElementClass Element_FWRK PT_FWRK 98
|
||||
Element_FWRK::Element_FWRK()
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_FWRK()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_FWRK";
|
||||
Name = "FWRK";
|
||||
@ -42,11 +43,10 @@ Element_FWRK::Element_FWRK()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_FWRK::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_FWRK static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_FWRK::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
if (parts[i].life == 0 && ((surround_space && parts[i].temp>400 && RNG::Ref().chance(9+parts[i].temp/40, 100000)) || parts[i].ctype == PT_DUST))
|
||||
{
|
||||
@ -112,6 +112,3 @@ int Element_FWRK::update(UPDATE_FUNC_ARGS)
|
||||
parts[i].life=0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_FWRK::~Element_FWRK() {}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_GAS PT_GAS 10
|
||||
Element_GAS::Element_GAS()
|
||||
|
||||
void Element::Element_GAS()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_GAS";
|
||||
Name = "GAS";
|
||||
@ -40,8 +40,4 @@ Element_GAS::Element_GAS()
|
||||
LowTemperatureTransition = NT;
|
||||
HighTemperature = 573.0f;
|
||||
HighTemperatureTransition = PT_FIRE;
|
||||
|
||||
Update = NULL;
|
||||
}
|
||||
|
||||
Element_GAS::~Element_GAS() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_GBMB PT_GBMB 157
|
||||
Element_GBMB::Element_GBMB()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_GBMB()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_GBMB";
|
||||
Name = "GBMB";
|
||||
@ -41,12 +44,11 @@ Element_GBMB::Element_GBMB()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_GBMB::update;
|
||||
Graphics = &Element_GBMB::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GBMB static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_GBMB::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int rx,ry,r;
|
||||
if (parts[i].life<=0)
|
||||
@ -76,10 +78,7 @@ int Element_GBMB::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GBMB static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_GBMB::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
if (cpart->life <= 0) {
|
||||
*pixel_mode |= PMODE_FLARE;
|
||||
@ -90,6 +89,3 @@ int Element_GBMB::graphics(GRAPHICS_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_GBMB::~Element_GBMB() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_GEL PT_GEL 142
|
||||
Element_GEL::Element_GEL()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_GEL()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_GEL";
|
||||
Name = "GEL";
|
||||
@ -41,12 +44,11 @@ Element_GEL::Element_GEL()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_GEL::update;
|
||||
Graphics = &Element_GEL::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GEL static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_GEL::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, rt;
|
||||
bool gel;
|
||||
@ -151,11 +153,7 @@ int Element_GEL::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GEL static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_GEL::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
int q = cpart->tmp;
|
||||
*colr = q*(32-255)/120+255;
|
||||
@ -164,7 +162,3 @@ int Element_GEL::graphics(GRAPHICS_FUNC_ARGS)
|
||||
*pixel_mode |= PMODE_BLUR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Element_GEL::~Element_GEL() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_GLAS PT_GLAS 45
|
||||
Element_GLAS::Element_GLAS()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_GLAS()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_GLAS";
|
||||
Name = "GLAS";
|
||||
@ -40,12 +43,11 @@ Element_GLAS::Element_GLAS()
|
||||
HighTemperature = 1973.0f;
|
||||
HighTemperatureTransition = PT_LAVA;
|
||||
|
||||
Update = &Element_GLAS::update;
|
||||
Create = &Element_GLAS::create;
|
||||
Update = &update;
|
||||
Create = &create;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GLAS static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_GLAS::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
parts[i].pavg[0] = parts[i].pavg[1];
|
||||
parts[i].pavg[1] = sim->pv[y/CELL][x/CELL];
|
||||
@ -57,10 +59,7 @@ int Element_GLAS::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GLAS static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
void Element_GLAS::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||
{
|
||||
sim->parts[i].pavg[1] = sim->pv[y/CELL][x/CELL];
|
||||
}
|
||||
|
||||
Element_GLAS::~Element_GLAS() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_GLOW PT_GLOW 66
|
||||
Element_GLOW::Element_GLOW()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_GLOW()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_GLOW";
|
||||
Name = "GLOW";
|
||||
@ -41,12 +44,11 @@ Element_GLOW::Element_GLOW()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_GLOW::update;
|
||||
Graphics = &Element_GLOW::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GLOW static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_GLOW::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
for (rx=-1; rx<2; rx++)
|
||||
@ -70,10 +72,7 @@ int Element_GLOW::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GLOW static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_GLOW::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
*firer = restrict_flt(cpart->temp-(275.13f+32.0f), 0, 128)/50.0f;
|
||||
*fireg = restrict_flt(cpart->ctype, 0, 128)/50.0f;
|
||||
@ -86,6 +85,3 @@ int Element_GLOW::graphics(GRAPHICS_FUNC_ARGS)
|
||||
*pixel_mode |= FIRE_ADD;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_GLOW::~Element_GLOW() {}
|
||||
|
@ -1,7 +1,10 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
#include "simulation/Air.h"
|
||||
//#TPT-Directive ElementClass Element_GOLD PT_GOLD 170
|
||||
Element_GOLD::Element_GOLD()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_GOLD()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_GOLD";
|
||||
Name = "GOLD";
|
||||
@ -42,12 +45,11 @@ Element_GOLD::Element_GOLD()
|
||||
HighTemperature = 1337.0f;
|
||||
HighTemperatureTransition = PT_LAVA;
|
||||
|
||||
Update = &Element_GOLD::update;
|
||||
Graphics = &Element_GOLD::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GOLD static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_GOLD::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int rx, ry, r, rndstore;
|
||||
static int checkCoordsX[] = { -4, 4, 0, 0 };
|
||||
@ -96,8 +98,7 @@ int Element_GOLD::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GOLD static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_GOLD::graphics(GRAPHICS_FUNC_ARGS)
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
int rndstore = RNG::Ref().gen();
|
||||
*colr += (rndstore % 10) - 5;
|
||||
@ -107,5 +108,3 @@ int Element_GOLD::graphics(GRAPHICS_FUNC_ARGS)
|
||||
*colb += (rndstore % 10) - 5;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Element_GOLD::~Element_GOLD() {}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_GOO PT_GOO 12
|
||||
Element_GOO::Element_GOO()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
|
||||
void Element::Element_GOO()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_GOO";
|
||||
Name = "GOO";
|
||||
@ -41,13 +43,12 @@ Element_GOO::Element_GOO()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_GOO::update;
|
||||
Update = &update;
|
||||
}
|
||||
|
||||
#define ADVECTION 0.1f
|
||||
constexpr float ADVECTION = 0.1f;
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GOO static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_GOO::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
if (!parts[i].life && sim->pv[y/CELL][x/CELL]>1.0f)
|
||||
parts[i].life = RNG::Ref().between(300, 379);
|
||||
@ -58,6 +59,3 @@ int Element_GOO::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_GOO::~Element_GOO() {}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "simulation/ElementCommon.h"
|
||||
//#TPT-Directive ElementClass Element_GPMP PT_GPMP 154
|
||||
Element_GPMP::Element_GPMP()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_GPMP()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_GPMP";
|
||||
Name = "GPMP";
|
||||
@ -42,12 +45,11 @@ Element_GPMP::Element_GPMP()
|
||||
|
||||
DefaultProperties.life = 10;
|
||||
|
||||
Update = &Element_GPMP::update;
|
||||
Graphics = &Element_GPMP::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GPMP static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_GPMP::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
if (parts[i].life!=10)
|
||||
@ -82,16 +84,10 @@ int Element_GPMP::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GPMP static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_GPMP::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
int lifemod = ((cpart->life>10?10:cpart->life)*19);
|
||||
*colg += lifemod;
|
||||
*colb += lifemod;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_GPMP::~Element_GPMP() {}
|
||||
|
@ -1,8 +1,10 @@
|
||||
#include "common/tpt-minmax.h"
|
||||
#include "simulation/ElementCommon.h"
|
||||
|
||||
//#TPT-Directive ElementClass Element_GRAV PT_GRAV 102
|
||||
Element_GRAV::Element_GRAV()
|
||||
static int update(UPDATE_FUNC_ARGS);
|
||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||
|
||||
void Element::Element_GRAV()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_GRAV";
|
||||
Name = "GRAV";
|
||||
@ -42,12 +44,11 @@ Element_GRAV::Element_GRAV()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_GRAV::update;
|
||||
Graphics = &Element_GRAV::graphics;
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GRAV static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_GRAV::update(UPDATE_FUNC_ARGS)
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
if (parts[i].vx*parts[i].vx + parts[i].vy*parts[i].vy >= 0.1f && RNG::Ref().chance(1, 512))
|
||||
{
|
||||
@ -58,8 +59,7 @@ int Element_GRAV::update(UPDATE_FUNC_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GRAV static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_GRAV::graphics(GRAPHICS_FUNC_ARGS)
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
int GRAV_R, GRAV_B, GRAV_G, GRAV_R2, GRAV_B2, GRAV_G2;
|
||||
|
||||
@ -115,6 +115,3 @@ int Element_GRAV::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_GRAV::~Element_GRAV() {}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user