diff --git a/menu.ino b/menu.ino index 5369740..c9f6720 100644 --- a/menu.ino +++ b/menu.ino @@ -160,3 +160,35 @@ void buildDrugMenu(const long extra[6]) { menuCols = true; menuSmall = col1Max + col2Max > 22; } + +int getMenuBackOut() { + // this whole thing could have been done so much better :( + // i suck at C++ + switch (sGameState) { + case STATE_SELL_MENU: + case STATE_BORROW_INPUT: + case STATE_WITHDRAW_INPUT: + return 1; + case STATE_INVENTORY: + return 2; + case STATE_JET_MENU: + return 3; + case STATE_SHARK_MENU: + return 4; + case STATE_BANK_MENU: + return 5; + case STATE_BUY_QTY_INPUT: + case STATE_SELL_QTY_INPUT: + return sCurrentDrug; + case STATE_INFO_DIALOG: + switch (sPreviousGameState) { + case STATE_BUY_MENU: + case STATE_SELL_MENU: + return sCurrentDrug; + default: + return 0; + } + default: + return 0; + } +} diff --git a/slangin.ino b/slangin.ino index 7105b70..05e161f 100644 --- a/slangin.ino +++ b/slangin.ino @@ -198,6 +198,7 @@ void loop() { buildDrugMenu(sDrugPrices); drawMenu(menuSmall, menuCols, menuLength, menu); drawMenuIndicator(menuSelected, menuSmall, menuCols, menuLength, menu, false); + drawDrugsOwned(menuSelected); break; case STATE_JET_MENU: { @@ -437,6 +438,9 @@ void loop() { } } drawMenuIndicator(menuSelected, menuSmall, menuCols, menuLength, menu, false); + if (sGameState == STATE_BUY_MENU || sGameState == STATE_SELL_MENU) { + drawDrugsOwned(menuSelected); + } } break; } @@ -669,3 +673,12 @@ void drawFightPrompt() { arduboy.drawCircle(67, 58, 5, WHITE); arduboy.drawCircle(103, 58, 5, WHITE); } + +void drawDrugsOwned(Drug drug) { + // wipe old indicator + arduboy.fillRect(60, 9, 68, 12, BLACK); + String numStr = String(pInventory[drug]); + font3x5.setCursor(92 - numStr.length() * 4, 13); + font3x5.print("You own "); + font3x5.print(numStr); +} diff --git a/states.ino b/states.ino index 9d8328f..ca11fa4 100644 --- a/states.ino +++ b/states.ino @@ -192,38 +192,6 @@ void newDayRandomEvent() { } } -int getMenuBackOut() { - // this whole thing could have been done so much better :( - // i suck at C++ - switch (sGameState) { - case STATE_SELL_MENU: - case STATE_BORROW_INPUT: - case STATE_WITHDRAW_INPUT: - return 1; - case STATE_INVENTORY: - return 2; - case STATE_JET_MENU: - return 3; - case STATE_SHARK_MENU: - return 4; - case STATE_BANK_MENU: - return 5; - case STATE_BUY_QTY_INPUT: - case STATE_SELL_QTY_INPUT: - return sCurrentDrug; - case STATE_INFO_DIALOG: - switch (sPreviousGameState) { - case STATE_BUY_MENU: - case STATE_SELL_MENU: - return sCurrentDrug; - default: - return 0; - } - default: - return 0; - } -} - void handleMenuAction() { screenInitialized = false; switch (sGameState) {