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 [70a50aa204]:

To Artifact [2484f1b5a0]:


1728
1729
1730
1731
1732
1733
1734










1735
1736
1737
1738












































1739
1740
1741
1742
1743
1744
1745
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744




1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795







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







  if(c.t!=TY_CLASS && (c.t!=TY_NUMBER || c.u)) Throw("Type mismatch");
  return NVALUE(broadcast(from,c.u,msg.u,arg1,arg2,arg3,s));
}

static inline Value v_create(Uint32 from,Value cl,Value x,Value y,Value im,Value d) {
  Uint32 n;
  if(!cl.t && !cl.u) return NVALUE(0);
  if(cl.t!=TY_CLASS || x.t || y.t || im.t || d.t) Throw("Type mismatch");
  n=create(from,cl.u,x.u,y.u,im.u,d.u);
  return OVALUE(n);
}

static inline Value v_replace(Uint32 from,Value cl,Value x,Value y,Value im,Value d) {
  Uint8 c;
  Uint32 n;
  Object*o;
  if(!cl.t && !cl.u) return NVALUE(0);
  if(cl.t!=TY_CLASS || x.t || x.t || y.t || im.t || d.t) Throw("Type mismatch");
  n=create(from,cl.u,x.u,y.u,im.u,d.u);
  return OVALUE(n);
}
  if(x.t || y.t || im.t || d.t) Throw("Type mismatch");
  if(x.u<1 || y.u<1 || x.u>pfwidth || y.u>pfheight) return NVALUE(0);
  if(cl.t==TY_CLASS) {
    if(c=classes[cl.u]->collisionLayers) {
      n=playfield[x.u+y.u*64-65];
      while(n!=VOIDLINK) {
        if(!(objects[n]->oflags&OF_DESTROYED) && (classes[objects[n]->class]->collisionLayers&c)) destroy(VOIDLINK,n,3);
        n=objects[n]->up;
      }
    }
    n=create(from,cl.u,x.u,y.u,im.u,d.u);
    set_bizarro(n,0);
    return OVALUE(n);
  } else if(cl.t>TY_MAXTYPE) {
    o=objects[n=v_object(cl)];
    if(o->oflags&OF_DESTROYED) return NVALUE(0);
    if(o->x==x.u && o->y==y.u && !(o->oflags&OF_BIZARRO)) {
      o->oflags&=~OF_MOVING;
      o->image=im.u;
      o->dir=resolve_dir(n,d.u);
      return cl;
    }
    if(c=classes[o->class]->collisionLayers) {
      n=playfield[x.u+y.u*64-65];
      while(n!=VOIDLINK) {
        if(!(objects[n]->oflags&OF_DESTROYED) && (classes[objects[n]->class]->collisionLayers&c)) destroy(cl.u,n,3);
        n=objects[n]->up;
      }
      n=v_object(cl);
    }
    move_to(from,n,x.u,y.u);
    if(o->x==x.u && o->y==y.u && !(o->oflags&OF_DESTROYED)) {
      o->oflags&=~OF_MOVING;
      o->image=im.u;
      o->dir=resolve_dir(n,d.u);
      set_bizarro(n,0);
      return OVALUE(n);
    } else {
      return NVALUE(0);
    }
  } else {
    Throw("Type mismatch");
  }
}

static int v_for(Uint16*code,int ptr,Value v,Value xv,Value yv) {
  int k=code[ptr];
  Uint32 n;
  if(xv.t || yv.t) Throw("Type mismatch");
  globals[k].t=TY_FOR;
  if(xv.u<1 || xv.u>pfwidth || yv.u<1 || yv.u>pfheight) {
3194
3195
3196
3197
3198
3199
3200


3201
3202
3203
3204
3205
3206
3207
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259







+
+







    case OP_QN: StackReq(1,1); t1=Pop(); NotSound(t1); if(t1.t==TY_NUMBER) Push(NVALUE(1)); else Push(NVALUE(0)); break;
    case OP_QO: StackReq(1,1); t1=Pop(); NotSound(t1); if(t1.t>TY_MAXTYPE) Push(NVALUE(1)); else Push(NVALUE(0)); break;
    case OP_QOZ: StackReq(1,1); t1=Pop(); NotSound(t1); if(t1.t>TY_MAXTYPE || (t1.t==TY_NUMBER && !t1.u)) Push(NVALUE(1)); else Push(NVALUE(0)); break;
    case OP_QS: StackReq(1,1); t1=Pop(); NotSound(t1); if(t1.t==TY_STRING || t1.t==TY_LEVELSTRING) Push(NVALUE(1)); else Push(NVALUE(0)); break;
    case OP_QUEEN: StackReq(0,1); Numeric(msgvars.arg1); i="\x06\x01\x07\x05\x03\x04\x02\x00"[msgvars.arg1.u&7]; Push(NVALUE(i)); break;
    case OP_REL: StackReq(1,1); t1=Pop(); Numeric(t1); i=resolve_dir(obj,t1.u); Push(NVALUE(i)); break;
    case OP_REL_C: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); i=v_object(t1); i=(i==VOIDLINK?t2.u:resolve_dir(i,t2.u)); Push(NVALUE(i)); break;
    case OP_REPLACE: NoIgnore(); StackReq(5,1); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_replace(obj,t1,t2,t3,t4,t5)); break;
    case OP_REPLACE_D: NoIgnore(); StackReq(5,0); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); v_replace(obj,t1,t2,t3,t4,t5); break;
    case OP_RET: return;
    case OP_ROT: StackReq(3,3); t3=Pop(); t2=Pop(); t1=Pop(); Push(t2); Push(t3); Push(t1); break;
    case OP_ROTBACK: StackReq(3,3); t3=Pop(); t2=Pop(); t1=Pop(); Push(t3); Push(t1); Push(t2); break;
    case OP_RSH: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t2.u&~31?0:t1.u>>t2.u)); break;
    case OP_RSH_C: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t2.u&~31?(t1.s<0?-1:0):t1.s>>t2.u)); break;
    case OP_SEEK: StackReq(1,1); t1=Pop(); i=obj_seek(obj,v_object(t1)); Push(NVALUE(i)); break;
    case OP_SEEK_C: StackReq(2,1); t2=Pop(); t1=Pop(); i=obj_seek(v_object(t1),v_object(t2)); Push(NVALUE(i)); break;