|
|
@ -2017,7 +2017,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
|
|
|
|
|
|
|
void SetupPartyMemberStats() { |
|
|
|
void SetupPartyMemberStats() { |
|
|
|
for (int i=0;i<7;i++) { |
|
|
|
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={ |
|
|
|
PARTY_MEMBER_STATS[PLAYER]->moveSet={ |
|
|
|
MOVELIST[BattleMoveName::HAILSTORM_A], |
|
|
|
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) { |
|
|
|
void CheckGrid(int x,int y,vd2d pos,int lifetime) { |
|
|
|
vi2d gridCenter = (vi2d)pos/32*32; |
|
|
|
if (!MOVEMENT_GRID.count({x,y})) { |
|
|
|
MOVEMENT_GRID.clear(); |
|
|
|
if (pos.x<0||pos.x>=WIDTH||pos.y<0||pos.y>=HEIGHT-64) { |
|
|
|
for (int x=-range+1;x<range;x++) { |
|
|
|
return; |
|
|
|
for (int y=-range+1;y<range;y++) { |
|
|
|
|
|
|
|
int dist = abs(x)+abs(y); |
|
|
|
|
|
|
|
if (dist<range) { |
|
|
|
|
|
|
|
vi2d offset = {x,y}; |
|
|
|
|
|
|
|
MOVEMENT_GRID[{x,y}]=gridCenter-cameraPos+offset*32; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
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<std::pair<int,int>,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;i<PARTY_MEMBER_COUNT;i++) { |
|
|
|
for (int i=0;i<PARTY_MEMBER_COUNT;i++) { |
|
|
|
if (CURRENT_TURN!=-i-1&&MOVEMENT_GRID[it->first]==(vi2d)(BATTLE_ENCOUNTER->pos-PARTY_MEMBER_OBJ[i]->GetPosWithOrigin())/32*32) { |
|
|
|
if (CURRENT_TURN!=-i-1&&pos==(vi2d)(PARTY_MEMBER_OBJ[i]->GetPosWithOrigin()-cameraPos)/32*32) { |
|
|
|
MOVEMENT_GRID[it->first]=NO_NEIGHBOR; |
|
|
|
nonSolid=true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!nonSolid) { |
|
|
|
for (int i=0;i<BATTLE_ENCOUNTER->objs.size();i++) { |
|
|
|
for (int i=0;i<BATTLE_ENCOUNTER->objs.size();i++) { |
|
|
|
if (MOVEMENT_GRID[it->first]==(vi2d)(BATTLE_ENCOUNTER->objs[i]->obj->GetPosWithOrigin()-cameraPos)/32*32) { |
|
|
|
if (pos==(vi2d)(BATTLE_ENCOUNTER->objs[i]->obj->GetPosWithOrigin()-cameraPos)/32*32) { |
|
|
|
MOVEMENT_GRID[it->first]=NO_NEIGHBOR; |
|
|
|
nonSolid=true; |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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<std::pair<int,int>,vd2d>::const_iterator it = MOVEMENT_GRID.cbegin();it!=MOVEMENT_GRID.cend();++it) { |
|
|
|
for (std::map<std::pair<int,int>,vd2d>::const_iterator it = MOVEMENT_GRID.cbegin();it!=MOVEMENT_GRID.cend();++it) { |
|
|
|
int gridX = it->first.first; |
|
|
|
int gridX = it->first.first; |
|
|
|
int gridY = it->first.second; |
|
|
|
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; |
|
|
|
return memberID; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool Collision(vd2d pos) { |
|
|
|
|
|
|
|
SetDrawTarget(layer::COLLISION); |
|
|
|
|
|
|
|
Pixel collisionData = GAME->GetDrawTarget()->GetPixel((int)pos.x,(int)pos.y); |
|
|
|
|
|
|
|
return collisionData!=MAGENTA; |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|