Free Hero Mesh

Check-in [c1c8bc41b1]
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 NEXTWARP message.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c1c8bc41b15cf34f70ec80fa010d4d04c613710b
User & Date: user on 2022-03-04 02:03:16
Other Links: manifest | tags
Context
2022-03-07
00:50
More elaborate information about making contributions check-in: 5ea4595ba3 user: user tags: trunk
2022-03-04
02:03
Implement the NEXTWARP message. check-in: c1c8bc41b1 user: user tags: trunk
01:56
If new messages are added, then instruc.h must be rewritten, too. check-in: b08bf22096 user: user tags: trunk
Changes

Modified class.doc from [775d5d0d22] to [5667a2b6a0].

673
674
675
676
677
678
679

680
681
682
683
684
685
686
  HITBY
  INIT
  JUMPED
  KEY
  LASTIMAGE
  MOVED
  MOVING

  PLAYERMOVING
  POSTINIT
  SUNK

Input constants:
  'BACK = 8
  'TAB = 9







>







673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
  HITBY
  INIT
  JUMPED
  KEY
  LASTIMAGE
  MOVED
  MOVING
  NEXTWARP
  PLAYERMOVING
  POSTINIT
  SUNK

Input constants:
  'BACK = 8
  'TAB = 9
2367
2368
2369
2370
2371
2372
2373






2374
2375
2376
2377
2378
2379
2380
  the move, and Arg1 and Arg2 are the target X and Y coordinates. If the
  return value is true, then the move is aborted. From will be zero if
  it is the first pass of checking if it can be moved due to Connection;
  in that case, if all first passes are successful then it will try again
  the second pass with From set to the first object of the group, and
  this second time they will actually be moved.







PLAYERMOVING
  If an object with the Player flag is about to move, then after the
  MOVING message is sent, PLAYERMOVING is sent to all objects. From is
  the object which is moving, Arg1 and Arg2 are where it will be moved to,
  and Arg3 is the From of the MOVING message. If the return value is true,
  then the move is aborted.








>
>
>
>
>
>







2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
  the move, and Arg1 and Arg2 are the target X and Y coordinates. If the
  return value is true, then the move is aborted. From will be zero if
  it is the first pass of checking if it can be moved due to Connection;
  in that case, if all first passes are successful then it will try again
  the second pass with From set to the first object of the group, and
  this second time they will actually be moved.

NEXTWARP
  Sent to the warp object if a warp fails. From is the same as it is for
  HITBY, Arg1 is the direction of movement, and Arg3 is the hit value.
  Return zero to not try again, or an object to try again with a new
  warp object.

PLAYERMOVING
  If an object with the Player flag is about to move, then after the
  MOVING message is sent, PLAYERMOVING is sent to all objects. From is
  the object which is moving, Arg1 and Arg2 are where it will be moved to,
  and Arg3 is the From of the MOVING message. If the return value is true,
  then the move is aborted.

Modified exec.c from [c5e36d78e2] to [c9c1928e06].

1488
1489
1490
1491
1492
1493
1494

1495





1496
1497
1498
1499
1500
1501
1502
      if((hit&0x48000)==0x8000) goto restart;
      if((hit&0x1000000) && !(hit&0x400080)) {
        if(hit&0x20000) goto success;
        if(move_to(from,obj,objects[objLF]->x,objects[objLF]->y)) goto success;
      }
    }
  }

  fail: if(hit&0x1000) goto success; o->inertia=0; return 0;





  success: if(!(hit&0x4000)) o->oflags|=OF_MOVED; if(hit&0x10000000) o->dir=dir; return 1;
}

static int jump_to(Uint32 from,Uint32 n,Uint32 x,Uint32 y) {
  int xx,yy;
  if(n==VOIDLINK) return 0;
  xx=objects[n]->x;







>
|
>
>
>
>
>







1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
      if((hit&0x48000)==0x8000) goto restart;
      if((hit&0x1000000) && !(hit&0x400080)) {
        if(hit&0x20000) goto success;
        if(move_to(from,obj,objects[objLF]->x,objects[objLF]->y)) goto success;
      }
    }
  }
  fail:
  if(hit&0x1000) goto success;
  if(hit&0x10000000) {
    v=send_message(obj,objW,MSG_NEXTWARP,NVALUE(dir),NVALUE(0),NVALUE(hit));
    if(v.t || v.u) goto warp;
  }
  o->inertia=0; return 0;
  success: if(!(hit&0x4000)) o->oflags|=OF_MOVED; if(hit&0x10000000) o->dir=dir; return 1;
}

static int jump_to(Uint32 from,Uint32 n,Uint32 x,Uint32 y) {
  int xx,yy;
  if(n==VOIDLINK) return 0;
  xx=objects[n]->x;

Modified heromesh.h from [3ad0961a68] to [5a98591922].

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#define CVALUE(x) UVALUE(x,TY_CLASS)
#define MVALUE(x) UVALUE(x,TY_MESSAGE)
#define ZVALUE(x) UVALUE(x,TY_STRING)
#define OVALUE(x) ((x)==VOIDLINK?NVALUE(0):UVALUE(x,objects[x]->generation))
#define ValueTo64(v) (((sqlite3_int64)((v).u))|(((sqlite3_int64)((v).t))<<32))
#define ValueEq(x,y) ((x).t==(y).t && (x).u==(y).u)

#define N_MESSAGES 26
extern const char*const standard_message_names[];
extern const char*const standard_sound_names[];
extern const char*const heromesh_key_names[256];

extern sqlite3*userdb;
extern xrm_db*resourcedb;
extern const char*basefilename;







|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#define CVALUE(x) UVALUE(x,TY_CLASS)
#define MVALUE(x) UVALUE(x,TY_MESSAGE)
#define ZVALUE(x) UVALUE(x,TY_STRING)
#define OVALUE(x) ((x)==VOIDLINK?NVALUE(0):UVALUE(x,objects[x]->generation))
#define ValueTo64(v) (((sqlite3_int64)((v).u))|(((sqlite3_int64)((v).t))<<32))
#define ValueEq(x,y) ((x).t==(y).t && (x).u==(y).u)

#define N_MESSAGES 27
extern const char*const standard_message_names[];
extern const char*const standard_sound_names[];
extern const char*const heromesh_key_names[256];

extern sqlite3*userdb;
extern xrm_db*resourcedb;
extern const char*basefilename;

Modified instruc.h from [a4f91b92f3] to [364162f345].

650
651
652
653
654
655
656

657
658
659
660
661
662
663
{"MoveNumber",8552579},
{"MoveTo",10584251},
{"Moved",8618101},
{"Moving",8618102},
{"Msg",8421502},
{"N",9437186},
{"NE",9437185},

{"NW",9437187},
{"NewX",8421566},
{"NewXY",8421567},
{"NewY",8421568},
{"OLDPHONE",8389402},
{"ONCE",8388609},
{"OSC",8388616},







>







650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
{"MoveNumber",8552579},
{"MoveTo",10584251},
{"Moved",8618101},
{"Moving",8618102},
{"Msg",8421502},
{"N",9437186},
{"NE",9437185},
{"NEXTWARP",8389146},
{"NW",9437187},
{"NewX",8421566},
{"NewXY",8421567},
{"NewY",8421568},
{"OLDPHONE",8389402},
{"ONCE",8388609},
{"OSC",8388616},
844
845
846
847
848
849
850
851
852
{"then",8683531},
{"tmark",8421600},
{"tuck",8421380},
{"uniq",8421607},
{"until",8683534},
{"while",8683535},
};
#define N_OP_NAMES 360
#endif







|

845
846
847
848
849
850
851
852
853
{"then",8683531},
{"tmark",8421600},
{"tuck",8421380},
{"uniq",8421607},
{"until",8683534},
{"while",8683535},
};
#define N_OP_NAMES 361
#endif

Modified names.h from [c6fc8993e8] to [27b23be7e2].

21
22
23
24
25
26
27

28
29
30
31
32
33
34
#define MSG_END_TURN 19
#define MSG_CONFLICT 20
#define MSG_COLLIDEBY 21
#define MSG_COLLIDE 22
#define MSG_COLLIDING 23
#define MSG_BLOCKED 24
#define MSG_CONNECT 25

#ifdef HEROMESH_MAIN
const char*const standard_message_names[]={
 "INIT",
 "CREATE",
 "DESTROY",
 "BEGIN_TURN",
 "ARRIVED",







>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#define MSG_END_TURN 19
#define MSG_CONFLICT 20
#define MSG_COLLIDEBY 21
#define MSG_COLLIDE 22
#define MSG_COLLIDING 23
#define MSG_BLOCKED 24
#define MSG_CONNECT 25
#define MSG_NEXTWARP 26
#ifdef HEROMESH_MAIN
const char*const standard_message_names[]={
 "INIT",
 "CREATE",
 "DESTROY",
 "BEGIN_TURN",
 "ARRIVED",
49
50
51
52
53
54
55

56
57
58
59
60
61
62
 "END_TURN",
 "CONFLICT",
 "COLLIDEBY",
 "COLLIDE",
 "COLLIDING",
 "BLOCKED",
 "CONNECT",

};
#endif
#define SND_SPLASH 0
#define SND_POUR 1
#define SND_DOOR 2
#define SND_GLASS 3
#define SND_BANG 4







>







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
 "END_TURN",
 "CONFLICT",
 "COLLIDEBY",
 "COLLIDE",
 "COLLIDING",
 "BLOCKED",
 "CONNECT",
 "NEXTWARP",
};
#endif
#define SND_SPLASH 0
#define SND_POUR 1
#define SND_DOOR 2
#define SND_GLASS 3
#define SND_BANG 4

Modified names.js from [d3641d4495] to [2016a9f624].

26
27
28
29
30
31
32

33
34
35
36
37
38
39
 // New
 20 = CONFLICT
 21 = COLLIDEBY
 22 = COLLIDE
 23 = COLLIDING
 24 = BLOCKED
 25 = CONNECT

`.split("\n").map(x=>/^ *([0-9]+) = ([^ ]*) *$/.exec(x)).filter(x=>x);
const standard_sound_names=[];
`
 SPLASH
 POUR
 DOOR
 GLASS







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 // New
 20 = CONFLICT
 21 = COLLIDEBY
 22 = COLLIDE
 23 = COLLIDING
 24 = BLOCKED
 25 = CONNECT
 26 = NEXTWARP
`.split("\n").map(x=>/^ *([0-9]+) = ([^ ]*) *$/.exec(x)).filter(x=>x);
const standard_sound_names=[];
`
 SPLASH
 POUR
 DOOR
 GLASS