Free Hero Mesh

Check-in [57d6d9a4f7]
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:Implement diagonal shoving.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 57d6d9a4f724ce42d8e8aabaa7184691d9d34a48
User & Date: user on 2021-04-02 19:32:39
Other Links: manifest | tags
Context
2021-04-02
23:39
Some improvements to documentation check-in: 536bbdfe8a user: user tags: trunk
19:32
Implement diagonal shoving. check-in: 57d6d9a4f7 user: user tags: trunk
07:08
Begin to implement sounds; it is currently unused and is not fully implemented, nor tested yet. check-in: c144d8069c user: user tags: trunk
Changes

Modified class.c from [8c2ce69ad5] to [42fb9875e1].

1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
    n=tokenv;
    nxttok();
    if(tokent!=TF_CLOSE) ParseError("Close parentheses expected\n");
    return n;
  }
  for(;;) {
    if(tokent==TF_CLOSE) return n;
    if(!Tokenf(TF_DIR) || tokenv>7 || (tokenv&1)) ParseError("Expected even absolute direction\n");
    n|=1<<tokenv;
    nxttok();
  }
}

static inline Uint8 class_def_shape(void) {
  Uint8 n=0;







|







1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
    n=tokenv;
    nxttok();
    if(tokent!=TF_CLOSE) ParseError("Close parentheses expected\n");
    return n;
  }
  for(;;) {
    if(tokent==TF_CLOSE) return n;
    if(!Tokenf(TF_DIR) || tokenv>7) ParseError("Expected absolute direction\n");
    n|=1<<tokenv;
    nxttok();
  }
}

static inline Uint8 class_def_shape(void) {
  Uint8 n=0;

Modified class.doc from [e05ea8d8f3] to [3525425cc1].

394
395
396
397
398
399
400
401
402
403
404
405
406
407
408

Shovable
  Set the Shovable variable for this class to 0x55 (meaning it is shovable
  in all four directions).

(Shovable <dir...>)
  Set this object to be shovable in the specified directions, which can be
  E, N, W, or S (diagonals are not allowed).

(Shovable <number>)
  Set the Shovable variable to the specified 8-bit number. (You cannot set
  the initial value of any other bits; they are always clear.)

Stealthy
  Set the Stealthy flag for this class.







|







394
395
396
397
398
399
400
401
402
403
404
405
406
407
408

Shovable
  Set the Shovable variable for this class to 0x55 (meaning it is shovable
  in all four directions).

(Shovable <dir...>)
  Set this object to be shovable in the specified directions, which can be
  any absolute direction.

(Shovable <number>)
  Set the Shovable variable to the specified 8-bit number. (You cannot set
  the initial value of any other bits; they are always clear.)

Stealthy
  Set the Stealthy flag for this class.
1833
1834
1835
1836
1837
1838
1839
1840

1841
1842
1843
1844
1845
1846
1847
=== Hit values ===

This section describes the bits of the return value of the HIT and HITBY
messages; these values are also used as the Arg3 of those messages.

Some descriptions below are marked with an asterisk. If the Compatible
flag is set for the object that returned this value, then all bits with
the asterisk in the below descriptions are masked out.


bit0
  Do not send the HITBY message to the target object.

bit1
  Do not destroy either object due to hardness/sharpness.








|
>







1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
=== Hit values ===

This section describes the bits of the return value of the HIT and HITBY
messages; these values are also used as the Arg3 of those messages.

Some descriptions below are marked with an asterisk. If the Compatible
flag is set for the object that returned this value, then all bits with
the asterisk in the below descriptions are masked out (bit15 is only
masked out for Compatible objects for diagonal movement).

bit0
  Do not send the HITBY message to the target object.

bit1
  Do not destroy either object due to hardness/sharpness.

1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902

bit13 *
  Abort before actually moving the object and before trying sliding.

bit14 *
  Do not set the Moved flag even if successful.

bit15
  Try again after trying shoving (whether or not the shoving is
  successful). If it tries to shove an object and it is successful, then
  it will automatically set this bit and automatically try again.

bit16
  Set by the game engine if it is attempting sliding.








|







1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903

bit13 *
  Abort before actually moving the object and before trying sliding.

bit14 *
  Do not set the Moved flag even if successful.

bit15 (*)
  Try again after trying shoving (whether or not the shoving is
  successful). If it tries to shove an object and it is successful, then
  it will automatically set this bit and automatically try again.

bit16
  Set by the game engine if it is attempting sliding.

1983
1984
1985
1986
1987
1988
1989
1990


* Many variables are limited to 16-bits.

* Moving objects is not allowed during LASTIMAGE processing.

* The way that the trigger phase works is different.

* In the ARRIVED and DEPARTED messages, Arg1 is always zero.











>
>
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
* Many variables are limited to 16-bits.

* Moving objects is not allowed during LASTIMAGE processing.

* The way that the trigger phase works is different.

* In the ARRIVED and DEPARTED messages, Arg1 is always zero.

* Diagonal shoving is not possible.

Modified exec.c from [371fab5994] to [6b2118fd7b].

835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850











851
852
853

854
855
856
857
858
859
860
      while(objE!=VOIDLINK) {
        if(o->oflags&(OF_DESTROYED|OF_VISUALONLY)) break;
        oE=objects[objE];
        if(oE->height>0) {
          hit&=0xFC287000;
          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?0xC0098F7F:-1L);
          if(hit&8) goto fail;
          if(!(hit&0x11)) {
            v=send_message(obj,objE,MSG_HITBY,NVALUE(oW->x),NVALUE(oW->y),NVALUE(hit));
            if(v.t>TY_MAXTYPE) goto warp;
            if(v.t) Throw("Type mismatch in HIT/HITBY");
            hit|=v.u&(classes[oE->class]->cflags&CF_COMPATIBLE?0xC0098F7F:-1L);
            if(hit&8) goto fail;
          }











        }
        objE=obj_below(objE);
      }

      if((hit&0x200000) && !(hit&0x402008)) {
        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







|





|


>
>
>
>
>
>
>
>
>
>
>



>







835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
      while(objE!=VOIDLINK) {
        if(o->oflags&(OF_DESTROYED|OF_VISUALONLY)) break;
        oE=objects[objE];
        if(oE->height>0) {
          hit&=0xFC287000;
          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?0xC0090F7F:-1L);
          if(hit&8) goto fail;
          if(!(hit&0x11)) {
            v=send_message(obj,objE,MSG_HITBY,NVALUE(oW->x),NVALUE(oW->y),NVALUE(hit));
            if(v.t>TY_MAXTYPE) goto warp;
            if(v.t) Throw("Type mismatch in HIT/HITBY");
            hit|=v.u&(classes[oE->class]->cflags&CF_COMPATIBLE?0xC0090F7F:-1L);
            if(hit&8) goto fail;
          }
        }
        // Shoving
        if(!(classes[o->class]->cflags&CF_COMPATIBLE)) {
          if(!(hit&0x44) && (oE->shovable&(1<<dir)) && o->inertia>=oE->weight && !(oE->oflags&OF_VISUALONLY)) {
            oE->inertia=o->inertia;
            if(move_dir(obj,objE,dir)) {
              if(!(oE->oflags&OF_DESTROYED)) o->inertia=oE->inertia;
              hit|=0x8000;
              if(hit&0x800000) goto restart;
            }
          }
        }
        objE=obj_below(objE);
      }
      if((hit&0x48000)==0x8000) goto restart;
      if((hit&0x200000) && !(hit&0x402008)) {
        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