Fix speed grid movement values and made so the centered movement option does not consume a turn

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 50d725ee7e
commit fca95e62d2
  1. BIN
      C++ProjectTemplate
  2. 24
      main.cpp

Binary file not shown.

@ -760,7 +760,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
//DisplayMessageBox("Not implemented yet."); //DisplayMessageBox("Not implemented yet.");
BATTLE_STATE=BattleState::MOVE_SELECT; BATTLE_STATE=BattleState::MOVE_SELECT;
SELECTED_MOVE_SQUARE={0,0}; SELECTED_MOVE_SQUARE={0,0};
PopulateMovementGrid(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->obj->GetPosWithOrigin(),PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->speed/2); PopulateMovementGrid(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->obj->GetPosWithOrigin(),CalculateSpeedGridMovementAmount(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->speed));
}break; }break;
case 5:{ //Run selected. case 5:{ //Run selected.
DisplayMessageBox("Not implemented yet."); DisplayMessageBox("Not implemented yet.");
@ -1045,9 +1045,13 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
escapeDown: escapeDown:
if (ACTIONKEYPRESSED) { if (ACTIONKEYPRESSED) {
BATTLE_ENCOUNTER->playerPos[-CURRENT_TURN-1]=(BATTLE_ENCOUNTER->playerPos[-CURRENT_TURN-1]/32+SELECTED_MOVE_SQUARE)*32; if (SELECTED_MOVE_SQUARE.x==0&&SELECTED_MOVE_SQUARE.y==0) {
BATTLE_STATE=BattleState::MOVE_CAMERA; BATTLE_STATE=BattleState::SELECT_ACTION;
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->atb=400; } else {
BATTLE_ENCOUNTER->playerPos[-CURRENT_TURN-1]=(BATTLE_ENCOUNTER->playerPos[-CURRENT_TURN-1]/32+SELECTED_MOVE_SQUARE)*32;
BATTLE_STATE=BattleState::MOVE_CAMERA;
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->atb=400;
}
} }
}break; }break;
case BattleState::ITEM_SELECT:{ case BattleState::ITEM_SELECT:{
@ -3822,7 +3826,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
void PopulateMovementGrid(vd2d pos,int range) { void PopulateMovementGrid(vd2d pos,int range) {
vi2d gridCenter = (vi2d)pos/32*32; vi2d gridCenter = (vi2d)pos/32*32;
MOVEMENT_GRID.clear(); MOVEMENT_GRID.clear();
CheckGrid(0,0,gridCenter-cameraPos,range); CheckGrid(0,0,gridCenter-cameraPos,std::min(8,range));
} }
vi2d grid(int x, int y) { vi2d grid(int x, int y) {
@ -4457,6 +4461,16 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
} }
} }
int CalculateSpeedGridMovementAmount(int spd) {
const std::array<int,8> spdRequirements={0,6,10,18,28,40,60,100};
for (int i=7;i>=0;i--) {
if (spd>spdRequirements[i]) {
return i+1;
}
}
return 1;
}
}; };
int main() int main()

Loading…
Cancel
Save