}
}
+ Field::UpdateSight();
+
creatures.resize(0);
doors.resize(0);
traps.resize(0);
void Field::UpdateSight(void)
{
int x, y;
- this->sightPass.resize((this->width * 2 + 1) * (this->height * 2 + 1));
- this->physicalPass.resize((this->width * 2 + 1) * (this->height * 2 + 1));
+ this->SightPass.resize((this->width * 2 + 1) * (this->height * 2 + 1));
+ this->PhysicalPass.resize((this->width * 2 + 1) * (this->height * 2 + 1));
for(y = 1; y < this->height * 2 + 1; y += 2)
{
for(x = 1; x < this->width * 2 + 1; x += 2)
{
- this->sightPass[y * this->width + x] = !this->GetSquare(x / 2, y / 2)->IsWall();
- this->physicalPass[y * this->width + x] = !this->GetSquare(x / 2, y / 2)->IsWall();
+ this->SightPass[y * this->width + x] = !this->GetSquare(x / 2, y / 2)->IsWall();
+ this->PhysicalPass[y * this->width + x] = !this->GetSquare(x / 2, y / 2)->IsWall();
}
}
{
if(!this->GetSquare(x / 2 - 1, y / 2 - 1) || !this->GetSquare(x / 2 - 1, y / 2) || !this->GetSquare(x / 2, y / 2 - 1) || !this->GetSquare(x / 2, y / 2))
{
- this->sightPass[y * this->width + x] = false;
- this->physicalPass[y * this->width + x] = false;
+ this->SightPass[y * this->width + x] = false;
+ this->PhysicalPass[y * this->width + x] = false;
}
else if(this->GetSquare(x / 2 - 1, y / 2 - 1)->IsWall() || this->GetSquare(x / 2, y / 2 - 1)->IsWall() || this->GetSquare(x / 2 - 1, y / 2)->IsWall() || this->GetSquare(x / 2, y / 2 )->IsWall())
{
- this->sightPass[y * this->width + x] = false;
- this->physicalPass[y * this->width + x] = false;
+ this->SightPass[y * this->width + x] = false;
+ this->PhysicalPass[y * this->width + x] = false;
}
else
{
- this->sightPass[y * this->width + x] = true;
- this->physicalPass[y * this->width + x] = true;
+ this->SightPass[y * this->width + x] = true;
+ this->PhysicalPass[y * this->width + x] = true;
}
}
}
{
if(!this->GetSquare(x / 2, y / 2 - 1) || !this->GetSquare(x / 2, y / 2))
{
- this->sightPass[y * this->width + x] = false;
- this->physicalPass[y * this->width + x] = false;
+ this->SightPass[y * this->width + x] = false;
+ this->PhysicalPass[y * this->width + x] = false;
}
else if(this->GetSquare(x / 2, y / 2 - 1)->IsWall() || this->GetSquare(x / 2, y / 2)->IsWall())
{
- this->sightPass[y * this->width + x] = false;
- this->physicalPass[y * this->width + x] = false;
+ this->SightPass[y * this->width + x] = false;
+ this->PhysicalPass[y * this->width + x] = false;
}
else
{
- this->sightPass[y * this->width + x] = true;
- this->physicalPass[y * this->width + x] = true;
+ this->SightPass[y * this->width + x] = true;
+ this->PhysicalPass[y * this->width + x] = true;
}
}
}
{
if(!this->GetSquare(x / 2 - 1, y / 2) || !this->GetSquare(x / 2, y / 2))
{
- this->sightPass[y * this->width + x] = false;
- this->physicalPass[y * this->width + x] = false;
+ this->SightPass[y * this->width + x] = false;
+ this->PhysicalPass[y * this->width + x] = false;
}
else if(this->GetSquare(x / 2 - 1, y / 2)->IsWall() || this->GetSquare(x / 2, y / 2)->IsWall())
{
- this->sightPass[y * this->width + x] = false;
- this->physicalPass[y * this->width + x] = false;
+ this->SightPass[y * this->width + x] = false;
+ this->PhysicalPass[y * this->width + x] = false;
}
else
{
- this->sightPass[y * this->width + x] = true;
- this->physicalPass[y * this->width + x] = true;
+ this->SightPass[y * this->width + x] = true;
+ this->PhysicalPass[y * this->width + x] = true;
}
}
}
CREATURE_IT creatureIt;
Creature *subJectCreaturePtr = subjectCreatureIt->second.get();
+
int px, py;
for(py = y; py < y + h; py++)
{
{
if(px < fieldPtr->GetWidth() && py < fieldPtr->GetHeight())
{
+ SDL_Rect checkRect = {GameSurfaceSDL::sideBarWidth + (px - x) * squareGraphicWidth - 3, 30 + (py - y) * squareGraphicHeight - 3, 6, 6};
SDL_Rect blitRect = {GameSurfaceSDL::sideBarWidth + (px - x) * squareGraphicWidth, 30 + (py - y) * squareGraphicHeight , squareGraphicWidth, squareGraphicHeight};
if(subJectCreaturePtr->GetLore()->GetFieldLore(0, px, py) > 0)
{
SDL_Rect fieldRect = {blitRect.x % 128, blitRect.y % 128, blitRect.x % 128 + squareGraphicWidth, blitRect.y % 128 + squareGraphicHeight};
SDL_BlitSurface(unknownFieldSurface, &fieldRect, windowSurface, &blitRect);
}
+
+ if(fieldPtr->SightPass[(py * 2 + 1) * fieldPtr->GetWidth() + (px * 2 + 1)])
+ SDL_FillRect(windowSurface, &checkRect, SDL_MapRGBA(windowSurface->format, 255, 255, 255, 255));
+ else
+ SDL_FillRect(windowSurface, &checkRect, SDL_MapRGBA(windowSurface->format, 255, 0, 0, 255));
}
}
}
SDL_BlitSurface(creatureSurfaces[creatureIt->first], &symbolRect, windowSurface, &blitRect);
}
}
+
+
+
}
void GameSurfaceSDL::FocusField(int x, int y)