diff --git a/Engine/gfx/gfx_util.cpp b/Engine/gfx/gfx_util.cpp index 1ce158674ee..1ce75fec9f6 100644 --- a/Engine/gfx/gfx_util.cpp +++ b/Engine/gfx/gfx_util.cpp @@ -66,7 +66,7 @@ static const BlendModeSetter BlendModeSets[kNumBlendModes] = bool SetBlender(BlendMode blend_mode, bool dst_has_alpha, bool src_has_alpha, int blend_alpha) { - if (blend_mode < 0 || blend_mode > kNumBlendModes) + if (blend_mode < 0 || blend_mode >= kNumBlendModes) return false; const BlendModeSetter &set = BlendModeSets[blend_mode]; PfnBlenderCb blender; @@ -151,7 +151,7 @@ void DrawSpriteWithTransparency(Bitmap *ds, Bitmap *sprite, int x, int y, int al } sprite = &hctemp; } - + if ((alpha < 0xFF) && (surface_depth > 8) && (sprite_depth > 8)) { set_trans_blender(0, 0, 0, alpha); diff --git a/Plugins/agspalrender/raycast.cpp b/Plugins/agspalrender/raycast.cpp index dcffe10262d..fb8aafb295b 100755 --- a/Plugins/agspalrender/raycast.cpp +++ b/Plugins/agspalrender/raycast.cpp @@ -96,8 +96,8 @@ unsigned char selectedColor; void Ray_SelectTile (int x,int y, unsigned char color) { - if (x < 0 || x > mapWidth) selectedX = -1; - else if (y < 0 || y > mapWidth) selectedY = -1; + if (x < 0 || x >= mapWidth) selectedX = -1; + else if (y < 0 || y >= mapHeight) selectedY = -1; else { selectedX = x; @@ -108,8 +108,8 @@ void Ray_SelectTile (int x,int y, unsigned char color) int Ray_HasSeenTile (int x,int y) { - if (x < 0 || x > mapWidth) return -1; - else if (y < 0 || y > mapWidth) return -1; + if (x < 0 || x >= mapWidth) return -1; + else if (y < 0 || y >= mapHeight) return -1; return seenMap [x][y]; } @@ -127,8 +127,8 @@ void Ray_DrawTile (int spr,int tile) { BITMAP *sprite = engine->GetSpriteGraphic (spr); unsigned char** sprarray = engine->GetRawBitmapSurface (sprite); - for (int y=0;y<64;++y) - for (int x=0;x<64;++x) + for (int y=0;yReleaseBitmapSurface (sprite); } @@ -137,8 +137,8 @@ void Ray_DrawOntoTile (int spr,int tile) { BITMAP *sprite = engine->GetSpriteGraphic (spr); unsigned char** sprarray = engine->GetRawBitmapSurface (sprite); - for (int y=0;y<64;++y) - for (int x=0;x<64;++x) + for (int y=0;yReleaseBitmapSurface (sprite); } @@ -661,33 +661,33 @@ void MakeTextures (int slot) void Ray_SetFloorAt (int x,int y,int tex) { - if (x < 0 || x > mapWidth || y < 0 || y > mapHeight || tex > 511) return; + if (x < 0 || x >= mapWidth || y < 0 || y >= mapHeight || tex > 511) return; else floorMap[x][y] = tex; } void Ray_SetCeilingAt (int x,int y,int tex) { - if (x < 0 || x > mapWidth || y < 0 || y > mapHeight || tex > 511) return; + if (x < 0 || x >= mapWidth || y < 0 || y >= mapHeight || tex > 511) return; else ceilingMap[x][y] = tex; } int Ray_GetCeilingAt (int x,int y) { - if (x < 0 || x > mapWidth || y < 0 || y > mapHeight) return -1; + if (x < 0 || x >= mapWidth || y < 0 || y >= mapHeight) return -1; else return ceilingMap [x][y]; } int Ray_GetFloorAt (int x,int y) { - if (x < 0 || x > mapWidth || y < 0 || y > mapHeight) return -1; + if (x < 0 || x >= mapWidth || y < 0 || y >= mapHeight) return -1; else return floorMap [x][y]; } int Ray_GetLightingAt (int x,int y) { - if (x < 0 || x > mapWidth || y < 0 || y > mapHeight) return -1; + if (x < 0 || x >= mapWidth || y < 0 || y >= mapHeight) return -1; else { int lighting=0; @@ -702,7 +702,7 @@ int Ray_GetLightingAt (int x,int y) void Ray_SetLightingAt (int x,int y,unsigned char lighting) { - if (x < 0 || x > mapWidth || y < 0 || y > mapHeight) return; + if (x < 0 || x >= mapWidth || y < 0 || y >= mapHeight) return; else { lightMap [x][y] = lighting;