Single target highlighting on overworld

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent dbde149aba
commit 764bff7683
  1. BIN
      C++ProjectTemplate
  2. 147
      main.cpp

Binary file not shown.

@ -163,7 +163,7 @@ public:
bool HEALING_OVERWORLD_SINGLE_MEMBER=false; //When set to true, a single member is being healed. bool HEALING_OVERWORLD_SINGLE_MEMBER=false; //When set to true, a single member is being healed.
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things. bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
std::vector<std::vector<TILE*>> MAP; //The foreground layer. std::vector<std::vector<TILE*>> MAP; //The foreground layer.
std::vector<std::vector<TILE*>> MAP2; std::vector<std::vector<TILE*>> MAP2;
std::vector<std::vector<TILE*>> MAP3; std::vector<std::vector<TILE*>> MAP3;
@ -336,6 +336,9 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
HEALING_OVERWORLD_MEMBER++; HEALING_OVERWORLD_MEMBER++;
} }
if (HEALING_OVERWORLD_MEMBER>=PARTY_MEMBER_COUNT) {
HEALING_OVERWORLD_MEMBERS=false;
}
castingMember->selectedMove=nullptr; castingMember->selectedMove=nullptr;
} }
if (HEALING_OVERWORLD_SINGLE_MEMBER) { if (HEALING_OVERWORLD_SINGLE_MEMBER) {
@ -1122,109 +1125,111 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
if (UpPressed()) { if (UpPressed()) {
GAME_STATE=GameState::OVERWORLD_MENU; GAME_STATE=GameState::OVERWORLD_MENU;
OVERWORLD_POWER_SELECTION_MEMBER=-1;
} }
if (ACTIONKEYPRESSED) { if (ACTIONKEYPRESSED) {
GAME_STATE=GameState::OVERWORLD_POWER_MENU; GAME_STATE=GameState::OVERWORLD_POWER_MENU;
} }
}break; }break;
case GameState::OVERWORLD_POWER_MENU:{ case GameState::OVERWORLD_POWER_MENU:{
if (CURRENT_TURN<0) { if (DownPressed()) {
if (DownPressed()) { if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]==(int)BATTLE_MOVELIST_DISPLAY.size()-1) {
if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]==(int)BATTLE_MOVELIST_DISPLAY.size()-1) { OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=0;
OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=0; OVERWORLD_POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]=0;
OVERWORLD_POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]=0; } else {
} else { OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=std::clamp(OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]+1,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=std::clamp(OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]+1,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1); if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]-OVERWORLD_POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]>=4) {
if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]-OVERWORLD_POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]>=4) { OVERWORLD_POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]++;
OVERWORLD_POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]++;
}
}
}
if (UpPressed()) {
if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]==0) {
OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=(int)BATTLE_MOVELIST_DISPLAY.size()-1;
OVERWORLD_POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]=std::clamp(OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]-3,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
} else {
OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=std::clamp(OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]-1,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]<OVERWORLD_POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]) {
OVERWORLD_POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]--;
}
} }
} }
if (LeftPressed()) { }
if (PARTY_MEMBER_COUNT==1) { if (UpPressed()) {
GAME_STATE=GameState::OVERWORLD_MENU; if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]==0) {
} else { OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=(int)BATTLE_MOVELIST_DISPLAY.size()-1;
GAME_STATE=GameState::OVERWORLD_POWER_PLAYER_MENU; OVERWORLD_POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]=std::clamp(OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]-3,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
} else {
OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=std::clamp(OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]-1,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]<OVERWORLD_POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]) {
OVERWORLD_POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]--;
} }
} }
if (ACTIONKEYPRESSED||RightPressed()) { }
GAME_STATE=GameState::OVERWORLD_GRADE_MENU; if (LeftPressed()) {
if (PARTY_MEMBER_COUNT==1) {
GAME_STATE=GameState::OVERWORLD_MENU;
} else {
GAME_STATE=GameState::OVERWORLD_POWER_PLAYER_MENU;
} }
} }
if (ACTIONKEYPRESSED||RightPressed()) {
GAME_STATE=GameState::OVERWORLD_GRADE_MENU;
}
}break; }break;
case GameState::OVERWORLD_GRADE_MENU:{ case GameState::OVERWORLD_GRADE_MENU:{
if (CURRENT_TURN<0) { if (RightPressed()) {
if (RightPressed()) { OVERWORLD_POWER_GRADE_CURSOR=(OVERWORLD_POWER_GRADE_CURSOR+1)%BATTLE_MOVELIST_DISPLAY[OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]].size();
OVERWORLD_POWER_GRADE_CURSOR=(OVERWORLD_POWER_GRADE_CURSOR+1)%BATTLE_MOVELIST_DISPLAY[OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]].size(); }
} if (DownPressed()||UpPressed()||LeftPressed()&&OVERWORLD_POWER_GRADE_CURSOR==0) {
if (DownPressed()||UpPressed()||LeftPressed()&&OVERWORLD_POWER_GRADE_CURSOR==0) { if (UpPressed()) {
if (UpPressed()) { if (BATTLE_MOVELIST_DISPLAY.size()>1) {
if (BATTLE_MOVELIST_DISPLAY.size()>1) { if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]==0) {
if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]==0) { OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=(int)BATTLE_MOVELIST_DISPLAY.size()-1;
OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=(int)BATTLE_MOVELIST_DISPLAY.size()-1; OVERWORLD_POWER_GRADE_CURSOR=std::clamp(OVERWORLD_POWER_GRADE_CURSOR,0,(int)BATTLE_MOVELIST_DISPLAY[OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]].size()-1);
OVERWORLD_POWER_GRADE_CURSOR=std::clamp(OVERWORLD_POWER_GRADE_CURSOR,0,(int)BATTLE_MOVELIST_DISPLAY[OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]].size()-1); POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]=std::clamp(OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]-3,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]=std::clamp(OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]-3,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1); } else {
} else { OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=std::clamp(OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]-1,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=std::clamp(OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]-1,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1); OVERWORLD_POWER_GRADE_CURSOR=std::clamp(OVERWORLD_POWER_GRADE_CURSOR,0,(int)BATTLE_MOVELIST_DISPLAY[OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]].size()-1);
OVERWORLD_POWER_GRADE_CURSOR=std::clamp(OVERWORLD_POWER_GRADE_CURSOR,0,(int)BATTLE_MOVELIST_DISPLAY[OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]].size()-1); if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]<POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]) {
if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]<POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]) { POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]--;
POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]--;
}
} }
} }
} else }
if (DownPressed()) { } else
if (BATTLE_MOVELIST_DISPLAY.size()>1) { if (DownPressed()) {
if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]==(int)BATTLE_MOVELIST_DISPLAY.size()-1) { if (BATTLE_MOVELIST_DISPLAY.size()>1) {
OVERWORLD_POWER_GRADE_CURSOR=0; if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]==(int)BATTLE_MOVELIST_DISPLAY.size()-1) {
OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=0; OVERWORLD_POWER_GRADE_CURSOR=0;
POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]=0; OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=0;
} else { POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]=0;
OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=std::clamp(OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]+1,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1); } else {
OVERWORLD_POWER_GRADE_CURSOR=std::clamp(OVERWORLD_POWER_GRADE_CURSOR,0,(int)BATTLE_MOVELIST_DISPLAY[OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]].size()-1); OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]=std::clamp(OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]+1,0,(int)BATTLE_MOVELIST_DISPLAY.size()-1);
if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]-POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]>=4) { OVERWORLD_POWER_GRADE_CURSOR=std::clamp(OVERWORLD_POWER_GRADE_CURSOR,0,(int)BATTLE_MOVELIST_DISPLAY[OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]].size()-1);
POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]++; if (OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]-POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]>=4) {
} POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]++;
} }
} }
} else {
OVERWORLD_POWER_GRADE_CURSOR=0;
GAME_STATE=GameState::OVERWORLD_POWER_MENU;
} }
} else } else {
if (LeftPressed()) { OVERWORLD_POWER_GRADE_CURSOR=0;
OVERWORLD_POWER_GRADE_CURSOR=std::clamp(OVERWORLD_POWER_GRADE_CURSOR-1,0,(int)(BATTLE_MOVELIST_DISPLAY[OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]].size())-1); GAME_STATE=GameState::OVERWORLD_POWER_MENU;
} }
if (ACTIONKEYPRESSED) { } else
if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_POWER_SELECTION_MEMBER]]->GetPP()>=BATTLE_MOVELIST_DISPLAY[OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]][OVERWORLD_POWER_GRADE_CURSOR]->PPCost) { if (LeftPressed()) {
PerformOverworldMove(BATTLE_MOVELIST_DISPLAY[OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]][OVERWORLD_POWER_GRADE_CURSOR],OVERWORLD_POWER_SELECTION_MEMBER); OVERWORLD_POWER_GRADE_CURSOR=std::clamp(OVERWORLD_POWER_GRADE_CURSOR-1,0,(int)(BATTLE_MOVELIST_DISPLAY[OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]].size())-1);
} }
if (ACTIONKEYPRESSED) {
if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_POWER_SELECTION_MEMBER]]->GetPP()>=BATTLE_MOVELIST_DISPLAY[OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]][OVERWORLD_POWER_GRADE_CURSOR]->PPCost) {
PerformOverworldMove(BATTLE_MOVELIST_DISPLAY[OVERWORLD_POWER_SELECTION_CURSOR[OVERWORLD_POWER_SELECTION_MEMBER]][OVERWORLD_POWER_GRADE_CURSOR],OVERWORLD_POWER_SELECTION_MEMBER);
} }
} }
}break; }break;
case GameState::OVERWORLD_TARGET_MENU:{ case GameState::OVERWORLD_TARGET_MENU:{
if (RightPressed()) { if (RightPressed()) {
PARTY_MEMBER_OBJ[OVERWORLD_TARGET_SELECTION]->highlighted=false;
OVERWORLD_TARGET_SELECTION=(OVERWORLD_TARGET_SELECTION+1)%PARTY_MEMBER_COUNT; OVERWORLD_TARGET_SELECTION=(OVERWORLD_TARGET_SELECTION+1)%PARTY_MEMBER_COUNT;
PARTY_MEMBER_OBJ[OVERWORLD_TARGET_SELECTION]->highlighted=true;
} }
if (LeftPressed()) { if (LeftPressed()) {
PARTY_MEMBER_OBJ[OVERWORLD_TARGET_SELECTION]->highlighted=false;
OVERWORLD_TARGET_SELECTION--; OVERWORLD_TARGET_SELECTION--;
if (OVERWORLD_TARGET_SELECTION<0) { if (OVERWORLD_TARGET_SELECTION<0) {
OVERWORLD_TARGET_SELECTION=PARTY_MEMBER_COUNT-1; OVERWORLD_TARGET_SELECTION=PARTY_MEMBER_COUNT-1;
} }
PARTY_MEMBER_OBJ[OVERWORLD_TARGET_SELECTION]->highlighted=true;
} }
if (UpPressed()){ if (UpPressed()){
GAME_STATE=GameState::OVERWORLD_GRADE_MENU; GAME_STATE=GameState::OVERWORLD_GRADE_MENU;
PARTY_MEMBER_OBJ[OVERWORLD_TARGET_SELECTION]->highlighted=false;
} }
if (ACTIONKEYPRESSED) { if (ACTIONKEYPRESSED) {
HEALING_OVERWORLD_SINGLE_MEMBER=true; HEALING_OVERWORLD_SINGLE_MEMBER=true;
@ -1232,6 +1237,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_POWER_SELECTION_MEMBER]]->SubtractPP(move->PPCost); PARTY_MEMBER_STATS[PARTY_MEMBER_ID[OVERWORLD_POWER_SELECTION_MEMBER]]->SubtractPP(move->PPCost);
DisplayMessageBox(PARTY_MEMBER_OBJ[OVERWORLD_POWER_SELECTION_MEMBER]->name+" begins to cast "+move->GetPowerName()+".\n"); DisplayMessageBox(PARTY_MEMBER_OBJ[OVERWORLD_POWER_SELECTION_MEMBER]->name+" begins to cast "+move->GetPowerName()+".\n");
GAME_STATE=GameState::OVERWORLD_GRADE_MENU; GAME_STATE=GameState::OVERWORLD_GRADE_MENU;
PARTY_MEMBER_OBJ[OVERWORLD_TARGET_SELECTION]->highlighted=false;
} }
}break; }break;
case GameState::EDITOR:{ case GameState::EDITOR:{
@ -1524,7 +1530,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
Object*obj=PARTY_MEMBER_OBJ[i]; Object*obj=PARTY_MEMBER_OBJ[i];
vi2d box = {(128-32*PARTY_MEMBER_COUNT)+i*64,160}; vi2d box = {(128-32*PARTY_MEMBER_COUNT)+i*64,160};
box+=screenShakeOffset; box+=screenShakeOffset;
if (CURRENT_TURN==-i-1) { if (CURRENT_TURN==-i-1||OVERWORLD_POWER_SELECTION_MEMBER==i) {
box.y-=20; box.y-=20;
} }
bool underAttack=false; bool underAttack=false;
@ -3908,6 +3914,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
if (move->name=="PK Lifeup") { if (move->name=="PK Lifeup") {
if (move->range==1) { if (move->range==1) {
GAME_STATE=GameState::OVERWORLD_TARGET_MENU; GAME_STATE=GameState::OVERWORLD_TARGET_MENU;
PARTY_MEMBER_OBJ[OVERWORLD_TARGET_SELECTION]->highlighted=true;
} else { } else {
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->SubtractPP(move->PPCost); PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->SubtractPP(move->PPCost);
DisplayMessageBox(PARTY_MEMBER_OBJ[partyMemberSlot]->name+" begins to cast "+move->GetPowerName()+".\n"); DisplayMessageBox(PARTY_MEMBER_OBJ[partyMemberSlot]->name+" begins to cast "+move->GetPowerName()+".\n");

Loading…
Cancel
Save