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

To Artifact [bd3e85a5da]:


1199
1200
1201
1202
1203
1204
1205

1206
1207
1208
1209
1210
1211


1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
  return 1;
}

static int defer_move(Uint32 obj,Uint32 dir,Uint8 plus) {
  Object*o;
  Object*q;
  Uint32 n;

  Value v;
  if(StackProtection()) Throw("Call stack overflow during movement");
  if(obj==VOIDLINK || obj==control_obj) return 0;
  o=objects[obj];
  if(o->oflags&(OF_DESTROYED|OF_BIZARRO)) return 0;
  dir=resolve_dir(obj,dir);


  if(plus) {
    if(o->oflags&OF_MOVING) {
      if(o->dir==dir) return 1;
      v=send_message(VOIDLINK,obj,MSG_CONFLICT,NVALUE(dir),NVALUE(0),NVALUE(0));
      if(!v_bool(v)) return 0;
    }
    o->oflags|=OF_MOVING;
    o->dir=dir;
  } else {
    if(!(o->oflags&OF_MOVING)) return 0;
    if(o->dir!=dir) return 0;
    o->oflags&=~OF_MOVING;
  }
  n=playfield[o->x+o->y*64-65];
  while(n!=VOIDLINK) {
    q=objects[n];
    if(!(q->oflags&(OF_DESTROYED|OF_VISUALONLY)) && ((q->height>0 && q->height>=o->climb) || (classes[q->class]->collisionLayers&classes[o->class]->collisionLayers))) {
      v=send_message(obj,n,MSG_BLOCKED,NVALUE(o->x),NVALUE(o->y),NVALUE(plus));
      if(v.t) Throw("Type mismatch");
      if(v.u&1) o->oflags&=~OF_MOVING;
      if(v.u&2) break;
    }
    n=q->up;
  }







>






>
>













|


|







1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
  return 1;
}

static int defer_move(Uint32 obj,Uint32 dir,Uint8 plus) {
  Object*o;
  Object*q;
  Uint32 n;
  Uint8 x,y;
  Value v;
  if(StackProtection()) Throw("Call stack overflow during movement");
  if(obj==VOIDLINK || obj==control_obj) return 0;
  o=objects[obj];
  if(o->oflags&(OF_DESTROYED|OF_BIZARRO)) return 0;
  dir=resolve_dir(obj,dir);
  x=o->x+x_delta[dir]; y=o->y+y_delta[dir];
  if(x<1 || x>pfwidth || y<1 || y>pfheight) return 0;
  if(plus) {
    if(o->oflags&OF_MOVING) {
      if(o->dir==dir) return 1;
      v=send_message(VOIDLINK,obj,MSG_CONFLICT,NVALUE(dir),NVALUE(0),NVALUE(0));
      if(!v_bool(v)) return 0;
    }
    o->oflags|=OF_MOVING;
    o->dir=dir;
  } else {
    if(!(o->oflags&OF_MOVING)) return 0;
    if(o->dir!=dir) return 0;
    o->oflags&=~OF_MOVING;
  }
  n=playfield[x+y*64-65];
  while(n!=VOIDLINK) {
    q=objects[n];
    if(!(q->oflags&(OF_DESTROYED|OF_VISUALONLY|OF_MOVING)) && ((q->height>0 && q->height>=o->climb) || (classes[q->class]->collisionLayers&classes[o->class]->collisionLayers))) {
      v=send_message(obj,n,MSG_BLOCKED,NVALUE(o->x),NVALUE(o->y),NVALUE(plus));
      if(v.t) Throw("Type mismatch");
      if(v.u&1) o->oflags&=~OF_MOVING;
      if(v.u&2) break;
    }
    n=q->up;
  }
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
        if(o->height>oE->climb || oE->height>o->climb || (classes[o->class]->collisionLayers&classes[oE->class]->collisionLayers)) {
          h&=handle_colliding(obj,objE,2,2);
        }
      }
      objE=oE->up;
    }
  }
  return ~h;
}

static void do_deferred_moves(void) {
  Object*o;
  Object*p;
  Uint32 h,n;
  int i,x,y;







|







3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
        if(o->height>oE->climb || oE->height>o->climb || (classes[o->class]->collisionLayers&classes[oE->class]->collisionLayers)) {
          h&=handle_colliding(obj,objE,2,2);
        }
      }
      objE=oE->up;
    }
  }
  return h;
}

static void do_deferred_moves(void) {
  Object*o;
  Object*p;
  Uint32 h,n;
  int i,x,y;
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
        if((h&1) && (o->oflags&OF_MOVING) && move_to(VOIDLINK,n,x,y)) {
          re=1;
          o->oflags=(o->oflags|OF_MOVED)&~OF_MOVING;
          i-=65;
          if(i<0) i=0;
          goto retry;
        }
        stop:
        if((h&5)!=4) o->oflags&=~OF_MOVING;
      }
      skip:
      n=o->up;
    }
  }
  if(re) goto restart;
}







<
|







3080
3081
3082
3083
3084
3085
3086

3087
3088
3089
3090
3091
3092
3093
3094
        if((h&1) && (o->oflags&OF_MOVING) && move_to(VOIDLINK,n,x,y)) {
          re=1;
          o->oflags=(o->oflags|OF_MOVED)&~OF_MOVING;
          i-=65;
          if(i<0) i=0;
          goto retry;
        }

        if((h&5)!=4) stop: o->oflags&=~OF_MOVING;
      }
      skip:
      n=o->up;
    }
  }
  if(re) goto restart;
}