list some starting ship options
This commit is contained in:
+17
-1
@@ -455,11 +455,13 @@ fn bool updateAndRender(TuiState* tui, void* s, u8* input_buffer, u64 loop_count
|
||||
switch (state->screen) {
|
||||
case ScreenCreateCharacter: {
|
||||
//// SIMULATION
|
||||
state->screen = ScreenMainGame; // TODO change this if you want to actually have character creation
|
||||
if (state->me.id != 0) {
|
||||
state->screen = ScreenMainGame;
|
||||
break;
|
||||
}
|
||||
if (state->section.selected_index == 0) {
|
||||
state->menu.len = ShipType_Count;
|
||||
}
|
||||
|
||||
if (input_buffer[0] == 'q' || user_pressed_esc) {
|
||||
should_quit = true;
|
||||
@@ -507,6 +509,20 @@ fn bool updateAndRender(TuiState* tui, void* s, u8* input_buffer, u64 loop_count
|
||||
|
||||
line++;
|
||||
// TODO: game-specific character creation stuff
|
||||
// 3. draw the ship choices
|
||||
str ship_label = "Choose your starting ship:";
|
||||
renderStrToBuffer(tui->frame_buffer, 5, ++line, ship_label, screen_dimensions);
|
||||
line++;
|
||||
renderChoiceMenu(
|
||||
tui,
|
||||
5,
|
||||
line,
|
||||
(ptr*)SHIP_TYPE_STRINGS,
|
||||
ShipType_Count,
|
||||
state->section.selected_index == 0,
|
||||
state->menu.selected_index,
|
||||
NULL
|
||||
);
|
||||
} break;
|
||||
case ScreenMainGame: {
|
||||
// SIMULATION
|
||||
|
||||
+2
-4
@@ -6,10 +6,8 @@
|
||||
|
||||
fn str charForEntity(EntityType e) {
|
||||
switch (e) {
|
||||
case EntityWall:
|
||||
return "# ";
|
||||
case EntityDoor:
|
||||
return "🚪";
|
||||
case EntityStarSystem:
|
||||
return "⭐";
|
||||
case EntityCharacter:
|
||||
return "🧙";
|
||||
//return "웃";
|
||||
|
||||
+193
-4
@@ -1,4 +1,5 @@
|
||||
#include "base/all.h"
|
||||
#include "string_chunk.h"
|
||||
|
||||
#ifndef GAMESHARED_H
|
||||
#define GAMESHARED_H
|
||||
@@ -15,18 +16,206 @@ typedef enum EntityFeature {
|
||||
|
||||
typedef enum EntityType {
|
||||
EntityNull,
|
||||
EntityWall,
|
||||
EntityDoor,
|
||||
EntityStarSystem,
|
||||
EntityCharacter,
|
||||
EntityType_Count,
|
||||
} EntityType;
|
||||
static const char* ENTITY_STRINGS[] = {
|
||||
"NULL",
|
||||
"Wall",
|
||||
"Door",
|
||||
"StarSystem",
|
||||
"Character",
|
||||
};
|
||||
|
||||
typedef enum ShipType {
|
||||
ShipSparrow,
|
||||
ShipDart,
|
||||
ShipHaulerPrimeZ1,
|
||||
ShipNX400,
|
||||
ShipType_Count,
|
||||
} ShipType;
|
||||
static const char* SHIP_TYPE_STRINGS[] = {
|
||||
"Sparrow",
|
||||
"Dart",
|
||||
"Hauler-Prime Z-1",
|
||||
"NX-400",
|
||||
};
|
||||
typedef struct ShipTemplate {
|
||||
ShipType type;
|
||||
u8 drive_efficiency;
|
||||
u8 life_support_efficiency;
|
||||
u16 vacuum_cargo_slots;
|
||||
u16 climate_cargo_slots;
|
||||
u16 passenger_berths;
|
||||
u16 passenger_amenities_flags;
|
||||
u16 smugglers_hold_cu_m;
|
||||
u32 base_cost;
|
||||
} ShipTemplate;
|
||||
global ShipTemplate SHIPS[] = {
|
||||
{
|
||||
.type = ShipSparrow, .drive_efficiency = 1, .life_support_efficiency = 2,
|
||||
.vacuum_cargo_slots = 5, .climate_cargo_slots = 0, .passenger_berths = 0,
|
||||
.passenger_amenities_flags = 0,
|
||||
.smugglers_hold_cu_m = 1, .base_cost = 100000,
|
||||
},
|
||||
{
|
||||
.type = ShipDart, .drive_efficiency = 12, .life_support_efficiency = 4,
|
||||
.vacuum_cargo_slots = 9, .climate_cargo_slots = 1, .passenger_berths = 1,
|
||||
.passenger_amenities_flags = 0,
|
||||
.smugglers_hold_cu_m = 0, .base_cost = 150000,
|
||||
},
|
||||
{
|
||||
.type = ShipHaulerPrimeZ1, .drive_efficiency = 3, .life_support_efficiency = 3,
|
||||
.vacuum_cargo_slots = 25, .climate_cargo_slots = 5, .passenger_berths = 0,
|
||||
.passenger_amenities_flags = 0,
|
||||
.smugglers_hold_cu_m = 0, .base_cost = 250000,
|
||||
},
|
||||
{
|
||||
.type = ShipNX400, .drive_efficiency = 6, .life_support_efficiency = 8,
|
||||
.vacuum_cargo_slots = 5, .climate_cargo_slots = 5, .passenger_berths = 5,
|
||||
.passenger_amenities_flags = 0,
|
||||
.smugglers_hold_cu_m = 0, .base_cost = 350000,
|
||||
},
|
||||
};
|
||||
|
||||
typedef struct PlayerShip {
|
||||
ShipType type;
|
||||
u8 drive_efficiency;
|
||||
u8 life_support_efficiency;
|
||||
u16 vacuum_cargo_slots;
|
||||
u16 climate_cargo_slots;
|
||||
u16 passenger_berths;
|
||||
u16 passenger_amenities_flags;
|
||||
u16 smugglers_hold_cu_m;
|
||||
u32 base_cost;
|
||||
u32 remaining_mortgage;
|
||||
f32 interest_rate;
|
||||
u32 cu_m_fuel; // we are just saying you can buy as much fuel as you want
|
||||
u32 cu_m_o2; // we are just saying you can buy as much o2 as you want
|
||||
u64 id;
|
||||
} PlayerShip;
|
||||
|
||||
typedef enum CommodityType {
|
||||
CommodityNull,
|
||||
CommodityHydrogenFuel,
|
||||
CommodityOxygen,
|
||||
CommodityWater,
|
||||
CommodityWheat,
|
||||
CommodityRice,
|
||||
CommodityCorn,
|
||||
CommodityPotatoes,
|
||||
CommodityBeef,
|
||||
CommodityChicken,
|
||||
CommodityButter,
|
||||
CommodityOliveOil,
|
||||
CommodityLiquor,
|
||||
CommodityBeer,
|
||||
CommodityFertilizer,
|
||||
CommodityCleaningSupplies,
|
||||
CommodityAirFilters,
|
||||
CommodityIndustrialChemicals,
|
||||
CommodityClothes,
|
||||
CommodityRawTextiles,
|
||||
CommodityElectronics,
|
||||
CommodityConstructionParts,
|
||||
Commodity3dPrinterParts,
|
||||
CommodityHandTools,
|
||||
CommodityCutlery,
|
||||
CommodityRobots,
|
||||
CommodityPlastics,
|
||||
CommodityHandWeapons,
|
||||
CommodityBatteries,
|
||||
CommoditySolarPanels,
|
||||
CommodityMedicines,
|
||||
CommodityOpticalComponents,
|
||||
CommodityGlass,
|
||||
CommodityLithium,
|
||||
CommodityBerylium,
|
||||
CommodityMagnesium,
|
||||
CommodityAluminium,
|
||||
CommoditySilicon,
|
||||
CommodityScandium,
|
||||
CommodityTitanium,
|
||||
CommodityVanadium,
|
||||
CommodityChromium,
|
||||
CommodityManganese,
|
||||
CommodityIron,
|
||||
CommodityCobalt,
|
||||
CommodityNickel,
|
||||
CommodityCopper,
|
||||
CommodityZinc,
|
||||
CommoditySelenium,
|
||||
CommodityZirconium,
|
||||
CommodityMolybdenum,
|
||||
CommodityRuthenium,
|
||||
CommodityRhodium,
|
||||
CommodityPalladium,
|
||||
CommoditySilver,
|
||||
CommodityCadmium,
|
||||
CommodityTin,
|
||||
CommodityTungsten,
|
||||
CommodityRhenium,
|
||||
CommodityIridium,
|
||||
CommodityPlatinum,
|
||||
CommodityGold,
|
||||
CommodityMercury,
|
||||
CommodityLead,
|
||||
Commodity_Count,
|
||||
} CommodityType;
|
||||
static const char* COMMODITY_STRINGS[] = {
|
||||
"NULL",
|
||||
"Hydrogen Fuel",
|
||||
"Oxygen",
|
||||
"Water",
|
||||
"Wheat",
|
||||
"Rice",
|
||||
"Corn",
|
||||
"Potatoes",
|
||||
"Beef",
|
||||
"Chicken",
|
||||
"Butter",
|
||||
"Olive Oil",
|
||||
"Liquor",
|
||||
"Beer",
|
||||
"Fertilizer",
|
||||
"Cleaning Supplies",
|
||||
"Air Filters",
|
||||
"Industrial Chemicals",
|
||||
"Clothes",
|
||||
"Raw Textiles",
|
||||
"Electronics",
|
||||
"Construction Parts",
|
||||
"3d Printer Parts",
|
||||
"Hand Tools",
|
||||
"Cutlery",
|
||||
"Robots",
|
||||
"Plastics",
|
||||
"Hand Weapons",
|
||||
"Batteries",
|
||||
"Solar Panels",
|
||||
"Medicines",
|
||||
"Optical Components",
|
||||
"Glass",
|
||||
};
|
||||
|
||||
typedef struct Commodity {
|
||||
CommodityType type;
|
||||
str name;
|
||||
u32 base_price_per_kg;
|
||||
u32 kg_per_container;
|
||||
u32 m3_per_kg;
|
||||
} Commodity;
|
||||
|
||||
typedef struct StarSystem {
|
||||
StringChunkList name;
|
||||
} StarSystem;
|
||||
|
||||
typedef struct Planet {
|
||||
StringChunkList name;
|
||||
bool habitable;
|
||||
u32 population;
|
||||
u32 commodities[Commodity_Count];
|
||||
} Planet;
|
||||
|
||||
typedef struct {
|
||||
i32 x;
|
||||
i32 y;
|
||||
|
||||
Reference in New Issue
Block a user