Add Create function, handles setting default properties for elements that need randomness or special code
Most of the switch statement in create_part is gone. There's a few others that I will get rid of in future commits. There will also be a CreateAllowed function, and a ChangeType. ChangeType will handle stuff that is duplicated in both create_part and part_change_type. Considering making a Destroy function instead of ChangeType, though. Later on, Lua events will be made for all 3 Credit to jacksonmj for the original design of all of this, I copied it into my mod years ago
This commit is contained in:
parent
5c1ea5ef0d
commit
9993290b72
@ -45,6 +45,8 @@
|
|||||||
#define GRAPHICS_FUNC_ARGS Renderer * ren, Particle *cpart, int nx, int ny, int *pixel_mode, int* cola, int *colr, int *colg, int *colb, int *firea, int *firer, int *fireg, int *fireb
|
#define GRAPHICS_FUNC_ARGS Renderer * ren, Particle *cpart, int nx, int ny, int *pixel_mode, int* cola, int *colr, int *colg, int *colb, int *firea, int *firer, int *fireg, int *fireb
|
||||||
#define GRAPHICS_FUNC_SUBCALL_ARGS ren, cpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb
|
#define GRAPHICS_FUNC_SUBCALL_ARGS ren, cpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb
|
||||||
|
|
||||||
|
#define ELEMENT_CREATE_FUNC_ARGS Simulation *sim, int i, int x, int y, int t, int v
|
||||||
|
|
||||||
#define CTYPEDRAW_FUNC_ARGS Simulation *sim, int i, int t, int v
|
#define CTYPEDRAW_FUNC_ARGS Simulation *sim, int i, int t, int v
|
||||||
#define CTYPEDRAW_FUNC_SUBCALL_ARGS sim, i, t, v
|
#define CTYPEDRAW_FUNC_SUBCALL_ARGS sim, i, t, v
|
||||||
|
|
||||||
|
@ -3285,54 +3285,9 @@ int Simulation::create_part(int p, int x, int y, int t, int v)
|
|||||||
parts[i].type = t;
|
parts[i].type = t;
|
||||||
parts[i].x = (float)x;
|
parts[i].x = (float)x;
|
||||||
parts[i].y = (float)y;
|
parts[i].y = (float)y;
|
||||||
if (t == PT_GLAS || t == PT_QRTZ || t == PT_TUNG)
|
|
||||||
{
|
|
||||||
parts[i].pavg[0] = 0.0f;
|
|
||||||
parts[i].pavg[1] = pv[y/CELL][x/CELL];
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (t)
|
switch (t)
|
||||||
{
|
{
|
||||||
case PT_WARP:
|
|
||||||
parts[i].life = RNG::Ref().between(70, 164);
|
|
||||||
break;
|
|
||||||
case PT_LIFE:
|
|
||||||
if (v < NGOL)
|
|
||||||
{
|
|
||||||
parts[i].tmp = grule[v+1][9] - 1;
|
|
||||||
parts[i].ctype = v;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PT_SING:
|
|
||||||
parts[i].life = RNG::Ref().between(60, 109);
|
|
||||||
break;
|
|
||||||
case PT_QRTZ:
|
|
||||||
case PT_PQRT:
|
|
||||||
parts[i].tmp2 = RNG::Ref().between(0, 10);
|
|
||||||
break;
|
|
||||||
case PT_CLST:
|
|
||||||
parts[i].tmp = RNG::Ref().between(0, 6);
|
|
||||||
break;
|
|
||||||
case PT_FIRE:
|
|
||||||
parts[i].life = RNG::Ref().between(120, 169);
|
|
||||||
break;
|
|
||||||
case PT_PLSM:
|
|
||||||
parts[i].life = RNG::Ref().between(50, 199);
|
|
||||||
break;
|
|
||||||
case PT_CFLM:
|
|
||||||
parts[i].life = RNG::Ref().between(50, 199);
|
|
||||||
break;
|
|
||||||
case PT_LAVA:
|
|
||||||
parts[i].life = RNG::Ref().between(240, 359);
|
|
||||||
break;
|
|
||||||
case PT_TESC:
|
|
||||||
parts[i].tmp = v;
|
|
||||||
if (parts[i].tmp > 300)
|
|
||||||
parts[i].tmp=300;
|
|
||||||
break;
|
|
||||||
case PT_CRMC:
|
|
||||||
parts[i].tmp2 = RNG::Ref().between(0, 4);
|
|
||||||
break;
|
|
||||||
case PT_ETRD:
|
case PT_ETRD:
|
||||||
etrd_life0_count++;
|
etrd_life0_count++;
|
||||||
break;
|
break;
|
||||||
@ -3340,7 +3295,6 @@ int Simulation::create_part(int p, int x, int y, int t, int v)
|
|||||||
{
|
{
|
||||||
if (player.spwn == 0)
|
if (player.spwn == 0)
|
||||||
{
|
{
|
||||||
parts[i].life = 100;
|
|
||||||
Element_STKM::STKM_init_legs(this, &player, i);
|
Element_STKM::STKM_init_legs(this, &player, i);
|
||||||
player.spwn = 1;
|
player.spwn = 1;
|
||||||
player.rocketBoots = false;
|
player.rocketBoots = false;
|
||||||
@ -3350,16 +3304,12 @@ int Simulation::create_part(int p, int x, int y, int t, int v)
|
|||||||
parts[i].type = 0;
|
parts[i].type = 0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int spawnID = create_part(-3, x, y, PT_SPAWN);
|
|
||||||
if (spawnID >= 0)
|
|
||||||
player.spawnID = spawnID;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PT_STKM2:
|
case PT_STKM2:
|
||||||
{
|
{
|
||||||
if (player2.spwn == 0)
|
if (player2.spwn == 0)
|
||||||
{
|
{
|
||||||
parts[i].life = 100;
|
|
||||||
Element_STKM::STKM_init_legs(this, &player2, i);
|
Element_STKM::STKM_init_legs(this, &player2, i);
|
||||||
player2.spwn = 1;
|
player2.spwn = 1;
|
||||||
player2.rocketBoots = false;
|
player2.rocketBoots = false;
|
||||||
@ -3369,9 +3319,6 @@ int Simulation::create_part(int p, int x, int y, int t, int v)
|
|||||||
parts[i].type = 0;
|
parts[i].type = 0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int spawnID = create_part(-3, x, y, PT_SPAWN2);
|
|
||||||
if (spawnID >= 0)
|
|
||||||
player2.spawnID = spawnID;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PT_FIGH:
|
case PT_FIGH:
|
||||||
@ -3380,7 +3327,6 @@ int Simulation::create_part(int p, int x, int y, int t, int v)
|
|||||||
while (fcount < MAX_FIGHTERS && fighters[fcount].spwn==1) fcount++;
|
while (fcount < MAX_FIGHTERS && fighters[fcount].spwn==1) fcount++;
|
||||||
if (fcount < MAX_FIGHTERS && fighters[fcount].spwn == 0)
|
if (fcount < MAX_FIGHTERS && fighters[fcount].spwn == 0)
|
||||||
{
|
{
|
||||||
parts[i].life = 100;
|
|
||||||
parts[i].tmp = fcount;
|
parts[i].tmp = fcount;
|
||||||
Element_STKM::STKM_init_legs(this, &fighters[fcount], i);
|
Element_STKM::STKM_init_legs(this, &fighters[fcount], i);
|
||||||
fighters[fcount].spwn = 1;
|
fighters[fcount].spwn = 1;
|
||||||
@ -3392,90 +3338,6 @@ int Simulation::create_part(int p, int x, int y, int t, int v)
|
|||||||
parts[i].type=0;
|
parts[i].type=0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
case PT_PHOT:
|
|
||||||
{
|
|
||||||
float a = RNG::Ref().between(0, 7) * 0.78540f;
|
|
||||||
parts[i].life = 680;
|
|
||||||
parts[i].ctype = 0x3FFFFFFF;
|
|
||||||
parts[i].vx = 3.0f*cosf(a);
|
|
||||||
parts[i].vy = 3.0f*sinf(a);
|
|
||||||
if (TYP(pmap[y][x]) == PT_FILT)
|
|
||||||
parts[i].ctype = Element_FILT::interactWavelengths(&parts[ID(pmap[y][x])], parts[i].ctype);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PT_ELEC:
|
|
||||||
{
|
|
||||||
float a = RNG::Ref().between(0, 359) * 3.14159f / 180.0f;
|
|
||||||
parts[i].life = 680;
|
|
||||||
parts[i].vx = 2.0f*cosf(a);
|
|
||||||
parts[i].vy = 2.0f*sinf(a);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PT_NEUT:
|
|
||||||
{
|
|
||||||
float r = RNG::Ref().between(128, 255) / 127.0f;
|
|
||||||
float a = RNG::Ref().between(0, 359) * 3.14159f / 180.0f;
|
|
||||||
parts[i].life = RNG::Ref().between(480, 959);
|
|
||||||
parts[i].vx = r*cosf(a);
|
|
||||||
parts[i].vy = r*sinf(a);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PT_PROT:
|
|
||||||
{
|
|
||||||
float a = RNG::Ref().between(0, 35) * 0.17453f;
|
|
||||||
parts[i].life = 680;
|
|
||||||
parts[i].vx = 2.0f*cosf(a);
|
|
||||||
parts[i].vy = 2.0f*sinf(a);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PT_GRVT:
|
|
||||||
{
|
|
||||||
float a = RNG::Ref().between(0, 359) * 3.14159f / 180.0f;
|
|
||||||
parts[i].life = RNG::Ref().between(250, 449);
|
|
||||||
parts[i].vx = 2.0f*cosf(a);
|
|
||||||
parts[i].vy = 2.0f*sinf(a);
|
|
||||||
parts[i].tmp = 7;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PT_TRON:
|
|
||||||
{
|
|
||||||
int randhue = RNG::Ref().between(0, 359);
|
|
||||||
int randomdir = RNG::Ref().between(0, 3);
|
|
||||||
parts[i].tmp = 1|(randomdir<<5)|(randhue<<7);//set as a head and a direction
|
|
||||||
parts[i].tmp2 = 4;//tail
|
|
||||||
parts[i].life = 5;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PT_LIGH:
|
|
||||||
{
|
|
||||||
float gx, gy, gsize;
|
|
||||||
|
|
||||||
if (v >= 0)
|
|
||||||
{
|
|
||||||
if (v > 55)
|
|
||||||
v = 55;
|
|
||||||
parts[i].life = v;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
parts[i].life = 30;
|
|
||||||
parts[i].temp = parts[i].life*150.0f; // temperature of the lightning shows the power of the lightning
|
|
||||||
GetGravityField(x, y, 1.0f, 1.0f, gx, gy);
|
|
||||||
gsize = gx*gx+gy*gy;
|
|
||||||
if (gsize<0.0016f)
|
|
||||||
{
|
|
||||||
float angle = RNG::Ref().between(0, 6283) * 0.001f;//(in radians, between 0 and 2*pi)
|
|
||||||
gsize = sqrtf(gsize);
|
|
||||||
// randomness in weak gravity fields (more randomness with weaker fields)
|
|
||||||
gx += cosf(angle)*(0.04f-gsize);
|
|
||||||
gy += sinf(angle)*(0.04f-gsize);
|
|
||||||
}
|
|
||||||
parts[i].tmp = (((int)(atan2f(-gy, gx)*(180.0f/M_PI))) + RNG::Ref().between(340, 380)) % 360;
|
|
||||||
parts[i].tmp2 = 4;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PT_FILT:
|
|
||||||
parts[i].tmp = v;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3497,6 +3359,13 @@ int Simulation::create_part(int p, int x, int y, int t, int v)
|
|||||||
colb = colb>255 ? 255 : (colb<0 ? 0 : colb);
|
colb = colb>255 ? 255 : (colb<0 ? 0 : colb);
|
||||||
parts[i].dcolour = (RNG::Ref().between(0, 149)<<24) | (colr<<16) | (colg<<8) | colb;
|
parts[i].dcolour = (RNG::Ref().between(0, 149)<<24) | (colr<<16) | (colg<<8) | colb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set non-static properties (such as randomly generated ones)
|
||||||
|
if (elements[t].Create)
|
||||||
|
{
|
||||||
|
(*(elements[t].Create))(this, i, x, y, t, v);
|
||||||
|
}
|
||||||
|
|
||||||
elementCount[t]++;
|
elementCount[t]++;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ Element_CFLM::Element_CFLM()
|
|||||||
|
|
||||||
Update = NULL;
|
Update = NULL;
|
||||||
Graphics = &Element_CFLM::graphics;
|
Graphics = &Element_CFLM::graphics;
|
||||||
|
Create = &Element_CFLM::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_CFLM static int graphics(GRAPHICS_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_CFLM static int graphics(GRAPHICS_FUNC_ARGS)
|
||||||
@ -67,5 +68,10 @@ int Element_CFLM::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_CFLM static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_CFLM::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
sim->parts[i].life = RNG::Ref().between(50, 199);
|
||||||
|
}
|
||||||
|
|
||||||
Element_CFLM::~Element_CFLM() {}
|
Element_CFLM::~Element_CFLM() {}
|
||||||
|
@ -42,6 +42,7 @@ Element_CLST::Element_CLST()
|
|||||||
|
|
||||||
Update = &Element_CLST::update;
|
Update = &Element_CLST::update;
|
||||||
Graphics = &Element_CLST::graphics;
|
Graphics = &Element_CLST::graphics;
|
||||||
|
Create = &Element_CLST::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_CLST static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_CLST static int update(UPDATE_FUNC_ARGS)
|
||||||
@ -98,5 +99,10 @@ int Element_CLST::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_CLST static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_CLST::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
sim->parts[i].tmp = RNG::Ref().between(0, 6);
|
||||||
|
}
|
||||||
|
|
||||||
Element_CLST::~Element_CLST() {}
|
Element_CLST::~Element_CLST() {}
|
||||||
|
@ -42,6 +42,7 @@ Element_CRMC::Element_CRMC()
|
|||||||
|
|
||||||
Update = &Element_CRMC::update;
|
Update = &Element_CRMC::update;
|
||||||
Graphics = &Element_CRMC::graphics;
|
Graphics = &Element_CRMC::graphics;
|
||||||
|
Create = &Element_CRMC::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_CRMC static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_CRMC static int update(UPDATE_FUNC_ARGS)
|
||||||
@ -62,5 +63,11 @@ int Element_CRMC::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_CRMC static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_CRMC::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
sim->parts[i].tmp2 = RNG::Ref().between(0, 4);
|
||||||
|
}
|
||||||
|
|
||||||
Element_CRMC::~Element_CRMC() {}
|
Element_CRMC::~Element_CRMC() {}
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ Element_ELEC::Element_ELEC()
|
|||||||
|
|
||||||
Update = &Element_ELEC::update;
|
Update = &Element_ELEC::update;
|
||||||
Graphics = &Element_ELEC::graphics;
|
Graphics = &Element_ELEC::graphics;
|
||||||
|
Create = &Element_ELEC::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_ELEC static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_ELEC static int update(UPDATE_FUNC_ARGS)
|
||||||
@ -135,5 +136,13 @@ int Element_ELEC::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_ELEC static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_ELEC::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() {}
|
Element_ELEC::~Element_ELEC() {}
|
||||||
|
@ -52,6 +52,9 @@ public:
|
|||||||
|
|
||||||
int (*Update) (UPDATE_FUNC_ARGS);
|
int (*Update) (UPDATE_FUNC_ARGS);
|
||||||
int (*Graphics) (GRAPHICS_FUNC_ARGS);
|
int (*Graphics) (GRAPHICS_FUNC_ARGS);
|
||||||
|
|
||||||
|
void (*Create)(ELEMENT_CREATE_FUNC_ARGS) = nullptr;
|
||||||
|
|
||||||
bool (*CtypeDraw) (CTYPEDRAW_FUNC_ARGS);
|
bool (*CtypeDraw) (CTYPEDRAW_FUNC_ARGS);
|
||||||
|
|
||||||
VideoBuffer * (*IconGenerator)(int, int, int);
|
VideoBuffer * (*IconGenerator)(int, int, int);
|
||||||
|
@ -42,6 +42,7 @@ Element_FILT::Element_FILT()
|
|||||||
|
|
||||||
Update = NULL;
|
Update = NULL;
|
||||||
Graphics = &Element_FILT::graphics;
|
Graphics = &Element_FILT::graphics;
|
||||||
|
Create = &Element_FILT::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_FILT static int graphics(GRAPHICS_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_FILT static int graphics(GRAPHICS_FUNC_ARGS)
|
||||||
@ -70,6 +71,12 @@ int Element_FILT::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_FILT static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_FILT::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
sim->parts[i].tmp = v;
|
||||||
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_FILT static int interactWavelengths(Particle* cpart, int origWl)
|
//#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)
|
// 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
|
// cpart is the FILT particle, origWl the original wavelengths in the interacting particle
|
||||||
|
@ -45,6 +45,7 @@ Element_FIRE::Element_FIRE()
|
|||||||
|
|
||||||
Update = &Element_FIRE::update;
|
Update = &Element_FIRE::update;
|
||||||
Graphics = &Element_FIRE::graphics;
|
Graphics = &Element_FIRE::graphics;
|
||||||
|
Create = &Element_FIRE::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_FIRE static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_FIRE static int update(UPDATE_FUNC_ARGS)
|
||||||
@ -265,4 +266,10 @@ int Element_FIRE::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_FIRE static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_FIRE::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
sim->parts[i].life = RNG::Ref().between(120, 169);
|
||||||
|
}
|
||||||
|
|
||||||
Element_FIRE::~Element_FIRE() {}
|
Element_FIRE::~Element_FIRE() {}
|
||||||
|
@ -41,6 +41,7 @@ Element_GLAS::Element_GLAS()
|
|||||||
HighTemperatureTransition = PT_LAVA;
|
HighTemperatureTransition = PT_LAVA;
|
||||||
|
|
||||||
Update = &Element_GLAS::update;
|
Update = &Element_GLAS::update;
|
||||||
|
Create = &Element_GLAS::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_GLAS static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_GLAS static int update(UPDATE_FUNC_ARGS)
|
||||||
@ -56,5 +57,10 @@ int Element_GLAS::update(UPDATE_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_GLAS static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_GLAS::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
sim->parts[i].pavg[1] = sim->pv[y/CELL][x/CELL];
|
||||||
|
}
|
||||||
|
|
||||||
Element_GLAS::~Element_GLAS() {}
|
Element_GLAS::~Element_GLAS() {}
|
||||||
|
@ -44,6 +44,7 @@ Element_GRVT::Element_GRVT()
|
|||||||
|
|
||||||
Update = &Element_GRVT::update;
|
Update = &Element_GRVT::update;
|
||||||
Graphics = &Element_GRVT::graphics;
|
Graphics = &Element_GRVT::graphics;
|
||||||
|
Create = &Element_GRVT::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_GRVT static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_GRVT static int update(UPDATE_FUNC_ARGS)
|
||||||
@ -71,4 +72,13 @@ int Element_GRVT::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_GRVT static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_GRVT::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
float a = RNG::Ref().between(0, 359) * 3.14159f / 180.0f;
|
||||||
|
sim->parts[i].life = 250 + RNG::Ref().between(0, 199);
|
||||||
|
sim->parts[i].vx = 2.0f*cosf(a);
|
||||||
|
sim->parts[i].vy = 2.0f*sinf(a);
|
||||||
|
}
|
||||||
|
|
||||||
Element_GRVT::~Element_GRVT() {}
|
Element_GRVT::~Element_GRVT() {}
|
||||||
|
@ -44,6 +44,7 @@ Element_LAVA::Element_LAVA()
|
|||||||
|
|
||||||
Update = &Element_FIRE::update;
|
Update = &Element_FIRE::update;
|
||||||
Graphics = &Element_LAVA::graphics;
|
Graphics = &Element_LAVA::graphics;
|
||||||
|
Create = &Element_LAVA::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -67,5 +68,10 @@ int Element_LAVA::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_LAVA static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_LAVA::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
sim->parts[i].life = RNG::Ref().between(240, 359);
|
||||||
|
}
|
||||||
|
|
||||||
Element_LAVA::~Element_LAVA() {}
|
Element_LAVA::~Element_LAVA() {}
|
||||||
|
@ -47,8 +47,9 @@ Element_LIFE::Element_LIFE()
|
|||||||
|
|
||||||
Update = NULL;
|
Update = NULL;
|
||||||
Graphics = &Element_LIFE::graphics;
|
Graphics = &Element_LIFE::graphics;
|
||||||
|
Create = &Element_LIFE::create;
|
||||||
|
|
||||||
if(!Element_GOL_colourInit)
|
if (!Element_GOL_colourInit)
|
||||||
{
|
{
|
||||||
Element_GOL_colourInit = true;
|
Element_GOL_colourInit = true;
|
||||||
|
|
||||||
@ -120,5 +121,14 @@ int Element_LIFE::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_LIFE static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_LIFE::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
if (v >= 0 && v < NGOL)
|
||||||
|
{
|
||||||
|
sim->parts[i].tmp = sim->grule[v+1][9] - 1;
|
||||||
|
sim->parts[i].ctype = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Element_LIFE::~Element_LIFE() {}
|
Element_LIFE::~Element_LIFE() {}
|
||||||
|
@ -43,6 +43,7 @@ Element_LIGH::Element_LIGH()
|
|||||||
|
|
||||||
Update = &Element_LIGH::update;
|
Update = &Element_LIGH::update;
|
||||||
Graphics = &Element_LIGH::graphics;
|
Graphics = &Element_LIGH::graphics;
|
||||||
|
Create = &Element_LIGH::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LIGHTING_POWER 0.65
|
#define LIGHTING_POWER 0.65
|
||||||
@ -376,5 +377,31 @@ int Element_LIGH::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_LIGH static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_LIGH::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
float gx, gy, gsize;
|
||||||
|
if (v >= 0)
|
||||||
|
{
|
||||||
|
if (v > 55)
|
||||||
|
v = 55;
|
||||||
|
sim->parts[i].life = v;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sim->parts[i].life = 30;
|
||||||
|
sim->parts[i].temp = sim->parts[i].life * 150.0f; // temperature of the lightning shows the power of the lightning
|
||||||
|
sim->GetGravityField(x, y, 1.0f, 1.0f, gx, gy);
|
||||||
|
gsize = gx * gx + gy * gy;
|
||||||
|
if (gsize < 0.0016f)
|
||||||
|
{
|
||||||
|
float angle = RNG::Ref().between(0, 6283) * 0.001f; //(in radians, between 0 and 2*pi)
|
||||||
|
gsize = sqrtf(gsize);
|
||||||
|
// randomness in weak gravity fields (more randomness with weaker fields)
|
||||||
|
gx += cosf(angle) * (0.04f - gsize);
|
||||||
|
gy += sinf(angle) * (0.04f - gsize);
|
||||||
|
}
|
||||||
|
sim->parts[i].tmp = (static_cast<int>(atan2f(-gy, gx) * (180.0f / M_PI)) + RNG::Ref().between(-20, 20) + 360) % 360;
|
||||||
|
sim->parts[i].tmp2 = 4;
|
||||||
|
}
|
||||||
|
|
||||||
Element_LIGH::~Element_LIGH() {}
|
Element_LIGH::~Element_LIGH() {}
|
||||||
|
@ -43,6 +43,7 @@ Element_NEUT::Element_NEUT()
|
|||||||
|
|
||||||
Update = &Element_NEUT::update;
|
Update = &Element_NEUT::update;
|
||||||
Graphics = &Element_NEUT::graphics;
|
Graphics = &Element_NEUT::graphics;
|
||||||
|
Create = &Element_NEUT::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_NEUT static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_NEUT static int update(UPDATE_FUNC_ARGS)
|
||||||
@ -196,6 +197,16 @@ int Element_NEUT::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_NEUT static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_NEUT::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
float r = RNG::Ref().between(128, 255) / 127.0f;
|
||||||
|
float a = RNG::Ref().between(0, 359) * 3.14159f / 180.0f;
|
||||||
|
sim->parts[i].life = RNG::Ref().between(480, 959);
|
||||||
|
sim->parts[i].vx = r * cosf(a);
|
||||||
|
sim->parts[i].vy = r * sinf(a);
|
||||||
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_NEUT static int DeutExplosion(Simulation * sim, int n, int x, int y, float temp, int t)
|
//#TPT-Directive ElementHeader Element_NEUT static int DeutExplosion(Simulation * sim, int n, int x, int y, float temp, int t)
|
||||||
int Element_NEUT::DeutExplosion(Simulation * sim, int n, int x, int y, float temp, int t)//testing a new deut create part
|
int Element_NEUT::DeutExplosion(Simulation * sim, int n, int x, int y, float temp, int t)//testing a new deut create part
|
||||||
{
|
{
|
||||||
|
@ -46,6 +46,7 @@ Element_PHOT::Element_PHOT()
|
|||||||
|
|
||||||
Update = &Element_PHOT::update;
|
Update = &Element_PHOT::update;
|
||||||
Graphics = &Element_PHOT::graphics;
|
Graphics = &Element_PHOT::graphics;
|
||||||
|
Create = &Element_PHOT::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_PHOT static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_PHOT static int update(UPDATE_FUNC_ARGS)
|
||||||
@ -144,5 +145,14 @@ int Element_PHOT::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_PHOT static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_PHOT::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
float a = RNG::Ref().between(0, 7) * 0.78540f;
|
||||||
|
sim->parts[i].vx = 3.0f * cosf(a);
|
||||||
|
sim->parts[i].vy = 3.0f * sinf(a);
|
||||||
|
if (TYP(sim->pmap[y][x]) == PT_FILT)
|
||||||
|
sim->parts[i].ctype = Element_FILT::interactWavelengths(&sim->parts[ID(sim->pmap[y][x])], sim->parts[i].ctype);
|
||||||
|
}
|
||||||
|
|
||||||
Element_PHOT::~Element_PHOT() {}
|
Element_PHOT::~Element_PHOT() {}
|
||||||
|
@ -43,6 +43,7 @@ Element_PLSM::Element_PLSM()
|
|||||||
|
|
||||||
Update = &Element_FIRE::update;
|
Update = &Element_FIRE::update;
|
||||||
Graphics = &Element_PLSM::graphics;
|
Graphics = &Element_PLSM::graphics;
|
||||||
|
Create = &Element_PLSM::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_PLSM static int graphics(GRAPHICS_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_PLSM static int graphics(GRAPHICS_FUNC_ARGS)
|
||||||
@ -65,5 +66,10 @@ int Element_PLSM::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_PLSM static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_PLSM::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
sim->parts[i].life = RNG::Ref().between(50, 199);
|
||||||
|
}
|
||||||
|
|
||||||
Element_PLSM::~Element_PLSM() {}
|
Element_PLSM::~Element_PLSM() {}
|
||||||
|
@ -42,6 +42,13 @@ Element_PQRT::Element_PQRT()
|
|||||||
|
|
||||||
Update = &Element_QRTZ::update;
|
Update = &Element_QRTZ::update;
|
||||||
Graphics = &Element_QRTZ::graphics;
|
Graphics = &Element_QRTZ::graphics;
|
||||||
|
Create = &Element_PQRT::create;
|
||||||
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_PQRT static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_PQRT::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
sim->parts[i].tmp2 = RNG::Ref().between(0, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
Element_PQRT::~Element_PQRT() {}
|
Element_PQRT::~Element_PQRT() {}
|
||||||
|
@ -44,6 +44,7 @@ Element_PROT::Element_PROT()
|
|||||||
|
|
||||||
Update = &Element_PROT::update;
|
Update = &Element_PROT::update;
|
||||||
Graphics = &Element_PROT::graphics;
|
Graphics = &Element_PROT::graphics;
|
||||||
|
Create = &Element_PROT::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_PROT static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_PROT static int update(UPDATE_FUNC_ARGS)
|
||||||
@ -204,4 +205,13 @@ int Element_PROT::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_PROT static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_PROT::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
float a = RNG::Ref().between(0, 35) * 0.17453f;
|
||||||
|
sim->parts[i].life = 680;
|
||||||
|
sim->parts[i].vx = 2.0f * cosf(a);
|
||||||
|
sim->parts[i].vy = 2.0f * sinf(a);
|
||||||
|
}
|
||||||
|
|
||||||
Element_PROT::~Element_PROT() {}
|
Element_PROT::~Element_PROT() {}
|
||||||
|
@ -42,6 +42,7 @@ Element_QRTZ::Element_QRTZ()
|
|||||||
|
|
||||||
Update = &Element_QRTZ::update;
|
Update = &Element_QRTZ::update;
|
||||||
Graphics = &Element_QRTZ::graphics;
|
Graphics = &Element_QRTZ::graphics;
|
||||||
|
Create = &Element_QRTZ::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_QRTZ static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_QRTZ static int update(UPDATE_FUNC_ARGS)
|
||||||
@ -155,5 +156,11 @@ int Element_QRTZ::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_QRTZ static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_QRTZ::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
sim->parts[i].tmp2 = RNG::Ref().between(0, 10);
|
||||||
|
sim->parts[i].pavg[1] = sim->pv[y/CELL][x/CELL];
|
||||||
|
}
|
||||||
|
|
||||||
Element_QRTZ::~Element_QRTZ() {}
|
Element_QRTZ::~Element_QRTZ() {}
|
||||||
|
@ -41,6 +41,7 @@ Element_SING::Element_SING()
|
|||||||
HighTemperatureTransition = NT;
|
HighTemperatureTransition = NT;
|
||||||
|
|
||||||
Update = &Element_SING::update;
|
Update = &Element_SING::update;
|
||||||
|
Create = &Element_SING::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_SING static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_SING static int update(UPDATE_FUNC_ARGS)
|
||||||
@ -140,5 +141,10 @@ int Element_SING::update(UPDATE_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_SING static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_SING::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
sim->parts[i].life = RNG::Ref().between(60, 109);
|
||||||
|
}
|
||||||
|
|
||||||
Element_SING::~Element_SING() {}
|
Element_SING::~Element_SING() {}
|
||||||
|
@ -46,11 +46,11 @@ Element_STKM::Element_STKM()
|
|||||||
|
|
||||||
Update = &Element_STKM::update;
|
Update = &Element_STKM::update;
|
||||||
Graphics = &Element_STKM::graphics;
|
Graphics = &Element_STKM::graphics;
|
||||||
|
Create = &Element_STKM::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_STKM static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_STKM static int update(UPDATE_FUNC_ARGS)
|
||||||
int Element_STKM::update(UPDATE_FUNC_ARGS)
|
int Element_STKM::update(UPDATE_FUNC_ARGS)
|
||||||
|
|
||||||
{
|
{
|
||||||
run_stickman(&sim->player, UPDATE_FUNC_SUBCALL_ARGS);
|
run_stickman(&sim->player, UPDATE_FUNC_SUBCALL_ARGS);
|
||||||
return 0;
|
return 0;
|
||||||
@ -66,6 +66,14 @@ int Element_STKM::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_STKM static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_STKM::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
int spawnID = sim->create_part(-3, x, y, PT_SPAWN);
|
||||||
|
if (spawnID >= 0)
|
||||||
|
sim->player.spawnID = spawnID;
|
||||||
|
}
|
||||||
|
|
||||||
#define INBOND(x, y) ((x)>=0 && (y)>=0 && (x)<XRES && (y)<YRES)
|
#define INBOND(x, y) ((x)>=0 && (y)>=0 && (x)<XRES && (y)<YRES)
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_STKM static int run_stickman(playerst *playerp, UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_STKM static int run_stickman(playerst *playerp, UPDATE_FUNC_ARGS)
|
||||||
|
@ -46,6 +46,7 @@ Element_STKM2::Element_STKM2()
|
|||||||
|
|
||||||
Update = &Element_STKM2::update;
|
Update = &Element_STKM2::update;
|
||||||
Graphics = &Element_STKM::graphics;
|
Graphics = &Element_STKM::graphics;
|
||||||
|
Create = &Element_STKM2::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_STKM2 static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_STKM2 static int update(UPDATE_FUNC_ARGS)
|
||||||
@ -55,4 +56,12 @@ int Element_STKM2::update(UPDATE_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_STKM2 static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_STKM2::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
int spawnID = sim->create_part(-3, x, y, PT_SPAWN2);
|
||||||
|
if (spawnID >= 0)
|
||||||
|
sim->player2.spawnID = spawnID;
|
||||||
|
}
|
||||||
|
|
||||||
Element_STKM2::~Element_STKM2() {}
|
Element_STKM2::~Element_STKM2() {}
|
||||||
|
@ -41,6 +41,18 @@ Element_TESC::Element_TESC()
|
|||||||
HighTemperatureTransition = NT;
|
HighTemperatureTransition = NT;
|
||||||
|
|
||||||
Update = NULL;
|
Update = NULL;
|
||||||
|
Create = &Element_TESC::create;
|
||||||
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_TESC static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_TESC::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
if (v >= 0)
|
||||||
|
{
|
||||||
|
sim->parts[i].tmp = v;
|
||||||
|
if (sim->parts[i].tmp > 300)
|
||||||
|
sim->parts[i].tmp = 300;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Element_TESC::~Element_TESC() {}
|
Element_TESC::~Element_TESC() {}
|
||||||
|
@ -43,6 +43,7 @@ Element_TRON::Element_TRON()
|
|||||||
|
|
||||||
Update = &Element_TRON::update;
|
Update = &Element_TRON::update;
|
||||||
Graphics = &Element_TRON::graphics;
|
Graphics = &Element_TRON::graphics;
|
||||||
|
Create = &Element_TRON::create;
|
||||||
|
|
||||||
Element_TRON::init_graphics();
|
Element_TRON::init_graphics();
|
||||||
}
|
}
|
||||||
@ -158,8 +159,6 @@ int Element_TRON::update(UPDATE_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_TRON static int graphics(GRAPHICS_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_TRON static int graphics(GRAPHICS_FUNC_ARGS)
|
||||||
int Element_TRON::graphics(GRAPHICS_FUNC_ARGS)
|
int Element_TRON::graphics(GRAPHICS_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
@ -186,6 +185,18 @@ int Element_TRON::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_TRON static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_TRON::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
int randhue = RNG::Ref().between(0, 359);
|
||||||
|
int randomdir = RNG::Ref().between(0, 3);
|
||||||
|
// Set as a head and a direction
|
||||||
|
sim->parts[i].tmp = 1 | (randomdir << 5) | (randhue << 7);
|
||||||
|
// Tail
|
||||||
|
sim->parts[i].tmp2 = 4;
|
||||||
|
sim->parts[i].life = 5;
|
||||||
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_TRON static int new_tronhead(Simulation * sim, int x, int y, int i, int direction)
|
//#TPT-Directive ElementHeader Element_TRON static int new_tronhead(Simulation * sim, int x, int y, int i, int direction)
|
||||||
int Element_TRON::new_tronhead(Simulation * sim, int x, int y, int i, int direction)
|
int Element_TRON::new_tronhead(Simulation * sim, int x, int y, int i, int direction)
|
||||||
{
|
{
|
||||||
|
@ -42,6 +42,7 @@ Element_WARP::Element_WARP()
|
|||||||
|
|
||||||
Update = &Element_WARP::update;
|
Update = &Element_WARP::update;
|
||||||
Graphics = &Element_WARP::graphics;
|
Graphics = &Element_WARP::graphics;
|
||||||
|
Create = &Element_WARP::create;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_WARP static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_WARP static int update(UPDATE_FUNC_ARGS)
|
||||||
@ -90,4 +91,10 @@ int Element_WARP::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#TPT-Directive ElementHeader Element_WARP static void create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
void Element_WARP::create(ELEMENT_CREATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
sim->parts[i].life = RNG::Ref().between(70, 164);
|
||||||
|
}
|
||||||
|
|
||||||
Element_WARP::~Element_WARP() {}
|
Element_WARP::~Element_WARP() {}
|
||||||
|
Reference in New Issue
Block a user