121 lines
2.1 KiB
C++
121 lines
2.1 KiB
C++
/*
|
|
Slangin'
|
|
Author: Rudis Muiznieks
|
|
License: WTFPL
|
|
*/
|
|
|
|
#include <Arduboy2.h>
|
|
#include "src/fonts/Font3x5.h";
|
|
#include "src/fonts/Font4x6.h";
|
|
|
|
Arduboy2 arduboy;
|
|
Font4x6 font4x6 = Font4x6();
|
|
Font3x5 font3x5 = Font3x5();
|
|
|
|
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
|
|
};
|
|
|
|
/**************/
|
|
/* game state */
|
|
/**************/
|
|
bool screenInitialized;
|
|
GameState sGameState;
|
|
int sCurrentDay;
|
|
|
|
/****************/
|
|
/* player state */
|
|
/****************/
|
|
int pMoney;
|
|
int pLoanAmount;
|
|
int pSavingsAmount;
|
|
GameLocation pLocation;
|
|
int pGuns;
|
|
int pCapacity;
|
|
int pHealth;
|
|
int pInventory[6] = {0};
|
|
|
|
/***********************/
|
|
/* game setup and loop */
|
|
/***********************/
|
|
void setup() {
|
|
sGameState = STATE_TITLE;
|
|
screenInitialized = false;
|
|
arduboy.begin();
|
|
arduboy.setFrameRate(15);
|
|
}
|
|
|
|
void loop() {
|
|
if (!(arduboy.nextFrame()))
|
|
return;
|
|
|
|
String menu[8];
|
|
int menuLength = 0;
|
|
bool menuCols = false;
|
|
bool menuSmall = false;
|
|
int menuSelected = 0;
|
|
|
|
if (!screenInitialized) {
|
|
menuSelected = 0;
|
|
arduboy.clear();
|
|
switch (sGameState) {
|
|
case STATE_TITLE:
|
|
arduboy.setCursor(25, 10);
|
|
arduboy.print(F("Slangin' v0.9"));
|
|
menu[0] = F("New Game");
|
|
menuLength = 1;
|
|
menuSmall = false;
|
|
menuCols = false;
|
|
drawMenu(menuSmall, menuCols, menuLength, menu);
|
|
drawMenuIndicator(menuSelected, menuSmall, menuCols, menuLength, menu);
|
|
break;
|
|
}
|
|
arduboy.display();
|
|
}
|
|
}
|
|
|
|
/***********************/
|
|
/* screen draw heplers */
|
|
/***********************/
|
|
void drawTitle(const String title) {
|
|
font4x6.setCursor(6, 8);
|
|
font4x6.print(title);
|
|
}
|