awlite

POSIX AWK port of Text Elite game
git clone git://git.luxferre.top/awlite.git
Log | Files | Refs | README

commit d8d85a27c4a4a0f046af0700a41dbcfa74dc7542
parent 7e3495527d2787724619cc55a9f3f010ba8d3d94
Author: Luxferre <lux@ferre>
Date:   Tue, 23 Jan 2024 17:26:27 +0200

v1.6.3: now galaxies are named

Diffstat:
MREADME | 4+++-
Mawlite.awk | 18+++++++++++-------
2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/README b/README @@ -56,7 +56,7 @@ Fuel price is fixed at 0.2 CR/LY, you can hold 7LY of fuel at most. == Gameplay differences from the original TE 1.5 C version == -As of the current version, 1.6.2: +As of the current version, 1.6.3: * multiple typos corrected in text strings * the "cash" and "sneak" commands were removed since v1.6 @@ -73,6 +73,8 @@ As of the current version, 1.6.2: * market and local info tables are better aligned * state saving/loading functionality introduced with "save"/"load" commands * since v1.6.1, the game gives you a hint if you might have found Raxxla +* since v1.6.3, galaxy names are also displayed with "local" command + (the names were taken from the Archimedes version of Classic Elite) To be continued. This list is expected to grow in the future. diff --git a/awlite.awk b/awlite.awk @@ -1,5 +1,5 @@ # awlite: POSIX AWK port of Text Elite -# Version 1.6.2 +# Version 1.6.3 # Original high-level algorithms from Text Elite 1.5 by Ian Bell, 1999, 2015 # Porting, corrections, improvements and optimizations by Luxferre, 2024 # @@ -18,7 +18,8 @@ # - market and local info tables are better aligned # - the "cash" and "sneak" commands are removed since v1.6 (use saves to cheat) # - state saving functionality since v1.6 with "save" and "load" commands -# - since 1.6.1, the game gives you a hint if you might have found Raxxla +# - since v1.6.1, the game gives you a hint if you might have found Raxxla +# - since v1.6.3, galaxy names are actually displayed (taken from ArcElite) # ... to be continued ... # utility functions @@ -221,13 +222,13 @@ function buildgalaxy(gnum, seeds, si, i) { asplit("23114 584 46931", seeds, " ") for(i=1;i<gnum;i++) galswitch(seeds) split("", galaxy) # global galaxy array - split("", galnames) # global galaxy names array + split("", plannames) # global galaxy planet names array split("", economies) # economy mapping for(i=0;i<galsize;i++) { split("", si) # init a new system info array makesystem(seeds, si) # populate it galaxy[i] = assocser(si, "|") # serialize into the field - galnames[i] = si["name"] # populate the name + plannames[i] = si["name"] # populate the name galcoords_x[i] = si["x"] # populate x coordinate galcoords_y[i] = si["y"] # populate y coordinate economies[i] = si["economy"] # populate economy type @@ -322,7 +323,7 @@ function matchsys(s, d, i, p, cd) { d = 9999 s = toupper(s) # system names are stored in uppercase for(i=0;i<galsize;i++) { - if(index(s, galnames[i]) == 1) { # found i-th system + if(index(s, plannames[i]) == 1) { # found i-th system cd = distance(galcoords_x[i], galcoords_y[i], galcoords_x[p], galcoords_y[p]) if(cd < d) {d = cd; p = i} } @@ -337,7 +338,7 @@ function dotweakrand() { game["use_native_rand"] = 1 - game["use_native_rand"] } # local command implementation function dolocal(d, i, p, si) { - printf("Galaxy number %i", player["galaxynum"]) + printf("\nGalaxy %i - %s\n", player["galaxynum"], galnames[player["galaxynum"]]) p = int(player["currentplanet"]) for(i=0;i<galsize;i++) { d = distance(galcoords_x[i], galcoords_y[i], galcoords_x[p], galcoords_y[p]) @@ -547,6 +548,9 @@ function gameinit() { # unit names asplit("t kg g", unitnames, " ") + # galaxy names (1-indexed) + split("Santaari Colesque Lara'tan Angiana Proximus Sol Jaftra Xrata", galnames, " ") + # government names asplit("Anarchy,Feudal,Multi-gov,Dictatorship,Communist,Confederacy,Democracy,Corporate State", govnames, ",") @@ -616,7 +620,7 @@ BEGIN { split("", globalseeds) # init galaxy seeds buildgalaxy(player["galaxynum"], globalseeds) # build the current galaxy genmarket(0, economies[player["currentplanet"]]) # build local market - printf("\nWelcome to awlite 1.6.2\n") + printf("\nWelcome to awlite 1.6.3\n") dohelp() # start the REPL printf("\n\nCash: %.1f> ", player["cash"]/10)