summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-06 15:14:08 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-06 15:14:08 (GMT)
commit662640c96c86ba83132f0683c35bfba24b43783c (patch)
tree5f0b5270d9410a683d45909e789c478c01d6d6e0 /src
parent0e43f2e83118897bc916db69a012f4686429d930 (diff)
downloadpowder-662640c96c86ba83132f0683c35bfba24b43783c.zip
powder-662640c96c86ba83132f0683c35bfba24b43783c.tar.gz
Fix previous merge with SOAP.cpp that created a bug in SOAP. add debug lines for PRTI, PRTO, WIFI and lines for SOAP.
Diffstat (limited to 'src')
-rw-r--r--src/game/GameController.cpp2
-rw-r--r--src/game/GameView.cpp2
-rw-r--r--src/graphics/Renderer.cpp31
-rw-r--r--src/graphics/Renderer.h3
-rw-r--r--src/simulation/ElementGraphics.h2
-rw-r--r--src/simulation/elements/PRTI.cpp1
-rw-r--r--src/simulation/elements/PRTO.cpp1
-rw-r--r--src/simulation/elements/SOAP.cpp10
-rw-r--r--src/simulation/elements/WIFI.cpp1
9 files changed, 50 insertions, 3 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index ea21fd1..2ca447d 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -560,6 +560,8 @@ void GameController::Update()
ui::Point pos = gameView->GetMousePosition();
if(pos.X >= 0 && pos.Y >= 0 && pos.X < XRES && pos.Y < YRES)
{
+ gameModel->GetRenderer()->mousePosX = pos.X;
+ gameModel->GetRenderer()->mousePosY = pos.Y;
gameView->SetSample(gameModel->GetSimulation()->Get(pos.X, pos.Y));
}
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index c9c293d..d0fde06 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -1289,7 +1289,7 @@ void GameView::NotifyNotificationsChanged(GameModel * sender)
std::vector<Notification*> notifications = sender->GetNotifications();
- int currentY = YRES-17;
+ int currentY = YRES-23;
for(std::vector<Notification*>::iterator iter = notifications.begin(), end = notifications.end(); iter != end; ++iter)
{
int width = (Graphics::textwidth((*iter)->Message.c_str()))+8;
diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp
index c1f24da..20bef9d 100644
--- a/src/graphics/Renderer.cpp
+++ b/src/graphics/Renderer.cpp
@@ -1127,6 +1127,14 @@ void Renderer::render_parts()
#endif
//Pixel rendering
+ if (pixel_mode & EFFECT_LINES)
+ {
+ if (t==PT_SOAP)
+ {
+ if ((parts[i].ctype&7) == 7)
+ draw_line(nx, ny, (int)(parts[parts[i].tmp].x+0.5f), (int)(parts[parts[i].tmp].y+0.5f), colr, colg, colb, cola);
+ }
+ }
if(pixel_mode & PSPEC_STICKMAN)
{
char buff[20]; //Buffer for HP
@@ -1619,6 +1627,25 @@ void Renderer::render_parts()
addpixel(nx+nxo, ny+nyo, colr, colg, colb, 255-orbd[r]);
}
}
+ if (pixel_mode & EFFECT_DBGLINES)
+ {
+ if (mousePosX == nx && mousePosY == ny)//draw lines connecting wifi/portal channels
+ {
+ int z;
+ int type = parts[i].type;
+ if (type == PT_PRTI)
+ type = PT_PRTO;
+ else if (type == PT_PRTO)
+ type = PT_PRTI;
+ for (z = 0; z<NPART; z++) {
+ if (parts[z].type)
+ {
+ if (parts[z].type==type&&parts[z].tmp==parts[i].tmp)
+ xor_line(nx,ny,(int)(parts[z].x+0.5f),(int)(parts[z].y+0.5f));
+ }
+ }
+ }
+ }
//Fire effects
if(firea && (pixel_mode & FIRE_BLEND))
{
@@ -2107,7 +2134,9 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
zoomEnabled(false),
decorations_enable(1),
gravityFieldEnabled(false),
- gravityZonesEnabled(false)
+ gravityZonesEnabled(false),
+ mousePosX(-1),
+ mousePosY(-1)
{
this->g = g;
this->sim = sim;
diff --git a/src/graphics/Renderer.h b/src/graphics/Renderer.h
index bf0f448..e7d6e74 100644
--- a/src/graphics/Renderer.h
+++ b/src/graphics/Renderer.h
@@ -49,6 +49,9 @@ public:
Graphics * g;
gcache_item *graphicscache;
+ //Mouse position for debug information
+ int mousePosX, mousePosY;
+
//Zoom window
ui::Point zoomWindowPosition;
ui::Point zoomScopePosition;
diff --git a/src/simulation/ElementGraphics.h b/src/simulation/ElementGraphics.h
index e84db94..0f3723c 100644
--- a/src/simulation/ElementGraphics.h
+++ b/src/simulation/ElementGraphics.h
@@ -25,6 +25,8 @@
#define EFFECT 0xFF000000
#define EFFECT_GRAVIN 0x01000000
#define EFFECT_GRAVOUT 0x02000000
+#define EFFECT_LINES 0x04000000
+#define EFFECT_DBGLINES 0x08000000
#define RENDER_EFFE OPTIONS | PSPEC_STICKMAN | EFFECT | PMODE_SPARK | PMODE_FLARE | PMODE_LFLARE
#define RENDER_FIRE OPTIONS | PSPEC_STICKMAN | /*PMODE_FLAT |*/ PMODE_ADD | PMODE_BLEND | FIREMODE
diff --git a/src/simulation/elements/PRTI.cpp b/src/simulation/elements/PRTI.cpp
index 451c54b..8383d90 100644
--- a/src/simulation/elements/PRTI.cpp
+++ b/src/simulation/elements/PRTI.cpp
@@ -129,6 +129,7 @@ int Element_PRTI::graphics(GRAPHICS_FUNC_ARGS)
*firer = 255;
*fireg = 0;
*fireb = 0;
+ *pixel_mode |= EFFECT_DBGLINES;
*pixel_mode |= EFFECT_GRAVIN;
*pixel_mode &= ~PMODE;
*pixel_mode |= PMODE_ADD;
diff --git a/src/simulation/elements/PRTO.cpp b/src/simulation/elements/PRTO.cpp
index 788e7d1..b4554ec 100644
--- a/src/simulation/elements/PRTO.cpp
+++ b/src/simulation/elements/PRTO.cpp
@@ -166,6 +166,7 @@ int Element_PRTO::graphics(GRAPHICS_FUNC_ARGS)
*firer = 0;
*fireg = 0;
*fireb = 255;
+ *pixel_mode |= EFFECT_DBGLINES;
*pixel_mode |= EFFECT_GRAVOUT;
*pixel_mode &= ~PMODE;
*pixel_mode |= PMODE_ADD;
diff --git a/src/simulation/elements/SOAP.cpp b/src/simulation/elements/SOAP.cpp
index d4ed39d..1d3a55b 100644
--- a/src/simulation/elements/SOAP.cpp
+++ b/src/simulation/elements/SOAP.cpp
@@ -43,6 +43,7 @@ Element_SOAP::Element_SOAP()
HighTemperatureTransition = NT;
Update = &Element_SOAP::update;
+ Graphics = &Element_SOAP::graphics;
}
@@ -120,7 +121,7 @@ int Element_SOAP::update(UPDATE_FUNC_ARGS)
parts[i].vx *= 0.5f;
}
- if(parts[i].ctype&2)
+ if(!(parts[i].ctype&2))
{
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
@@ -279,5 +280,12 @@ int Element_SOAP::update(UPDATE_FUNC_ARGS)
return 0;
}
+//#TPT-Directive ElementHeader Element_SOAP static int graphics(GRAPHICS_FUNC_ARGS)
+int Element_SOAP::graphics(GRAPHICS_FUNC_ARGS)
+
+{
+ *pixel_mode |= EFFECT_LINES;
+ return 1;
+}
Element_SOAP::~Element_SOAP() {}
diff --git a/src/simulation/elements/WIFI.cpp b/src/simulation/elements/WIFI.cpp
index a108c91..0dc08e0 100644
--- a/src/simulation/elements/WIFI.cpp
+++ b/src/simulation/elements/WIFI.cpp
@@ -93,6 +93,7 @@ int Element_WIFI::graphics(GRAPHICS_FUNC_ARGS)
*colr = sin(frequency*q + 0) * 127 + 128;
*colg = sin(frequency*q + 2) * 127 + 128;
*colb = sin(frequency*q + 4) * 127 + 128;
+ *pixel_mode |= EFFECT_DBGLINES;
return 0;
}