Wall names in HUD

Conflicts:

	src/game/GameView.cpp
This commit is contained in:
jacob1 2012-09-06 09:48:31 -04:00 committed by Simon Robertshaw
parent 2243c86ef9
commit 1391de2e3a
6 changed files with 39 additions and 20 deletions

View File

@ -1192,6 +1192,14 @@ std::string GameController::ElementResolve(int type)
return "";
}
std::string GameController::WallName(int type)
{
if(gameModel && gameModel->GetSimulation() && gameModel->GetSimulation()->wtypes && type >= 0)
return std::string(gameModel->GetSimulation()->wtypes[type].name);
else
return "";
}
void GameController::NotifyUpdateAvailable(Client * sender)
{
class UpdateConfirmation: public ConfirmDialogueCallback {

View File

@ -126,6 +126,7 @@ public:
ui::Point PointTranslate(ui::Point point);
ui::Point NormaliseBlockCoord(ui::Point point);
std::string ElementResolve(int type);
std::string WallName(int type);
void ResetAir();
void ResetSpark();

View File

@ -1924,18 +1924,18 @@ void GameView::OnDraw()
std::stringstream sampleInfo;
sampleInfo.precision(2);
if(sample.particle.type)
{
{
if(showDebug)
{
sampleInfo << c->ElementResolve(sample.particle.type);
if(sample.particle.ctype > 0 && sample.particle.ctype < PT_NUM)
sampleInfo << " (" << c->ElementResolve(sample.particle.ctype) << ")";
else
sampleInfo << " ()";
sampleInfo << ", Pressure: " << std::fixed << sample.AirPressure;
sampleInfo << " ()";
sampleInfo << ", Temp: " << std::fixed << sample.particle.temp -273.15f;
sampleInfo << ", Life: " << sample.particle.life;
sampleInfo << ", Tmp: " << sample.particle.tmp;
sampleInfo << ", Pressure: " << std::fixed << sample.AirPressure;
}
else
{
@ -1943,12 +1943,17 @@ void GameView::OnDraw()
sampleInfo << "Molten " << c->ElementResolve(sample.particle.ctype);
else
sampleInfo << c->ElementResolve(sample.particle.type);
sampleInfo << ", Pressure: " << std::fixed << sample.AirPressure;
sampleInfo << ", Temp: " << std::fixed << sample.particle.temp -273.15f;
sampleInfo << ", Pressure: " << std::fixed << sample.AirPressure;
}
if(sample.particle.type == PT_PHOT)
wavelengthGfx = sample.particle.ctype;
}
else if (sample.WallType)
{
sampleInfo << c->WallName(sample.WallType);
sampleInfo << ", Pressure: " << std::fixed << sample.AirPressure;
}
else
{
sampleInfo << "Empty, Pressure: " << std::fixed << sample.AirPressure;

View File

@ -414,6 +414,10 @@ SimulationSample Simulation::Get(int x, int y)
sample.particle = parts[photons[y][x]>>8];
sample.ParticleID = photons[y][x]>>8;
}
if (bmap[y/CELL][x/CELL])
{
sample.WallType = bmap[y/CELL][x/CELL];
}
sample.AirPressure = pv[y/CELL][x/CELL];
sample.AirTemperature = hv[y/CELL][x/CELL];
sample.AirVelocityX = vx[y/CELL][x/CELL];

View File

@ -120,22 +120,22 @@ wall_type * LoadWalls(int & wallCount)
{
wall_type wtypes[] =
{
{PIXPACK(0x808080), PIXPACK(0x000000), 0, Renderer::WallIcon, "Erases walls."},
{PIXPACK(0xC0C0C0), PIXPACK(0x101010), 0, Renderer::WallIcon, "Wall. Indestructible. Blocks everything. Conductive."},
{PIXPACK(0x808080), PIXPACK(0x808080), 0, Renderer::WallIcon, "E-Wall. Becomes transparent when electricity is connected."},
{PIXPACK(0xFF8080), PIXPACK(0xFF2008), 1, Renderer::WallIcon, "Detector. Generates electricity when a particle is inside."},
{PIXPACK(0x808080), PIXPACK(0x000000), 0, Renderer::WallIcon, "Streamline. Set start point of a streamline."},
{PIXPACK(0x8080FF), PIXPACK(0x000000), 1, Renderer::WallIcon, "Fan. Accelerates air. Use line tool to set direction and strength."},
{PIXPACK(0xC0C0C0), PIXPACK(0x101010), 2, Renderer::WallIcon, "Wall. Blocks most particles but lets liquids through. Conductive."},
{PIXPACK(0x808080), PIXPACK(0x000000), 1, Renderer::WallIcon, "Wall. Absorbs particles but lets air currents through."},
{PIXPACK(0x808080), PIXPACK(0x000000), 3, Renderer::WallIcon, "Wall. Indestructible. Blocks everything."},
{PIXPACK(0x3C3C3C), PIXPACK(0x000000), 1, Renderer::WallIcon, "Wall. Indestructible. Blocks particles, allows air"},
{PIXPACK(0x575757), PIXPACK(0x000000), 1, Renderer::WallIcon, "Wall. Indestructible. Blocks liquids and gasses, allows powders"},
{PIXPACK(0xFFFF22), PIXPACK(0x101010), 2, Renderer::WallIcon, "Conductor, allows particles, conducts electricity"},
{PIXPACK(0x242424), PIXPACK(0x101010), 0, Renderer::WallIcon, "E-Hole, absorbs particles, release them when powered"},
{PIXPACK(0x579777), PIXPACK(0x000000), 1, Renderer::WallIcon, "Wall. Indestructible. Blocks liquids and solids, allows gasses"},
{PIXPACK(0xFFEE00), PIXPACK(0xAA9900), 4, Renderer::WallIcon, "Gravity wall"},
{PIXPACK(0xFFAA00), PIXPACK(0xAA5500), 4, Renderer::WallIcon, "Energy wall, allows only energy type particles to pass"},
{PIXPACK(0x808080), PIXPACK(0x000000), 0, Renderer::WallIcon, "ERASE", "Erases walls."},
{PIXPACK(0xC0C0C0), PIXPACK(0x101010), 0, Renderer::WallIcon, "CONDUCTIVE WALL","Wall. Indestructible. Blocks everything. Conductive."},
{PIXPACK(0x808080), PIXPACK(0x808080), 0, Renderer::WallIcon, "EWALL", "E-Wall. Becomes transparent when electricity is connected."},
{PIXPACK(0xFF8080), PIXPACK(0xFF2008), 1, Renderer::WallIcon, "DETECTOR", "Detector. Generates electricity when a particle is inside."},
{PIXPACK(0x808080), PIXPACK(0x000000), 0, Renderer::WallIcon, "STREAMLINE", "Streamline. Set start point of a streamline."},
{PIXPACK(0x8080FF), PIXPACK(0x000000), 1, Renderer::WallIcon, "FAN", "Fan. Accelerates air. Use line tool to set direction and strength."},
{PIXPACK(0xC0C0C0), PIXPACK(0x101010), 2, Renderer::WallIcon, "LIQUID WALL", "Wall. Blocks most particles but lets liquids through. Conductive."},
{PIXPACK(0x808080), PIXPACK(0x000000), 1, Renderer::WallIcon, "ABSORB WALL", "Wall. Absorbs particles but lets air currents through."},
{PIXPACK(0x808080), PIXPACK(0x000000), 3, Renderer::WallIcon, "WALL", "Wall. Indestructible. Blocks everything."},
{PIXPACK(0x3C3C3C), PIXPACK(0x000000), 1, Renderer::WallIcon, "AIRONLY WALL", "Wall. Indestructible. Blocks particles, allows air"},
{PIXPACK(0x575757), PIXPACK(0x000000), 1, Renderer::WallIcon, "POWDER WALL", "Wall. Indestructible. Blocks liquids and gasses, allows powders"},
{PIXPACK(0xFFFF22), PIXPACK(0x101010), 2, Renderer::WallIcon, "CONDUCTOR", "Conductor, allows particles, conducts electricity"},
{PIXPACK(0x242424), PIXPACK(0x101010), 0, Renderer::WallIcon, "EHOLE", "E-Hole, absorbs particles, release them when powered"},
{PIXPACK(0x579777), PIXPACK(0x000000), 1, Renderer::WallIcon, "GAS WALL", "Wall. Indestructible. Blocks liquids and solids, allows gasses"},
{PIXPACK(0xFFEE00), PIXPACK(0xAA9900), 4, Renderer::WallIcon, "GRAVITY WALL", "Gravity wall"},
{PIXPACK(0xFFAA00), PIXPACK(0xAA5500), 4, Renderer::WallIcon, "ENERGY WALL", "Energy wall, allows only energy type particles to pass"},
};
wallCount = UI_WALLCOUNT;
wall_type * wtypesT = (wall_type*)malloc(UI_WALLCOUNT*sizeof(wall_type));

View File

@ -18,6 +18,7 @@ struct wall_type
pixel eglow; // if emap set, add this to fire glow
int drawstyle;
VideoBuffer * (*textureGen)(int, int, int);
const char *name;
const char *descs;
};