Added arrows and extra menu alignments

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 5cc966e71c
commit 0236f1f28f
  1. BIN
      C++ProjectTemplate
  2. BIN
      C++ProjectTemplate.data
  3. 2
      C++ProjectTemplate.js
  4. BIN
      C++ProjectTemplate.wasm
  5. 21
      main.cpp
  6. 14
      pixelGameEngine.h
  7. 3
      states.h

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 840 KiB

After

Width:  |  Height:  |  Size: 841 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

@ -291,7 +291,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
return true; return true;
} }
void GetAnyKeyPress() override { void GetAnyKeyPress(olc::Key keypress) override {
if (messageBoxVisible) { if (messageBoxVisible) {
if (messageBoxMarker==messageBoxFinalText.length()) { if (messageBoxMarker==messageBoxFinalText.length()) {
if (messageBoxStartMarker+messageBoxStopMarker<targetText.length()) { if (messageBoxStartMarker+messageBoxStopMarker<targetText.length()) {
@ -1050,8 +1050,9 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
}break; }break;
case 1:{//Power is selected. case 1:{//Power is selected.
PopulateBattleMoveList(0,true); OVERWORLD_POWER_SELECTION_MEMBER=0;
GAME_STATE=GameState::OVERWORLD_POWER_MENU; PopulateBattleMoveList(OVERWORLD_POWER_SELECTION_MEMBER,true);
GAME_STATE=GameState::OVERWORLD_POWER_PLAYER_MENU;
}break; }break;
case 2:{//Items is selected. case 2:{//Items is selected.
@ -1186,9 +1187,12 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
case GameState::GAME_WORLD: case GameState::GAME_WORLD:
case GameState::OVERWORLD_MENU: case GameState::OVERWORLD_MENU:
case GameState::OVERWORLD_POWER_MENU: case GameState::OVERWORLD_POWER_MENU:
case GameState::OVERWORLD_POWER_PLAYER_MENU:
case GameState::OVERWORLD_GRADE_MENU: case GameState::OVERWORLD_GRADE_MENU:
case GameState::OVERWORLD_ITEMS_MENU: case GameState::OVERWORLD_ITEMS_MENU:
case GameState::OVERWORLD_EQUIP_ITEM_MENU:
case GameState::OVERWORLD_EQUIP_MENU: case GameState::OVERWORLD_EQUIP_MENU:
case GameState::OVERWORLD_EQUIP_PLAYER_MENU:
case GameState::OVERWORLD_STATUS_MENU:{ case GameState::OVERWORLD_STATUS_MENU:{
DrawGameWorld(); DrawGameWorld();
if (GAME_STATE!=GameState::GAME_WORLD) { if (GAME_STATE!=GameState::GAME_WORLD) {
@ -1202,7 +1206,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
DrawDecal({static_cast<float>(2+4),static_cast<float>(2+6+OVERWORLD_MENU_SELECTION*16)},SPRITES["cursor.png"]); DrawDecal({static_cast<float>(2+4),static_cast<float>(2+6+OVERWORLD_MENU_SELECTION*16)},SPRITES["cursor.png"]);
} }
if (GAME_STATE==GameState::OVERWORLD_POWER_MENU||GAME_STATE==GameState::OVERWORLD_GRADE_MENU) { 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_OFFSET[OVERWORLD_POWER_SELECTION_MEMBER]);
} }
}break; }break;
@ -3698,9 +3702,16 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
++counter; ++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});
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) { if (BATTLE_STATE==BattleState::POWER_SELECT||GAME_STATE==GameState::OVERWORLD_POWER_MENU) {
DrawDecal({4,static_cast<float>(12*(POWER_SELECTION_CURSOR[partyMemberSlot]-POWER_SELECTION_OFFSET[partyMemberSlot])+8)},SPRITES["cursor.png"]); DrawDecal({4,static_cast<float>(12*(POWER_SELECTION_CURSOR[partyMemberSlot]-POWER_SELECTION_OFFSET[partyMemberSlot])+8)},SPRITES["cursor.png"]);
} else { } 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<float>(12*(POWER_SELECTION_CURSOR[partyMemberSlot]-POWER_SELECTION_OFFSET[partyMemberSlot])+8)},SPRITES["cursor.png"]); DrawDecal({(float)(WIDTH/4+4+POWER_GRADE_CURSOR[partyMemberSlot]*8+8),static_cast<float>(12*(POWER_SELECTION_CURSOR[partyMemberSlot]-POWER_SELECTION_OFFSET[partyMemberSlot])+8)},SPRITES["cursor.png"]);
} }
if (BATTLE_MOVELIST_DISPLAY.size()>4) { if (BATTLE_MOVELIST_DISPLAY.size()>4) {

@ -929,7 +929,7 @@ namespace olc
// Called once on application termination, so you can be one clean coder // Called once on application termination, so you can be one clean coder
virtual bool OnUserDestroy(); virtual bool OnUserDestroy();
virtual void GetAnyKey(); virtual void GetAnyKey();
virtual void GetAnyKeyPress(); virtual void GetAnyKeyPress(olc::Key pressedKey);
// Called when a text entry is confirmed with "enter" key // Called when a text entry is confirmed with "enter" key
virtual void OnTextEntryComplete(const std::string& sText); virtual void OnTextEntryComplete(const std::string& sText);
@ -3306,7 +3306,7 @@ namespace olc
{ return true; } { return true; }
void PixelGameEngine::GetAnyKey(){}; void PixelGameEngine::GetAnyKey(){};
void PixelGameEngine::GetAnyKeyPress(){}; void PixelGameEngine::GetAnyKeyPress(olc::Key pressedKey){};
void PixelGameEngine::OnTextEntryComplete(const std::string& sText) { UNUSED(sText); } void PixelGameEngine::OnTextEntryComplete(const std::string& sText) { UNUSED(sText); }
bool PixelGameEngine::OnConsoleCommand(const std::string& sCommand) { UNUSED(sCommand); return false; } bool PixelGameEngine::OnConsoleCommand(const std::string& sCommand) { UNUSED(sCommand); return false; }
@ -3453,9 +3453,10 @@ namespace olc
platform->HandleSystemEvent(); platform->HandleSystemEvent();
// Compare hardware input states from previous frame // Compare hardware input states from previous frame
auto ScanHardware = [&](HWButton* pKeys, bool* pStateOld, bool* pStateNew, uint32_t nKeyCount) auto ScanHardware = [&](HWButton* pKeys, bool* pStateOld, bool* pStateNew, uint32_t nKeyCount,bool keyboard=true)
{ {
bool pressed=false; bool pressed=false;
int key;
for (uint32_t i = 0; i < nKeyCount; i++) for (uint32_t i = 0; i < nKeyCount; i++)
{ {
pKeys[i].bPressed = false; pKeys[i].bPressed = false;
@ -3465,6 +3466,7 @@ namespace olc
if (pStateNew[i]) if (pStateNew[i])
{ {
pressed=true; pressed=true;
key=i;
pKeys[i].bPressed = !pKeys[i].bHeld; pKeys[i].bPressed = !pKeys[i].bHeld;
pKeys[i].bHeld = true; pKeys[i].bHeld = true;
} }
@ -3477,11 +3479,13 @@ namespace olc
} }
pStateOld[i] = pStateNew[i]; pStateOld[i] = pStateNew[i];
} }
if (pressed) {GetAnyKeyPress();} if (pressed) {
if (keyboard) {GetAnyKeyPress((olc::Key)key);}
else {GetAnyKeyPress(olc::Key::NONE);}}
}; };
ScanHardware(pKeyboardState, pKeyOldState, pKeyNewState, 256); ScanHardware(pKeyboardState, pKeyOldState, pKeyNewState, 256);
ScanHardware(pMouseState, pMouseOldState, pMouseNewState, nMouseButtons); ScanHardware(pMouseState, pMouseOldState, pMouseNewState, nMouseButtons,false);
// Cache mouse coordinates so they remain consistent during frame // Cache mouse coordinates so they remain consistent during frame
vMousePos = vMousePosCache; vMousePos = vMousePosCache;

@ -10,8 +10,11 @@ namespace GameState{
OVERWORLD_MENU, OVERWORLD_MENU,
OVERWORLD_POWER_MENU, OVERWORLD_POWER_MENU,
OVERWORLD_GRADE_MENU, OVERWORLD_GRADE_MENU,
OVERWORLD_POWER_PLAYER_MENU,
OVERWORLD_ITEMS_MENU, OVERWORLD_ITEMS_MENU,
OVERWORLD_EQUIP_ITEM_MENU,
OVERWORLD_EQUIP_MENU, OVERWORLD_EQUIP_MENU,
OVERWORLD_EQUIP_PLAYER_MENU,
OVERWORLD_STATUS_MENU, OVERWORLD_STATUS_MENU,
}; };
} }

Loading…
Cancel
Save