ref: c1c97f935684bb2b6ce2036761dfa613b69bf381
parent: 2680c99732db8591e945c10dfb67f45d3c9f551f
author: qwx <qwx@sciops.net>
date: Wed Jul 14 02:35:46 EDT 2021
fs: load wtexels.bin
--- a/dat.h
+++ b/dat.h
@@ -1,3 +1,4 @@
+typedef struct Wall Wall;
typedef struct Pic Pic;
extern char *prefix;
@@ -14,6 +15,9 @@
Vfntspc = 1,
Vfntpicw = Vfntspc+Vfntw+Vfntspc,
+ Wallsz = 64,
+ Wtexelsz = Wallsz / 2,
+
Kfire = 0,
K↑,
K↓,
@@ -34,6 +38,12 @@
extern int npal;
extern u32int *pal;
+
+struct Wall{
+ u32int p[Wallsz*Wallsz];
+};
+extern Wall *walls;
+extern int nwalls;
enum{
PCarrow,
--- a/fs.c
+++ b/fs.c
@@ -11,6 +11,8 @@
uchar *fontmap;
int nglyph;
Pic *dfont;
+int nwalls;
+Wall *walls;
static Biobuf *
eopen(char *s, int mode)
@@ -218,6 +220,45 @@
}
static void
+loadwalls(void)
+{
+ int i, j, n, v;
+ Biobuf *bf;
+ Wall *w, *we;
+ u32int *p;
+
+ bf = eopen("wtexels.bin", OREAD);
+ n = get32(bf) / (Wallsz * Wtexelsz);
+ walls = emalloc(n * sizeof *walls);
+ nwalls = n;
+ for(w=walls, we=w+n; w<we; w++){
+ for(i=0; i<Wallsz; i++){
+ p = w->p + i;
+ for(j=0; j<Wtexelsz; j++){
+ v = get8(bf);
+ *p = v & 15;
+ p += Wallsz;
+ *p = v >> 4 & 15;
+ p += Wallsz;
+ }
+ }
+ char name[32], c[9];
+ snprint(name, sizeof name, "wall%02zd.bit", w-walls);
+ int fd;
+ if((fd = create(name, OWRITE, 0644)) < 0)
+ sysfatal("shit %r");
+ fprint(fd, "%11s %11d %11d %11d %11d ",
+ chantostr(c, GREY8), 0, 0, 64, 64);
+ for(n=0; n<Wallsz*Wallsz; n++){
+ c[0] = w->p[n] & 0xff;
+ write(fd, c, 1);
+ }
+ close(fd);
+ }
+ Bterm(bf);
+}
+
+static void
loadfontmap(void)
{
int n;
@@ -263,13 +304,5 @@
loadpal();
loadbasestr();
loadfontmap();
+ loadwalls();
}
-
-// grids: 32/256/2048
-// wtexels.bin
-// stexels.bin
-// bitshapes.bin
-// entities.db
-// entities.str
-// mappings.bin
-// map bsp + str (on demand, with shim load gauge)