diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 18da3bc..ed150e0 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/SeasonI.h b/SeasonI.h index e677425..7f5b3fe 100644 --- a/SeasonI.h +++ b/SeasonI.h @@ -139,6 +139,7 @@ class SeasonI:public PixelGameEngine{ std::string ReadStringFromStream(std::ifstream&f); void CenterCameraOnPlayer(); int GetPointQuadrantRelativeToLine(vi2d x1y1,vi2d x2y2,vi2d point); + TILE GetSafeTileData(std::vector>&data); char GetTileDegreeSafely(std::vector>&data); }; extern SeasonI*GAME; diff --git a/assets/terrainmap.xcf b/assets/terrainmap.xcf index 33dae13..1c67de9 100644 Binary files a/assets/terrainmap.xcf and b/assets/terrainmap.xcf differ diff --git a/main.cpp b/main.cpp index 7c0e17a..1ba0220 100644 --- a/main.cpp +++ b/main.cpp @@ -4587,7 +4587,7 @@ void SeasonI::DrawGameWorld() { int yTileOffset = cameraPos.y/32; for (auto&obj:OBJECTS) { if (!obj->drawn&&(!obj->dead||EDITING_LAYER==layer::ENCOUNTER)&& - (GetTileDegreeSafely(MAP2)&& + (GetTileDegreeSafely(MAP2)==0&& obj->GetPos().y+obj->originPoint.y>(y+yTileOffset)*32&& obj->GetPos().y+obj->originPoint.y<=(y+yTileOffset+1)*32)) { obj->drawn=true; @@ -5546,10 +5546,16 @@ int SeasonI::GetPointQuadrantRelativeToLine(vi2d x1y1,vi2d x2y2,vi2d point){ return (x2y2.y - x1y1.y) * point.x + (x1y1.x - x2y2.x) * point.y + (x2y2.x * x1y1.y - x1y1.x * x2y2.y); } +TILE SeasonI::GetSafeTileData(std::vector>&data){ + int tileY=(int)PARTY_MEMBER_OBJ[0]->GetPosWithOrigin().y/32; + int tileX=(int)PARTY_MEMBER_OBJ[0]->GetPosWithOrigin().x/32; + return tileX>=0&&tileY>=0&&tileXGetPosWithOrigin().y/32][(int)PARTY_MEMBER_OBJ[0]->GetPosWithOrigin().x/32]:TILE(0,0,0); +} + char SeasonI::GetTileDegreeSafely(std::vector>&data){ int tileY=(int)PARTY_MEMBER_OBJ[0]->GetPosWithOrigin().y/32; int tileX=(int)PARTY_MEMBER_OBJ[0]->GetPosWithOrigin().x/32; - return tileX>=0&&tileY>=0&&tileXGetPosWithOrigin().y/32][(int)PARTY_MEMBER_OBJ[0]->GetPosWithOrigin().x/32]->tileDegree:0; + return GetSafeTileData(data).tileDegree; } #ifndef TEST_SUITE diff --git a/save0 b/save0 index 6646336..da5418c 100644 --- a/save0 +++ b/save0 @@ -1 +1 @@ -120 120 PLAYER 30 30 8 8 4 0 0 0 0 0 0 0 11 9 10 13 14 15 16 17 33 29 21 25 1 4 6 3 4 7 8 3590.34 279.648 120 120 NESS 30 30 8 8 4 0 0 0 0 0 0 0 6 33 34 29 30 31 32 0 3 -1 7 12 3590.34 266.648 120 120 PAULA 30 30 8 8 4 0 0 0 0 0 0 0 6 21 22 23 24 37 38 0 3 -1 7 -1 3592.34 256.648 120 120 JEFF 30 30 8 8 4 0 0 0 0 0 0 0 1 0 0 3 -1 -1 -1 -999 -999 120 120 ANNA 30 30 8 8 4 0 0 0 0 0 0 0 4 21 25 26 29 0 3 5 7 12 3592.34 244.648 120 120 KING 30 30 8 8 4 0 0 0 0 0 0 0 1 0 0 3 -1 -1 -1 -999 -999 120 120 POO 30 30 8 8 4 0 0 0 0 0 0 0 1 0 0 3 -1 -1 -1 -999 -999 47 6 7 7 7 7 7 7 7 7 7 7 6 3 3 3 10 10 10 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2 11 0 0 512 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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