Free Hero Mesh

Check-in [db4b88bbcd]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.
Overview
Comment:Add misc/har.c and misc/mbform.doc (previously named fileform1.txt) and improve the README file
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: db4b88bbcde98cc9757995c50282b5e24cf8ba46
User & Date: user on 2021-06-24 06:15:21
Other Links: manifest | tags
Context
2021-06-24
21:25
Add and implement the Trigger and TriggerAt instructions. check-in: f36f18a600 user: user tags: trunk
06:15
Add misc/har.c and misc/mbform.doc (previously named fileform1.txt) and improve the README file check-in: db4b88bbcd user: user tags: trunk
2021-06-23
19:31
When saving a level in the level editor, ensure that level strings are null-terminated. check-in: 8bb2908d01 user: user tags: trunk
Changes

Modified README from [5cdd108762] to [cfa7aa1742].

94
95
96
97
98
99
100



101
102
103
104
105
106
107
108
109
110














111
112
113

114
115
116
117
118




























119
120
121
122
123
124
125
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129

130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170







+
+
+










+
+
+
+
+
+
+
+
+
+
+
+
+
+


-
+





+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







* README: This file. Describes how to find the Fossil repository, the
installation, documentation, discussion/community.

* bindings.doc: Describes the configuration of key/mouse bindings.

* class.doc: This document describes the Free Hero Mesh programming
language. Read this if you want to define your own classes of objects.

* codepage.doc: Describes the use of code pages and the file format of the
codepage.har file.

* commandline.doc: Describes the command-line arguments. The man page
also describes the command-line arguments, although the commandline.doc
file has a more elaborate description.

* config.doc: Describes the configuration options for Free Hero Mesh.

* export.doc: The level export format is described in this file; it can
be used for importing as well as exporting.

* man6/heromesh.6: Man page; includes information about command-line
arguments, environment variables, and link to further documentation.

* man6/heromesh.str: Must be installed in the same directory as the
man6/heromesh.6 file. The distributor should change this to point to
the correct directories where the files are stored; these directories
will be mentioned in the man page

* misc/mbform.doc: Describes the .mb file format for Hero Mesh. (Not
directly relevant to Free Hero Mesh. It contains information that was
used for writing the converter, and may be of interest to some readers
for other purposes, but is neither used nor does it contain anything
that is needed for users or developers of Free Hero Mesh.)

* picedit.doc: Describes the picture editor.

* puzzleset.doc: Describes wat makes up a puzzle set.
* puzzleset.doc: Describes what makes up a puzzle set.

* sql.doc: This file lists and documents each of the SQL functions and SQL
tables that are available. This is not relevant to programming the rules
of the game; it is used for user customization.


=== Other files ===

Free Hero Mesh also includes the following other files, which are not the
source code files, compilation files, or documentation files:

* codepage.har: Contains fonts for code pages. Code page 437 is included
inside of the executable file and does not need this file; this file is
only needed for code pages other than 437.

* default.heromeshrc: An example configuration file which you can customize
for your own use. You should at least set the proper paths to the files.

* mbtofhm.c: Converter from Everett Kaser's MESH engine into Free Hero
Mesh. Give the base name of the output files as the command-line argument,
and receives the .mb file from stdin.

* misc/har.c: A small C program for dealing with Hamster archives. This is
not properly a part of Free Hero Mesh (and is not needed in order to use
or compile Free Hero Mesh), but is included since it is likely to be useful
for some users.

* misc/sokoban.tar.gz: Example puzzle set.

(The files in the misc/ directory are not part of Free Hero Mesh nor are
they needed by Free Hero Mesh, but are provided for convenience. They can
safely be ignored or deleted if you are not using them.)


=== Community/discussion ===

For discussion of Free Hero Mesh, use the NNTP server. This is a newsgroup
in the zzo38computer.org NNTP server, named:

  un2.org.zzo38computer.soft.freeheromesh

Added misc/har.c version [bd2c90d441].


















































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#if 0
gcc -s -O2 -o ~/bin/har -Wno-unused-result har.c
exit
#endif

/*
  Hamster archiver
  Public domain

  c = Create
  d = Delete
  l = Lowercase
  o = Extract to stdout
  r = Rename
  s = Safe
  t = List
  u = Uppercase
  x = Extract
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define fatal(...) do { fprintf(stderr,__VA_ARGS__); putchar('\n'); exit(1); } while(0)

static const char safe[128]={
  [0]=1,
  ['0'...'9']=1,
  ['A'...'Z']=1,
  ['a'...'z']=1,
  ['-']=1,
  ['_']=1,
  ['.']=1,
  ['/']=1,
  ['+']=1,
};

static char opt[128];
static char name[256];
static unsigned long size;
static int argc;
static char**argv;

static void process_lump(int a) {
  int n=0;
  int d=1;
  int c,o;
  FILE*fp;
  FILE*in;
  if(opt['c']) {
    strcpy(name,argv[a]);
    in=fopen(argv[a+opt['r']],"r");
    if(!in) {
      perror(argv[a+opt['r']]);
      fatal("Cannot open file for input");
    }
    if(opt['u']) {
      for(n=0;name[n];n++) if(name[n]>='a' && name[n]<='z') name[n]+='A'-'a';
    } else if(opt['l']) {
      for(n=0;name[n];n++) if(name[n]>='A' && name[n]<='Z') name[n]+='a'-'A';
    }
    fseek(in,0,SEEK_END);
    size=ftell(in);
    fseek(in,0,SEEK_SET);
    o=1;
  } else {
    in=stdin;
    for(;;) {
      c=fgetc(stdin);
      if(c==EOF) exit(0);
      if(opt['u'] && c>='a' && c<='z') c+='A'-'a'; else if(opt['l'] && c>='A' && c<='Z') c+='a'-'A';
      if(opt['s']) {
        if(c=='/') d=1; else if(c && c!='.') d=0;
        if((c&~127) || !safe[c] || (c=='.' && n && name[n-1]=='.') || (c=='/' && d)) c='_';
      }
      name[n++]=c;
      if(!c) break;
      if(n==254) fatal("Name too long: %s",name);
    }
    if(opt['s']) {
      if(!n) name[1]=0,n=1;
      if(d) name[n-1]='_';
    }
    size=fgetc(stdin)<<16;
    size|=fgetc(stdin)<<24;
    size|=fgetc(stdin);
    size|=fgetc(stdin)<<8;
    if(argc<3) {
      o=1;
    } else {
      o=0;
      for(n=2;n<argc;n++) {
        if(!strcmp(name,argv[n])) {
          o=1;
          if(opt['r'] && ++n<argc) strcpy(name,argv[n]);
          break;
        }
        if(opt['r']) n++;
      }
    }
    if(opt['d']) o=!o;
  }
  if(o && opt['t']) {
    puts(name);
    o=0;
  }
  if(o) {
    if(opt['x']) {
      fp=fopen(name,"w");
      if(!fp) {
        perror(name);
        fatal("Cannot open file for output");
      }
    } else {
      fp=stdout;
      if(!opt['o']) {
        fwrite(name,1,strlen(name)+1,stdout);
        putchar(size>>16);
        putchar(size>>24);
        putchar(size);
        putchar(size>>8);
      }
    }
    while(size--) fputc(fgetc(in),fp);
    if(opt['x']) fclose(fp);
  } else {
    while(size--) fgetc(in);
  }
  if(opt['c']) fclose(in);
}

int main(int Argc,char**Argv) {
  char*t;
  int a;
  argc=Argc;
  argv=Argv;
  if(argc>1) for(t=argv[1];*t;) opt[*t++&127]=1;
  if(opt['c']) {
    for(a=2;a<argc;a+=opt['r']+1) process_lump(a);
  } else {
    for(;;) process_lump(0);
  }
  return 0;
}

Name change from fileform1.txt to misc/mbform.doc.