Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/simulation/elements/BACT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ void Element::Element_BACT()

static int update(UPDATE_FUNC_ARGS)
{
int r, rx, ry;
short r, rx, ry;

rx = RNG::Ref().between(-2, 2);
ry = RNG::Ref().between(-2, 2);
rx = RNG::Ref().between(-2, 2);
ry = RNG::Ref().between(-2, 2);

// O2 use itself (made very slow for somewhat accuracy)
if (RNG::Ref().chance(1, 1000)){
Expand All @@ -71,8 +71,8 @@ static int update(UPDATE_FUNC_ARGS)
{
r = pmap[y+ry][x+rx];

int t = TYP(r);
int ir = ID(r);
short t = TYP(r);
short ir = ID(r);

if (r){
// Steal O2 and offload CO2
Expand Down Expand Up @@ -131,8 +131,8 @@ static int update(UPDATE_FUNC_ARGS)
&& BOUNDS_CHECK && (rx || ry))
{
r = pmap[y+ry][x+rx];
int t = TYP(r);
int ir = ID(r);
short t = TYP(r);
short ir = ID(r);

// Empty
if (t == 0){
Expand All @@ -157,14 +157,14 @@ static int update(UPDATE_FUNC_ARGS)
static int graphics(GRAPHICS_FUNC_ARGS)
{
// Oxygen
int o = cpart->bio.o2;
short o = cpart->bio.o2;

// C02
int c = cpart->bio.co2;
short c = cpart->bio.co2;

int q = cpart->bio.o2;
//short q = cpart->bio.o2;

int d = o - c;
short d = o - c;


*colr = (int)fmin(d, 20) * 2;
Expand Down
14 changes: 7 additions & 7 deletions src/simulation/elements/BLD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void Element::Element_BLD()

static int update(UPDATE_FUNC_ARGS)
{
int r, rx, ry;
short r, rx, ry;

rx = RNG::Ref().between(-2, 2);
ry = RNG::Ref().between(-2, 2);
Expand All @@ -69,8 +69,8 @@ static int update(UPDATE_FUNC_ARGS)
{
r = pmap[y+ry][x+rx];

int t = TYP(r);
int ir = ID(r);
short t = TYP(r);
short ir = ID(r);

if (r){
// Oxygen collection
Expand Down Expand Up @@ -141,7 +141,7 @@ static int update(UPDATE_FUNC_ARGS)
if (RNG::Ref().chance(1, 100)){
// convert biology to tumor (grow)
if (sim->elements[TYP(r)].Properties & TYPE_BIO && TYP(r) != PT_TUMOR){
int ir = ID(r);
short ir = ID(r);
sim->part_change_type(ir, parts[ir].x, parts[ir].y, PT_TUMOR);
}
}
Expand All @@ -152,13 +152,13 @@ static int update(UPDATE_FUNC_ARGS)

static int graphics(GRAPHICS_FUNC_ARGS)
{
// o and c can be delcared as short as both bio.o2 and bio.co2 do not go over 32768
// Oxygen
int o = cpart->bio.o2;
short o = cpart->bio.o2;

// C02
int c = cpart->bio.co2;
short c = cpart->bio.co2;

int q = cpart->bio.o2;
*colr = (int)fmax(9 * o, 75);
*colg = 0;
*colb = 8 * c;
Expand Down
5 changes: 3 additions & 2 deletions src/simulation/elements/BVES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ int Element_BVES_update(UPDATE_FUNC_ARGS)
if (!r)
{
// BRCK border
int index = sim->create_part(-1,x+rx,y+ry,PT_MEAT);
//int index = sim->create_part(-1,x+rx,y+ry,PT_MEAT);
}
}
}
Expand Down Expand Up @@ -575,7 +575,8 @@ static void transfer_bves_to_bves(Particle *src, Particle *dest, bool STOR)

static void pushParticle(Simulation * sim, int i, int count, int original)
{
int rndstore, rnd, rx, ry, r, x, y, np, q;
int rndstore, rnd, x, y, np, q;
short rx, ry, r;
unsigned int notctype = nextColor(sim->parts[i].tmp);
if (!TYP(sim->parts[i].ctype) || count >= 2)//don't push if there is nothing there, max speed of 2 per frame
return;
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/elements/GGOO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void Element::Element_GGOO()

static int update(UPDATE_FUNC_ARGS)
{
int r, rx, ry;
short r, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (BOUNDS_CHECK && (rx || ry))
Expand Down
12 changes: 6 additions & 6 deletions src/simulation/elements/LUNG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void Element::Element_LUNG()

static int update(UPDATE_FUNC_ARGS)
{
int r, rx, ry;
short r, rx, ry;

rx = RNG::Ref().between(-2, 2);
ry = RNG::Ref().between(-2, 2);
Expand All @@ -69,7 +69,7 @@ static int update(UPDATE_FUNC_ARGS)
if (BOUNDS_CHECK && (rx || ry))
{
r = pmap[y+ry][x+rx];
int ir = ID(r);
short ir = ID(r);

if (r) {
// Oxygen collection (more efficient than BLD)
Expand Down Expand Up @@ -146,14 +146,14 @@ static int update(UPDATE_FUNC_ARGS)
static int graphics(GRAPHICS_FUNC_ARGS)
{
// Oxygen
int o = cpart->bio.o2;
unsigned char o = cpart->bio.o2;

// C02
int c = cpart->bio.co2;
//unsigned char c = cpart->bio.co2;

*colr = (int)fmax(7 * o, 100);
*colr = (short)fmax(7 * o, 100);
*colg = 0;
*colb = (int)fmax(7 * o, 60);
*colb = (short)fmax(7 * o, 60);
*pixel_mode |= PMODE_BLUR;

*colr = int(*colr * (cpart->bio.health) / 100.0f);
Expand Down
16 changes: 9 additions & 7 deletions src/simulation/elements/MEAT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ void Element::Element_MEAT()
static int update(UPDATE_FUNC_ARGS)
{
int r, rx, ry;
int rad = parts[i].tmp;
int max_health = parts[i].tmp2;

//int rad = parts[i].tmp;
//int max_health = parts[i].tmp2;

rx = RNG::Ref().between(-2, 2);
ry = RNG::Ref().between(-2, 2);
Expand All @@ -77,7 +78,7 @@ static int update(UPDATE_FUNC_ARGS)
if (RNG::Ref().chance(1, 2)){
// Diffuse among bio
if (sim->elements[TYP(r)].Properties & TYPE_BIO && TYP(r) != PT_BLD){
int ir = ID(r);
short ir = ID(r);

if (parts[i].bio.o2 > parts[ir].bio.o2){
parts[i].bio.o2--;
Expand Down Expand Up @@ -132,14 +133,15 @@ static int update(UPDATE_FUNC_ARGS)
static int graphics(GRAPHICS_FUNC_ARGS)
{
// Oxygen
int o = cpart->bio.o2;
unsigned char o = cpart->bio.o2;

// C02
int c = cpart->bio.co2;
//wasn't used, just commented it out just incase
//unsigned char c = cpart->bio.co2;

*colr = (int)fmax(7 * o, 100);
*colr = (short)fmax(7 * o, 100);
*colg = 0;
*colb = (int)fmax(3 * o, 30);
*colb = (short)fmax(3 * o, 30);
*pixel_mode |= PMODE_BLUR;

// Life mix
Expand Down
4 changes: 2 additions & 2 deletions src/simulation/elements/NEUR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void Element::Element_NEUR()
static int update(UPDATE_FUNC_ARGS)
{

int r, nnx, nny, rx, ry;
int r,/* nnx, nny,*/ rx, ry;

// O2 use by neuron itself
if (RNG::Ref().chance(1, 100)){
Expand All @@ -74,7 +74,7 @@ static int update(UPDATE_FUNC_ARGS)
if (RNG::Ref().chance(1, 2)){
// Diffuse among bio
if (sim->elements[TYP(r)].Properties & TYPE_BIO && TYP(r) != PT_BLD){
int ir = ID(r);
short ir = ID(r);

if (parts[i].bio.o2 > parts[ir].bio.o2){
parts[i].bio.o2--;
Expand Down
8 changes: 4 additions & 4 deletions src/simulation/elements/PSN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static int update(UPDATE_FUNC_ARGS)
rx = RNG::Ref().between(-2, 2);
ry = RNG::Ref().between(-2, 2);
r = pmap[y+ry][x+rx];
int ir = ID(r);
short ir = ID(r);
if (sim->elements[TYP(r)].Properties & TYPE_BIO){
parts[ir].bio.health -= parts[i].tmp;
parts[i].life--;
Expand All @@ -72,12 +72,12 @@ static int update(UPDATE_FUNC_ARGS)
static int graphics(GRAPHICS_FUNC_ARGS)
{
// Oxygen
int o = cpart->tmp;
unsigned char o = cpart->tmp;

// C02
int c = cpart->bio.co2;
//unsigned char c = cpart->bio.co2;

int q = cpart->bio.o2;
//unsigned char q = cpart->bio.o2;
*colr = 0;
*colg = (int)fmax(9 * o, 75);;
*colb = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/simulation/elements/SKIND.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void Element::Element_SKIND()

static int update(UPDATE_FUNC_ARGS)
{
int r, nnx, nny, rx, ry;
short r,/* nnx, nny,*/ rx, ry;

// O2 use by skin itself
if (RNG::Ref().chance(1, 150)){
Expand All @@ -73,7 +73,7 @@ static int update(UPDATE_FUNC_ARGS)
if (RNG::Ref().chance(1, 2)){
// Diffuse among bio
if (sim->elements[TYP(r)].Properties & TYPE_BIO && TYP(r) != PT_BLD){
int ir = ID(r);
short ir = ID(r);

if (parts[i].bio.o2 > parts[ir].bio.o2){
parts[i].bio.o2--;
Expand Down
5 changes: 3 additions & 2 deletions src/simulation/elements/SKINE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ void Element::Element_SKINE()

static int update(UPDATE_FUNC_ARGS)
{
int r, nnx, nny, rx, ry;
//r, rx, and ry can be short as all values are under 32768, may change to signed char later
short r,/* nnx, nny,*/ rx, ry;

// O2 use by skin itself
if (RNG::Ref().chance(1, 150)){
Expand All @@ -73,7 +74,7 @@ int r, nnx, nny, rx, ry;
if (RNG::Ref().chance(1, 2)){
// Diffuse among bio
if (sim->elements[TYP(r)].Properties & TYPE_BIO && TYP(r) != PT_BLD){
int ir = ID(r);
short ir = ID(r);

if (parts[i].bio.o2 > parts[ir].bio.o2){
parts[i].bio.o2--;
Expand Down
17 changes: 6 additions & 11 deletions src/simulation/elements/SKINS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,11 @@ void Element::Element_SKINS()
Graphics = &graphics;
}

static int update(UPDATE_FUNC_ARGS)
{

int r, nnx, nny, rx, ry;
static int update(UPDATE_FUNC_ARGS){
short r,/* nnx, nny,*/ rx, ry;

// O2 use by skin itself
if (RNG::Ref().chance(1, 150)){

if (parts[i].bio.o2 > 0){
parts[i].bio.o2 -= 1;
parts[i].bio.co2 += 1;
Expand All @@ -67,14 +64,13 @@ static int update(UPDATE_FUNC_ARGS)
ry = RNG::Ref().between(-2, 2);

// Resource diffuse
if (BOUNDS_CHECK && (rx || ry))
{
if (BOUNDS_CHECK && (rx || ry)) {
r = pmap[y+ry][x+rx];
if (r) {
if (RNG::Ref().chance(1, 2)){
// Diffuse among bio
if (sim->elements[TYP(r)].Properties & TYPE_BIO && TYP(r) != PT_BLD){
int ir = ID(r);
short ir = ID(r);

if (parts[i].bio.o2 > parts[ir].bio.o2){
parts[i].bio.o2--;
Expand All @@ -93,8 +89,7 @@ static int update(UPDATE_FUNC_ARGS)
if (parts[i].bio.o2 > 10){
// Growth check

if (BOUNDS_CHECK && (rx || ry))
{
if (BOUNDS_CHECK && (rx || ry)){
bool f_meat = 0;

for (rx=-2; rx<3; rx++){
Expand All @@ -103,7 +98,7 @@ static int update(UPDATE_FUNC_ARGS)

for (ry=-2; ry<3; ry++){

if (f_meat) break;
if (f_meat) {break;};

r = pmap[y+ry][x+rx];
if (r){
Expand Down
4 changes: 2 additions & 2 deletions src/simulation/elements/THOR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ void Element::Element_THOR()

static int update(UPDATE_FUNC_ARGS)
{

int r, rx, ry, rt;
//why was rt even here if unused?, has been commented out
short r, rx, ry/*, rt*/;
for (rx = -1; rx < 2; rx++) {
for (ry = -1; ry < 2; ry++) {
if (BOUNDS_CHECK) {
Expand Down
Loading