diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 75b9882..d04337d 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/assets/maps/map0 b/assets/maps/map0 index 7646c3c..7e2b79d 100644 --- a/assets/maps/map0 +++ b/assets/maps/map0 @@ -54,7 +54,6 @@ OBJECT160.000000;128.000000;8 OBJECT192.000000;128.000000;8 OBJECT288.000000;128.000000;8 OBJECT313.000000;151.000000;8 -OBJECT35.000000;158.000000;0 OBJECT313.000000;131.000000;10 OBJECT192.000000;160.000000;8 OBJECT160.000000;160.000000;8 @@ -80,7 +79,7 @@ OBJECT256.000000;256.000000;8 OBJECT224.000000;256.000000;8 OBJECT192.000000;256.000000;8 OBJECT160.000000;256.000000;8 +OBJECT208.000000;356.000000;0 ENCOUNTER64.000000;512.000000;90;2 -ENCOUNTER64.000000;256.000000;50;1 ENCOUNTER192.000000;352.000000;100;1 ENCOUNTER480.000000;160.000000;100;3 \ No newline at end of file diff --git a/assets/maps/map0_2 b/assets/maps/map0_2 index a04989a..e90f47f 100644 --- a/assets/maps/map0_2 +++ b/assets/maps/map0_2 @@ -9,11 +9,11 @@ ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? +????????????????????????56?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? +??????????????????????9256?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? +????????????????????????56?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? +????????????????????92??56?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? +????????????????????????56?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? diff --git a/assets/maps/map0_5 b/assets/maps/map0_5 index 183e6b3..a893407 100644 --- a/assets/maps/map0_5 +++ b/assets/maps/map0_5 @@ -9,11 +9,11 @@ ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? +????????????????????????56?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? +??????????????????????9256?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? +????????????????????????56?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? +????????????????????92??56?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? +????????????????????????56?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? diff --git a/main.cpp b/main.cpp index 435edbc..ddf98a9 100644 --- a/main.cpp +++ b/main.cpp @@ -2017,7 +2017,7 @@ goes on a very long time, I hope you can understand this is only for testing pur void SetupPartyMemberStats() { for (int i=0;i<7;i++) { - PARTY_MEMBER_STATS[i]=new Entity(120,120,30,30,8,{0,0,0,0},4,{MOVELIST[BattleMoveName::TESTMOVE1]}); + PARTY_MEMBER_STATS[i]=new Entity(120,120,30,30,8,{0,0,0,0},8,{MOVELIST[BattleMoveName::TESTMOVE1]}); } PARTY_MEMBER_STATS[PLAYER]->moveSet={ MOVELIST[BattleMoveName::HAILSTORM_A], @@ -3323,33 +3323,54 @@ goes on a very long time, I hope you can understand this is only for testing pur } } - void PopulateMovementGrid(vd2d pos,int range) { - vi2d gridCenter = (vi2d)pos/32*32; - MOVEMENT_GRID.clear(); - for (int x=-range+1;x=WIDTH||pos.y<0||pos.y>=HEIGHT-64) { + return; + } + for (int xx=0;xx<32;xx++) { + for (int yy=0;yy<32;yy++) { + vi2d offset={xx,yy}; + if (Collision(pos+offset)) { + return; + } } } - } - for (std::map,vd2d>::const_iterator it = MOVEMENT_GRID.cbegin();it!=MOVEMENT_GRID.cend();++it) { - vi2d offset = {it->first.first,it->first.second}; + bool nonSolid=false; //Ran into a non-solid instance, which means we can't mark the tile, but we can continue moving through. for (int i=0;ifirst]==(vi2d)(BATTLE_ENCOUNTER->pos-PARTY_MEMBER_OBJ[i]->GetPosWithOrigin())/32*32) { - MOVEMENT_GRID[it->first]=NO_NEIGHBOR; + if (CURRENT_TURN!=-i-1&&pos==(vi2d)(PARTY_MEMBER_OBJ[i]->GetPosWithOrigin()-cameraPos)/32*32) { + nonSolid=true; break; } } - for (int i=0;iobjs.size();i++) { - if (MOVEMENT_GRID[it->first]==(vi2d)(BATTLE_ENCOUNTER->objs[i]->obj->GetPosWithOrigin()-cameraPos)/32*32) { - MOVEMENT_GRID[it->first]=NO_NEIGHBOR; - break; + if (!nonSolid) { + for (int i=0;iobjs.size();i++) { + if (pos==(vi2d)(BATTLE_ENCOUNTER->objs[i]->obj->GetPosWithOrigin()-cameraPos)/32*32) { + nonSolid=true; + } } } + + if (!nonSolid) { + MOVEMENT_GRID[{x,y}]=pos; + } + if (lifetime>0) { + vi2d offsetLeft = {-32,0}; + CheckGrid(x-1,y,pos+offsetLeft,lifetime-1); + vi2d offsetRight = {32,0}; + CheckGrid(x+1,y,pos+offsetRight,lifetime-1); + vi2d offsetUp = {0,-32}; + CheckGrid(x,y-1,pos+offsetUp,lifetime-1); + vi2d offsetDown = {0,32}; + CheckGrid(x,y+1,pos+offsetDown,lifetime-1); + } } + } + + void PopulateMovementGrid(vd2d pos,int range) { + vi2d gridCenter = (vi2d)pos/32*32; + MOVEMENT_GRID.clear(); + CheckGrid(0,0,gridCenter-cameraPos,range); for (std::map,vd2d>::const_iterator it = MOVEMENT_GRID.cbegin();it!=MOVEMENT_GRID.cend();++it) { int gridX = it->first.first; int gridY = it->first.second; @@ -3391,6 +3412,12 @@ goes on a very long time, I hope you can understand this is only for testing pur } return memberID; } + + bool Collision(vd2d pos) { + SetDrawTarget(layer::COLLISION); + Pixel collisionData = GAME->GetDrawTarget()->GetPixel((int)pos.x,(int)pos.y); + return collisionData!=MAGENTA; + } };