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];
|