summaryrefslogtreecommitdiff
path: root/src/simulation
diff options
context:
space:
mode:
Diffstat (limited to 'src/simulation')
-rw-r--r--src/simulation/Elements.h9
-rw-r--r--src/simulation/GOLMenu.h8
-rw-r--r--src/simulation/MenuSection.h12
-rw-r--r--src/simulation/Particle.cpp7
-rw-r--r--src/simulation/Particle.h14
-rw-r--r--src/simulation/SaveRenderer.cpp20
-rw-r--r--src/simulation/SaveRenderer.h7
-rw-r--r--src/simulation/Sign.cpp7
-rw-r--r--src/simulation/Sign.h12
-rw-r--r--src/simulation/Simulation.cpp10
-rw-r--r--src/simulation/Simulation.h9
-rw-r--r--src/simulation/SimulationData.cpp6
-rw-r--r--src/simulation/SimulationData.h7
-rw-r--r--src/simulation/Stickman.h (renamed from src/simulation/Player.h)12
-rw-r--r--src/simulation/StructProperty.h12
-rw-r--r--src/simulation/WallType.h12
-rw-r--r--src/simulation/elements/BCLN.cpp2
-rw-r--r--src/simulation/elements/CLNE.cpp2
-rw-r--r--src/simulation/elements/CONV.cpp2
-rw-r--r--src/simulation/elements/CRAY.cpp4
-rw-r--r--src/simulation/elements/PBCN.cpp2
-rw-r--r--src/simulation/elements/PCLN.cpp2
22 files changed, 33 insertions, 145 deletions
diff --git a/src/simulation/Elements.h b/src/simulation/Elements.h
index b019ac4..e0dfcee 100644
--- a/src/simulation/Elements.h
+++ b/src/simulation/Elements.h
@@ -1,10 +1,3 @@
-/*
- * Elements.h
- *
- * Created on: Jan 5, 2012
- * Author: Simon
- */
-
#ifndef ELEMENTS_H_
#define ELEMENTS_H_
@@ -35,7 +28,7 @@
#define PROP_LIFE_KILL 0x08000 //2^15 Kill when life value is <= zero
#define PROP_LIFE_KILL_DEC 0x10000 //2^16 Kill when life value is decremented to <= zero
#define PROP_SPARKSETTLE 0x20000 //2^17 Allow Sparks/Embers to settle
-#define PROP_NOAMBHEAT 0x40000 //2^18 Don't transfer or receive heat from ambient heat.
+#define PROP_NOAMBHEAT 0x40000 //2^18 Don't transfer or receive heat from ambient heat.
#define FLAG_STAGNANT 0x1
#define FLAG_SKIPMOVE 0x2 // skip movement for one frame, only implemented for PHOT
diff --git a/src/simulation/GOLMenu.h b/src/simulation/GOLMenu.h
index 36bb5dd..9054313 100644
--- a/src/simulation/GOLMenu.h
+++ b/src/simulation/GOLMenu.h
@@ -1,11 +1,3 @@
-//
-// GOLMenu.h
-// The Powder Toy
-//
-// Created by Simon Robertshaw on 04/06/2012.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
#ifndef The_Powder_Toy_GOLMenu_h
#define The_Powder_Toy_GOLMenu_h
diff --git a/src/simulation/MenuSection.h b/src/simulation/MenuSection.h
index b8e16fe..12b1ba6 100644
--- a/src/simulation/MenuSection.h
+++ b/src/simulation/MenuSection.h
@@ -1,13 +1,5 @@
-//
-// MenuSection.h
-// The Powder Toy
-//
-// Created by Simon Robertshaw on 04/06/2012.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-#ifndef The_Powder_Toy_MenuSection_h
-#define The_Powder_Toy_MenuSection_h
+#ifndef MENUSECTION_H_
+#define MENUSECTION_H_
struct menu_section
{
diff --git a/src/simulation/Particle.cpp b/src/simulation/Particle.cpp
index 115ed95..19089a1 100644
--- a/src/simulation/Particle.cpp
+++ b/src/simulation/Particle.cpp
@@ -1,10 +1,3 @@
-/*
- * Particle.cpp
- *
- * Created on: Jun 6, 2012
- * Author: Simon
- */
-
#include <cstddef>
#include "Particle.h"
diff --git a/src/simulation/Particle.h b/src/simulation/Particle.h
index bb0297e..fbb5988 100644
--- a/src/simulation/Particle.h
+++ b/src/simulation/Particle.h
@@ -1,13 +1,5 @@
-//
-// Particle.h
-// The Powder Toy
-//
-// Created by Simon Robertshaw on 04/06/2012.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-#ifndef The_Powder_Toy_Particle_h
-#define The_Powder_Toy_Particle_h
+#ifndef PARTICLE_H_
+#define PARTICLE_H_
#include <vector>
#include "StructProperty.h"
@@ -24,7 +16,7 @@ struct Particle
int tmp2;
unsigned int dcolour;
/** Returns a list of properties, their type and offset within the structure that can be changed
- by higher-level processes refering to them by name such as Lua or the property tool **/
+ by higher-level processes referring to them by name such as Lua or the property tool **/
static std::vector<StructProperty> GetProperties();
};
diff --git a/src/simulation/SaveRenderer.cpp b/src/simulation/SaveRenderer.cpp
index fc30a28..283ab10 100644
--- a/src/simulation/SaveRenderer.cpp
+++ b/src/simulation/SaveRenderer.cpp
@@ -1,10 +1,3 @@
-/*
- * SaveRenderer.cpp
- *
- * Created on: Apr 3, 2012
- * Author: Simon
- */
-
#include "SaveRenderer.h"
#include "client/GameSave.h"
#include "graphics/Graphics.h"
@@ -61,11 +54,11 @@ Thumbnail * SaveRenderer::Render(GameSave * save, bool decorations, bool fire)
glTranslated(0, MENUSIZE, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
- glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
-
- ren->clearScreen(1.0f);
- ren->ClearAccumulation();
+ glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ ren->clearScreen(1.0f);
+ ren->ClearAccumulation();
#ifdef OGLR
ren->RenderBegin();
@@ -120,7 +113,7 @@ Thumbnail * SaveRenderer::Render(GameSave * save, bool decorations, bool fire)
pixel * dst;
pixel * src = g->vid;
- ren->ClearAccumulation();
+ ren->ClearAccumulation();
if (fire)
{
@@ -178,6 +171,5 @@ Thumbnail * SaveRenderer::Render(unsigned char * saveData, int dataSize, bool de
}
SaveRenderer::~SaveRenderer() {
- // TODO Auto-generated destructor stub
}
diff --git a/src/simulation/SaveRenderer.h b/src/simulation/SaveRenderer.h
index be4a83b..7570bb7 100644
--- a/src/simulation/SaveRenderer.h
+++ b/src/simulation/SaveRenderer.h
@@ -1,10 +1,3 @@
-/*
- * SaveRenderer.h
- *
- * Created on: Apr 3, 2012
- * Author: Simon
- */
-
#ifndef SAVERENDERER_H_
#define SAVERENDERER_H_
#ifdef OGLI
diff --git a/src/simulation/Sign.cpp b/src/simulation/Sign.cpp
index 82d9a18..57d98bc 100644
--- a/src/simulation/Sign.cpp
+++ b/src/simulation/Sign.cpp
@@ -1,10 +1,3 @@
-/*
- * Sign.cpp
- *
- * Created on: Jun 25, 2012
- * Author: Simon
- */
-
#include "Sign.h"
#include "graphics/Graphics.h"
#include "simulation/Simulation.h"
diff --git a/src/simulation/Sign.h b/src/simulation/Sign.h
index 1b45c25..4d15b02 100644
--- a/src/simulation/Sign.h
+++ b/src/simulation/Sign.h
@@ -1,13 +1,5 @@
-//
-// Sign.h
-// The Powder Toy
-//
-// Created by Simon Robertshaw on 04/06/2012.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-#ifndef The_Powder_Toy_Sign_h
-#define The_Powder_Toy_Sign_h
+#ifndef SIGN_H_
+#define SIGN_H_
#include <string>
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index 44932b5..b6f4f84 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -2847,18 +2847,18 @@ int Simulation::create_part(int p, int x, int y, int tv)
)
{
parts[pmap[y][x]>>8].ctype = t;
- if (t == PT_LIFE && v < NGOLALT && drawOn != PT_STOR) parts[pmap[y][x]>>8].tmp = v;
+ if (t == PT_LIFE && v < NGOL && drawOn != PT_STOR) parts[pmap[y][x]>>8].tmp = v;
}
else if ((drawOn == PT_DTEC || (drawOn == PT_PSTN && t != PT_FRME)) && drawOn != t)
{
parts[pmap[y][x]>>8].ctype = t;
- if (drawOn == PT_DTEC && t==PT_LIFE && v<NGOLALT)
+ if (drawOn == PT_DTEC && t==PT_LIFE && v<NGOL)
parts[pmap[y][x]>>8].tmp = v;
}
else if (drawOn == PT_CRAY && drawOn != t && drawOn != PT_PSCN && drawOn != PT_INST && drawOn != PT_METL)
{
parts[pmap[y][x]>>8].ctype = t;
- if (t==PT_LIFE && v<NGOLALT)
+ if (t==PT_LIFE && v<NGOL)
parts[pmap[y][x]>>8].tmp2 = v;
parts[pmap[y][x]>>8].temp = elements[t].Temperature;
}
@@ -2959,7 +2959,7 @@ int Simulation::create_part(int p, int x, int y, int tv)
parts[i].tmp = 50;
break;
case PT_LIFE:
- if (v<NGOLALT)
+ if (v<NGOL)
{
parts[i].tmp = grule[v+1][9] - 1;
parts[i].ctype = v;
@@ -3553,7 +3553,7 @@ void Simulation::update_particles_i(int start, int inc)
if (parts[r>>8].type==PT_LIFE)
{
golnum = parts[r>>8].ctype+1;
- if (golnum<=0 || golnum>NGOLALT) {
+ if (golnum<=0 || golnum>NGOL) {
kill_part(r>>8);
continue;
}
diff --git a/src/simulation/Simulation.h b/src/simulation/Simulation.h
index abcea15..9e9424f 100644
--- a/src/simulation/Simulation.h
+++ b/src/simulation/Simulation.h
@@ -1,10 +1,3 @@
-/*
- * Simulation.h
- *
- * Created on: Jan 2, 2012
- * Author: Simon
- */
-
#ifndef SIMULATION_H_
#define SIMULATION_H_
#include <cstring>
@@ -16,7 +9,7 @@
#include "SimulationData.h"
#include "Sign.h"
#include "Particle.h"
-#include "Player.h"
+#include "Stickman.h"
#include "WallType.h"
#include "GOLMenu.h"
#include "MenuSection.h"
diff --git a/src/simulation/SimulationData.cpp b/src/simulation/SimulationData.cpp
index e338e2f..12f6ca8 100644
--- a/src/simulation/SimulationData.cpp
+++ b/src/simulation/SimulationData.cpp
@@ -1,9 +1,3 @@
-#/*
- * SimulationData.cpp
- *
- * Created on: Jan 24, 2012
- * Author: Simon
- */
#include "SimulationData.h"
//#include "ElementFunctions.h"
#include "ElementGraphics.h"
diff --git a/src/simulation/SimulationData.h b/src/simulation/SimulationData.h
index 1d47813..770d732 100644
--- a/src/simulation/SimulationData.h
+++ b/src/simulation/SimulationData.h
@@ -1,10 +1,3 @@
-/*
- * SimulationData.h
- *
- * Created on: Jan 24, 2012
- * Author: Simon
- */
-
#include <vector>
#define SC_WALL 0
diff --git a/src/simulation/Player.h b/src/simulation/Stickman.h
index af2b68e..0e9cd3c 100644
--- a/src/simulation/Player.h
+++ b/src/simulation/Stickman.h
@@ -1,13 +1,5 @@
-//
-// Player.h
-// The Powder Toy
-//
-// Created by Simon Robertshaw on 04/06/2012.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-#ifndef The_Powder_Toy_Player_h
-#define The_Powder_Toy_Player_h
+#ifndef STICKMAN_H_
+#define STICKMAN_H_
struct playerst
{
diff --git a/src/simulation/StructProperty.h b/src/simulation/StructProperty.h
index 5c46c7e..dda72c4 100644
--- a/src/simulation/StructProperty.h
+++ b/src/simulation/StructProperty.h
@@ -1,13 +1,5 @@
-//
-// StructProperty.h
-// The Powder Toy
-//
-// Created by Simon Robertshaw on 04/06/2012.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-#ifndef The_Powder_Toy_StructProperty_h
-#define The_Powder_Toy_StructProperty_h
+#ifndef STRUCTPROPERTY_H_
+#define STRUCTPROPERTY_H_
#include <string>
#include <stdint.h>
diff --git a/src/simulation/WallType.h b/src/simulation/WallType.h
index c2d916a..c9f30e3 100644
--- a/src/simulation/WallType.h
+++ b/src/simulation/WallType.h
@@ -1,13 +1,5 @@
-//
-// WallType.h
-// The Powder Toy
-//
-// Created by Simon Robertshaw on 04/06/2012.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-#ifndef The_Powder_Toy_WallType_h
-#define The_Powder_Toy_WallType_h
+#ifndef WALLTYPE_H_
+#define WALLTYPE_H_
#include "graphics/Graphics.h"
class VideoBuffer;
diff --git a/src/simulation/elements/BCLN.cpp b/src/simulation/elements/BCLN.cpp
index a617620..de10464 100644
--- a/src/simulation/elements/BCLN.cpp
+++ b/src/simulation/elements/BCLN.cpp
@@ -57,7 +57,7 @@ int Element_BCLN::update(UPDATE_FUNC_ARGS)
parts[i].vx += advection*sim->vx[y/CELL][x/CELL];
parts[i].vy += advection*sim->vy[y/CELL][x/CELL];
}
- 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>=NGOLALT)))
+ 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)))
{
int r, rx, ry, rt;
for (rx=-1; rx<2; rx++)
diff --git a/src/simulation/elements/CLNE.cpp b/src/simulation/elements/CLNE.cpp
index f0a9c44..482d2c9 100644
--- a/src/simulation/elements/CLNE.cpp
+++ b/src/simulation/elements/CLNE.cpp
@@ -49,7 +49,7 @@ Element_CLNE::Element_CLNE()
//#TPT-Directive ElementHeader Element_CLNE static int update(UPDATE_FUNC_ARGS)
int Element_CLNE::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>=NGOLALT)))
+ 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)))
{
int r, rx, ry, rt;
for (rx=-1; rx<2; rx++)
diff --git a/src/simulation/elements/CONV.cpp b/src/simulation/elements/CONV.cpp
index 8f2f0c6..bb313ac 100644
--- a/src/simulation/elements/CONV.cpp
+++ b/src/simulation/elements/CONV.cpp
@@ -50,7 +50,7 @@ Element_CONV::Element_CONV()
int Element_CONV::update(UPDATE_FUNC_ARGS)
{
int r, rx, ry;
- if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !sim->elements[parts[i].ctype].Enabled || parts[i].ctype==PT_CONV || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT)))
+ if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !sim->elements[parts[i].ctype].Enabled || parts[i].ctype==PT_CONV || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOL)))
{
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
diff --git a/src/simulation/elements/CRAY.cpp b/src/simulation/elements/CRAY.cpp
index 55c9bf8..f0d276a 100644
--- a/src/simulation/elements/CRAY.cpp
+++ b/src/simulation/elements/CRAY.cpp
@@ -88,7 +88,7 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
break;
}
r = pmap[y+nyi+nyy][x+nxi+nxx];
- if (!sim->IsWallBlocking(x+nxi+nxx, y+nyi+nyy, parts[i].ctype) && (!sim->pmap[y+nyi+nyy][x+nxi+nxx] || (parts[i].ctype == PT_SPRK && !destroy))) { // create, also set color if it has passed through FILT
+ if (!sim->IsWallBlocking(x+nxi+nxx, y+nyi+nyy, parts[i].ctype) && (!sim->pmap[y+nyi+nyy][x+nxi+nxx] || (parts[i].ctype == PT_SPRK && parts[r>>8].type != PT_BREC && !destroy))) { // create, also set color if it has passed through FILT
int nr;
if (parts[i].ctype == PT_LIFE)
nr = sim->create_part(-1, x+nxi+nxx, y+nyi+nyy, parts[i].ctype|(parts[i].tmp2<<8));
@@ -98,7 +98,7 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
parts[nr].dcolour = colored;
parts[nr].temp = parts[i].temp;
}
- if((!destroy || parts[i].ctype != PT_SPRK) && !--partsRemaining)
+ if((!destroy || (parts[i].ctype != PT_SPRK &&parts[r>>8].type != PT_BREC)) && !--partsRemaining)
docontinue = 0;
} else if ((r&0xFF)==PT_FILT) { // get color if passed through FILT
colored = wavelengthToDecoColour(parts[r>>8].ctype);
diff --git a/src/simulation/elements/PBCN.cpp b/src/simulation/elements/PBCN.cpp
index f0e4964..bec42db 100644
--- a/src/simulation/elements/PBCN.cpp
+++ b/src/simulation/elements/PBCN.cpp
@@ -63,7 +63,7 @@ int Element_PBCN::update(UPDATE_FUNC_ARGS)
return 1;
}
}
- 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>=NGOLALT)))
+ 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)))
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES)
diff --git a/src/simulation/elements/PCLN.cpp b/src/simulation/elements/PCLN.cpp
index fc9db0e..1cd2ede 100644
--- a/src/simulation/elements/PCLN.cpp
+++ b/src/simulation/elements/PCLN.cpp
@@ -77,7 +77,7 @@ int Element_PCLN::update(UPDATE_FUNC_ARGS)
parts[i].life = 10;
}
}
- 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>=NGOLALT)))
+ 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)))
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES)