diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 6b1d7c3..f5c82e3 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/assets/maps/map0_5 b/assets/maps/map0_5 index be19ff8..88c9c74 100644 --- a/assets/maps/map0_5 +++ b/assets/maps/map0_5 @@ -4,8 +4,8 @@ ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????:4:4:4:4;6???? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????;4???? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????=6>6>6>6?6????;4???? -??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????=6=7<2=2>2?7?6??;4???? -??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????=7>6>6>6>6>6?7??;4???? +??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????=6=7=9=2?9?7?6??;4???? +??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????=7>8>6>6>6>9?7??;4???? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????8282??;4???? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????5<6<6<7<;4???? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? diff --git a/assets/terrainmap.png b/assets/terrainmap.png index 3ef6325..69346f3 100644 Binary files a/assets/terrainmap.png and b/assets/terrainmap.png differ diff --git a/assets/terrainmap.xcf b/assets/terrainmap.xcf index 0e6f35d..33dae13 100644 Binary files a/assets/terrainmap.xcf and b/assets/terrainmap.xcf differ diff --git a/main.cpp b/main.cpp index 5c373d9..44e44cf 100644 --- a/main.cpp +++ b/main.cpp @@ -961,7 +961,8 @@ void SeasonI::LoadMap(Map*map) { unsigned char tileX,tileY; tileX=data[i]-'0'; tileY=data[i+1]-'0'; - tiles.push_back(new TILE(tileX,tileY)); + + tiles.push_back(new TILE(tileX,tileY,TILE::GetTileDegree(map,tileX,tileY))); } MAP.push_back(tiles); MAP_HEIGHT++; @@ -975,7 +976,7 @@ void SeasonI::LoadMap(Map*map) { unsigned char tileX,tileY; tileX=data[i]-'0'; tileY=data[i+1]-'0'; - tiles.push_back(new TILE(tileX,tileY)); + tiles.push_back(new TILE(tileX,tileY,TILE::GetTileDegree(map,tileX,tileY))); } MAP2.push_back(tiles); } @@ -986,7 +987,7 @@ void SeasonI::LoadMap(Map*map) { unsigned char tileX,tileY; tileX=data[i]-'0'; tileY=data[i+1]-'0'; - tiles.push_back(new TILE(tileX,tileY)); + tiles.push_back(new TILE(tileX,tileY,TILE::GetTileDegree(map,tileX,tileY))); } MAP3.push_back(tiles); } @@ -997,7 +998,7 @@ void SeasonI::LoadMap(Map*map) { unsigned char tileX,tileY; tileX=data[i]-'0'; tileY=data[i+1]-'0'; - tiles.push_back(new TILE(tileX,tileY)); + tiles.push_back(new TILE(tileX,tileY,TILE::GetTileDegree(map,tileX,tileY))); } MAP4.push_back(tiles); } @@ -1008,7 +1009,7 @@ void SeasonI::LoadMap(Map*map) { unsigned char tileX,tileY; tileX=data[i]-'0'; tileY=data[i+1]-'0'; - tiles.push_back(new TILE(tileX,tileY)); + tiles.push_back(new TILE(tileX,tileY,TILE::GetTileDegree(map,tileX,tileY))); } MAP5.push_back(tiles); } @@ -1019,7 +1020,7 @@ void SeasonI::LoadMap(Map*map) { unsigned char tileX,tileY; tileX=data[i]-'0'; tileY=data[i+1]-'0'; - tiles.push_back(new TILE(tileX,tileY)); + tiles.push_back(new TILE(tileX,tileY,TILE::GetTileDegree(map,tileX,tileY))); } MAP6.push_back(tiles); } @@ -4585,7 +4586,14 @@ void SeasonI::DrawGameWorld() { for (int y=-1;ydrawn&&(!obj->dead||EDITING_LAYER==layer::ENCOUNTER)&&obj->GetPos().y+obj->originPoint.y>(y+yTileOffset)*32&&obj->GetPos().y+obj->originPoint.y<=(y+yTileOffset+1)*32) { + if (!obj->drawn&&(!obj->dead||EDITING_LAYER==layer::ENCOUNTER)&& + (MAP2[y+yTileOffset][(obj->GetPos().x+obj->originPoint.x)/32]->tileDegree==0&& + obj->GetPos().y+obj->originPoint.y>(y+yTileOffset)*32&& + obj->GetPos().y+obj->originPoint.y<=(y+yTileOffset+1)*32|| + MAP2[y+yTileOffset][(obj->GetPos().x+obj->originPoint.x)/32]->tileDegree==-1&& //y=-x+b Check if 32-x position is greater than our y. + ((int)(obj->GetPos().x+obj->originPoint.x)%32<32-(int)(obj->GetPos().y+obj->originPoint.y)%32)/*|| + y+yTileOffset<(int)(obj->GetPos().y+obj->originPoint.y)/32*/)) { + printf("%d<%d\n",(int)(obj->GetPos().x+obj->originPoint.x)%32,32-(int)(obj->GetPos().y+obj->originPoint.y)%32); obj->drawn=true; if (obj->blinkFrames>0) { obj->blinkFrames--; @@ -4606,7 +4614,7 @@ void SeasonI::DrawGameWorld() { while (accY>=1) { for (int xxx=0;xxx64) { - GetDrawTarget()->SetPixel(obj->GetPos().x-cameraPos.x+pixelOffsetX+xxx,obj->GetPos().y-cameraPos.y+pixelOffsetY,Pixel(255,255,255,abs(sin(M_PI/60*frameCount)*210))); + GetDrawTarget()->SetPixel(obj->GetPos().x-cameraPos.x+pixelOffsetX+xxx,obj->GetPos().y-cameraPos.y+pixelOffsetY,Pixel(255,255,255,std::abs(sin(M_PI/60*frameCount)*210))); } } accY-=1; @@ -5503,7 +5511,6 @@ void SeasonI::LoadGameSaveData(int saveSlot) { double xPos=ReadDoubleFromStream(file); double yPos=ReadDoubleFromStream(file); if (PARTY_MEMBER_STATS[i]->obj!=nullptr) { - PARTY_MEMBER_STATS[i]->obj->SetPos({xPos,yPos}); positions[playerCount++]={xPos,yPos}; } } @@ -5516,9 +5523,16 @@ void SeasonI::LoadGameSaveData(int saveSlot) { for (int i=0;iSetPos(positions[i]); } diff --git a/save0 b/save0 index e6a3b11..6646336 100644 --- a/save0 +++ b/save0 @@ -1 +1 @@ -120 120 PLAYER 2 30 8 8 4 0 0 0 0 0 0 0 11 9 10 13 14 15 16 17 33 29 21 25 1 6 4 3 4 7 8 3428.04 408.473 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 3441.04 408.473 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 3453.04 408.473 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 14 30 8 8 4 0 0 0 0 0 0 0 4 21 25 26 29 0 3 5 7 12 3465.04 408.473 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 1 1 0 1 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 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 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 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 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 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 748398 594420 PLAYER 0 \ No newline at end of file +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 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 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 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 748398 596691 PLAYER 0 \ No newline at end of file diff --git a/tiles.h b/tiles.h index beae6b6..c51a2ed 100644 --- a/tiles.h +++ b/tiles.h @@ -1,16 +1,30 @@ #ifndef TILES_H #define TILES_H #include "pixelGameEngine.h" +#include "map.h" using namespace olc; +extern std::map SPRITES; + class TILE{ public: int tileX; int tileY; - char tileDegree; - TILE(int tileX,int tileY) { - this->tileX=tileX; - this->tileY=tileY; - }; + char tileDegree=0; //-1 is slanted from bottom-left to top-right. 1 is slanted from top-left to bottom-right. + TILE(int tileX,int tileY,char tileDegree) + :tileX(tileX),tileY(tileY),tileDegree(tileDegree){} + static char GetTileDegree(Map*map,int tileX,int tileY) { + if (map->tileset==SPRITES["terrainmap.png"]) { + if (tileX==12&&tileY==0|| + tileX==12&&tileY==1) { + return -1; + } + if (tileX==14&&tileY==0|| + tileX==14&&tileY==1) { + return 1; + } + } + return 0; + } }; #endif \ No newline at end of file