Free Hero Mesh

Check-in [0ced76ece7]
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:Use 23-bit code page numbers.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0ced76ece74a40767f1414cd7e9eac1604f484f5
User & Date: user on 2022-01-12 02:28:26
Other Links: manifest | tags
Context
2022-01-13
06:48
Implement cryptographic hash algorithms. (These are not currently used by Free Hero Mesh but is expected to be used in future.) check-in: 1293433867 user: user tags: trunk
2022-01-12
02:28
Use 23-bit code page numbers. check-in: 0ced76ece7 user: user tags: trunk
2022-01-08
06:06
Flush output in SQL command line mode. check-in: 70ae21443d user: user tags: trunk
Changes

Modified class.c from [7243e8c48b] to [cfa005344c].

2551
2552
2553
2554
2555
2556
2557
2558

2559
2560
2561
2562
2563
2564
2565
2551
2552
2553
2554
2555
2556
2557

2558
2559
2560
2561
2562
2563
2564
2565







-
+







        case OP_MISC4: define_user_flags(0x1000,0x101F); break;
        case OP_MISC5: define_user_flags(0x1020,0x103F); break;
        case OP_MISC6: define_user_flags(0x1040,0x105F); break;
        case OP_MISC7: define_user_flags(0x1060,0x107F); break;
        case OP_COLLISIONLAYERS: define_user_flags(0x1080,0x1087); break;
        case OP_CODEPAGE:
          nxttok();
          if(tokent!=TF_INT || tokenv<1 || tokenv>65535) ParseError("Number from 1 to 65535 expected\n");
          if(tokent!=TF_INT || tokenv<1 || tokenv>0x7FFFFF) ParseError("Number from 1 to 8388607 expected\n");
          set_code_page(tokenv);
          nxttok();
          if(tokent!=TF_CLOSE) ParseError("Expected close parenthesis\n");
          break;
        case OP_ORDER:
          if(norders) ParseError("Extra (Order) block\n");
          parse_order_block();

Modified class.doc from [19bc4a72c6] to [d18040badb].

264
265
266
267
268
269
270
271

272
273
274
275
276
277
278
264
265
266
267
268
269
270

271
272
273
274
275
276
277
278







-
+








(Background <number> [<number>])
  Set the background colour, from 0 to 255. The default value is 1. You
  can optionally specify a second number, which is the background colour
  for the inventory; if not specified, uses the same colour for both.

(CodePage <number>)
  Define the code page, from 1 to 65535. If not specified, then the
  Define the code page, from 1 to 8388607. If not specified, then the
  default code page is used.

(Control <definitions...>)
  Define the control class. The format is the same like other class
  definitions, except that Image and Abstract are not allowed. An
  object of this class is automatically created when initializing the
  level, at X and Y coordinates both zero, and cannot otherwise be

Modified codepage.doc from [1ddaf3a23f] to [9ad890221b].

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
1
2
3
4
5


6
7



8

9









10







11
12
13
14
15
16
17





-
-
+
+
-
-
-

-
+
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-








=== Code page numbers ===

Code page numbers are assigned according to the following:

* Code page numbers are 16-bit numbers. Numbers 0, 65534, and 65535 are
not used; they are reserved for internal use of the software. (TODO:
* Code page numbers are 23-bit numbers. Numbers 0, 65534, and 65535 are
not used; they are reserved for internal use of the software.
Maybe this should be changed to 23-bit code page numbers that I will
maintain a list of. The below will still apply for code page numbers
that fit in 16-bits, though.)

* Mainly, IBM code page numbers are used.
* Mainly, IBM code page numbers are used. (Note, these are not all the

* If there is something from Microsoft or FreeDOS that does not already
have a IBM code page number and does not conflict with IBM assignments,
then they may also be used.

* If a Microsoft code page extends a IBM code page and is otherwise 100%
backward compatible with it, and ahs the same number as the corresponding
IBM code page, then the extensions added by Microsoft will also apply to
that code page (only).
same as Microsoft code page numbers.)

Note that not all of the code page numbers according to the above are
actually used in Free Hero Mesh; Free Hero Mesh only uses ASCII-based
code pages with 8-bit characters (although the implementation may be
improved in future to allow multibyte code pages, but currently it
doesn't). The full set of code page numbers may still be useful for
other applications, though.

(Even if multibyte code pages are implemented in future (as well as the
possibility of different font sizes than 8x8, and for narrow/wide
characters), Shift-JIS is not suitable for Free Hero Mesh, because Free
Hero Mesh uses a backslash for string escaping and a multibyte character
in Shift-JIS can contain the ASCII code for a backslash. However, EUC-JP
may be suitable.)

Modified heromesh.h from [641a517ed3] to [0675ee5ddc].

94
95
96
97
98
99
100

101
102
103
104
105

106
107
108
109
110
111
112
94
95
96
97
98
99
100
101
102
103
104
105

106
107
108
109
110
111
112
113







+




-
+







#define read_userstate(a,b,c) read_lump_or_userstate(a,b,c,1)

// == picture ==

extern SDL_Surface*screen;
extern Uint16 picture_size;
extern int left_margin;
extern Uint32 codepage;

void init_palette(void);
void init_screen(void);
void load_pictures(void);
void set_code_page(Uint16 n);
void set_code_page(Uint32 n);

// Use only when screen is unlocked
void draw_picture(int x,int y,Uint16 img);
void draw_cell(int x,int y);

// Use only when screen is locked
void draw_text(int x,int y,const unsigned char*t,int bg,int fg);

Modified picture.c from [74bc65b7f7] to [f61adccb5b].

20
21
22
23
24
25
26

27
28
29
30
31
32
33
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34







+







#include "heromesh.h"
#include "cursorshapes.h"
#include "keyicons.xbm"

SDL_Surface*screen;
Uint16 picture_size;
int left_margin;
Uint32 codepage;

static SDL_Surface*picts;
static Uint8*curpic;
static const unsigned char*fontdata;

static const char default_palette[]=
  "C020FF "
813
814
815
816
817
818
819
820

821
822
823
824
825
826
827
814
815
816
817
818
819
820

821
822
823
824
825
826
827
828







-
+







    SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,SDL_DEFAULT_REPEAT_INTERVAL);
  }
  SDL_EnableUNICODE(1);
  optionquery[1]=Q_margin;
  left_margin=strtol(xrm_get_resource(resourcedb,optionquery,optionquery,2)?:"65",0,10);
}

void set_code_page(Uint16 n) {
void set_code_page(Uint32 n) {
  int c,i,j,s;
  const char*v;
  unsigned char*d;
  Uint8 b[32];
  FILE*fp;
  if(!n) return;
  if(n==367) n=437;
849
850
851
852
853
854
855
856

857
858
859
860
861
862
863
850
851
852
853
854
855
856

857
858
859
860
861
862
863
864







-
+







      goto done;
    }
    if(!c) break;
    if(!s) {
      if(c<'0' || c>'9') s=1;
      else if(c=='0' && !i) s=1;
      else i=10*i+c-'0';
      if(i>65535) s=1;
      if(i>0x7FFFFF) s=1;
    }
  }
  if(s || i!=n) goto skip;
  i=fgetc(fp)<<16;
  i|=fgetc(fp)<<24;
  i|=fgetc(fp)<<0;
  i|=fgetc(fp)<<8;
885
886
887
888
889
890
891

892
893
894
895
896
897
898
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900







+







  i=fgetc(fp)<<16;
  i|=fgetc(fp)<<24;
  i|=fgetc(fp)<<0;
  i|=fgetc(fp)<<8;
  fseek(fp,i,SEEK_CUR);
  goto name;
  done:
  codepage=n;
  fclose(fp);
}

// Widgets

static void draw_scrollbar(int*cur,int page,int max,int x0,int y0,int x1,int y1) {
  Uint8*pix=screen->pixels;