|
|
|
@ -174,6 +174,7 @@ Object*INTERACTING_WITH=nullptr; |
|
|
|
|
std::vector<std::pair<Item*,int>> SHOP_ITEMS={}; |
|
|
|
|
int MONEY=0; |
|
|
|
|
int ENEMY_MONEY_SUM=0; |
|
|
|
|
int SHOP_MENU_CURSOR=0; |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
[Choice1,Choice2,Choice3] |
|
|
|
@ -1796,6 +1797,12 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
GAME_STATE=GameState::OVERWORLD_EQUIP_MENU; |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case GameState::SHOPKEEPER_MENU:{ |
|
|
|
|
CursorControl(SHOP_MENU_CURSOR,SHOP_ITEMS.size()+1); |
|
|
|
|
if (ACTIONKEYPRESSED) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
reset: |
|
|
|
|
ANYKEYPRESSED=ACTIONKEYPRESSED=false; |
|
|
|
@ -1930,8 +1937,8 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
case GameState::OVERWORLD_TARGET_MENU: |
|
|
|
|
case GameState::SHOPKEEPER_MENU:{ |
|
|
|
|
DrawGameWorld(); |
|
|
|
|
SetDrawTarget(layer::INTERFACE); |
|
|
|
|
if (GAME_STATE!=GameState::GAME_WORLD&&GAME_STATE!=GameState::OVERWORLD_TARGET_MENU) { |
|
|
|
|
SetDrawTarget(layer::INTERFACE); |
|
|
|
|
vi2d boxPos = {2,2}; |
|
|
|
|
DrawDialogBox(boxPos,{(int)(WIDTH*0.25+4),5*16+4},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); |
|
|
|
|
const std::array<std::string,5> MENU_ITEMS = {"Check","Power","Items","Equip","Status"}; |
|
|
|
@ -2063,6 +2070,26 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
if (GAME_STATE==GameState::OVERWORLD_POWER_MENU||GAME_STATE==GameState::OVERWORLD_POWER_PLAYER_MENU||GAME_STATE==GameState::OVERWORLD_GRADE_MENU) { |
|
|
|
|
DrawBattleMoveList(OVERWORLD_POWER_SELECTION_MEMBER); |
|
|
|
|
} |
|
|
|
|
if (GAME_STATE==GameState::SHOPKEEPER_MENU) { |
|
|
|
|
DrawDialogBox({1,1},{WIDTH/2-2,HEIGHT/2},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); |
|
|
|
|
DrawDialogBox({(int)(WIDTH/2+2),2},{(int)(WIDTH/2-4),(int)(HEIGHT/4)},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); |
|
|
|
|
|
|
|
|
|
for (int i=0;i<SHOP_ITEMS.size();i++) { |
|
|
|
|
DrawStringPropDecal({12,(float)(8+i*12)},SHOP_ITEMS[i].first->name,WHITE,AutoScaleText(SHOP_ITEMS[i].first->name,WIDTH*(1.f/3)-14)); |
|
|
|
|
std::string moneyText="$"+std::to_string(SHOP_ITEMS[i].second); |
|
|
|
|
vf2d textSize=GetTextSizeProp(moneyText); |
|
|
|
|
DrawStringPropDecal({WIDTH*(1.f/3)+4,(float)(8+i*12)},moneyText); |
|
|
|
|
vf2d textSize2=(vf2d)GetTextSizeProp("00"); |
|
|
|
|
DrawStringPropDecal({WIDTH*(1.f/3)+4+textSize.x,(float)(8+i*12)},"00",WHITE,{0.4f,0.7f}); |
|
|
|
|
DrawLineDecal({WIDTH*(1.f/3)+4+textSize.x,(float)(8+i*12+textSize2.y*0.7f)},{WIDTH*(1.f/3)+4+textSize.x+textSize2.x*0.4f,(float)(8+i*12+textSize2.y*0.7f)}); |
|
|
|
|
} |
|
|
|
|
DrawMoneyBox({2,HEIGHT/2+2}); |
|
|
|
|
DrawStringPropDecal({12,(float)(8+SHOP_ITEMS.size()*12)},"Exit",WHITE); |
|
|
|
|
DrawDecal({4,(float)(8+SHOP_MENU_CURSOR*12)},SPRITES["cursor.png"]); |
|
|
|
|
if (SHOP_MENU_CURSOR<SHOP_ITEMS.size()) { |
|
|
|
|
DrawStringPropDecal({(int)(WIDTH/2)+6,6},Wrap(SHOP_ITEMS[SHOP_MENU_CURSOR].first->description,(int)(WIDTH/2)-6,true,{1,1})); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case GameState::EDITOR:{ |
|
|
|
|
DrawGameWorld(); |
|
|
|
@ -2298,19 +2325,6 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
|
|
|
|
|
//////////////////INTERFACE LAYER.
|
|
|
|
|
SetDrawTarget(layer::INTERFACE); |
|
|
|
|
|
|
|
|
|
if (GAME_STATE==GameState::SHOPKEEPER_MENU) { |
|
|
|
|
DrawDialogBox({1,1},{WIDTH/2-2,HEIGHT/2},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); |
|
|
|
|
for (int i=0;i<SHOP_ITEMS.size();i++) { |
|
|
|
|
DrawStringPropDecal({12,(float)(8+i*12)},SHOP_ITEMS[i].first->name,WHITE,AutoScaleText(SHOP_ITEMS[i].first->name,WIDTH*(1.f/3)-14)); |
|
|
|
|
std::string moneyText="$"+std::to_string(SHOP_ITEMS[i].second); |
|
|
|
|
vf2d textSize=GetTextSizeProp(moneyText); |
|
|
|
|
DrawStringPropDecal({WIDTH*(1.f/3)+4,(float)(8+i*12)},moneyText); |
|
|
|
|
vf2d textSize2=(vf2d)GetTextSizeProp("00"); |
|
|
|
|
DrawStringPropDecal({WIDTH*(1.f/3)+4+textSize.x,(float)(8+i*12)},"00",WHITE,{0.4f,0.7f}); |
|
|
|
|
DrawLineDecal({WIDTH*(1.f/3)+4+textSize.x,(float)(8+i*12+textSize2.y*0.7f)},{WIDTH*(1.f/3)+4+textSize.x+textSize2.x*0.4f,(float)(8+i*12+textSize2.y*0.7f)}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (BATTLE_ENCOUNTER!=nullptr&&BATTLE_STATE==BattleState::MOVE_SELECT) { |
|
|
|
|
vd2d cursorOffset = {-2,-2}; |
|
|
|
|
vd2d cursorScale = {1,1}; |
|
|
|
@ -4803,6 +4817,36 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
vf2d size = ((prop)?GetTextSizeProp(str):GetTextSize(str))*scale; |
|
|
|
|
return {std::min(scale.x,targetWidth/size.x),scale.y}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CursorControl(int&cursor,int max) { |
|
|
|
|
if (UpPressed()) { |
|
|
|
|
cursor--; |
|
|
|
|
if (cursor<0) { |
|
|
|
|
cursor=max-1; |
|
|
|
|
} |
|
|
|
|
if (cursor==0) { |
|
|
|
|
KEY_LASTPRESSED=NONE; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (DownPressed()) { |
|
|
|
|
cursor=(cursor+1)%max; |
|
|
|
|
if (cursor==max-1) { |
|
|
|
|
KEY_LASTPRESSED=NONE; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//The player's money count. It's shown in a box that is WIDTH/4 and HEIGHT/6 in size.
|
|
|
|
|
void DrawMoneyBox(vf2d pos) { |
|
|
|
|
DrawDialogBox(pos,{(int)(WIDTH/4),(int)(HEIGHT/6)},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); |
|
|
|
|
std::string drawStr="$ "+std::to_string(MONEY); |
|
|
|
|
vf2d textSize=GetTextSizeProp(drawStr); |
|
|
|
|
vf2d stringOffset={4,2+(HEIGHT/12)-textSize.y}; |
|
|
|
|
DrawStringPropDecal(pos+stringOffset,drawStr,WHITE,{1,2}); |
|
|
|
|
vf2d textSize2=(vf2d)GetTextSizeProp("00"); |
|
|
|
|
DrawStringPropDecal({pos.x+stringOffset.x+textSize.x+2,pos.y+stringOffset.y},"00",WHITE,{0.4f,0.7f}); |
|
|
|
|
DrawLineDecal({pos.x+stringOffset.x+textSize.x+2,pos.y+stringOffset.y+textSize2.y*0.7f},{pos.x+stringOffset.x+textSize.x+textSize2.x*0.4f+2,pos.y+stringOffset.y+textSize2.y*0.7f}); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
int main() |
|
|
|
|