|
|
|
@ -447,10 +447,11 @@ public: |
|
|
|
|
int CURRENT_TURN=-99; //Who's turn we are enacting.
|
|
|
|
|
int BATTLE_SELECTION_CURSOR=0; |
|
|
|
|
int POWER_SELECTION_CURSOR[4]={0,0,0,0}; |
|
|
|
|
int POWER_GRADE_CURSOR[4]={0,0,0,0}; |
|
|
|
|
int TARGET_SELECTION_CURSOR=0; |
|
|
|
|
bool ANYKEYPRESSED=false; |
|
|
|
|
bool ACTIONKEYPRESSED=false; |
|
|
|
|
std::map<std::string,std::vector<Battle::Move*>> BATTLE_MOVELIST_DISPLAY; |
|
|
|
|
std::vector<std::vector<Battle::Move*>> BATTLE_MOVELIST_DISPLAY; |
|
|
|
|
std::map<int,int> ADDITIONAL_FONT_VALS = { |
|
|
|
|
{α,0},{β,1},{γ,2},{Ω,3},{Σ,4}, |
|
|
|
|
}; |
|
|
|
@ -1143,20 +1144,28 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
Object*obj=PARTY_MEMBER_OBJ[-CURRENT_TURN-1]; |
|
|
|
|
for (int i=0;i<member->moveSet.size();i++) { |
|
|
|
|
Battle::Move*move = member->moveSet[i]; |
|
|
|
|
if (BATTLE_MOVELIST_DISPLAY.count(move->name)) { |
|
|
|
|
bool found=false; |
|
|
|
|
for (int i=0;i<BATTLE_MOVELIST_DISPLAY[move->name].size();i++) { |
|
|
|
|
if (ADDITIONAL_FONT_VALS[move->grade]<ADDITIONAL_FONT_VALS[BATTLE_MOVELIST_DISPLAY[move->name][i]->grade]) { |
|
|
|
|
BATTLE_MOVELIST_DISPLAY[move->name].insert(BATTLE_MOVELIST_DISPLAY[move->name].begin()+i,move); |
|
|
|
|
found=true; |
|
|
|
|
break; |
|
|
|
|
bool exists=false; |
|
|
|
|
for (int j=0;j<BATTLE_MOVELIST_DISPLAY.size();j++) { |
|
|
|
|
if (BATTLE_MOVELIST_DISPLAY[j][0]->name.compare(move->name)==0) { |
|
|
|
|
bool found=false; |
|
|
|
|
for (int k=0;k<BATTLE_MOVELIST_DISPLAY[j].size();k++) { |
|
|
|
|
if (ADDITIONAL_FONT_VALS[move->grade]<ADDITIONAL_FONT_VALS[BATTLE_MOVELIST_DISPLAY[j][k]->grade]) { |
|
|
|
|
BATTLE_MOVELIST_DISPLAY[j].insert(BATTLE_MOVELIST_DISPLAY[j].begin()+i,move); |
|
|
|
|
found=true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (!found) { |
|
|
|
|
BATTLE_MOVELIST_DISPLAY[j].push_back(move); |
|
|
|
|
} |
|
|
|
|
exists=true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (!found) { |
|
|
|
|
BATTLE_MOVELIST_DISPLAY[move->name].push_back(move); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
BATTLE_MOVELIST_DISPLAY[move->name].push_back(move); |
|
|
|
|
} |
|
|
|
|
if (!exists) { |
|
|
|
|
std::vector<Battle::Move*> vec; |
|
|
|
|
vec.push_back(move); |
|
|
|
|
BATTLE_MOVELIST_DISPLAY.push_back(vec); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
@ -1193,6 +1202,23 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
POWER_SELECTION_OFFSET[-CURRENT_TURN-1]--; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (ACTIONKEYPRESSED) { |
|
|
|
|
BATTLE_STATE=BattleState::GRADE_SELECT; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
@ -1432,7 +1458,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
} |
|
|
|
|
if (BATTLE_ENCOUNTER!=nullptr) { |
|
|
|
|
SetDrawTarget(layer::HIGH); |
|
|
|
|
if (BATTLE_STATE==BattleState::SELECT_ACTION||BATTLE_STATE==BattleState::POWER_SELECT||BATTLE_STATE==BattleState::ITEM_SELECT) { |
|
|
|
|
if (BATTLE_STATE==BattleState::SELECT_ACTION||BATTLE_STATE==BattleState::POWER_SELECT||BATTLE_STATE==BattleState::GRADE_SELECT||BATTLE_STATE==BattleState::ITEM_SELECT) { |
|
|
|
|
DrawDialogBox({1,1},{(int)(WIDTH*0.75),HEIGHT/6},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128)); |
|
|
|
|
const std::string labels[6]={"Power","Attack","Item","Defend","Move","Run"}; |
|
|
|
|
for (int i=0;i<6;i+=2) { |
|
|
|
@ -1441,38 +1467,46 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
} |
|
|
|
|
DrawDecal({BATTLE_SELECTION_CURSOR/2*64+3,9+((BATTLE_SELECTION_CURSOR%2==0)?0:14)},SPRITES["cursor.png"]); |
|
|
|
|
} |
|
|
|
|
if (BATTLE_STATE==BattleState::POWER_SELECT) { |
|
|
|
|
if (BATTLE_STATE==BattleState::POWER_SELECT||BATTLE_STATE==BattleState::GRADE_SELECT) { |
|
|
|
|
SetDrawTarget(layer::INTERFACE); |
|
|
|
|
DrawDialogBox({1,1},{(int)(WIDTH/2),HEIGHT/4},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128)); |
|
|
|
|
std::map<std::string, std::vector<Battle::Move *>>::const_iterator it = BATTLE_MOVELIST_DISPLAY.cbegin(); |
|
|
|
|
int counter=0; |
|
|
|
|
int displayLimit=0; |
|
|
|
|
while (it!=BATTLE_MOVELIST_DISPLAY.cend()) { |
|
|
|
|
for (int i=0;i<BATTLE_MOVELIST_DISPLAY.size();i++) { |
|
|
|
|
if (counter>=POWER_SELECTION_OFFSET[-CURRENT_TURN-1]&&counter<=POWER_SELECTION_OFFSET[-CURRENT_TURN-1]+3) { |
|
|
|
|
int displayYOffset=-POWER_SELECTION_OFFSET[-CURRENT_TURN-1]*12; |
|
|
|
|
std::vector<Battle::Move*> moves = it->second; |
|
|
|
|
std::string name = it->first; |
|
|
|
|
std::vector<Battle::Move*> moves = BATTLE_MOVELIST_DISPLAY[i]; |
|
|
|
|
std::string name = moves[0]->name; |
|
|
|
|
if (GetTextSizeProp(name).x>WIDTH/4) { |
|
|
|
|
DrawStringPropDecal({12,12*counter+8+displayYOffset},name,WHITE,{(WIDTH/4)/(float)GetTextSizeProp(name).x,1}); |
|
|
|
|
} else { |
|
|
|
|
DrawStringPropDecal({12,12*counter+8+displayYOffset},name); |
|
|
|
|
} |
|
|
|
|
std::wstring drawStr; |
|
|
|
|
for (int i=0;i<moves.size();i++) { |
|
|
|
|
drawStr+=moves[i]->grade; |
|
|
|
|
if (BATTLE_STATE==BattleState::GRADE_SELECT&&POWER_SELECTION_CURSOR[-CURRENT_TURN-1]==counter) { |
|
|
|
|
if (POWER_GRADE_CURSOR[-CURRENT_TURN-1]==i) {
|
|
|
|
|
DrawFancyStringDecal({8+WIDTH/4+4+i*8,12*counter+8+displayYOffset},std::wstring(1,moves[i]->grade)); |
|
|
|
|
} else { |
|
|
|
|
DrawFancyStringDecal({8+WIDTH/4+4+i*8,12*counter+8+displayYOffset},std::wstring(1,moves[i]->grade),VERY_DARK_GREY); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
DrawFancyStringDecal({8+WIDTH/4+4+i*8,12*counter+8+displayYOffset},std::wstring(1,moves[i]->grade)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
DrawFancyStringDecal({8+WIDTH/4+4,12*counter+8+displayYOffset},drawStr); |
|
|
|
|
} |
|
|
|
|
++it; |
|
|
|
|
++counter; |
|
|
|
|
} |
|
|
|
|
DrawDecal({4,12*(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-POWER_SELECTION_OFFSET[-CURRENT_TURN-1])+8},SPRITES["cursor.png"]); |
|
|
|
|
if (BATTLE_STATE==BattleState::POWER_SELECT) { |
|
|
|
|
DrawDecal({4,12*(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-POWER_SELECTION_OFFSET[-CURRENT_TURN-1])+8},SPRITES["cursor.png"]); |
|
|
|
|
} else { |
|
|
|
|
DrawDecal({WIDTH/4+4+POWER_GRADE_CURSOR[-CURRENT_TURN-1]*8+8,12*(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-POWER_SELECTION_OFFSET[-CURRENT_TURN-1])+8},SPRITES["cursor.png"]); |
|
|
|
|
} |
|
|
|
|
if (BATTLE_MOVELIST_DISPLAY.size()>4) { |
|
|
|
|
if (POWER_SELECTION_OFFSET[-CURRENT_TURN-1]>0) { |
|
|
|
|
DrawRotatedDecal({WIDTH/2-16,3},SPRITES["cursor.png"],-M_PI_2,{4,4}); |
|
|
|
|
DrawRotatedDecal({WIDTH/2-16,7},SPRITES["cursor.png"],-M_PI_2,{4,4}); |
|
|
|
|
} |
|
|
|
|
if (POWER_SELECTION_OFFSET[-CURRENT_TURN-1]+3<BATTLE_MOVELIST_DISPLAY.size()) { |
|
|
|
|
DrawRotatedDecal({WIDTH/2-16,HEIGHT/4-11},SPRITES["cursor.png"],M_PI_2,{4,4}); |
|
|
|
|
if (POWER_SELECTION_OFFSET[-CURRENT_TURN-1]+3<BATTLE_MOVELIST_DISPLAY.size()-1) { |
|
|
|
|
DrawRotatedDecal({WIDTH/2-16,HEIGHT/4-7},SPRITES["cursor.png"],M_PI_2,{4,4}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|