Fix previous merge with SOAP.cpp that created a bug in SOAP. add debug lines for PRTI, PRTO, WIFI and lines for SOAP.

This commit is contained in:
Simon Robertshaw 2012-08-06 16:14:08 +01:00
parent 0e43f2e831
commit 662640c96c
9 changed files with 50 additions and 3 deletions

View File

@ -560,6 +560,8 @@ void GameController::Update()
ui::Point pos = gameView->GetMousePosition(); ui::Point pos = gameView->GetMousePosition();
if(pos.X >= 0 && pos.Y >= 0 && pos.X < XRES && pos.Y < YRES) 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)); gameView->SetSample(gameModel->GetSimulation()->Get(pos.X, pos.Y));
} }

View File

@ -1289,7 +1289,7 @@ void GameView::NotifyNotificationsChanged(GameModel * sender)
std::vector<Notification*> notifications = sender->GetNotifications(); 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) for(std::vector<Notification*>::iterator iter = notifications.begin(), end = notifications.end(); iter != end; ++iter)
{ {
int width = (Graphics::textwidth((*iter)->Message.c_str()))+8; int width = (Graphics::textwidth((*iter)->Message.c_str()))+8;

View File

@ -1127,6 +1127,14 @@ void Renderer::render_parts()
#endif #endif
//Pixel rendering //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) if(pixel_mode & PSPEC_STICKMAN)
{ {
char buff[20]; //Buffer for HP 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]); 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 //Fire effects
if(firea && (pixel_mode & FIRE_BLEND)) if(firea && (pixel_mode & FIRE_BLEND))
{ {
@ -2107,7 +2134,9 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
zoomEnabled(false), zoomEnabled(false),
decorations_enable(1), decorations_enable(1),
gravityFieldEnabled(false), gravityFieldEnabled(false),
gravityZonesEnabled(false) gravityZonesEnabled(false),
mousePosX(-1),
mousePosY(-1)
{ {
this->g = g; this->g = g;
this->sim = sim; this->sim = sim;

View File

@ -49,6 +49,9 @@ public:
Graphics * g; Graphics * g;
gcache_item *graphicscache; gcache_item *graphicscache;
//Mouse position for debug information
int mousePosX, mousePosY;
//Zoom window //Zoom window
ui::Point zoomWindowPosition; ui::Point zoomWindowPosition;
ui::Point zoomScopePosition; ui::Point zoomScopePosition;

View File

@ -25,6 +25,8 @@
#define EFFECT 0xFF000000 #define EFFECT 0xFF000000
#define EFFECT_GRAVIN 0x01000000 #define EFFECT_GRAVIN 0x01000000
#define EFFECT_GRAVOUT 0x02000000 #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_EFFE OPTIONS | PSPEC_STICKMAN | EFFECT | PMODE_SPARK | PMODE_FLARE | PMODE_LFLARE
#define RENDER_FIRE OPTIONS | PSPEC_STICKMAN | /*PMODE_FLAT |*/ PMODE_ADD | PMODE_BLEND | FIREMODE #define RENDER_FIRE OPTIONS | PSPEC_STICKMAN | /*PMODE_FLAT |*/ PMODE_ADD | PMODE_BLEND | FIREMODE

View File

@ -129,6 +129,7 @@ int Element_PRTI::graphics(GRAPHICS_FUNC_ARGS)
*firer = 255; *firer = 255;
*fireg = 0; *fireg = 0;
*fireb = 0; *fireb = 0;
*pixel_mode |= EFFECT_DBGLINES;
*pixel_mode |= EFFECT_GRAVIN; *pixel_mode |= EFFECT_GRAVIN;
*pixel_mode &= ~PMODE; *pixel_mode &= ~PMODE;
*pixel_mode |= PMODE_ADD; *pixel_mode |= PMODE_ADD;

View File

@ -166,6 +166,7 @@ int Element_PRTO::graphics(GRAPHICS_FUNC_ARGS)
*firer = 0; *firer = 0;
*fireg = 0; *fireg = 0;
*fireb = 255; *fireb = 255;
*pixel_mode |= EFFECT_DBGLINES;
*pixel_mode |= EFFECT_GRAVOUT; *pixel_mode |= EFFECT_GRAVOUT;
*pixel_mode &= ~PMODE; *pixel_mode &= ~PMODE;
*pixel_mode |= PMODE_ADD; *pixel_mode |= PMODE_ADD;

View File

@ -43,6 +43,7 @@ Element_SOAP::Element_SOAP()
HighTemperatureTransition = NT; HighTemperatureTransition = NT;
Update = &Element_SOAP::update; Update = &Element_SOAP::update;
Graphics = &Element_SOAP::graphics;
} }
@ -120,7 +121,7 @@ int Element_SOAP::update(UPDATE_FUNC_ARGS)
parts[i].vx *= 0.5f; parts[i].vx *= 0.5f;
} }
if(parts[i].ctype&2) if(!(parts[i].ctype&2))
{ {
for (rx=-2; rx<3; rx++) for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++) for (ry=-2; ry<3; ry++)
@ -279,5 +280,12 @@ int Element_SOAP::update(UPDATE_FUNC_ARGS)
return 0; 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() {} Element_SOAP::~Element_SOAP() {}

View File

@ -93,6 +93,7 @@ int Element_WIFI::graphics(GRAPHICS_FUNC_ARGS)
*colr = sin(frequency*q + 0) * 127 + 128; *colr = sin(frequency*q + 0) * 127 + 128;
*colg = sin(frequency*q + 2) * 127 + 128; *colg = sin(frequency*q + 2) * 127 + 128;
*colb = sin(frequency*q + 4) * 127 + 128; *colb = sin(frequency*q + 4) * 127 + 128;
*pixel_mode |= EFFECT_DBGLINES;
return 0; return 0;
} }