OSDN Git Service

視界処理のデバッグ表示を修正。 / Fix debug process for sight range.
authorDeskull <desull@users.sourceforge.jp>
Fri, 9 Jan 2015 11:52:53 +0000 (20:52 +0900)
committerDeskull <desull@users.sourceforge.jp>
Fri, 9 Jan 2015 11:52:53 +0000 (20:52 +0900)
Deeangband/Field.cpp
Deeangband/GameSurfaceSDL.cpp
Deeangband/GameSurfaceSDL.h
lib-Vanilla/Dungeon.xml

index a76096a..4ef1a39 100644 (file)
@@ -98,93 +98,92 @@ namespace Deeangband
        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));
+               int updateSizeX = this->width * 2 + 1;
+               int updateSizeY = this->height * 2 + 1;
+               this->SightPass.resize(updateSizeX * updateSizeY);
+               this->PhysicalPass.resize(updateSizeX * updateSizeY);
 
-               for(x = 0; x < this->height * this->width; x++)
+               for(x = 0; x < updateSizeX * updateSizeY; x++)
                {
-                       this->SightPass[x] = true;
-                       this->PhysicalPass[x] = true;
+                       this->SightPass[x] = false;
+                       this->PhysicalPass[x] = false;
                }
 
-               for(y = 1; y < this->height * 2 + 1; y += 2)
+               for(y = 1; y < updateSizeY; y += 2)
                {
-                       for(x = 1; x < this->width * 2 + 1; x += 2)
+                       for(x = 1; x < updateSizeX; 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 * updateSizeX + x] = !this->GetSquare(x / 2, y / 2)->IsWall();
+                               this->PhysicalPass[y * updateSizeX + x] = !this->GetSquare(x / 2, y / 2)->IsWall();
                        }
                }
 
+
                for(y = 0; y < this->height * 2 + 1; y += 2)
                {
                        for(x = 0; x < this->width * 2 + 1; x += 2)
                        {
                                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 * updateSizeX + x] = false;
+                                       this->PhysicalPass[y * updateSizeX + x] = false;
                                }
                                else if((!this->GetSquare(x / 2 - 1, y / 2 - 1)->IsWall() && !this->GetSquare(x / 2, y / 2 )->IsWall()) || (!this->GetSquare(x / 2, y / 2 - 1)->IsWall() && !this->GetSquare(x / 2 - 1, y / 2)->IsWall()))
                                {
-                                       this->SightPass[y * this->width + x] = true;
-                                       this->PhysicalPass[y * this->width + x] = true;
+                                       this->SightPass[y * updateSizeX + x] = true;
+                                       this->PhysicalPass[y * updateSizeX + x] = true;
                                }
                                else
                                {
-                                       this->SightPass[y * this->width + x] = false;
-                                       this->PhysicalPass[y * this->width + x] = false;
+                                       this->SightPass[y * updateSizeX + x] = false;
+                                       this->PhysicalPass[y * updateSizeX + x] = false;
                                }
                        }
                }
 
-
-               /*
                for(y = 0; y < this->height * 2 + 1; y += 2)
                {
                        for(x = 1; x < this->width * 2 + 1; x += 2)
                        {
                                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 * updateSizeX + x] = false;
+                                       this->PhysicalPass[y * updateSizeX + 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 * updateSizeX + x] = false;
+                                       this->PhysicalPass[y * updateSizeX + x] = false;
                                }
                                else
                                {
-                                       this->SightPass[y * this->width + x] = true;
-                                       this->PhysicalPass[y * this->width + x] = true;
+                                       this->SightPass[y * updateSizeX + x] = true;
+                                       this->PhysicalPass[y * updateSizeX + x] = true;
                                }
                        }
                }
 
-
-               for(y = 1; y < this->height * 2 + 1; y += 2)
+               for(y = 1; y < updateSizeY; y += 2)
                {
-                       for(x = 0; x < this->width * 2 + 1; x += 2)
+                       for(x = 0; x < updateSizeX; x += 2)
                        {
                                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 * updateSizeX + x] = false;
+                                       this->PhysicalPass[y * updateSizeX + 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 * updateSizeX + x] = false;
+                                       this->PhysicalPass[y * updateSizeX+ x] = false;
                                }
                                else
                                {
-                                       this->SightPass[y * this->width + x] = true;
-                                       this->PhysicalPass[y * this->width + x] = true;
+                                       this->SightPass[y * updateSizeX + x] = true;
+                                       this->PhysicalPass[y * updateSizeX + x] = true;
                                }
                        }
                }
-               */
 
        }
 
@@ -208,7 +207,7 @@ namespace Deeangband
 
        bool Field::GetSightPass(int x, int y)
        {
-               return SightPass[y * width + x];
+               return SightPass[y * (this->width * 2 + 1) + x];
        }
 
 }
\ No newline at end of file
index 86a0c33..6c06790 100644 (file)
@@ -606,7 +606,7 @@ void GameSurfaceSDL::drawField(const CREATURE_IT &subjectCreatureIt, GameWorld *
                                else
                                        SDL_FillRect(windowSurface, &checkRect3, SDL_MapRGBA(windowSurface->format, 255, 0, 0, 255));
 
-                               if(fieldPtr->GetSightPass(px * 2 + 1, py * 2))
+                               if(fieldPtr->GetSightPass(px * 2, py * 2 + 1))
                                        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));
index 24ba0b9..87e4cdb 100644 (file)
@@ -221,6 +221,7 @@ namespace Deeangband
                 */
                void GameSurfaceSDL::updateCreatureGraphics(CREATURE_IT creatureIt);
 
+
        };
 
 }
\ No newline at end of file
index 729180d..c703e46 100644 (file)
@@ -18,8 +18,8 @@
                                <ControllCamp></ControllCamp>
                                <GuardianSpecies></GuardianSpecies>
                                <BaseSize class_id="4" tracking_level="0" version="10">
-                                       <X>50</X>
-                                       <Y>50</Y>
+                                       <X>40</X>
+                                       <Y>40</Y>
                                </BaseSize>
                        </px>
                </second>