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 [b1c3ec4693]:

To Artifact [e91c1e1c82]:


420
421
422
423
424
425
426











427
428
429
430
431
432
433
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444







+
+
+
+
+
+
+
+
+
+
+







  return VOIDLINK;
}

static Uint32 obj_class_at(Uint32 c,Uint32 x,Uint32 y) {
  Uint32 i;
  if(x<1 || x>pfwidth || y<1 || y>pfheight) return VOIDLINK;
  i=playfield[x+y*64-65];
  if(c && (classes[c]->cflags&CF_GROUP)) {
    Uint16 k;
    while(i!=VOIDLINK) {
      if(!(objects[i]->oflags&OF_DESTROYED)) {
        k=objects[i]->class;
        while(k!=c && classes[k]->codes && classes[k]->codes[0]==OP_SUPER) k=classes[k]->codes[1];
      }
      i=objects[i]->up;
    }
    return VOIDLINK;
  }
  while(i!=VOIDLINK) {
    if(objects[i]->class==c && !(objects[i]->oflags&OF_DESTROYED)) return i;
    i=objects[i]->up;
  }
  return VOIDLINK;
}

563
564
565
566
567
568
569





570
571
572
573
574





575
576

577
578
579
580
581
582
583
574
575
576
577
578
579
580
581
582
583
584
585
586

587
588
589
590
591
592
593
594
595

596
597
598
599
600
601
602
603







+
+
+
+
+

-



+
+
+
+
+

-
+








static Uint32 v_is(Value x,Value y) {
  Uint32 n;
  if(x.t==TY_NUMBER && !x.u) {
    return 0;
  } else if(x.t>TY_MAXTYPE && y.t==TY_CLASS) {
    n=v_object(x);
    if(classes[y.u]->cflags&CF_GROUP) {
      n=objects[n]->class;
      while(n!=y.u && classes[n]->codes && classes[n]->codes[0]==OP_SUPER) n=classes[n]->codes[1];
      return (n==y.u)?1:0;
    }
    return (objects[n]->class==y.u)?1:0;
    //TODO: subclassing (using CF_GROUP)
  } else if((x.t>TY_MAXTYPE || x.t==TY_CLASS) && y.t==TY_NUMBER && !y.u) {
    return 1;
  } else if(x.t==TY_CLASS && y.t==TY_CLASS) {
    if(classes[y.u]->cflags&CF_GROUP) {
      n=x.u;
      while(n!=y.u && classes[n]->codes && classes[n]->codes[0]==OP_SUPER) n=classes[n]->codes[1];
      return (n==y.u)?1:0;
    }
    return (x.u==y.u)?1:0;
    //TODO: subclassing (using CF_GROUP)
    //TODO: CF_GROUP
  } else {
    Throw("Type mismatch");
  }
}

static Uint32 v_destroyed(Value v) {
  if(v.t==TY_NUMBER) {
2273
2274
2275
2276
2277
2278
2279


2280
2281
2282
2283
2284
2285
2286
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308







+
+







    case OP_STRENGTH_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->strength=t1.u; break;
    case OP_STRENGTH_E16: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->strength=t1.u&0xFFFF; break;
    case OP_STRENGTH_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->strength=t1.u; break;
    case OP_STRENGTH_EC16: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->strength=t1.u&0xFFFF; break;
    case OP_STRING: StackReq(0,1); Push(UVALUE(code[ptr++],TY_STRING)); break;
    case OP_SOUND: StackReq(2,0); t2=Pop(); t1=Pop(); break; // Sound not implemented at this time
    case OP_SUB: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u-t2.u)); break;
    case OP_SUPER: i=code[1]; code=classes[i]->codes; ptr=get_message_ptr(i,msgvars.msg); if(ptr==0xFFFF) break; break;
    case OP_SUPER_C: i=code[1]; j=get_message_ptr(i,msgvars.msg); if(j!=0xFFFF) execute_program(classes[i]->codes,j,obj); break;
    case OP_SWAP: StackReq(2,2); t1=Pop(); t2=Pop(); Push(t1); Push(t2); break;
    case OP_SYNCHRONIZE: StackReq(2,0); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); animate_sync(obj,t1.u,t2.u); break;
    case OP_TARGET: StackReq(0,1); Push(NVALUE(v_target(obj)?1:0)); break;
    case OP_TARGET_C: StackReq(1,1); i=v_object(Pop()); Push(NVALUE(v_target(i)?1:0)); break;
    case OP_TEMPERATURE: StackReq(0,1); Push(NVALUE(o->temperature)); break;
    case OP_TEMPERATURE_C: StackReq(1,1); Push(GetVariableOrAttributeOf(temperature,NVALUE)); break;
    case OP_TEMPERATURE_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->temperature=t1.u; break;
2395
2396
2397
2398
2399
2400
2401

2402
2403
2404
2405
2406
2407
2408
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431







+







  Uint32 t=0;
  Uint32 n;
  Object*o;
  Value v;
  if(s==2) t=0xFFFFFFFFULL;
  if(lastobj==VOIDLINK) return t;
  n=lastobj;
  if(c && (classes[c]->cflags&CF_GROUP)) Throw("Broadcast for abstract classes is not implemented yet");
  while(o=objects[n]) {
    if(!c || o->class==c) {
      v=send_message(from,n,msg,arg1,arg2,arg3);
      switch(s) {
        case 0:
          t++;
          break;