|
|
|
@ -165,6 +165,30 @@ EquipSlot::Equip EQUIP_MENU_SLOT=EquipSlot::WEAPON; |
|
|
|
|
int EQUIP_ITEM_MENU_CURSOR=0; |
|
|
|
|
int EQUIP_ITEM_MENU_OFFSET=0; |
|
|
|
|
std::vector<int> EQUIP_ITEM_MENU_CONTENTS={}; |
|
|
|
|
std::vector<std::pair<Item*,int>> SHOP_MENU_CONTENTS={}; |
|
|
|
|
std::array<int,16> MESSAGE_BOX_DIALOG_ANSWERS={}; |
|
|
|
|
std::array<std::string,3> MESSAGE_BOX_CHOICE_LIST={"","",""}; |
|
|
|
|
bool waitingForChoice=false; |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
[Choice1,Choice2,Choice3] |
|
|
|
|
After a choice, dialog parser will jump to appropriate branch labeled as: |
|
|
|
|
0: Stuff |
|
|
|
|
1: Stuff |
|
|
|
|
2: Stuff |
|
|
|
|
|
|
|
|
|
In addition, each branch will store its choice selector in an incrementing variable. |
|
|
|
|
*/ |
|
|
|
|
void DisplayMessageBox(std::string targetT) { |
|
|
|
|
targetText=targetT; |
|
|
|
|
messageBoxText=""; |
|
|
|
|
messageBoxFinalText=""; |
|
|
|
|
messageBoxLoad=true; |
|
|
|
|
messageBoxVisible=true; |
|
|
|
|
messageBoxMarker=0; |
|
|
|
|
messageBoxStartMarker=0; |
|
|
|
|
messageBoxStopMarker=0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
|
|
|
|
|
|
|
|
|
@ -406,7 +430,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
while (messageBoxMarker<messageBoxFinalText.length()) { |
|
|
|
|
while (messageBoxMarker<messageBoxFinalText.length()&&!waitingForChoice) { |
|
|
|
|
AdvanceMessageBox(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -638,7 +662,14 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
const int MESSAGE_BORDER_X=4; |
|
|
|
|
const int MESSAGE_BORDER_Y=4; |
|
|
|
|
bool charsWritten=false; |
|
|
|
|
std::string lastLine=""; |
|
|
|
|
while (messageBoxStartMarker+messageBoxStopMarker<targetText.length()&&GetTextSizeProp(messageBoxFinalText).y<HEIGHT/4-MESSAGE_BORDER_Y) { |
|
|
|
|
if (targetText[messageBoxStopMarker+messageBoxStartMarker]=='[') { |
|
|
|
|
while (targetText[messageBoxStopMarker+messageBoxStartMarker]!=']') { |
|
|
|
|
messageBoxFinalText+=targetText[messageBoxStopMarker+++messageBoxStartMarker]; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
while (messageBoxStartMarker+messageBoxStopMarker<targetText.length()&&GetTextSizeProp(messageBoxFinalText).x<WIDTH/2-MESSAGE_BORDER_X) { |
|
|
|
|
if (!charsWritten&&targetText[messageBoxStopMarker+messageBoxStartMarker]!=' ') { |
|
|
|
|
messageBoxFinalText+=targetText[messageBoxStopMarker+++messageBoxStartMarker]; |
|
|
|
@ -662,10 +693,29 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
messageBoxLoad=false; |
|
|
|
|
} else { |
|
|
|
|
if (messageBoxMarker<messageBoxFinalText.length()) { |
|
|
|
|
if (messageBoxFinalText[messageBoxMarker]=='[') { |
|
|
|
|
messageBoxMarker++; |
|
|
|
|
waitingForChoice=true; |
|
|
|
|
MESSAGE_BOX_CHOICE_LIST={"","",""}; |
|
|
|
|
int counter=0; |
|
|
|
|
while (messageBoxFinalText[messageBoxMarker]!=']') { |
|
|
|
|
if (messageBoxFinalText[messageBoxMarker]==',') { |
|
|
|
|
counter++; |
|
|
|
|
messageBoxMarker++; |
|
|
|
|
} |
|
|
|
|
if (messageBoxFinalText[messageBoxMarker]!=']') { |
|
|
|
|
MESSAGE_BOX_CHOICE_LIST[counter]+=messageBoxFinalText[messageBoxMarker++]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (int i=0;i<MESSAGE_BOX_CHOICE_LIST.size();i++) { |
|
|
|
|
printf("%s\n",MESSAGE_BOX_CHOICE_LIST[i].c_str()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
messageBoxText+=messageBoxFinalText[messageBoxMarker++]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//CAMERA UPDATES MUST BE LAST!!! COLLISIONS RELY ON THE GAME POSITION STATES REMAINING THE SAME!
|
|
|
|
|
void cameraUpdate() { |
|
|
|
@ -2817,7 +2867,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
CreateObjectInfo(new Standard_Obj(NPC16_8,"npc17_8",{0,0},nullptr,{2,2},BLUE,20),"player.png",32,Flag::NONE,Flag::NONE); |
|
|
|
|
CreateObjectInfo(new Standard_Obj(NPC17_8,"npc18_8",{0,0},nullptr,{2,2},BLUE,20),"player.png",32,Flag::NONE,Flag::NONE); |
|
|
|
|
CreateObjectInfo(new Standard_Obj(NPC18_8,"npc19_8",{0,0},nullptr,{2,2},BLUE,20),"player.png",32,Flag::NONE,Flag::NONE); |
|
|
|
|
CreateObjectInfo(new Standard_Obj(NPC19_8,"npc20_8",{0,0},nullptr,{2,2},BLUE,20),"player.png",32,Flag::NONE,Flag::NONE); |
|
|
|
|
CreateObjectInfo(new Shopkeeper_Obj(SHOPKEEPER,"Shopkeeper",{0,0},nullptr,{1,1},YELLOW,20),"player.png",32,Flag::NONE,Flag::NONE); |
|
|
|
|
CreateObjectInfo(new TrashCan_Obj(TRASH_CAN,"trashCan",{0,0},nullptr,{1,1},WHITE,0),"trashcan.png",32,Flag::NONE,Flag::NONE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -3043,17 +3093,6 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), |
|
|
|
|
return GAME_STATE==GameState::GAME_WORLD&&BATTLE_ENCOUNTER==nullptr&&!IsTextEntryEnabled()&&!messageBoxVisible&&PARTY_MEMBER_OBJ[0]!=nullptr&&CurrentCutscene==nullptr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void DisplayMessageBox(std::string targetT) { |
|
|
|
|
targetText=targetT; |
|
|
|
|
messageBoxText=""; |
|
|
|
|
messageBoxFinalText=""; |
|
|
|
|
messageBoxLoad=true; |
|
|
|
|
messageBoxVisible=true; |
|
|
|
|
messageBoxMarker=0; |
|
|
|
|
messageBoxStartMarker=0; |
|
|
|
|
messageBoxStopMarker=0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void DrawDialogBox(const vi2d &pos, const vi2d &size, Pixel p = WHITE, Pixel p2 = DARK_GREY, Pixel p3 = VERY_DARK_GREY) { |
|
|
|
|
DrawDecal({(float)pos.x,(float)pos.y},SPRITES["pixel.png"],size,p2); |
|
|
|
|
DrawDecal({(float)pos.x+1,(float)pos.y+1},SPRITES["pixel.png"],{(float)size.x-2,(float)size.y-2},p); |
|
|
|
|