OSDN Git Service

視界処理のデバッグ表示処理を実装。 / Implement debug process for sight range.
authorDeskull <desull@users.sourceforge.jp>
Thu, 8 Jan 2015 14:49:28 +0000 (23:49 +0900)
committerDeskull <desull@users.sourceforge.jp>
Thu, 8 Jan 2015 14:49:28 +0000 (23:49 +0900)
Deeangband/Field.cpp
Deeangband/Field.h
Deeangband/GameSurfaceSDL.cpp

index c803a77..07facb0 100644 (file)
@@ -132,6 +132,8 @@ namespace Deeangband
                        }
                }
 
+               /*
+
                for(y = 0; y < this->height * 2 + 1; y += 2)
                {
                        for(x = 1; x < this->width * 2 + 1; x += 2)
@@ -154,6 +156,7 @@ namespace Deeangband
                        }
                }
 
+
                for(y = 1; y < this->height * 2 + 1; y += 2)
                {
                        for(x = 0; x < this->width * 2 + 1; x += 2)
@@ -175,6 +178,7 @@ namespace Deeangband
                                }
                        }
                }
+               */
 
        }
 
@@ -196,4 +200,9 @@ namespace Deeangband
                return true;
        }
 
+       bool Field::GetSightPass(int x, int y)
+       {
+               return SightPass[y * width + x];
+       }
+
 }
\ No newline at end of file
index 8c96ace..6d59ef6 100644 (file)
@@ -155,6 +155,8 @@ namespace Deeangband
                std::vector<bool> SightPass; //!< \8el\8b÷\8e\8b\8ao\92Ê\89ß\83t\83\89\83O
                std::vector<bool> PhysicalPass; //!< \8el\8b÷\95¨\97\9d\92Ê\89ß\83t\83\89\83O
 
+               bool Field::GetSightPass(int x, int y);
+
        };
 
 }
index 47a9356..943be60 100644 (file)
@@ -570,7 +570,10 @@ void GameSurfaceSDL::drawField(const CREATURE_IT &subjectCreatureIt, GameWorld *
                {
                        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 checkRect1 = {GameSurfaceSDL::sideBarWidth + (px - x) * squareGraphicWidth - 2 + 12, 30 + (py - y) * squareGraphicHeight - 2 + 12, 4, 4};
+                               SDL_Rect checkRect2 = {GameSurfaceSDL::sideBarWidth + (px - x) * squareGraphicWidth - 2, 30 + (py - y) * squareGraphicHeight - 2, 4, 4};
+                               SDL_Rect checkRect3 = {GameSurfaceSDL::sideBarWidth + (px - x) * squareGraphicWidth - 2, 30 + (py - y) * squareGraphicHeight - 2 + 12, 4, 4};
+                               SDL_Rect checkRect4 = {GameSurfaceSDL::sideBarWidth + (px - x) * squareGraphicWidth - 2 + 12, 30 + (py - y) * squareGraphicHeight - 2, 4, 4};
                                SDL_Rect blitRect = {GameSurfaceSDL::sideBarWidth + (px - x) * squareGraphicWidth, 30 + (py - y) * squareGraphicHeight , squareGraphicWidth, squareGraphicHeight};
                                if(subJectCreaturePtr->GetLore()->GetFieldLore(0, px, py) > 0)
                                {
@@ -588,10 +591,27 @@ void GameSurfaceSDL::drawField(const CREATURE_IT &subjectCreatureIt, GameWorld *
                                        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));
+                               if(fieldPtr->GetSightPass(px * 2 + 1, py * 2 + 1))
+                                       SDL_FillRect(windowSurface, &checkRect1, SDL_MapRGBA(windowSurface->format, 255, 255, 255, 255));
                                else
-                                       SDL_FillRect(windowSurface, &checkRect, SDL_MapRGBA(windowSurface->format, 255, 0, 0, 255));
+                                       SDL_FillRect(windowSurface, &checkRect1, SDL_MapRGBA(windowSurface->format, 255, 0, 0, 255));
+
+                               if(fieldPtr->GetSightPass(px * 2, py * 2))
+                                       SDL_FillRect(windowSurface, &checkRect2, SDL_MapRGBA(windowSurface->format, 255, 255, 255, 255));
+                               else
+                                       SDL_FillRect(windowSurface, &checkRect2, SDL_MapRGBA(windowSurface->format, 255, 0, 0, 255));
+
+                               /*
+                               if(fieldPtr->GetSightPass(px * 2, py * 2 + 1))
+                                       SDL_FillRect(windowSurface, &checkRect3, SDL_MapRGBA(windowSurface->format, 255, 255, 255, 255));
+                               else
+                                       SDL_FillRect(windowSurface, &checkRect3, SDL_MapRGBA(windowSurface->format, 255, 0, 0, 255));
+                               if(fieldPtr->GetSightPass(px * 2 + 1, py * 2))
+                                       SDL_FillRect(windowSurface, &checkRect4, SDL_MapRGBA(windowSurface->format, 255, 255, 255, 255));
+                               else
+                                       SDL_FillRect(windowSurface, &checkRect4, SDL_MapRGBA(windowSurface->format, 255, 0, 0, 255));
+                               */
+
                        }
                }
        }