Free Hero Mesh

Check-in [78faa91e26]
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:Fix a problem with the level importing and implement the F record in level importing.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 78faa91e267ab32d319acad9e66f6e1ad14c6eed
User & Date: user on 2022-06-08 04:39:36
Other Links: manifest | tags
Context
2022-06-13
23:08
Split out the code for making a new puzzle set into a separate subroutine, and do not add user cache entries for them until they are loaded the first time. check-in: a36346d28e user: user tags: trunk
2022-06-08
04:39
Fix a problem with the level importing and implement the F record in level importing. check-in: 78faa91e26 user: user tags: trunk
03:41
Display number of solved levels if you push CTRL+K. check-in: e4f3f04743 user: user tags: trunk
Changes

Modified edit.c from [fbb61cd5b6] to [6d33b70e63].

900
901
902
903
904
905
906
907
908
909
910

911
912
913
914
915
916
917
  *y=strtol(p,&p,10);
  if(*p && *p!=' ' && *p!='\t') return 0;
  while(*p==' ' || *p=='\t') p++;
  return p;
}

static char*import_value(char*p,Value*v) {
  int i;
  int n=strcspn(p," \t");
  if(!p) return 0;
  while(*p==' ' || *p=='\t') p++;

  if(*p>='0' && *p<='9') {
    v->t=TY_NUMBER;
    v->u=strtol(p,&p,10)&0xFFFF;
  } else if(*p=='$') {
    v->t=TY_CLASS;
    p++; n--;
    for(i=1;i<0x4000;i++) {







|
<


>







900
901
902
903
904
905
906
907

908
909
910
911
912
913
914
915
916
917
  *y=strtol(p,&p,10);
  if(*p && *p!=' ' && *p!='\t') return 0;
  while(*p==' ' || *p=='\t') p++;
  return p;
}

static char*import_value(char*p,Value*v) {
  int i,n;

  if(!p) return 0;
  while(*p==' ' || *p=='\t') p++;
  n=strcspn(p," \t");
  if(*p>='0' && *p<='9') {
    v->t=TY_NUMBER;
    v->u=strtol(p,&p,10)&0xFFFF;
  } else if(*p=='$') {
    v->t=TY_CLASS;
    p++; n--;
    for(i=1;i<0x4000;i++) {
1074
1075
1076
1077
1078
1079
1080













1081
1082
1083
1084
1085
1086
1087
          screen_message("Duplicate D line");
          goto done;
        }
        d=1;
        annihilate();
        pfwidth=x;
        pfheight=y;













        break;
      case 'V':
        p=import_numbers(p+1,&x,0);
        if(!p || *p) goto bad;
        level_version=x;
        level_changed=0;
        break;







>
>
>
>
>
>
>
>
>
>
>
>
>







1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
          screen_message("Duplicate D line");
          goto done;
        }
        d=1;
        annihilate();
        pfwidth=x;
        pfheight=y;
        break;
      case 'F':
        if(!d) goto missd;
        v.t=0;
        p=import_value(p+1,&v);
        if(v.t!=TY_CLASS) goto bad;
        for(y=1;y<=pfheight;y++) for(x=1;x<=pfwidth;x++) {
          v.t=objalloc(v.u);
          if(v.t==VOIDLINK) goto bad;
          objects[v.t]->x=x;
          objects[v.t]->y=y;
          pflink(v.t);
        }
        break;
      case 'V':
        p=import_numbers(p+1,&x,0);
        if(!p || *p) goto bad;
        level_version=x;
        level_changed=0;
        break;

Modified export.doc from [d7f4429fb6] to [6ff8088996].

32
33
34
35
36
37
38






39
40
41
42
43
44
45
C code
  The level code number, from 0 to 65535.

D width height
  The play field dimensions. The width and height must be 1 to 64. This
  line must come before any objects are listed, and is mandatory.







V version
  This command never occurs in levels exported from Free Hero Mesh,
  although it can optionally occur in imported levels. If it is specified,
  then it sets the level version number.

W
  After all objects in the normal world, use this command to start the







>
>
>
>
>
>







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
C code
  The level code number, from 0 to 65535.

D width height
  The play field dimensions. The width and height must be 1 to 64. This
  line must come before any objects are listed, and is mandatory.

F $class
  This command never occurs in levels exported from Free Hero Mesh,
  although it can optionally occur in imported levels. This command fills
  the entire playfield with the specified class; the image number and
  other parameters are always zero.

V version
  This command never occurs in levels exported from Free Hero Mesh,
  although it can optionally occur in imported levels. If it is specified,
  then it sets the level version number.

W
  After all objects in the normal world, use this command to start the