Power menu functionality completed

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 7f2339ce19
commit afcc310fa4
  1. BIN
      C++ProjectTemplate
  2. 2
      assets/maps/map0
  3. 64
      main.cpp

Binary file not shown.

@ -53,7 +53,6 @@ OBJECT224.000000;128.000000;8
OBJECT160.000000;128.000000;8
OBJECT192.000000;128.000000;8
OBJECT288.000000;128.000000;8
OBJECT453.000000;133.000000;0
OBJECT313.000000;151.000000;8
OBJECT313.000000;131.000000;10
OBJECT192.000000;160.000000;8
@ -75,6 +74,7 @@ OBJECT160.000000;224.000000;8
OBJECT288.000000;224.000000;8
OBJECT224.000000;224.000000;8
OBJECT256.000000;224.000000;7
OBJECT76.000000;228.000000;0
OBJECT288.000000;256.000000;8
OBJECT256.000000;256.000000;8
OBJECT224.000000;256.000000;8

@ -1196,18 +1196,31 @@ goes on a very long time, I hope you can understand this is only for testing pur
case BattleState::POWER_SELECT:{
if (CURRENT_TURN<0) {
if (DownPressed()) {
POWER_SELECTION_CURSOR[-CURRENT_TURN-1]=std::clamp(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]+1,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
if (POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-POWER_SELECTION_OFFSET[-CURRENT_TURN-1]>=4) {
POWER_SELECTION_OFFSET[-CURRENT_TURN-1]++;
if (POWER_SELECTION_CURSOR[-CURRENT_TURN-1]==(int)BATTLE_MOVELIST_DISPLAY.size()-1) {
POWER_SELECTION_CURSOR[-CURRENT_TURN-1]=0;
POWER_SELECTION_OFFSET[-CURRENT_TURN-1]=0;
} else {
POWER_SELECTION_CURSOR[-CURRENT_TURN-1]=std::clamp(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]+1,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
if (POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-POWER_SELECTION_OFFSET[-CURRENT_TURN-1]>=4) {
POWER_SELECTION_OFFSET[-CURRENT_TURN-1]++;
}
}
}
if (UpPressed()) {
POWER_SELECTION_CURSOR[-CURRENT_TURN-1]=std::clamp(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-1,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
if (POWER_SELECTION_CURSOR[-CURRENT_TURN-1]<POWER_SELECTION_OFFSET[-CURRENT_TURN-1]) {
POWER_SELECTION_OFFSET[-CURRENT_TURN-1]--;
if (POWER_SELECTION_CURSOR[-CURRENT_TURN-1]==0) {
POWER_SELECTION_CURSOR[-CURRENT_TURN-1]=(int)BATTLE_MOVELIST_DISPLAY.size()-1;
POWER_SELECTION_OFFSET[-CURRENT_TURN-1]=std::clamp(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-3,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
} else {
POWER_SELECTION_CURSOR[-CURRENT_TURN-1]=std::clamp(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-1,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
if (POWER_SELECTION_CURSOR[-CURRENT_TURN-1]<POWER_SELECTION_OFFSET[-CURRENT_TURN-1]) {
POWER_SELECTION_OFFSET[-CURRENT_TURN-1]--;
}
}
}
if (ACTIONKEYPRESSED) {
if (LeftPressed()) {
BATTLE_STATE=BattleState::SELECT_ACTION;
}
if (ACTIONKEYPRESSED||RightPressed()) {
BATTLE_STATE=BattleState::GRADE_SELECT;
}
}
@ -1215,12 +1228,39 @@ goes on a very long time, I hope you can understand this is only for testing pur
case BattleState::GRADE_SELECT:{
if (CURRENT_TURN<0) {
if (RightPressed()) {
POWER_GRADE_CURSOR[-CURRENT_TURN-1]=std::clamp(POWER_GRADE_CURSOR[-CURRENT_TURN-1]+1,0,(int)(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]].size())-1);
}
if (UpPressed()||LeftPressed()&&POWER_GRADE_CURSOR[-CURRENT_TURN-1]==0) {
POWER_GRADE_CURSOR[-CURRENT_TURN-1]=0;
BATTLE_STATE=BattleState::POWER_SELECT;
POWER_GRADE_CURSOR[-CURRENT_TURN-1]=(POWER_GRADE_CURSOR[-CURRENT_TURN-1]+1)%BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]].size();
}
if (DownPressed()||UpPressed()||LeftPressed()&&POWER_GRADE_CURSOR[-CURRENT_TURN-1]==0) {
if (UpPressed()) {
if (POWER_SELECTION_CURSOR[-CURRENT_TURN-1]==0) {
POWER_SELECTION_CURSOR[-CURRENT_TURN-1]=(int)BATTLE_MOVELIST_DISPLAY.size()-1;
POWER_GRADE_CURSOR[-CURRENT_TURN-1]=std::clamp(POWER_GRADE_CURSOR[-CURRENT_TURN-1],0,(int)BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]].size()-1);
POWER_SELECTION_OFFSET[-CURRENT_TURN-1]=std::clamp(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-3,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
} else {
POWER_SELECTION_CURSOR[-CURRENT_TURN-1]=std::clamp(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-1,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
POWER_GRADE_CURSOR[-CURRENT_TURN-1]=std::clamp(POWER_GRADE_CURSOR[-CURRENT_TURN-1],0,(int)BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]].size()-1);
if (POWER_SELECTION_CURSOR[-CURRENT_TURN-1]<POWER_SELECTION_OFFSET[-CURRENT_TURN-1]) {
POWER_SELECTION_OFFSET[-CURRENT_TURN-1]--;
}
}
} else
if (DownPressed()) {
if (POWER_SELECTION_CURSOR[-CURRENT_TURN-1]==(int)BATTLE_MOVELIST_DISPLAY.size()-1) {
POWER_GRADE_CURSOR[-CURRENT_TURN-1]=0;
POWER_SELECTION_CURSOR[-CURRENT_TURN-1]=0;
POWER_SELECTION_OFFSET[-CURRENT_TURN-1]=0;
} else {
POWER_SELECTION_CURSOR[-CURRENT_TURN-1]=std::clamp(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]+1,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
POWER_GRADE_CURSOR[-CURRENT_TURN-1]=std::clamp(POWER_GRADE_CURSOR[-CURRENT_TURN-1],0,(int)BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]].size()-1);
if (POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-POWER_SELECTION_OFFSET[-CURRENT_TURN-1]>=4) {
POWER_SELECTION_OFFSET[-CURRENT_TURN-1]++;
}
}
} else {
POWER_GRADE_CURSOR[-CURRENT_TURN-1]=0;
BATTLE_STATE=BattleState::POWER_SELECT;
}
} else
if (LeftPressed()) {
POWER_GRADE_CURSOR[-CURRENT_TURN-1]=std::clamp(POWER_GRADE_CURSOR[-CURRENT_TURN-1]-1,0,(int)(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]].size())-1);
}

Loading…
Cancel
Save