OSDN Git Service

視界判定処理のリバートとSDL_Render初期設定の明示的追加。 / Revert of sight judge and Add declare setting...
authorDeskull <desull@users.sourceforge.jp>
Thu, 15 Jan 2015 13:10:31 +0000 (22:10 +0900)
committerDeskull <desull@users.sourceforge.jp>
Thu, 15 Jan 2015 13:10:31 +0000 (22:10 +0900)
Deeangband/Field.cpp
Deeangband/GameSurfaceSDL.cpp

index ff86f9a..450a25f 100644 (file)
@@ -255,6 +255,7 @@ namespace Deeangband
                for(s = 0 ; s < allocSize; s++) coordVec[s] = false;
                coordVec[size * sideWidth + size] = true;
 
+               /*
                for(y = -size; y <= size; y++)
                {
                        for(x = -size; x <= size; x++)
@@ -262,8 +263,8 @@ namespace Deeangband
                                if(Coordinates::Distance(0, 0, x, y) <= size) coordVec[(y+size) * sideWidth + (x+size)] = true;
                        }
                }
+               */
 
-               /*
                for(s = size; s >= 1; s--)
                {
                        for(x = baseX - s; x <= baseX + s; x++)
@@ -272,7 +273,7 @@ namespace Deeangband
                                int ty1 = baseY - s;
                                int ty2 = baseY + s;
 
-                               if(Coordinates::Distance(baseX, baseY, tx, ty1) > size) continue;
+                               if(Coordinates::Distance(baseX, baseY, tx, ty1) >= size) continue;
 
                                if(tx >= 0 && ty1 >= 0 && tx < this->width && ty1 < this->height)
                                {
@@ -344,7 +345,7 @@ namespace Deeangband
                                int tx2 = baseX + s;
                                int ty = y;
 
-                               if(Coordinates::Distance(baseX, baseY, tx1, ty) > size) continue;
+                               if(Coordinates::Distance(baseX, baseY, tx1, ty) >= size) continue;
 
 
                                if(tx1 >= 0 && ty >= 0 && tx1 < this->width && ty < this->height)
@@ -410,7 +411,6 @@ namespace Deeangband
                        }
 
                }
-               */
        }
 
        bool Field::HaveSight(int bx, int by, int tx, int ty)
index fdebd7d..c1b68a4 100644 (file)
@@ -67,6 +67,8 @@ namespace Deeangband
                framesPerSecond = 0;
                frameDeltaTimeLast = frameTimeLast = SDL_GetTicks();
 
+               SDL_SetRenderDrawBlendMode(this->renderer, SDL_BLENDMODE_NONE);
+
                this->rectTitleDst.Set(10, 10, 266, 266);
                this->rectTitleSrc.Set(0, 0, 256, 256);
                this->rectFpsDst.Set(0, 0, 50, 20);
@@ -633,12 +635,11 @@ void GameSurfaceSDL::drawField(const CREATURE_IT &subjectCreatureIt, GameWorld *
                        if(px >= 0 && py >= 0 && px < fieldPtr->GetWidth() && py < fieldPtr->GetHeight())
                        {
                                SDL_Rect blitRect = {(px - x) * squareGraphicWidth - sx, (py - y) * squareGraphicHeight - sy, squareGraphicWidth, squareGraphicHeight};
-                               /*
-                               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 - 6 + 12, 30 + (py - y) * squareGraphicHeight - 1, 12, 2};
-                               SDL_Rect checkRect4 = {GameSurfaceSDL::sideBarWidth + (px - x) * squareGraphicWidth - 1, 30 + (py - y) * squareGraphicHeight - 6 + 12, 2, 12};
-                               */
+
+                               SDL_Rect checkRect1 = {(px - x) * squareGraphicWidth - sx - 2 + 12, 30 + (py - y) * squareGraphicHeight - 2 - sy + 12, 4, 4};
+                               SDL_Rect checkRect2 = {(px - x) * squareGraphicWidth - sx - 2, 30 + (py - y) * squareGraphicHeight - 2 - sy , 4, 4};
+                               SDL_Rect checkRect3 = {(px - x) * squareGraphicWidth - sx - 6 + 12, 30 + (py - y) * squareGraphicHeight - 1 - sy , 12, 2};
+                               SDL_Rect checkRect4 = {(px - x) * squareGraphicWidth - sx - 1, 30 + (py - y) * squareGraphicHeight - 6 + 12 - sy , 2, 12};
 
                                if(subJectCreaturePtr->InSight(px, py))
                                {
@@ -656,12 +657,13 @@ void GameSurfaceSDL::drawField(const CREATURE_IT &subjectCreatureIt, GameWorld *
                                        SDL_RenderCopy(this->renderer, unknownFieldTexture, &fieldRect, &blitRect);
                                }
 
-/*                     
-
+                               /*
                                if(fieldPtr->GetSightPass(px * 2 + 1, py * 2 + 1))
-                                       SDL_FillRect(windowSurface, &checkRect1, SDL_MapRGBA(windowSurface->format, 255, 255, 255, 255));
+                                       SDL_SetRenderDrawColor(this->renderer, 255, 255, 255, 255);
                                else
-                                       SDL_FillRect(windowSurface, &checkRect1, SDL_MapRGBA(windowSurface->format, 255, 0, 0, 255));
+                                       SDL_SetRenderDrawColor(this->renderer, 255, 0, 0, 255);
+                               */
+                               SDL_RenderFillRect(this->renderer, &checkRect1);
 
                                if(fieldPtr->GetSightPass(px * 2, py * 2))
                                        SDL_FillRect(windowSurface, &checkRect2, SDL_MapRGBA(windowSurface->format, 255, 255, 255, 255));
@@ -677,7 +679,6 @@ void GameSurfaceSDL::drawField(const CREATURE_IT &subjectCreatureIt, GameWorld *
                                        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));
-*/
                        }
                }
        }