From 860fc0d4c9e2761e9047534fa87e8c3f6bbe62e9 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Wed, 25 Jul 2012 14:08:14 +0100 Subject: [PATCH] Streamlines --- src/graphics/Renderer.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp index c1328d326..557746858 100644 --- a/src/graphics/Renderer.cpp +++ b/src/graphics/Renderer.cpp @@ -621,6 +621,27 @@ void Renderer::DrawWalls() vid[(y*CELL+j)*(VIDXRES)+(x*CELL+i)] = PIXPACK(0x242424); } } + else if (wt==WL_STREAM) + { + float lx, ly, nx, ny; + lx = x*CELL + CELL*0.5f; + ly = y*CELL + CELL*0.5f; + for (int t = 0; t < 1024; t++) + { + nx = (int)(lx+0.5f); + ny = (int)(ly+0.5f); + if (nx<0 || nx>=XRES || ny<0 || ny>=YRES) + break; + addpixel(nx, ny, 255, 255, 255, 64); + i = nx/CELL; + j = ny/CELL; + lx += sim->vx[j][i]*0.125f; + ly += sim->vy[j][i]*0.125f; + if (bmap[j][i]==WL_STREAM && i!=x && j!=y) + break; + } + drawtext(x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); + } if (wtypes[wt].eglow && emap[y][x]) { // glow if electrified