Factor functions shared between elements into headers
The signature duplication was getting out of hand; too easy to get wrong.
This commit is contained in:
parent
0f1218df0c
commit
ca6c67c16c
@ -3,6 +3,7 @@
|
|||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
#include "simulation/ElementClasses.h"
|
#include "simulation/ElementClasses.h"
|
||||||
|
#include "simulation/elements/PIPE.h"
|
||||||
#include "common/tpt-compat.h"
|
#include "common/tpt-compat.h"
|
||||||
#include "bson/BSON.h"
|
#include "bson/BSON.h"
|
||||||
#include "graphics/Renderer.h"
|
#include "graphics/Renderer.h"
|
||||||
@ -114,9 +115,6 @@ std::pair<bool, std::vector<char>> GameSave::Serialise() const
|
|||||||
return { false, {} };
|
return { false, {} };
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const std::array<Vec2<int>, 8> Element_PIPE_offsets;
|
|
||||||
void Element_PIPE_transformPatchOffsets(Particle &part, const std::array<int, 8> &offsetMap);
|
|
||||||
|
|
||||||
void GameSave::Transform(Mat2<int> transform, Vec2<int> nudge)
|
void GameSave::Transform(Mat2<int> transform, Vec2<int> nudge)
|
||||||
{
|
{
|
||||||
// undo translation by rotation
|
// undo translation by rotation
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
#include "simulation/SimulationData.h"
|
#include "simulation/SimulationData.h"
|
||||||
#include "simulation/Snapshot.h"
|
#include "simulation/Snapshot.h"
|
||||||
|
#include "simulation/elements/STKM.h"
|
||||||
|
|
||||||
#include "gui/dialogues/ErrorMessage.h"
|
#include "gui/dialogues/ErrorMessage.h"
|
||||||
#include "gui/dialogues/InformationMessage.h"
|
#include "gui/dialogues/InformationMessage.h"
|
||||||
@ -881,7 +882,6 @@ void GameController::Update()
|
|||||||
rightSelected = sr;
|
rightSelected = sr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Element_STKM_set_element(Simulation *sim, playerst *playerp, int element);
|
|
||||||
if (!sim->player.spwn)
|
if (!sim->player.spwn)
|
||||||
Element_STKM_set_element(sim, &sim->player, rightSelected);
|
Element_STKM_set_element(sim, &sim->player, rightSelected);
|
||||||
if (!sim->player2.spwn)
|
if (!sim->player2.spwn)
|
||||||
|
@ -9,15 +9,14 @@
|
|||||||
#include "common/tpt-rand.h"
|
#include "common/tpt-rand.h"
|
||||||
#include "common/tpt-thread-local.h"
|
#include "common/tpt-thread-local.h"
|
||||||
#include "gui/game/Brush.h"
|
#include "gui/game/Brush.h"
|
||||||
|
#include "elements/EMP.h"
|
||||||
|
#include "elements/LOLZ.h"
|
||||||
|
#include "elements/STKM.h"
|
||||||
|
#include "elements/PIPE.h"
|
||||||
|
#include "elements/FILT.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
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];
|
|
||||||
|
|
||||||
static float remainder_p(float x, float y)
|
static float remainder_p(float x, float y)
|
||||||
{
|
{
|
||||||
return std::fmod(x, y) + (x>=0 ? 0 : y);
|
return std::fmod(x, y) + (x>=0 ? 0 : y);
|
||||||
@ -127,7 +126,6 @@ MissingElements Simulation::Load(const GameSave *save, bool includePressure, Vec
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
bool Element_FIGH_CanAlloc(Simulation *sim);
|
|
||||||
if (tempPart.type == PT_FIGH && !Element_FIGH_CanAlloc(this))
|
if (tempPart.type == PT_FIGH && !Element_FIGH_CanAlloc(this))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -159,7 +157,6 @@ MissingElements Simulation::Load(const GameSave *save, bool includePressure, Vec
|
|||||||
elementCount[tempPart.type]++;
|
elementCount[tempPart.type]++;
|
||||||
|
|
||||||
|
|
||||||
void Element_STKM_init_legs(Simulation * sim, playerst *playerp, int i);
|
|
||||||
switch (parts[i].type)
|
switch (parts[i].type)
|
||||||
{
|
{
|
||||||
case PT_STKM:
|
case PT_STKM:
|
||||||
@ -200,7 +197,6 @@ MissingElements Simulation::Load(const GameSave *save, bool includePressure, Vec
|
|||||||
case PT_FIGH:
|
case PT_FIGH:
|
||||||
{
|
{
|
||||||
unsigned int oldTmp = parts[i].tmp;
|
unsigned int oldTmp = parts[i].tmp;
|
||||||
int Element_FIGH_Alloc(Simulation *sim);
|
|
||||||
parts[i].tmp = Element_FIGH_Alloc(this);
|
parts[i].tmp = Element_FIGH_Alloc(this);
|
||||||
if (parts[i].tmp >= 0)
|
if (parts[i].tmp >= 0)
|
||||||
{
|
{
|
||||||
@ -212,7 +208,6 @@ MissingElements Simulation::Load(const GameSave *save, bool includePressure, Vec
|
|||||||
parts[i].ctype = 0;
|
parts[i].ctype = 0;
|
||||||
}
|
}
|
||||||
fighters[parts[i].tmp].elem = PT_DUST;
|
fighters[parts[i].tmp].elem = PT_DUST;
|
||||||
void Element_FIGH_NewFighter(Simulation *sim, int fighterID, int i, int elem);
|
|
||||||
Element_FIGH_NewFighter(this, parts[i].tmp, i, parts[i].ctype);
|
Element_FIGH_NewFighter(this, parts[i].tmp, i, parts[i].ctype);
|
||||||
if (fan)
|
if (fan)
|
||||||
fighters[parts[i].tmp].fan = true;
|
fighters[parts[i].tmp].fan = true;
|
||||||
@ -1262,7 +1257,6 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Element_FILT_interactWavelengths(Simulation *sim, Particle* cpart, int origWl);
|
|
||||||
if (e == 2) //if occupy same space
|
if (e == 2) //if occupy same space
|
||||||
{
|
{
|
||||||
switch (parts[i].type)
|
switch (parts[i].type)
|
||||||
@ -3922,7 +3916,6 @@ void Simulation::AfterSim()
|
|||||||
if (emp_trigger_count)
|
if (emp_trigger_count)
|
||||||
{
|
{
|
||||||
// pitiful attempt at trying to keep code relating to a given element in the same file
|
// 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);
|
Element_EMP_Trigger(this, emp_trigger_count);
|
||||||
emp_trigger_count = 0;
|
emp_trigger_count = 0;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "FILT.h"
|
||||||
|
|
||||||
static int update(UPDATE_FUNC_ARGS);
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
|
|
||||||
@ -130,7 +131,6 @@ static int update(UPDATE_FUNC_ARGS)
|
|||||||
{
|
{
|
||||||
if (parts[r].tmp != 6)
|
if (parts[r].tmp != 6)
|
||||||
{
|
{
|
||||||
int Element_FILT_interactWavelengths(Simulation *sim, Particle* cpart, int origWl);
|
|
||||||
colored = Element_FILT_interactWavelengths(sim, &parts[r], colored);
|
colored = Element_FILT_interactWavelengths(sim, &parts[r], colored);
|
||||||
if (!colored)
|
if (!colored)
|
||||||
break;
|
break;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "COAL.h"
|
||||||
int Element_COAL_update(UPDATE_FUNC_ARGS);
|
|
||||||
int Element_COAL_graphics(GRAPHICS_FUNC_ARGS);
|
|
||||||
|
|
||||||
void Element::Element_BCOL()
|
void Element::Element_BCOL()
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "BIZR.h"
|
||||||
int Element_BIZR_update(UPDATE_FUNC_ARGS);
|
|
||||||
int Element_BIZR_graphics(GRAPHICS_FUNC_ARGS);
|
|
||||||
|
|
||||||
void Element::Element_BIZR()
|
void Element::Element_BIZR()
|
||||||
{
|
{
|
||||||
|
5
src/simulation/elements/BIZR.h
Normal file
5
src/simulation/elements/BIZR.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
int Element_BIZR_graphics(GRAPHICS_FUNC_ARGS);
|
||||||
|
int Element_BIZR_update(UPDATE_FUNC_ARGS);
|
@ -1,7 +1,5 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "BIZR.h"
|
||||||
int Element_BIZR_update(UPDATE_FUNC_ARGS);
|
|
||||||
int Element_BIZR_graphics(GRAPHICS_FUNC_ARGS);
|
|
||||||
|
|
||||||
void Element::Element_BIZRG()
|
void Element::Element_BIZRG()
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "BIZR.h"
|
||||||
int Element_BIZR_update(UPDATE_FUNC_ARGS);
|
|
||||||
int Element_BIZR_graphics(GRAPHICS_FUNC_ARGS);
|
|
||||||
|
|
||||||
void Element::Element_BIZRS()
|
void Element::Element_BIZRS()
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "VIBR.h"
|
||||||
int Element_VIBR_update(UPDATE_FUNC_ARGS);
|
|
||||||
int Element_VIBR_graphics(GRAPHICS_FUNC_ARGS);
|
|
||||||
|
|
||||||
void Element::Element_BVBR()
|
void Element::Element_BVBR()
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "COAL.h"
|
||||||
int Element_COAL_update(UPDATE_FUNC_ARGS);
|
|
||||||
int Element_COAL_graphics(GRAPHICS_FUNC_ARGS);
|
|
||||||
|
|
||||||
void Element::Element_COAL()
|
void Element::Element_COAL()
|
||||||
{
|
{
|
||||||
|
5
src/simulation/elements/COAL.h
Normal file
5
src/simulation/elements/COAL.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
int Element_COAL_graphics(GRAPHICS_FUNC_ARGS);
|
||||||
|
int Element_COAL_update(UPDATE_FUNC_ARGS);
|
@ -1,4 +1,5 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "FILT.h"
|
||||||
|
|
||||||
static int update(UPDATE_FUNC_ARGS);
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
static bool ctypeDraw(CTYPEDRAW_FUNC_ARGS);
|
static bool ctypeDraw(CTYPEDRAW_FUNC_ARGS);
|
||||||
|
4
src/simulation/elements/EMP.h
Normal file
4
src/simulation/elements/EMP.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
void Element_EMP_Trigger(Simulation *sim, int triggerCount);
|
4
src/simulation/elements/ETRD.h
Normal file
4
src/simulation/elements/ETRD.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
int Element_ETRD_nearestSparkablePart(Simulation *sim, int targetId);
|
@ -1,15 +1,10 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "STKM.h"
|
||||||
|
|
||||||
static int update(UPDATE_FUNC_ARGS);
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
static bool createAllowed(ELEMENT_CREATE_ALLOWED_FUNC_ARGS);
|
static bool createAllowed(ELEMENT_CREATE_ALLOWED_FUNC_ARGS);
|
||||||
static void changeType(ELEMENT_CHANGETYPE_FUNC_ARGS);
|
static void changeType(ELEMENT_CHANGETYPE_FUNC_ARGS);
|
||||||
static void Free(Simulation *sim, unsigned char i);
|
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()
|
void Element::Element_FIGH()
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "FILT.h"
|
||||||
|
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||||
int Element_FILT_interactWavelengths(Simulation *sim, Particle* cpart, int origWl);
|
|
||||||
|
|
||||||
void Element::Element_FILT()
|
void Element::Element_FILT()
|
||||||
{
|
{
|
||||||
|
5
src/simulation/elements/FILT.h
Normal file
5
src/simulation/elements/FILT.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
int Element_FILT_getWavelengths(const Particle* cpart);
|
||||||
|
int Element_FILT_interactWavelengths(Simulation *sim, Particle* cpart, int origWl);
|
@ -1,7 +1,7 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "FIRE.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
int Element_FIRE_update(UPDATE_FUNC_ARGS);
|
|
||||||
static int updateLegacy(UPDATE_FUNC_ARGS);
|
static int updateLegacy(UPDATE_FUNC_ARGS);
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||||
|
4
src/simulation/elements/FIRE.h
Normal file
4
src/simulation/elements/FIRE.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
int Element_FIRE_update(UPDATE_FUNC_ARGS);
|
@ -1,6 +1,6 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "FIRE.h"
|
||||||
|
|
||||||
int Element_FIRE_update(UPDATE_FUNC_ARGS);
|
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
#include <iostream>
|
#include "FILT.h"
|
||||||
|
|
||||||
static int update(UPDATE_FUNC_ARGS);
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
|
|
||||||
|
7
src/simulation/elements/LOLZ.h
Normal file
7
src/simulation/elements/LOLZ.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
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];
|
@ -1,6 +1,6 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "FIRE.h"
|
||||||
|
|
||||||
int Element_FIRE_update(UPDATE_FUNC_ARGS);
|
|
||||||
static int update(UPDATE_FUNC_ARGS);
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "NTCT.h"
|
||||||
int Element_NTCT_update(UPDATE_FUNC_ARGS);
|
|
||||||
|
|
||||||
void Element::Element_NTCT()
|
void Element::Element_NTCT()
|
||||||
{
|
{
|
||||||
|
4
src/simulation/elements/NTCT.h
Normal file
4
src/simulation/elements/NTCT.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
int Element_NTCT_update(UPDATE_FUNC_ARGS);
|
@ -1,8 +1,8 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "PCLN.h"
|
||||||
|
|
||||||
static int update(UPDATE_FUNC_ARGS);
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
bool Element_PCLN_ctypeDraw(CTYPEDRAW_FUNC_ARGS);
|
|
||||||
|
|
||||||
void Element::Element_PBCN()
|
void Element::Element_PBCN()
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "PCLN.h"
|
||||||
|
|
||||||
static int update(UPDATE_FUNC_ARGS);
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
bool Element_PCLN_ctypeDraw(CTYPEDRAW_FUNC_ARGS);
|
|
||||||
|
|
||||||
void Element::Element_PCLN()
|
void Element::Element_PCLN()
|
||||||
{
|
{
|
||||||
|
4
src/simulation/elements/PCLN.h
Normal file
4
src/simulation/elements/PCLN.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
bool Element_PCLN_ctypeDraw(CTYPEDRAW_FUNC_ARGS);
|
@ -1,6 +1,7 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "FIRE.h"
|
||||||
|
#include "FILT.h"
|
||||||
|
|
||||||
int Element_FIRE_update(UPDATE_FUNC_ARGS);
|
|
||||||
static int update(UPDATE_FUNC_ARGS);
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||||
@ -151,7 +152,6 @@ static void create(ELEMENT_CREATE_FUNC_ARGS)
|
|||||||
float a = sim->rng.between(0, 7) * 0.78540f;
|
float a = sim->rng.between(0, 7) * 0.78540f;
|
||||||
sim->parts[i].vx = 3.0f * cosf(a);
|
sim->parts[i].vx = 3.0f * cosf(a);
|
||||||
sim->parts[i].vy = 3.0f * sinf(a);
|
sim->parts[i].vy = 3.0f * sinf(a);
|
||||||
int Element_FILT_interactWavelengths(Simulation *sim, Particle* cpart, int origWl);
|
|
||||||
if (TYP(sim->pmap[y][x]) == PT_FILT)
|
if (TYP(sim->pmap[y][x]) == PT_FILT)
|
||||||
sim->parts[i].ctype = Element_FILT_interactWavelengths(sim, &sim->parts[ID(sim->pmap[y][x])], sim->parts[i].ctype);
|
sim->parts[i].ctype = Element_FILT_interactWavelengths(sim, &sim->parts[ID(sim->pmap[y][x])], sim->parts[i].ctype);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "PIPE.h"
|
||||||
|
#include "SOAP.h"
|
||||||
|
|
||||||
extern const std::array<Vec2<int>, 8> Element_PIPE_offsets;
|
|
||||||
void Element_PIPE_transformPatchOffsets(Particle &part, const std::array<int, 8> &offsetMap);
|
|
||||||
int Element_PIPE_update(UPDATE_FUNC_ARGS);
|
|
||||||
int Element_PIPE_graphics(GRAPHICS_FUNC_ARGS);
|
|
||||||
static void props_pipe_to_part(const Particle *pipe, Particle *part, bool STOR);
|
static void props_pipe_to_part(const Particle *pipe, Particle *part, bool STOR);
|
||||||
void Element_PIPE_transfer_pipe_to_part(Simulation * sim, Particle *pipe, Particle *part, bool STOR);
|
|
||||||
static void transfer_part_to_pipe(Particle *part, Particle *pipe);
|
static void transfer_part_to_pipe(Particle *part, Particle *pipe);
|
||||||
static void transfer_pipe_to_pipe(Particle *src, Particle *dest, bool STOR);
|
static void transfer_pipe_to_pipe(Particle *src, Particle *dest, bool STOR);
|
||||||
static void pushParticle(Simulation * sim, int i, int count, int original);
|
static void pushParticle(Simulation * sim, int i, int count, int original);
|
||||||
void Element_SOAP_detach(Simulation * sim, int i);
|
|
||||||
|
|
||||||
void Element::Element_PIPE()
|
void Element::Element_PIPE()
|
||||||
{
|
{
|
||||||
|
11
src/simulation/elements/PIPE.h
Normal file
11
src/simulation/elements/PIPE.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
int Element_PIPE_graphics(GRAPHICS_FUNC_ARGS);
|
||||||
|
void Element_PIPE_transfer_pipe_to_part(Simulation * sim, Particle *pipe, Particle *part, bool STOR);
|
||||||
|
void Element_PIPE_transformPatchOffsets(Particle &part, const std::array<int, 8> &offsetMap);
|
||||||
|
int Element_PIPE_update(UPDATE_FUNC_ARGS);
|
||||||
|
void Element_PPIP_flood_trigger(Simulation * sim, int x, int y, int sparkedBy);
|
||||||
|
|
||||||
|
extern int Element_PPIP_ppip_changed;
|
||||||
|
extern const std::array<Vec2<int>, 8> Element_PIPE_offsets;
|
@ -1,6 +1,6 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "FIRE.h"
|
||||||
|
|
||||||
int Element_FIRE_update(UPDATE_FUNC_ARGS);
|
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "PIPE.h"
|
||||||
int Element_PIPE_update(UPDATE_FUNC_ARGS);
|
|
||||||
int Element_PIPE_graphics(GRAPHICS_FUNC_ARGS);
|
|
||||||
|
|
||||||
void Element::Element_PPIP()
|
void Element::Element_PPIP()
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "QRTZ.h"
|
||||||
|
|
||||||
int Element_QRTZ_update(UPDATE_FUNC_ARGS);
|
|
||||||
int Element_QRTZ_graphics(GRAPHICS_FUNC_ARGS);
|
|
||||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||||
|
|
||||||
void Element::Element_PQRT()
|
void Element::Element_PQRT()
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
#include "simulation/orbitalparts.h"
|
#include "simulation/orbitalparts.h"
|
||||||
|
#include "PIPE.h"
|
||||||
|
#include "SOAP.h"
|
||||||
|
|
||||||
void Element_PIPE_transfer_pipe_to_part(Simulation * sim, Particle *pipe, Particle *part, bool STOR);
|
|
||||||
static int update(UPDATE_FUNC_ARGS);
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
void Element_SOAP_detach(Simulation * sim, int i);
|
|
||||||
|
|
||||||
void Element::Element_PRTI()
|
void Element::Element_PRTI()
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "QRTZ.h"
|
||||||
|
|
||||||
int Element_QRTZ_update(UPDATE_FUNC_ARGS);
|
|
||||||
int Element_QRTZ_graphics(GRAPHICS_FUNC_ARGS);
|
|
||||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||||
|
|
||||||
void Element::Element_QRTZ()
|
void Element::Element_QRTZ()
|
||||||
|
5
src/simulation/elements/QRTZ.h
Normal file
5
src/simulation/elements/QRTZ.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
int Element_QRTZ_graphics(GRAPHICS_FUNC_ARGS);
|
||||||
|
int Element_QRTZ_update(UPDATE_FUNC_ARGS);
|
@ -1,6 +1,5 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "RFRG.h"
|
||||||
int Element_RFRG_update(UPDATE_FUNC_ARGS);
|
|
||||||
|
|
||||||
void Element::Element_RFGL()
|
void Element::Element_RFGL()
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "RFRG.h"
|
||||||
int Element_RFRG_update(UPDATE_FUNC_ARGS);
|
|
||||||
|
|
||||||
void Element::Element_RFRG()
|
void Element::Element_RFRG()
|
||||||
{
|
{
|
||||||
|
4
src/simulation/elements/RFRG.h
Normal file
4
src/simulation/elements/RFRG.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
int Element_RFRG_update(UPDATE_FUNC_ARGS);
|
4
src/simulation/elements/SOAP.h
Normal file
4
src/simulation/elements/SOAP.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
void Element_SOAP_detach(Simulation * sim, int i);
|
@ -1,6 +1,9 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "NTCT.h"
|
||||||
|
#include "PIPE.h"
|
||||||
|
#include "FIRE.h"
|
||||||
|
#include "ETRD.h"
|
||||||
|
|
||||||
int Element_FIRE_update(UPDATE_FUNC_ARGS);
|
|
||||||
static int update(UPDATE_FUNC_ARGS);
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
|
|
||||||
@ -83,13 +86,11 @@ static int update(UPDATE_FUNC_ARGS)
|
|||||||
return 1;
|
return 1;
|
||||||
case PT_NTCT:
|
case PT_NTCT:
|
||||||
case PT_PTCT:
|
case PT_PTCT:
|
||||||
int Element_NTCT_update(UPDATE_FUNC_ARGS);
|
|
||||||
Element_NTCT_update(UPDATE_FUNC_SUBCALL_ARGS);
|
Element_NTCT_update(UPDATE_FUNC_SUBCALL_ARGS);
|
||||||
break;
|
break;
|
||||||
case PT_ETRD:
|
case PT_ETRD:
|
||||||
if (parts[i].life==1)
|
if (parts[i].life==1)
|
||||||
{
|
{
|
||||||
int Element_ETRD_nearestSparkablePart(Simulation *sim, int targetId);
|
|
||||||
auto nearp = Element_ETRD_nearestSparkablePart(sim, i);
|
auto nearp = Element_ETRD_nearestSparkablePart(sim, i);
|
||||||
if (nearp!=-1 && sim->parts_avg(i, nearp, PT_INSL)!=PT_INSL)
|
if (nearp!=-1 && sim->parts_avg(i, nearp, PT_INSL)!=PT_INSL)
|
||||||
{
|
{
|
||||||
@ -247,7 +248,6 @@ static int update(UPDATE_FUNC_ARGS)
|
|||||||
case PT_PPIP:
|
case PT_PPIP:
|
||||||
if (parts[i].life == 3 && pavg!=PT_INSL)
|
if (parts[i].life == 3 && pavg!=PT_INSL)
|
||||||
{
|
{
|
||||||
void Element_PPIP_flood_trigger(Simulation * sim, int x, int y, int sparkedBy);
|
|
||||||
if (sender == PT_NSCN || sender == PT_PSCN || sender == PT_INST)
|
if (sender == PT_NSCN || sender == PT_PSCN || sender == PT_INST)
|
||||||
Element_PPIP_flood_trigger(sim, x+rx, y+ry, sender);
|
Element_PPIP_flood_trigger(sim, x+rx, y+ry, sender);
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "STKM.h"
|
||||||
|
|
||||||
static int update(UPDATE_FUNC_ARGS);
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
int Element_STKM_graphics(GRAPHICS_FUNC_ARGS);
|
|
||||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||||
static bool createAllowed(ELEMENT_CREATE_ALLOWED_FUNC_ARGS);
|
static bool createAllowed(ELEMENT_CREATE_ALLOWED_FUNC_ARGS);
|
||||||
static void changeType(ELEMENT_CHANGETYPE_FUNC_ARGS);
|
static void changeType(ELEMENT_CHANGETYPE_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_STKM_set_element(Simulation *sim, playerst *playerp, int element);
|
|
||||||
void Element_STKM_interact(Simulation *sim, playerst *playerp, int i, int x, int y);
|
|
||||||
|
|
||||||
void Element::Element_STKM()
|
void Element::Element_STKM()
|
||||||
{
|
{
|
||||||
|
12
src/simulation/elements/STKM.h
Normal file
12
src/simulation/elements/STKM.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
int Element_FIGH_Alloc(Simulation *sim);
|
||||||
|
bool Element_FIGH_CanAlloc(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);
|
||||||
|
void Element_STKM_interact(Simulation *sim, playerst *playerp, int i, int x, int y);
|
||||||
|
int Element_STKM_run_stickman(playerst *playerp, UPDATE_FUNC_ARGS);
|
||||||
|
void Element_STKM_set_element(Simulation *sim, playerst *playerp, int element);
|
||||||
|
void Element_STKM_set_element(Simulation *sim, playerst *playerp, int element);
|
@ -1,12 +1,10 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "STKM.h"
|
||||||
|
|
||||||
static int update(UPDATE_FUNC_ARGS);
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
static void create(ELEMENT_CREATE_FUNC_ARGS);
|
||||||
static bool createAllowed(ELEMENT_CREATE_ALLOWED_FUNC_ARGS);
|
static bool createAllowed(ELEMENT_CREATE_ALLOWED_FUNC_ARGS);
|
||||||
static void changeType(ELEMENT_CHANGETYPE_FUNC_ARGS);
|
static void changeType(ELEMENT_CHANGETYPE_FUNC_ARGS);
|
||||||
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_STKM2()
|
void Element::Element_STKM2()
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "SOAP.h"
|
||||||
|
|
||||||
void Element_SOAP_detach(Simulation * sim, int i);
|
|
||||||
static int update(UPDATE_FUNC_ARGS);
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
static bool ctypeDraw(CTYPEDRAW_FUNC_ARGS);
|
static bool ctypeDraw(CTYPEDRAW_FUNC_ARGS);
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "VIBR.h"
|
||||||
int Element_VIBR_update(UPDATE_FUNC_ARGS);
|
|
||||||
int Element_VIBR_graphics(GRAPHICS_FUNC_ARGS);
|
|
||||||
|
|
||||||
void Element::Element_VIBR()
|
void Element::Element_VIBR()
|
||||||
{
|
{
|
||||||
|
5
src/simulation/elements/VIBR.h
Normal file
5
src/simulation/elements/VIBR.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
int Element_VIBR_graphics(GRAPHICS_FUNC_ARGS);
|
||||||
|
int Element_VIBR_update(UPDATE_FUNC_ARGS);
|
@ -1,6 +1,6 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "VIRS.h"
|
||||||
|
|
||||||
int Element_VIRS_update(UPDATE_FUNC_ARGS);
|
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
|
|
||||||
void Element::Element_VIRS()
|
void Element::Element_VIRS()
|
||||||
|
4
src/simulation/elements/VIRS.h
Normal file
4
src/simulation/elements/VIRS.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
|
||||||
|
int Element_VIRS_update(UPDATE_FUNC_ARGS);
|
@ -1,6 +1,6 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "VIRS.h"
|
||||||
|
|
||||||
int Element_VIRS_update(UPDATE_FUNC_ARGS);
|
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
|
|
||||||
void Element::Element_VRSG()
|
void Element::Element_VRSG()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
#include "VIRS.h"
|
||||||
|
|
||||||
int Element_VIRS_update(UPDATE_FUNC_ARGS);
|
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
|
|
||||||
void Element::Element_VRSS()
|
void Element::Element_VRSS()
|
||||||
|
Reference in New Issue
Block a user