Free Hero Mesh

Check-in [df0b4678c0]
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 the high 8-bits of Shovable variable.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: df0b4678c0e273ca696cf160c60adbf92ae1f2a8
User & Date: user on 2022-02-16 03:49:34
Other Links: manifest | tags
Context
2022-02-16
07:09
Implement the Morton and ,Morton instructions. (On some computers it may be possible to optimize this better; this optimization is not currently implemented.) check-in: 3532fea858 user: user tags: trunk
03:49
Implement the high 8-bits of Shovable variable. check-in: df0b4678c0 user: user tags: trunk
2022-02-15
00:37
If creating an object in the bizarro world with an overridden order of execution, ensure that it is inserted into the proper place in its order. check-in: 2882130a06 user: user tags: trunk
Changes

Modified class.doc from [57198ff64d] to [5e0bfb99d0].

1057
1058
1059
1060
1061
1062
1063
1064
1065





1066
1067
1068
1069
1070
1071
1072
  to move has the Connection flag, it cannot be destroyed due to running
  into something sharp, but may still destroy other things if it is sharp
  enough to do so (whether or not the other thing has a Connection flag).

Shovable : int16 [c]
  Defines what directions the object may be shoved, where bit0 means east,
  bit2 means north, bit4 means west, and bit6 means south. Bit1, bit3,
  bit5, and bit7 can be used for diagonal shoving. Higher bits are
  reserved for future and should not be used.






Stealthy : bool [c]
  If this flag is set, then the Arrived and Departed variables of other
  objects are not automatically set when this object moves.

Strength : int16/int32 [c]
  When this object's code tries to move this or other objects by the use







|
|
>
>
>
>
>







1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
  to move has the Connection flag, it cannot be destroyed due to running
  into something sharp, but may still destroy other things if it is sharp
  enough to do so (whether or not the other thing has a Connection flag).

Shovable : int16 [c]
  Defines what directions the object may be shoved, where bit0 means east,
  bit2 means north, bit4 means west, and bit6 means south. Bit1, bit3,
  bit5, and bit7 can be used for diagonal shoving. Higher bits are used
  for connection movement, if the Connection flag is also set; each bit
  which is set makes it connect to an object in that direction which has
  the same CollisionLayers value, the bit in the Shovable high 8-bits for
  the opposite direction, and the Connection flag. If the Connection flag
  is not set, then you can use the high bits of Shovable for your own use,
  since the game engine will not use them in that case.

Stealthy : bool [c]
  If this flag is set, then the Arrived and Departed variables of other
  objects are not automatically set when this object moves.

Strength : int16/int32 [c]
  When this object's code tries to move this or other objects by the use

Modified exec.c from [16dc0816de] to [b4fc39460c].

984
985
986
987
988
989
990















991
992
993
994
995
996
997
  if((o->oflags^OF_CONNECTION)&(OF_MOVING|OF_DESTROYED|OF_CONNECTION|OF_BIZARRO)) return;
  conn[nconn].obj=obj;
  conn[nconn].id=nconn; // used for stable sorting
  conn[nconn].visual=(o->oflags&OF_VISUALONLY)?1:0;
  o->oflags|=OF_MOVING|OF_VISUALONLY;
  nconn++;
}
















static int fake_move_dir(Uint32 obj,Uint32 dir,Uint8 no) {
  // This is similar to move_dir, but specialized for the HIT/HITBY processing in connected_move.
  // Note that this may result in calling the real move_dir due to shoving.
  Object*o;
  Object*oE;
  Object*oF;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
  if((o->oflags^OF_CONNECTION)&(OF_MOVING|OF_DESTROYED|OF_CONNECTION|OF_BIZARRO)) return;
  conn[nconn].obj=obj;
  conn[nconn].id=nconn; // used for stable sorting
  conn[nconn].visual=(o->oflags&OF_VISUALONLY)?1:0;
  o->oflags|=OF_MOVING|OF_VISUALONLY;
  nconn++;
}

static void add_connection_shov(Object*o) {
  int i,x,y;
  Uint8 b=classes[o->class]->collisionLayers;
  Uint32 n;
  for(i=0;i<8;i++) if(o->shovable&(0x100<<i)) {
    x=o->x+x_delta[i]; y=o->y+y_delta[i];
    if(x<1 || x>pfwidth || y<1 || y>pfheight) continue;
    n=playfield[x+y*64-65];
    while(n!=VOIDLINK) {
      if(classes[objects[n]->class]->collisionLayers==b && (objects[n]->shovable&(0x100<<(4^i)))) add_connection(n);
      n=objects[n]->up;
    }
  }
}

static int fake_move_dir(Uint32 obj,Uint32 dir,Uint8 no) {
  // This is similar to move_dir, but specialized for the HIT/HITBY processing in connected_move.
  // Note that this may result in calling the real move_dir due to shoving.
  Object*o;
  Object*oE;
  Object*oF;
1160
1161
1162
1163
1164
1165
1166
1167

1168
1169

1170
1171
1172
1173
1174
1175
1176
  int last;
  int i,j;
  if(nconn!=pconn) Throw("Improper nested connected move");
  // Find and add all connections
  add_connection(obj);
  for(i=first;i<nconn;i++) {
    loop1:
    objects[n=conn[i].obj]->inertia=inertia;

    if(v_bool(send_message(obj,n,MSG_CONNECT,NVALUE(i-first),NVALUE(dir),NVALUE(weight)))) goto fail;
    weight+=objects[n]->weight;

  }
  if(conn_option&0x01) {
    for(i=first;i<nconn;i++) {
      o=objects[conn[i].obj];
      if(o->inertia<weight) goto fail;
      inertia-=o->weight;
    }







|
>

|
>







1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
  int last;
  int i,j;
  if(nconn!=pconn) Throw("Improper nested connected move");
  // Find and add all connections
  add_connection(obj);
  for(i=first;i<nconn;i++) {
    loop1:
    o=objects[n=conn[i].obj];
    o->inertia=inertia;
    if(v_bool(send_message(obj,n,MSG_CONNECT,NVALUE(i-first),NVALUE(dir),NVALUE(weight)))) goto fail;
    weight+=o->weight;
    if(o->shovable&0xFF00) add_connection_shov(o);
  }
  if(conn_option&0x01) {
    for(i=first;i<nconn;i++) {
      o=objects[conn[i].obj];
      if(o->inertia<weight) goto fail;
      inertia-=o->weight;
    }