Free Hero Mesh

Check-in [040a277835]
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:Add checks for OF_DESTROYED and OF_VISUALONLY flags of an object that is trying to move, at the necessary times
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 040a2778355a0aefc78dba1087216a16f6d7f41f
User & Date: user on 2020-12-20 07:39:26
Other Links: manifest | tags
Context
2020-12-20
08:28
Implement inventory; also correct a mistake in create() check-in: e22341996b user: user tags: trunk
07:39
Add checks for OF_DESTROYED and OF_VISUALONLY flags of an object that is trying to move, at the necessary times check-in: 040a277835 user: user tags: trunk
01:22
Cause visual animations of an object to reset the first time each turn that object sets a logical animation check-in: f263eed6d9 user: user tags: trunk
Changes

Modified exec.c from [3b5e9774eb] to [686cc38d0d].

706
707
708
709
710
711
712

713
714
715
716
717
718
719
    objRF=obj_dir(obj,(dir-1)&7);
    vol=o->volume;
    if(objLF!=VOIDLINK) vol+=volume_at(objects[objLF]->x,objects[objLF]->y);
    if(objRF!=VOIDLINK) vol+=volume_at(objects[objRF]->x,objects[objRF]->y);
    if(vol<=max_volume) {
      objE=objF;
      while(objE!=VOIDLINK) {

        oE=objects[objE];
        if(oE->height>0) {
          v=send_message(objE,obj,MSG_HIT,NVALUE(oE->x),NVALUE(oE->y),NVALUE(hit|0x80000));
          if(v.t) Throw("Type mismatch in HIT/HITBY");
          hit=v.u&(classes[o->class]->cflags&CF_COMPATIBLE?0xFC098F7F:-1);
          if(hit&8) goto fail;
          if(!(hit&0x11)) {







>







706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
    objRF=obj_dir(obj,(dir-1)&7);
    vol=o->volume;
    if(objLF!=VOIDLINK) vol+=volume_at(objects[objLF]->x,objects[objLF]->y);
    if(objRF!=VOIDLINK) vol+=volume_at(objects[objRF]->x,objects[objRF]->y);
    if(vol<=max_volume) {
      objE=objF;
      while(objE!=VOIDLINK) {
        if(o->oflags&(OF_DESTROYED|OF_VISUALONLY)) break;
        oE=objects[objE];
        if(oE->height>0) {
          v=send_message(objE,obj,MSG_HIT,NVALUE(oE->x),NVALUE(oE->y),NVALUE(hit|0x80000));
          if(v.t) Throw("Type mismatch in HIT/HITBY");
          hit=v.u&(classes[o->class]->cflags&CF_COMPATIBLE?0xFC098F7F:-1);
          if(hit&8) goto fail;
          if(!(hit&0x11)) {
730
731
732
733
734
735
736

737
738
739
740
741
742
743
744
745
746

747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763

764
765
766
767
768
769
770
          if(hit&0x20000) goto success;
          if(!oF) goto fail;
          if(move_to(from,obj,oF->x,oF->y)) goto success; else goto fail;
        }
      }
    } else {
      // Volume is too much; hit the objects it won't go between

      objE=objLF;
      while(objE!=VOIDLINK) {
        oE=objects[objE];
        if(oE->height>0) {
          v=send_message(objE,obj,MSG_HIT,NVALUE(oE->x),NVALUE(oE->y),NVALUE(0x80008));
          if(v.t) Throw("Type mismatch in HIT/HITBY");
          if(!(v.u&1)) v=send_message(obj,objE,MSG_HITBY,NVALUE(o->x),NVALUE(o->y),NVALUE(v.u|0x80008));
        }
        objE=obj_below(objE);
      }

      objE=objRF;
      while(objE!=VOIDLINK) {
        oE=objects[objE];
        if(oE->height>0) {
          v=send_message(objE,obj,MSG_HIT,NVALUE(oE->x),NVALUE(oE->y),NVALUE(0x80008));
          if(v.t) Throw("Type mismatch in HIT/HITBY");
          if(!(v.u&1)) v=send_message(obj,objE,MSG_HITBY,NVALUE(o->x),NVALUE(o->y),NVALUE(v.u|0x80008));
        }
        objE=obj_below(objE);
      }
    }
  } else {
    // Orthogonal movement
    if(hit) hit=(hit&0x0C000000)|0x800;
    if(!oF) goto fail;
    objE=objF;
    while(objE!=VOIDLINK) {

      oE=objects[objE];
      if(oE->height>0) {
        hit&=~7;
        // HIT/HITBY messages
        v=send_message(objE,obj,MSG_HIT,NVALUE(oE->x),NVALUE(oE->y),NVALUE(hit));
        if(v.t) Throw("Type mismatch in HIT/HITBY");
        hit|=v.u&(classes[o->class]->cflags&CF_COMPATIBLE?0xFC098F7F:-1);







>










>

















>







731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
          if(hit&0x20000) goto success;
          if(!oF) goto fail;
          if(move_to(from,obj,oF->x,oF->y)) goto success; else goto fail;
        }
      }
    } else {
      // Volume is too much; hit the objects it won't go between
      if(o->oflags&(OF_DESTROYED|OF_VISUALONLY)) goto fail;
      objE=objLF;
      while(objE!=VOIDLINK) {
        oE=objects[objE];
        if(oE->height>0) {
          v=send_message(objE,obj,MSG_HIT,NVALUE(oE->x),NVALUE(oE->y),NVALUE(0x80008));
          if(v.t) Throw("Type mismatch in HIT/HITBY");
          if(!(v.u&1)) v=send_message(obj,objE,MSG_HITBY,NVALUE(o->x),NVALUE(o->y),NVALUE(v.u|0x80008));
        }
        objE=obj_below(objE);
      }
      if(o->oflags&(OF_DESTROYED|OF_VISUALONLY)) goto fail;
      objE=objRF;
      while(objE!=VOIDLINK) {
        oE=objects[objE];
        if(oE->height>0) {
          v=send_message(objE,obj,MSG_HIT,NVALUE(oE->x),NVALUE(oE->y),NVALUE(0x80008));
          if(v.t) Throw("Type mismatch in HIT/HITBY");
          if(!(v.u&1)) v=send_message(obj,objE,MSG_HITBY,NVALUE(o->x),NVALUE(o->y),NVALUE(v.u|0x80008));
        }
        objE=obj_below(objE);
      }
    }
  } else {
    // Orthogonal movement
    if(hit) hit=(hit&0x0C000000)|0x800;
    if(!oF) goto fail;
    objE=objF;
    while(objE!=VOIDLINK) {
      if(o->oflags&(OF_DESTROYED|OF_VISUALONLY)) break;
      oE=objects[objE];
      if(oE->height>0) {
        hit&=~7;
        // HIT/HITBY messages
        v=send_message(objE,obj,MSG_HIT,NVALUE(oE->x),NVALUE(oE->y),NVALUE(hit));
        if(v.t) Throw("Type mismatch in HIT/HITBY");
        hit|=v.u&(classes[o->class]->cflags&CF_COMPATIBLE?0xFC098F7F:-1);