Free Hero Mesh

Check-in [d05fed08fd]
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:When checking for CollisionLayers during connection movement, ignore objects that are also moving at the same time.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d05fed08fd35bc9da53c2af6c0e8228f44f8ca6f
User & Date: user on 2022-02-11 22:34:43
Other Links: manifest | tags
Context
2022-02-12
00:59
Fix connection moving so that HIT/HITBY during the second phase are sorted and that even if one fails, it will try all of them in order that shoving etc will be all or nothing. check-in: 28294a20b2 user: user tags: trunk
2022-02-11
22:34
When checking for CollisionLayers during connection movement, ignore objects that are also moving at the same time. check-in: d05fed08fd user: user tags: trunk
21:25
Implement the connection movement. check-in: 7f3f255b14 user: user tags: trunk
Changes

Modified exec.c from [05cf8f416c] to [6af053ca03].

486
487
488
489
490
491
492











493
494
495
496
497
498
499
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510







+
+
+
+
+
+
+
+
+
+
+







  i=playfield[x+y*64-65];
  while(i!=VOIDLINK) {
    if(!(objects[i]->oflags&OF_DESTROYED) && (classes[objects[i]->class]->collisionLayers&b)) return i;
    i=objects[i]->up;
  }
  return VOIDLINK;
}

static int connection_collision(Uint8 b,Uint32 x,Uint32 y) {
  Uint32 i;
  if(x<1 || x>pfwidth || y<1 || y>pfheight) return 1;
  i=playfield[x+y*64-65];
  while(i!=VOIDLINK) {
    if(!(objects[i]->oflags&OF_DESTROYED) && (classes[objects[i]->class]->collisionLayers&b)) return !!((OF_CONNECTION|OF_MOVING)&~objects[i]->oflags);
    i=objects[i]->up;
  }
  return 0;
}

static Uint32 obj_top_at(Uint32 x,Uint32 y) {
  Uint32 i,r;
  if(x<1 || x>pfwidth || y<1 || y>pfheight) return VOIDLINK;
  i=playfield[x+y*64-65];
  r=VOIDLINK;
  while(i!=VOIDLINK) {
994
995
996
997
998
999
1000
1001

1002
1003
1004
1005
1006
1007
1008
1005
1006
1007
1008
1009
1010
1011

1012
1013
1014
1015
1016
1017
1018
1019







-
+







  if(objF==VOIDLINK) goto fail;
  if(hit) hit=0x800|(hit&0x10000000);
  oF=objects[objF];
  objLF=obj_dir(obj,(dir+1)&7);
  objRF=obj_dir(obj,(dir-1)&7);
  if(height_at(oF->x,oF->y)<=o->climb) hit|=0x200000;
  if(no) {
    if((vol=classes[oF->class]->collisionLayers) && obj_layer_at(vol,oF->x,oF->y)!=VOIDLINK) goto fail;
    if((vol=classes[oF->class]->collisionLayers) && connection_collision(vol,oF->x,oF->y)) goto fail;
    hit|=0x4066;
  }
  if(dir&1) {
    // Diagonal movement
    hit|=0x80000;
    vol=o->volume;
    if(objLF!=VOIDLINK) vol+=volume_at(objects[objLF]->x,objects[objLF]->y);
1196
1197
1198
1199
1200
1201
1202
1203

1204
1205
1206
1207
1208
1209
1210
1207
1208
1209
1210
1211
1212
1213

1214
1215
1216
1217
1218
1219
1220
1221







-
+







      n=lastobj;
      while(n!=VOIDLINK) {
        if(v_bool(send_message(conn[i].obj,n,MSG_PLAYERMOVING,NVALUE(o->x+x_delta[dir]),NVALUE(o->y+y_delta[dir]),NVALUE(0)))) goto fail;
        n=objects[n]->prev;
      }
    }
    if(j=classes[o->class]->collisionLayers) {
      if(obj_layer_at(j,o->x+x_delta[dir],o->y+y_delta[dir])!=VOIDLINK) goto fail;
      if(connection_collision(j,o->x+x_delta[dir],o->y+y_delta[dir])) goto fail;
    }
  }
  // Move everything in the group
  conn_dir=dir;
  qsort(conn+first,last-first,sizeof(Connection),compare_connection);
  for(i=first;i<last;i++) {
    o=objects[n=conn[i].obj];