summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt14
-rw-r--r--procyon.desktop5
-rw-r--r--procyon/GNUmakefile7
-rw-r--r--procyon/include/acm/bs.h100
-rw-r--r--procyon/include/acm/evt.h10
-rw-r--r--procyon/include/acm/info.h12
-rw-r--r--procyon/include/acm/sav.h9
-rw-r--r--procyon/source/bs/shipnm.c66
-rw-r--r--procyon/source/evt/jmp.c13
-rw-r--r--procyon/source/info/jmplen.c7
-rw-r--r--procyon/source/info/sysdist.c7
-rw-r--r--procyon/source/main.c2
-rw-r--r--procyon/source/sav/cont.c (renamed from procyon/source/bs/cont.c)30
-rw-r--r--procyon/source/sav/sav.c (renamed from procyon/source/bs/sav.c)2
14 files changed, 192 insertions, 92 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 6c184dd..2a57e29 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,17 @@
+# 1
+
+* Move save handlers into their own module 'sav';
+* Add new module 'evt';
+* Move shipnm into new module 'info';
+* Update save format;
+* Add jump function;
+* Rename ship to shipid;
+* Add ship structure;
+* Store ship information in player data;
+* Add function for getting the length to a system;
+* Add function for determining the jump range of a ship;
+* Add desktop entry;
+
# 0
* Initial;
diff --git a/procyon.desktop b/procyon.desktop
new file mode 100644
index 0000000..21c9313
--- /dev/null
+++ b/procyon.desktop
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Type=Application
+Name=Procyon
+Exec=/usr/bin/procyon
+
diff --git a/procyon/GNUmakefile b/procyon/GNUmakefile
index b54c12f..a9379b7 100644
--- a/procyon/GNUmakefile
+++ b/procyon/GNUmakefile
@@ -33,13 +33,16 @@ HDRS := \
# BINARIES
OBJS := \
- source/bs/cont.o \
source/bs/dbglog.o \
source/bs/exit.o \
source/bs/init.o \
- source/bs/sav.o \
source/bs/shipnm.o \
+ source/evt/jmp.o \
source/gfx/initgfx.o \
+ source/info/jmplen.o \
+ source/info/sysdist.o \
+ source/sav/cont.o \
+ source/sav/sav.o \
source/main.o
BIN := procyon.elf
diff --git a/procyon/include/acm/bs.h b/procyon/include/acm/bs.h
index 58acdcf..497bdb0 100644
--- a/procyon/include/acm/bs.h
+++ b/procyon/include/acm/bs.h
@@ -7,8 +7,8 @@
#include <stdio.h>
#include <zap/bs.h>
-#define acm_ver ((uint_least64_t)+0x0)
-#define acm_savver ((uint_least64_t)+0x0)
+#define acm_ver ((uint_least64_t)+0x1)
+#define acm_savver ((uint_least64_t)+0x1)
#define acm_plnmlen ((zap_sz)+0x10u)
@@ -21,39 +21,54 @@
#endif
typedef enum {
- acm_ship_add,
- acm_ship_ana,
- acm_ship_asp,
- acm_ship_boa,
- acm_ship_cob,
- acm_ship_con,
- acm_ship_cou,
- acm_ship_cyg,
- acm_ship_dov,
- acm_ship_eag,
- acm_ship_falc,
- acm_ship_fer,
- acm_ship_frei,
- acm_ship_geck,
- acm_ship_haul,
- acm_ship_hawk,
- acm_ship_keel,
- acm_ship_kes,
- acm_ship_krait,
- acm_ship_lift,
- acm_ship_lion,
- acm_ship_mamba,
- acm_ship_moray,
- acm_ship_osp,
- acm_ship_pan,
- acm_ship_puma,
- acm_ship_py,
- acm_ship_shut,
- acm_ship_side,
- acm_ship_tran,
- acm_ship_vip,
- acm_ship_vult,
-} acm_ship;
+ acm_drv_h1,
+ acm_drv_h2,
+ acm_drv_h3,
+ acm_drv_h4,
+ acm_drv_h5,
+ acm_drv_h6,
+ acm_drv_h7,
+ acm_drv_h8,
+ acm_drv_m1,
+ acm_drv_m2,
+ acm_drv_m3,
+ acm_drv_m4,
+} acm_drv;
+
+typedef enum {
+ acm_shipid_add,
+ acm_shipid_ana,
+ acm_shipid_asp,
+ acm_shipid_boa,
+ acm_shipid_cob,
+ acm_shipid_con,
+ acm_shipid_cou,
+ acm_shipid_cyg,
+ acm_shipid_dov,
+ acm_shipid_eag,
+ acm_shipid_falc,
+ acm_shipid_fer,
+ acm_shipid_frei,
+ acm_shipid_geck,
+ acm_shipid_haul,
+ acm_shipid_hawk,
+ acm_shipid_keel,
+ acm_shipid_kes,
+ acm_shipid_krait,
+ acm_shipid_lift,
+ acm_shipid_lion,
+ acm_shipid_mamba,
+ acm_shipid_moray,
+ acm_shipid_osp,
+ acm_shipid_pan,
+ acm_shipid_puma,
+ acm_shipid_py,
+ acm_shipid_shut,
+ acm_shipid_side,
+ acm_shipid_tran,
+ acm_shipid_vip,
+ acm_shipid_vult,
+} acm_shipid;
typedef enum {
acm_stat_err,
@@ -77,9 +92,15 @@ typedef struct {
} acm_obj;
typedef struct {
+ acm_drv drv;
+ acm_shipid id;
+} acm_ship;
+
+typedef struct {
char nm[acm_plnmlen + 0x1u];
uint_least16_t heat;
acm_objpos pos;
+ uint_least64_t selsys;
acm_ship ship;
uint_least64_t tm;
} acm_pldat;
@@ -93,11 +114,8 @@ extern struct {
extern sig_atomic_t volatile acm_gotintr;
- void acm_cont( acm_pldat * pldat);
- void acm_dbglog(char const * fmt,...);
- void acm_init( void);
-[[noreturn]] void acm_exit( acm_stat stat);
- void acm_sav( acm_pldat const * pldat);
- char const * acm_shipnm(acm_ship ship);
+ void acm_dbglog(char const * fmt,...);
+ void acm_init( void);
+[[noreturn]] void acm_exit( acm_stat stat);
#endif
diff --git a/procyon/include/acm/evt.h b/procyon/include/acm/evt.h
new file mode 100644
index 0000000..3a5aa2a
--- /dev/null
+++ b/procyon/include/acm/evt.h
@@ -0,0 +1,10 @@
+#if !defined(acm_hdr_evt)
+#define acm_hdr_evt
+
+#include <acm/bs.h>
+
+#include <stdint.h>
+
+bool acm_jmp(uint_least64_t sys);
+
+#endif
diff --git a/procyon/include/acm/info.h b/procyon/include/acm/info.h
new file mode 100644
index 0000000..d42ad0b
--- /dev/null
+++ b/procyon/include/acm/info.h
@@ -0,0 +1,12 @@
+#if !defined(acm_hdr_info)
+#define acm_hdr_info
+
+#include <acm/bs.h>
+
+#include <stdint.h>
+
+char const * acm_shipnm( acm_shipid ship);
+uint_least64_t acm_sysdist(uint_least64_t sys);
+uint_least64_t acm_jmplen( acm_ship const * ship);
+
+#endif
diff --git a/procyon/include/acm/sav.h b/procyon/include/acm/sav.h
new file mode 100644
index 0000000..4caf810
--- /dev/null
+++ b/procyon/include/acm/sav.h
@@ -0,0 +1,9 @@
+#if !defined(acm_hdr_sav)
+#define acm_hdr_sav
+
+#include <acm/bs.h>
+
+void acm_cont(acm_pldat * pldat);
+void acm_sav( acm_pldat const * pldat);
+
+#endif
diff --git a/procyon/source/bs/shipnm.c b/procyon/source/bs/shipnm.c
index dcbd6fb..f1d8f4e 100644
--- a/procyon/source/bs/shipnm.c
+++ b/procyon/source/bs/shipnm.c
@@ -1,70 +1,70 @@
#include <acm/bs.h>
-char const * acm_shipnm(acm_ship const _ship) {
+char const * acm_shipnm(acm_shipid const _ship) {
switch (_ship) {
- case acm_ship_add:
+ case acm_shipid_add:
return "Adder";
- case acm_ship_ana:
+ case acm_shipid_ana:
return "Anaconda";
- case acm_ship_asp:
+ case acm_shipid_asp:
return "Asp";
- case acm_ship_boa:
+ case acm_shipid_boa:
return "Boa";
- case acm_ship_cob:
+ case acm_shipid_cob:
return "Cobra";
- case acm_ship_con:
+ case acm_shipid_con:
return "Constrictor";
- case acm_ship_cou:
+ case acm_shipid_cou:
return "Courier";
- case acm_ship_cyg:
+ case acm_shipid_cyg:
return "Cygnus";
- case acm_ship_dov:
+ case acm_shipid_dov:
return "Dove";
- case acm_ship_eag:
+ case acm_shipid_eag:
return "Eagle";
- case acm_ship_falc:
+ case acm_shipid_falc:
return "Falcon";
- case acm_ship_fer:
+ case acm_shipid_fer:
return "Fer-de-lance";
- case acm_ship_frei:
+ case acm_shipid_frei:
return "Freighter";
- case acm_ship_geck:
+ case acm_shipid_geck:
return "Gecko";
- case acm_ship_haul:
+ case acm_shipid_haul:
return "Hauler";
- case acm_ship_hawk:
+ case acm_shipid_hawk:
return "Hawk";
- case acm_ship_keel:
+ case acm_shipid_keel:
return "Keelback";
- case acm_ship_kes:
+ case acm_shipid_kes:
return "Kestral";
- case acm_ship_krait:
+ case acm_shipid_krait:
return "Krait";
- case acm_ship_lift:
+ case acm_shipid_lift:
return "Lifter";
- case acm_ship_lion:
+ case acm_shipid_lion:
return "Lion";
- case acm_ship_mamba:
+ case acm_shipid_mamba:
return "Mamba";
- case acm_ship_moray:
+ case acm_shipid_moray:
return "Moray";
- case acm_ship_osp:
+ case acm_shipid_osp:
return "Osprey";
- case acm_ship_pan:
+ case acm_shipid_pan:
return "Panther";
- case acm_ship_puma:
+ case acm_shipid_puma:
return "Puma";
- case acm_ship_py:
+ case acm_shipid_py:
return "Python";
- case acm_ship_shut:
+ case acm_shipid_shut:
return "Shuttle";
- case acm_ship_side:
+ case acm_shipid_side:
return "Sidewinder";
- case acm_ship_tran:
+ case acm_shipid_tran:
return "Transporter";
- case acm_ship_vip:
+ case acm_shipid_vip:
return "Viper";
- case acm_ship_vult:
+ case acm_shipid_vult:
return "Vulture";
}
}
diff --git a/procyon/source/evt/jmp.c b/procyon/source/evt/jmp.c
new file mode 100644
index 0000000..5a93491
--- /dev/null
+++ b/procyon/source/evt/jmp.c
@@ -0,0 +1,13 @@
+#include <acm/evt.h>
+#include <acm/info.h>
+
+#include <stdint.h>
+
+bool acm_jmp(uint_least64_t const _sys) {
+ acm_pldat pldat = acm_dat.pldat;
+ if (acm_sysdist(_sys) > acm_jmplen(&pldat.ship)) {
+ return true;
+ }
+ acm_dat.pldat = pldat;
+ return false;
+}
diff --git a/procyon/source/info/jmplen.c b/procyon/source/info/jmplen.c
new file mode 100644
index 0000000..7ef8995
--- /dev/null
+++ b/procyon/source/info/jmplen.c
@@ -0,0 +1,7 @@
+#include <acm/info.h>
+
+#include <stdint.h>
+
+uint_least64_t acm_jmplen(acm_ship const * _ship) {
+ return 0x0u;
+}
diff --git a/procyon/source/info/sysdist.c b/procyon/source/info/sysdist.c
new file mode 100644
index 0000000..2e77220
--- /dev/null
+++ b/procyon/source/info/sysdist.c
@@ -0,0 +1,7 @@
+#include <acm/info.h>
+
+#include <stdint.h>
+
+uint_least64_t acm_sysdist(uint_least64_t const _sys) {
+ return ~(uint_least64_t)0x0u;
+}
diff --git a/procyon/source/main.c b/procyon/source/main.c
index 84168ba..19439a4 100644
--- a/procyon/source/main.c
+++ b/procyon/source/main.c
@@ -1,4 +1,4 @@
-#include <acm/bs.h>
+#include <acm/sav.h>
#include <flux.h>
#include <inttypes.h>
diff --git a/procyon/source/bs/cont.c b/procyon/source/sav/cont.c
index 61907fc..e52fd76 100644
--- a/procyon/source/bs/cont.c
+++ b/procyon/source/sav/cont.c
@@ -1,4 +1,5 @@
-#include <acm/bs.h>
+#include <acm/info.h>
+#include <acm/sav.h>
#include <flux.h>
#include <inttypes.h>
@@ -58,22 +59,23 @@ void acm_cont(acm_pldat * const _pldat) {
);
goto new;
}
- printf("Loaded CMDR %s, %s @ %" PRIiLEAST64 "\n",pldat.nm,acm_shipnm(pldat.ship),pldat.tm);
+ printf("Loaded CMDR %s, %s @ %" PRIiLEAST64 "\n",pldat.nm,acm_shipnm(pldat.ship.id),pldat.tm);
*_pldat = pldat;
return;
new:;
- pldat.heat = 0x120u; /* 288K */
- pldat.pos.px = 0x0u;
- pldat.pos.py = 0x0u;
- pldat.pos.pz = 0x0u;
- pldat.pos.rx = 0x0u;
- pldat.pos.ry = 0x0u;
- pldat.pos.rz = 0x0u;
- pldat.pos.vx = 0x0u;
- pldat.pos.vy = 0x0u;
- pldat.pos.vz = 0x0u;
- pldat.ship = acm_ship_side;
- pldat.tm = 0x9679C2B40u; /* 3250-01-01T12:00:00Z */
+ pldat.heat = 0x120u; /* 288K */
+ pldat.pos.px = 0x0u;
+ pldat.pos.py = 0x0u;
+ pldat.pos.pz = 0x0u;
+ pldat.pos.rx = 0x0u;
+ pldat.pos.ry = 0x0u;
+ pldat.pos.rz = 0x0u;
+ pldat.pos.vx = 0x0u;
+ pldat.pos.vy = 0x0u;
+ pldat.pos.vz = 0x0u;
+ pldat.ship.drv = acm_drv_h1;
+ pldat.ship.id = acm_shipid_side;
+ pldat.tm = 0x9679C2B40u; /* 3250-01-01T12:00:00Z */
zap_memcp(acm_dflplnm,acm_plnmlen + 0x1u,pldat.nm);
*_pldat = pldat;
}
diff --git a/procyon/source/bs/sav.c b/procyon/source/sav/sav.c
index 1e0b226..d7301c7 100644
--- a/procyon/source/bs/sav.c
+++ b/procyon/source/sav/sav.c
@@ -1,4 +1,4 @@
-#include <acm/bs.h>
+#include <acm/sav.h>
#include <flux.h>
#include <stdio.h>