Free Hero Mesh

Check-in [d81bafda40]
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:Change the code that sends MSG_CREATED and MSG_DESTROYED according to my testing of how Hero Mesh is working
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d81bafda40949b49a9fe2ca8fe740162047a7e01
User & Date: user on 2021-01-06 01:14:02
Other Links: manifest | tags
Context
2021-01-06
07:31
Add instructions for checking types of values check-in: ef4096f816 user: user tags: trunk
01:14
Change the code that sends MSG_CREATED and MSG_DESTROYED according to my testing of how Hero Mesh is working check-in: d81bafda40 user: user tags: trunk
2021-01-05
19:20
Write more in class.doc check-in: 01f32e4d01 user: user tags: trunk
Changes

Modified exec.c from [d29672c800] to [101a0036ee].

601
602
603
604
605
606
607
608
609
610

611
612
613
614
615
616
617
618
619
620
621
  o->x=x;
  o->y=y;
  o->image=im;
  o->dir=d;
  pflink(n);
  v=send_message(from,n,MSG_CREATE,NVALUE(0),NVALUE(0),NVALUE(0));
  if(o->oflags&OF_DESTROYED) return VOIDLINK;
  for(i=25;i>=0;i--) {
    xx=x+Xbit(i); yy=y+Ybit(i);
    if(xx<1 || xx>pfwidth || yy<1 || yy>pfheight) continue;

    m=playfield[xx+yy*64-65];
    while(m!=VOIDLINK) {
      p=objects[m];
      if(p->arrivals&(1<<i)) if(m!=n) send_message(n,m,MSG_CREATED,NVALUE(x),NVALUE(y),v);
      m=p->up;
    }
  }
  if(o->oflags&OF_DESTROYED) return VOIDLINK;
  m=objects[n]->up;
  if(m!=VOIDLINK) {
    v=send_message(VOIDLINK,n,MSG_SUNK,NVALUE(0),NVALUE(0),v);







|
|

>



|







601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
  o->x=x;
  o->y=y;
  o->image=im;
  o->dir=d;
  pflink(n);
  v=send_message(from,n,MSG_CREATE,NVALUE(0),NVALUE(0),NVALUE(0));
  if(o->oflags&OF_DESTROYED) return VOIDLINK;
  for(y=0;y<5;y++) for(x=0;x<5;x++) {
    xx=o->x+x-2; yy=o->y+y-2;
    if(xx<1 || xx>pfwidth || yy<1 || yy>pfheight) continue;
    i=4-x+5*y;
    m=playfield[xx+yy*64-65];
    while(m!=VOIDLINK) {
      p=objects[m];
      if(p->arrivals&(1<<i)) if(m!=n) send_message(n,m,MSG_CREATED,NVALUE(o->x),NVALUE(o->y),v);
      m=p->up;
    }
  }
  if(o->oflags&OF_DESTROYED) return VOIDLINK;
  m=objects[n]->up;
  if(m!=VOIDLINK) {
    v=send_message(VOIDLINK,n,MSG_SUNK,NVALUE(0),NVALUE(0),v);
644
645
646
647
648
649
650

651
652
653
654

655
656
657
658
659
660
661
      if(o->prev!=VOIDLINK) objects[o->prev]->next=o->next;
      if(o->next!=VOIDLINK) objects[o->next]->prev=o->prev;
      // This object is not itself removed from the linked list, since it may be destroyed while enumerating all objects
    }
    o->oflags|=OF_DESTROYED;
    if(why!=8 && !(o->oflags&OF_VISUALONLY)) {
      // Not checking for stealth; stealth only applies to movement, not destruction

      xx=o->x; yy=o->y;
      for(i=25;i>=0;i--) {
        x=xx+Xbit(i); y=yy+Ybit(i);
        if(x<1 || x>pfwidth || y<1 || y>pfheight) continue;

        n=playfield[x+y*64-65];
        while(n!=VOIDLINK) {
          o=objects[n];
          if(o->departures&(1<<i)) send_message(to,n,MSG_DESTROYED,NVALUE(0),NVALUE(0),NVALUE(why));
          n=o->up;
        }
      }







>
|
<
<

>







645
646
647
648
649
650
651
652
653


654
655
656
657
658
659
660
661
662
      if(o->prev!=VOIDLINK) objects[o->prev]->next=o->next;
      if(o->next!=VOIDLINK) objects[o->next]->prev=o->prev;
      // This object is not itself removed from the linked list, since it may be destroyed while enumerating all objects
    }
    o->oflags|=OF_DESTROYED;
    if(why!=8 && !(o->oflags&OF_VISUALONLY)) {
      // Not checking for stealth; stealth only applies to movement, not destruction
      for(yy=0;yy<5;yy++) for(xx=0;xx<5;xx++) {
        x=o->x+xx-2; y=o->y+yy-2;


        if(x<1 || x>pfwidth || y<1 || y>pfheight) continue;
        i=4-xx+5*yy;
        n=playfield[x+y*64-65];
        while(n!=VOIDLINK) {
          o=objects[n];
          if(o->departures&(1<<i)) send_message(to,n,MSG_DESTROYED,NVALUE(0),NVALUE(0),NVALUE(why));
          n=o->up;
        }
      }