diff --git a/C++ProjectTemplate b/C++ProjectTemplate index dd3fb97..ad318b0 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/main.cpp b/main.cpp index d0af25f..096390a 100644 --- a/main.cpp +++ b/main.cpp @@ -151,7 +151,10 @@ public: int OVERWORLD_MENU_SELECTION=0; std::vector INTERACTION_MESSAGES; bool CLOSE_OVERWORLD_WINDOW=false; //When set to true, should cause the overworld menu to close as well once the dialog box is closed. + int OVERWORLD_POWER_SELECTION_CURSOR[4]={0,0,0,0}; + int OVERWORLD_POWER_GRADE_CURSOR=0; int OVERWORLD_POWER_SELECTION_OFFSET[4]={0,0,0,0}; + int OVERWORLD_GRADE_SELECTION_OFFSET=0; int OVERWORLD_POWER_SELECTION_MEMBER=0; bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things. @@ -1066,6 +1069,19 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), } } }break; + case GameState::OVERWORLD_POWER_PLAYER_MENU:{ + if (LeftPressed()) { + OVERWORLD_POWER_SELECTION_MEMBER--; + if (OVERWORLD_POWER_SELECTION_MEMBER<0) { + OVERWORLD_POWER_SELECTION_MEMBER=PARTY_MEMBER_COUNT-1; + } + PopulateBattleMoveList(OVERWORLD_POWER_SELECTION_MEMBER,true); + } + if (RightPressed()) { + OVERWORLD_POWER_SELECTION_MEMBER=(OVERWORLD_POWER_SELECTION_MEMBER+1)%PARTY_MEMBER_COUNT; + PopulateBattleMoveList(OVERWORLD_POWER_SELECTION_MEMBER,true); + } + }break; case GameState::EDITOR:{ if (IsTextEntryEnabled()) { return; @@ -1207,7 +1223,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), DrawDecal({static_cast(2+4),static_cast(2+6+OVERWORLD_MENU_SELECTION*16)},SPRITES["cursor.png"]); } if (GAME_STATE==GameState::OVERWORLD_POWER_MENU||GAME_STATE==GameState::OVERWORLD_POWER_PLAYER_MENU||GAME_STATE==GameState::OVERWORLD_GRADE_MENU) { - DrawBattleMoveList(OVERWORLD_POWER_SELECTION_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]); + DrawBattleMoveList(OVERWORLD_POWER_SELECTION_MEMBER); } }break; case GameState::EDITOR:{ @@ -3275,7 +3291,6 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), vi2d gridCenter = (vi2d)pos/32*32; MOVEMENT_GRID.clear(); CheckGrid(0,0,gridCenter-cameraPos,range); - } vi2d grid(int x, int y) { @@ -3626,30 +3641,55 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), } void DrawBattleMoveList(int partyMemberSlot) { + int selectioncursor=0; + if (BATTLE_ENCOUNTER==nullptr) { + selectioncursor=OVERWORLD_POWER_SELECTION_CURSOR[partyMemberSlot]; + } else { + selectioncursor=POWER_SELECTION_CURSOR[partyMemberSlot]; + } + int gradeselectioncursor=0; + if (BATTLE_ENCOUNTER==nullptr) { + gradeselectioncursor=OVERWORLD_POWER_GRADE_CURSOR; + } else { + gradeselectioncursor=POWER_GRADE_CURSOR[partyMemberSlot]; + } + int powerselectionoffset=0; + if (BATTLE_ENCOUNTER==nullptr) { + powerselectionoffset=OVERWORLD_POWER_SELECTION_OFFSET[partyMemberSlot]; + } else { + powerselectionoffset=POWER_SELECTION_OFFSET[partyMemberSlot]; + } SetDrawTarget(layer::INTERFACE); DrawDialogBox({1,1},{(int)(WIDTH/2),HEIGHT/4},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); vd2d descBoxPos = {WIDTH-(int)(WIDTH/2.5)-2,1}; vi2d textStartingOffset = {4,4}; DrawDialogBox(descBoxPos,{(int)(WIDTH/2.5),HEIGHT/4},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); - DrawStringPropDecal(descBoxPos+textStartingOffset,Wrap(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[partyMemberSlot]][0]->desc,((int)(WIDTH/2.5-8)),true,{0.8,0.8}),WHITE,{0.8,0.8}); + if (BATTLE_MOVELIST_DISPLAY.size()>0) { + DrawStringPropDecal(descBoxPos+textStartingOffset,Wrap(BATTLE_MOVELIST_DISPLAY[selectioncursor][0]->desc,((int)(WIDTH/2.5-8)),true,{0.8,0.8}),WHITE,{0.8,0.8}); + } vd2d ppCostBoxPos = {WIDTH-WIDTH/3-2,HEIGHT/4+2}; DrawDialogBox(ppCostBoxPos,{(int)(WIDTH/6),HEIGHT/8},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); DrawStringPropDecal(ppCostBoxPos+textStartingOffset,"PP Cost",WHITE,{0.7,0.8}); - std::string label = std::to_string(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[partyMemberSlot]][POWER_GRADE_CURSOR[partyMemberSlot]]->PPCost); - DrawStringPropDecal({static_cast(ppCostBoxPos.x+textStartingOffset.x+(WIDTH/6)-8-GetTextSizeProp(label).x*1.5),static_cast(ppCostBoxPos.y+textStartingOffset.y+8)},label,WHITE,{1.5,1.5}); + std::string label; + if (BATTLE_MOVELIST_DISPLAY.size()>0) { + label=std::to_string(BATTLE_MOVELIST_DISPLAY[selectioncursor][gradeselectioncursor]->PPCost); + DrawStringPropDecal({static_cast(ppCostBoxPos.x+textStartingOffset.x+(WIDTH/6)-8-GetTextSizeProp(label).x*1.5),static_cast(ppCostBoxPos.y+textStartingOffset.y+8)},label,WHITE,{1.5,1.5}); + } vd2d damageBoxPos = {WIDTH-WIDTH/3+WIDTH/6-1,HEIGHT/4+2}; DrawDialogBox({WIDTH-WIDTH/3+WIDTH/6-1,HEIGHT/4+2},{(int)(WIDTH/6),HEIGHT/8},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); DrawStringPropDecal(damageBoxPos+textStartingOffset,"Damage",WHITE,{0.7,0.8}); - label = (BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[partyMemberSlot]][POWER_GRADE_CURSOR[partyMemberSlot]]->baseDmg!=0)?std::to_string(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[partyMemberSlot]][POWER_GRADE_CURSOR[partyMemberSlot]]->baseDmg+PARTY_MEMBER_STATS[partyMemberSlot]->baseAtk)+"~"+std::to_string(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[partyMemberSlot]][POWER_GRADE_CURSOR[partyMemberSlot]]->randomDmg+BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[partyMemberSlot]][POWER_GRADE_CURSOR[partyMemberSlot]]->baseDmg+PARTY_MEMBER_STATS[partyMemberSlot]->baseAtk):"N/A"; - DrawStringPropDecal({static_cast(damageBoxPos.x+textStartingOffset.x+(WIDTH/6)-8-GetTextSizeProp(label).x*(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5))),static_cast(damageBoxPos.y+textStartingOffset.y+8)},label,WHITE,{static_cast(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5)),1.5}); + if (BATTLE_MOVELIST_DISPLAY.size()>0) { + label = (BATTLE_MOVELIST_DISPLAY[selectioncursor][gradeselectioncursor]->baseDmg!=0)?std::to_string(BATTLE_MOVELIST_DISPLAY[selectioncursor][gradeselectioncursor]->baseDmg+PARTY_MEMBER_STATS[partyMemberSlot]->baseAtk)+"~"+std::to_string(BATTLE_MOVELIST_DISPLAY[selectioncursor][gradeselectioncursor]->randomDmg+BATTLE_MOVELIST_DISPLAY[selectioncursor][gradeselectioncursor]->baseDmg+PARTY_MEMBER_STATS[partyMemberSlot]->baseAtk):"N/A"; + DrawStringPropDecal({static_cast(damageBoxPos.x+textStartingOffset.x+(WIDTH/6)-8-GetTextSizeProp(label).x*(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5))),static_cast(damageBoxPos.y+textStartingOffset.y+8)},label,WHITE,{static_cast(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5)),1.5}); + } if (BATTLE_ENCOUNTER!=nullptr) { vd2d rangeBoxPos = {WIDTH-WIDTH/3+WIDTH/6-1,HEIGHT/4+HEIGHT/8+3}; DrawDialogBox({WIDTH-WIDTH/3+WIDTH/6-1,HEIGHT/4+HEIGHT/8+3},{(int)(WIDTH/6),HEIGHT/8},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); DrawStringPropDecal(rangeBoxPos+textStartingOffset,"Range",WHITE,{0.7,0.8}); - label = std::to_string(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[partyMemberSlot]][POWER_GRADE_CURSOR[partyMemberSlot]]->range); + label = std::to_string(BATTLE_MOVELIST_DISPLAY[selectioncursor][gradeselectioncursor]->range); DrawStringPropDecal({static_cast(rangeBoxPos.x+textStartingOffset.x+(WIDTH/6)-8-GetTextSizeProp(label).x*(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5))),static_cast(rangeBoxPos.y+textStartingOffset.y+8)},label,WHITE,{static_cast(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5)),1.5}); } @@ -3657,15 +3697,15 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), vd2d channelTimeBoxPos = {WIDTH-WIDTH/3-1,HEIGHT/4+HEIGHT/8+3}; DrawDialogBox({WIDTH-WIDTH/3-1,HEIGHT/4+HEIGHT/8+3},{(int)(WIDTH/6),HEIGHT/8},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); DrawStringPropDecal(channelTimeBoxPos+textStartingOffset,"Cast",WHITE,{0.7,0.8}); - label = std::to_string((float)BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[partyMemberSlot]][POWER_GRADE_CURSOR[partyMemberSlot]]->channelTime/60).erase(3); + label = std::to_string((float)BATTLE_MOVELIST_DISPLAY[selectioncursor][gradeselectioncursor]->channelTime/60).erase(3); DrawStringPropDecal({static_cast(channelTimeBoxPos.x+textStartingOffset.x+(WIDTH/6)-8-GetTextSizeProp(label).x*(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5))),static_cast(channelTimeBoxPos.y+textStartingOffset.y+8)},label,WHITE,{static_cast(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5)),1.5}); } int counter=0; int displayLimit=0; for (int i=0;i=POWER_SELECTION_OFFSET[partyMemberSlot]&&counter<=POWER_SELECTION_OFFSET[partyMemberSlot]+3) { - int displayYOffset=-POWER_SELECTION_OFFSET[partyMemberSlot]*12; + if (counter>=powerselectionoffset&&counter<=powerselectionoffset+3) { + int displayYOffset=-powerselectionoffset*12; std::vector moves = BATTLE_MOVELIST_DISPLAY[i]; std::string name = moves[0]->name; if (GetTextSizeProp(name).x>WIDTH/4) { @@ -3675,8 +3715,8 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), } for (int i=0;iGetPP()>=moves[i]->PPCost) { drawCol=WHITE; } else { @@ -3703,22 +3743,22 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), ++counter; } if (BATTLE_ENCOUNTER==nullptr) { - vi2d textSize = GetTextSizeProp(PARTY_MEMBER_STATS[partyMemberSlot]->obj->name)/2; - DrawStringPropDecal({(float)WIDTH/2.F-textSize.x-6,1},PARTY_MEMBER_STATS[partyMemberSlot]->obj->name,WHITE,{0.5,1}); + vi2d textSize = GetTextSizeProp(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->obj->name)/2; + DrawStringPropDecal({(float)WIDTH/2.F-textSize.x-6,1},PARTY_MEMBER_STATS[PARTY_MEMBER_ID[partyMemberSlot]]->obj->name,WHITE,{0.5,1}); DrawRotatedDecal({(float)WIDTH/2-textSize.x-8,5},SPRITES["cursor.png"],M_PI,{(float)SPRITES["cursor.png"]->sprite->width/2,(float)SPRITES["cursor.png"]->sprite->height/2},{(sinf(frameCount/20.F*M_PI)>0)?0.5F:0.25F,(sinf(frameCount/20.F*M_PI)>0)?0.5F:0.25F}); DrawRotatedDecal({(float)WIDTH/2-4,5},SPRITES["cursor.png"],0,{(float)SPRITES["cursor.png"]->sprite->width/2,(float)SPRITES["cursor.png"]->sprite->height/2},{(sinf(frameCount/20.F*M_PI)>0)?0.5F:0.25F,(sinf(frameCount/20.F*M_PI)>0)?0.5F:0.25F}); } if (BATTLE_STATE==BattleState::POWER_SELECT||GAME_STATE==GameState::OVERWORLD_POWER_MENU) { - DrawDecal({4,static_cast(12*(POWER_SELECTION_CURSOR[partyMemberSlot]-POWER_SELECTION_OFFSET[partyMemberSlot])+8)},SPRITES["cursor.png"]); + DrawDecal({4,static_cast(12*(selectioncursor-powerselectionoffset)+8)},SPRITES["cursor.png"]); } else if (BATTLE_STATE==BattleState::GRADE_SELECT||GAME_STATE==GameState::OVERWORLD_GRADE_MENU){ - DrawDecal({(float)(WIDTH/4+4+POWER_GRADE_CURSOR[partyMemberSlot]*8+8),static_cast(12*(POWER_SELECTION_CURSOR[partyMemberSlot]-POWER_SELECTION_OFFSET[partyMemberSlot])+8)},SPRITES["cursor.png"]); + DrawDecal({(float)(WIDTH/4+4+gradeselectioncursor*8+8),static_cast(12*(selectioncursor-powerselectionoffset)+8)},SPRITES["cursor.png"]); } if (BATTLE_MOVELIST_DISPLAY.size()>4) { - if (POWER_SELECTION_OFFSET[partyMemberSlot]>0) { + if (powerselectionoffset>0) { DrawRotatedDecal({WIDTH/2-16,7},SPRITES["cursor.png"],-M_PI_2,{4,4}); } - if (POWER_SELECTION_OFFSET[partyMemberSlot]+3