Free Hero Mesh

Diff
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.

Differences From Artifact [8147a9749f]:

To Artifact [17e9f0f3a2]:


1947
1948
1949
1950
1951
1952
1953












1954
1955
1956
1957
1958
1959
1960
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972







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







  cl->collisionLayers|=su->collisionLayers;
  if(cl->nmsg=su->nmsg) {
    cl->messages=malloc(cl->nmsg*sizeof(Uint16));
    if(!cl->messages) fatal("Allocation failed\n");
    for(i=0;i<cl->nmsg;i++) cl->messages[i]=(su->messages[i]==0xFFFF)?0xFFFF:0x0000;
  }
}

static int make_dispatch_block(int cla,Class*cl,int ptr) {
  int i;
  cl->codes=realloc(cl->codes,0x10000*sizeof(Uint16));
  if(!cl->codes) fatal("Allocation failed\n");
  if(get_message_ptr(cla,MSG_KEY)!=0xFFFF) ParseError("Class $%s has a KEY message already\n",cl->name);
  if(ptr>0xFDFE) ParseError("Out of code space\n");
  set_message_ptr(cla,MSG_KEY,ptr);
  cl->codes[ptr]=OP_DISPATCH;
  for(i=1;i<257;i++) cl->codes[ptr+i]=0;
  return ptr+257;
}

static void class_definition(int cla,sqlite3_stmt*vst) {
  Hash*hash=calloc(LOCAL_HASH_SIZE,sizeof(Hash));
  Class*cl=classes[cla];
  int ptr=0;
  int compat=0;
  int i;
1972
1973
1974
1975
1976
1977
1978
1979

1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1984
1985
1986
1987
1988
1989
1990

1991










1992
1993
1994
1995
1996
1997
1998







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







    if(Tokenf(TF_EOF)) {
      ParseError("Unexpected end of file\n");
    } else if(Tokenf(TF_MACRO)) {
      ParseError("Unexpected macro token\n");
    } else if(Tokenf(TF_OPEN)) {
      nxttok();
      if(Tokenf(TF_KEY)) {
        if(!disp) {
        if(!disp) disp=1,ptr=make_dispatch_block(cla,cl,ptr);
          cl->codes=realloc(cl->codes,0x10000*sizeof(Uint16));
          if(!cl->codes) fatal("Allocation failed\n");
          if(get_message_ptr(cla,MSG_KEY)!=0xFFFF) ParseError("Class $%s has a KEY message already\n",cl->name);
          if(ptr>0xFDFE) ParseError("Out of code space\n");
          disp=1;
          set_message_ptr(cla,MSG_KEY,ptr);
          cl->codes[ptr]=OP_DISPATCH;
          for(i=1;i<257;i++) cl->codes[ptr+i]=0;
          ptr+=257;
        }
        i=tokenv&255;
        cl->codes[cl->messages[MSG_KEY]+i]=ptr;
        if(cl->cflags&CF_INPUT) {
          nxttok();
          if(tokent!=TF_NAME || tokenv!=OP_IGNOREKEY) keymask[i>>3]|=1<<(i&7);
          pushback=1;
        }
2070
2071
2072
2073
2074
2075
2076
2077

2078
2079
2080
2081






























2082
2083
2084
2085
2086
2087
2088
2072
2073
2074
2075
2076
2077
2078

2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120







-
+




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







            ptr=parse_instructions(cla,ptr,hash,compat);
            break;
          case OP_COLLISIONLAYERS:
            cl->collisionLayers=i=class_def_misc();
            if(i&~255) ParseError("CollisionLayers out of range\n");
            break;
          case OP_OTHERS:
            if(!disp) ParseError("Others block without key dispatch block\n");
            if(!disp) disp=1,ptr=make_dispatch_block(cla,cl,ptr);
            if(!(cl->cflags&CF_INPUT)) ParseError("Others block without Input flag\n");
            cl->codes[cl->messages[MSG_KEY]+256]=ptr;
            ptr=parse_instructions(cla,ptr,hash,compat);
            break;
          case OP_ROOK:
            if(!disp) disp=1,ptr=make_dispatch_block(cla,cl,ptr);
            if(ptr>=0xFFED) ParseError("Out of code space\n");
            for(i=37;i<=40;i++) {
              cl->codes[cl->messages[MSG_KEY]+i]=ptr;
              if(cl->cflags&CF_INPUT) keymask[i>>3]|=1<<(i&7);
            }
            cl->codes[ptr++]=OP_QUEEN;
            ptr=parse_instructions(cla,ptr,hash,compat);
            break;
          case OP_BISHOP:
            if(!disp) disp=1,ptr=make_dispatch_block(cla,cl,ptr);
            if(ptr>=0xFFED) ParseError("Out of code space\n");
            for(i=33;i<=36;i++) {
              cl->codes[cl->messages[MSG_KEY]+i]=ptr;
              if(cl->cflags&CF_INPUT) keymask[i>>3]|=1<<(i&7);
            }
            cl->codes[ptr++]=OP_QUEEN;
            ptr=parse_instructions(cla,ptr,hash,compat);
            break;
          case OP_QUEEN:
            if(!disp) disp=1,ptr=make_dispatch_block(cla,cl,ptr);
            if(ptr>=0xFFED) ParseError("Out of code space\n");
            for(i=33;i<=40;i++) {
              cl->codes[cl->messages[MSG_KEY]+i]=ptr;
              if(cl->cflags&CF_INPUT) keymask[i>>3]|=1<<(i&7);
            }
            cl->codes[ptr++]=OP_QUEEN;
            ptr=parse_instructions(cla,ptr,hash,compat);
            break;
          case 0x0200 ... 0x02FF:
            set_message_ptr(cla,tokenv&255,ptr);
            ptr=parse_instructions(cla,ptr,hash,compat);
            break;
          case 0xC000 ... 0xFFFF:
            set_message_ptr(cla,tokenv+256-0xC000,ptr);
            ptr=parse_instructions(cla,ptr,hash,compat);