2022-06-15 12:47:42 -05:00
|
|
|
/*
|
2022-06-15 12:51:24 -05:00
|
|
|
Slangin'
|
|
|
|
Author: Rudis Muiznieks
|
|
|
|
License: WTFPL
|
2022-06-15 12:47:42 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <Arduboy2.h>
|
2022-06-17 16:38:40 -05:00
|
|
|
#include "src/fonts/Font3x5.h";
|
|
|
|
#include "src/fonts/Font4x6.h";
|
2022-06-15 12:47:42 -05:00
|
|
|
|
|
|
|
Arduboy2 arduboy;
|
2022-06-16 23:25:49 -05:00
|
|
|
Font4x6 font4x6 = Font4x6();
|
2022-06-17 16:38:40 -05:00
|
|
|
Font3x5 font3x5 = Font3x5();
|
2022-06-15 12:47:42 -05:00
|
|
|
|
2022-06-15 18:36:12 -05:00
|
|
|
enum GameState {
|
|
|
|
STATE_TITLE = 0,
|
|
|
|
STATE_TURN_MENU,
|
|
|
|
STATE_JET_MENU,
|
|
|
|
STATE_PRICE_LIST,
|
|
|
|
STATE_INVENTORY,
|
|
|
|
STATE_BUY_MENU,
|
|
|
|
STATE_SELL_MENU,
|
|
|
|
STATE_FIGHT_MENU,
|
|
|
|
STATE_SHARK_MENU,
|
|
|
|
STATE_BANK_MENU,
|
|
|
|
STATE_INFO_DIALOG,
|
|
|
|
STATE_QUESTION_DIALOG,
|
|
|
|
STATE_AMOUNT_DIALOG,
|
|
|
|
STATE_SUBWAY
|
|
|
|
};
|
|
|
|
|
|
|
|
enum GameLocation {
|
|
|
|
LOC_BRONX = 0,
|
|
|
|
LOC_GHETTO,
|
|
|
|
LOC_CENTRAL_PARK,
|
|
|
|
LOC_MANHATTEN,
|
|
|
|
LOC_CONEY_ISLAND,
|
|
|
|
LOC_BROOKLYN
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Drug {
|
|
|
|
DRUG_COCAINE = 0,
|
|
|
|
DRUG_HEROINE,
|
|
|
|
DRUG_ACID,
|
|
|
|
DRUG_WEED,
|
|
|
|
DRUG_SPEED,
|
|
|
|
DRUG_LUDES
|
|
|
|
};
|
|
|
|
|
|
|
|
enum DialogType {
|
|
|
|
DIALOG_INFO = 0,
|
|
|
|
DIALOG_YESNO,
|
|
|
|
DIALOG_AMOUNT
|
|
|
|
};
|
|
|
|
|
2022-06-16 23:25:49 -05:00
|
|
|
/**************/
|
|
|
|
/* game state */
|
|
|
|
/**************/
|
2022-06-15 18:36:12 -05:00
|
|
|
bool screenInitialized;
|
2022-06-16 23:25:49 -05:00
|
|
|
GameState sGameState;
|
2022-06-15 18:36:12 -05:00
|
|
|
int sCurrentDay;
|
2022-06-16 23:25:49 -05:00
|
|
|
|
|
|
|
/****************/
|
|
|
|
/* player state */
|
|
|
|
/****************/
|
2022-06-15 18:36:12 -05:00
|
|
|
int pMoney;
|
|
|
|
int pLoanAmount;
|
|
|
|
int pSavingsAmount;
|
|
|
|
GameLocation pLocation;
|
|
|
|
int pGuns;
|
|
|
|
int pCapacity;
|
|
|
|
int pHealth;
|
|
|
|
int pInventory[6] = {0};
|
|
|
|
|
2022-06-16 23:25:49 -05:00
|
|
|
/***********************/
|
|
|
|
/* game setup and loop */
|
|
|
|
/***********************/
|
2022-06-15 12:47:42 -05:00
|
|
|
void setup() {
|
2022-06-16 23:25:49 -05:00
|
|
|
sGameState = STATE_TITLE;
|
2022-06-15 18:36:12 -05:00
|
|
|
screenInitialized = false;
|
2022-06-15 12:47:42 -05:00
|
|
|
arduboy.begin();
|
|
|
|
arduboy.setFrameRate(15);
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
if (!(arduboy.nextFrame()))
|
|
|
|
return;
|
|
|
|
|
2022-06-17 08:58:56 -05:00
|
|
|
String menu[8];
|
|
|
|
int menuLength = 0;
|
2022-06-17 16:38:40 -05:00
|
|
|
bool menuCols = false;
|
2022-06-17 08:58:56 -05:00
|
|
|
bool menuSmall = false;
|
2022-06-17 16:38:40 -05:00
|
|
|
int menuSelected = 0;
|
2022-06-17 08:58:56 -05:00
|
|
|
|
2022-06-15 18:36:12 -05:00
|
|
|
if (!screenInitialized) {
|
2022-06-17 16:38:40 -05:00
|
|
|
menuSelected = 0;
|
2022-06-16 23:25:49 -05:00
|
|
|
arduboy.clear();
|
|
|
|
switch (sGameState) {
|
2022-06-15 18:36:12 -05:00
|
|
|
case STATE_TITLE:
|
2022-06-17 16:38:40 -05:00
|
|
|
arduboy.setCursor(25, 10);
|
|
|
|
arduboy.print(F("Slangin' v0.9"));
|
2022-06-17 08:58:56 -05:00
|
|
|
menu[0] = F("New Game");
|
2022-06-17 16:38:40 -05:00
|
|
|
menuLength = 1;
|
|
|
|
menuSmall = false;
|
|
|
|
menuCols = false;
|
|
|
|
drawMenu(menuSmall, menuCols, menuLength, menu);
|
|
|
|
drawMenuIndicator(menuSelected, menuSmall, menuCols, menuLength, menu);
|
2022-06-15 18:36:12 -05:00
|
|
|
break;
|
|
|
|
}
|
2022-06-16 23:25:49 -05:00
|
|
|
arduboy.display();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************/
|
|
|
|
/* screen draw heplers */
|
|
|
|
/***********************/
|
2022-06-17 08:58:56 -05:00
|
|
|
void drawTitle(const String title) {
|
2022-06-17 16:38:40 -05:00
|
|
|
font4x6.setCursor(6, 8);
|
|
|
|
font4x6.print(title);
|
2022-06-15 12:47:42 -05:00
|
|
|
}
|