Free Hero Mesh

Check-in [01f32e4d01]
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:Write more in class.doc
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 01f32e4d017bcb0b6b3d54c3c97f3c6dcb50b61e
User & Date: user on 2021-01-05 19:20:08
Other Links: manifest | tags
Context
2021-01-06
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
07:12
Implement displaying the replay list check-in: d308a8c8ca user: user tags: trunk
Changes

Modified class.doc from [3662bf9dd0] to [7351e72438].

214
215
216
217
218
219
220




































































































































































221
222
223
224
225
226
227
(@<name> <value>)
  Define a global variable and its initial value.

(<message> <code...>)
  Defines a default message code for all classes which do not specify
  their own code for this message.






































































































































































=== Data types ===

The following data types are available:

* Number: A 32-bit integer. Whether it is treated as signed or unsigned
depends on the context. In some cases, it is used as bit field data.







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







214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
(@<name> <value>)
  Define a global variable and its initial value.

(<message> <code...>)
  Defines a default message code for all classes which do not specify
  their own code for this message.


=== Class definitions ===

Within a class definition, the following definitions can be used. See also
the section about variables; many of these definitions are used to specify
the initial value for variables of objects of this class.

Outside of code blocks, named constants are not normally interchangeable
with the numbers having the same value.

Abstract
  (Not implemented yet.)

(Arrivals InPlace)
  This is an abbreviation for (Arrivals 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
  0 0 0 0 0 0 0 0).

(Arrivals <numbers...>)
  Define the Arrivals variable for this class. This is twenty-five numbers
  each of which is either zero or one. They are meant to be on five lines
  of five numbers each, making a 5x5 matrix, where the centre means this
  object's location.

(Climb <number>)
  Define the Climb variable for this class.

Compatible
  Sets the Compatible flag for this class.

,Compatible
  Sets the Compatible flag for this class, but removes the restriction of
  some variables limited to 16-bits.

(DefaultImage <list...>)
  Each entry is either a number of an image in this class, or two
  numbers in parentheses giving a range of images, or () to indicate
  that there are no default images. This specifies which images can
  be used in objects of this class which are initially present on
  the level (placed in the editor). If () is used, then this class
  is not available in the editor. If there is no (DefaultImage) block,
  all images are available. The (Image) block must come before this one.

(Density <number>)
  Define the Density variable for this class. If you want the Density to
  be different in the editor, specify the value to use in the editor here,
  and then change the Density value in the INIT block.

(Departures InPlace)
  This is an abbreviation for (Departures 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
  0 0 0 0 0 0 0 0 0).

(Departures <numbers...>)
  Define the Departures variable for this class. The format is the same as
  for the Arrivals variable; see above.

(EditorHelp <strings...>)
  A help message to display in the level editor; normally, this would
  explain what values are expected for Misc1, Misc2, Misc3, and Dir.
  Each string is one line of text.

(Hard <number>)
  Define the hardness of this object on all four sides.

(Hard <pairs...>)
  Define the hardness per direction. Each pair is in parentheses, and is
  a direction (E, N, W, or S) followed by a 16-bit number. If any
  direction is not specified, then the hardness is zero in that direction.

(Height <number>)
  Define the Height variable for this class.

(Help <strings...>)
  A help message for the game player, which would normally explain what
  this object does. Each string is one line of text.

(Image <strings...>)
  Specify strings with the names of images. The first string is the
  name of the image numbered 0, next for the image numbered 1, etc.

Input
  Set the Input flag for this class.

Invisible
  Set the Invisible flag for this class.

(Misc4 <numbers...>)
  Specify any combination of numbers and/or bit constants. Defines the
  Misc4 variable of this class to be the bitwise OR of the listed numbers.

(Misc5 <numbers...>)
  Define the Misc5 variable for this class; see Misc4 above for details.

(Misc6 <numbers...>)
  Define the Misc6 variable for this class; see Misc4 above for details.

(Misc7 <numbers...>)
  Define the Misc7 variable for this class; see Misc4 above for details.

Player
  Set the Player flag for this class.

Quiz
  If specified, the internal variables of objects of this class cannot
  normally be examined by the player. However, the player can override
  this definition at run time; you cannot rely on it. Class codes cannot
  read the value of this flag.

(Shape <number>)
  Define the shape of this object on all four sides, where 0 means flat,
  1 means slanted to left, 2 means slanted to right, and 3 means slanted
  both left and right.

(Shape <pairs...>)
  Define the shape of this object per side, similar to the (Hard) block.

(Sharp <number>)
  Define the sharpness of this object on all four sides.

(Sharp <pairs...>)
  Define sharpness per direction, as for the (Hard) block.

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.

(Strength <number>)
  Define the Strength variable for this class.

(SUBS <code...>)
  Make a code block with no entry point. This isn't very useful, but it
  is provided for compatibility with Hero Mesh.

(Temperature <number>)
  Define the Temperature variable for this class.

VisualOnly
  Set the VisualOnly flag for this class.

(Volume <number>)
  Define the Volume variable for this class.

(Weight <number>)
  Define the Weight variable for this class.

(<label> <code...>)
  Make a code block whose entry point is the specified label.

(<message> <code...>)
  Make a code block whose entry point is the specified message.

(<key> <code...>)
  (This is not implemented yet.)


=== Data types ===

The following data types are available:

* Number: A 32-bit integer. Whether it is treated as signed or unsigned
depends on the context. In some cases, it is used as bit field data.
1086
1087
1088
1089
1090
1091
1092
1093

1094
1095
1096
1097
1098
1099
1100

QueueTurn  ( key -- ) **
  Queue another turn after this one, using the specified key code, which
  must be a number from 0 to 255. The extra turn is not entered into the
  replay list and does not increase MoveNumber, but otherwise will act
  like any other turn. Popup messages are not removed; they will be
  retained, and these extra turns execute the input phase as though there
  is no popup quiz.


ret  ( -- )
  Exit the current subroutine. If this is a message block, it must either
  leave the stack as it is, or leave it but with one extra value pushed
  which will be the return value from the message call. (This is implied
  at the end of a code block.)








|
>







1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265

QueueTurn  ( key -- ) **
  Queue another turn after this one, using the specified key code, which
  must be a number from 0 to 255. The extra turn is not entered into the
  replay list and does not increase MoveNumber, but otherwise will act
  like any other turn. Popup messages are not removed; they will be
  retained, and these extra turns execute the input phase as though there
  is no popup quiz. (Not implemented yet. Details described here might be
  changed when it is implemented.)

ret  ( -- )
  Exit the current subroutine. If this is a message block, it must either
  leave the stack as it is, or leave it but with one extra value pushed
  which will be the return value from the message call. (This is implied
  at the end of a code block.)

1242
1243
1244
1245
1246
1247
1248
1249


1250
1251
1252
1253
1254
1255

1256
1257
1258
1259
1260
1261
1262
=== Messages ===

This section describes when the various standard messages are sent to
objects, and what return values are expected. (Do not confuse CREATE with
CREATED or DESTROY with DESTROYED; they have different purposes.)

ARRIVED
  



BEGIN_TURN
  Sent to all objects during the beginning phase (the phase after the
  input phase). From is an object with the Player flag (if there is any),
  Arg1 and Arg2 are the X and Y coordinates of that object, and Arg3 is
  the most recent return value from a KEY message.


COLLIDE
  Received when this object is trying to move into a location where there
  is a collision, so it can't move there. Of the return value, bit0 means
  to prevent the movement (even if the objects are moved out of the way or
  destroyed in order to make room), bit1 means to not send any COLLIDEBY
  messages, and bit2 means to pretend the move attempt was successful even







|
>
>





|
>







1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
=== Messages ===

This section describes when the various standard messages are sent to
objects, and what return values are expected. (Do not confuse CREATE with
CREATED or DESTROY with DESTROYED; they have different purposes.)

ARRIVED
  Sent during the trigger phase if the Arrived value is nonzero. Arg1 is
  the saved Arrived value. The Arrived variable will usually be set
  automatically; see the section about variables.

BEGIN_TURN
  Sent to all objects during the beginning phase (the phase after the
  input phase). From is an object with the Player flag (if there is any),
  Arg1 and Arg2 are the X and Y coordinates of that object, and Arg3 is
  the most recent return value from a KEY message. The beginning phase may
  be suppressed; if it is, then the ending phase is also suppressed.

COLLIDE
  Received when this object is trying to move into a location where there
  is a collision, so it can't move there. Of the return value, bit0 means
  to prevent the movement (even if the objects are moved out of the way or
  destroyed in order to make room), bit1 means to not send any COLLIDEBY
  messages, and bit2 means to pretend the move attempt was successful even
1276
1277
1278
1279
1280
1281
1282
1283



1284
1285
1286


1287
1288
1289
1290
1291
1292
1293
1294
1295
1296



1297
1298
1299









1300
1301
1302









1303
1304
1305
1306
1307
1308
1309
CREATE
  Sent when the object is created by the Create instruction. This is done
  after the object is created, but before sending any other messages. The
  From is the object that created it. The return value will be used as the
  Arg3 of the SUNK and CREATED messages it might send if appropriate.

CREATED
  




DEPARTED
  



DESTROY
  Received when the object is about to be destroyed. Arg3 is the reason:
  0 for the Destroy or ,Destroy instruction, 1 due to this object moving
  into something sharp, 2 due to something sharp moving into this one,
  or 3 for a conflict with CollisionLayers. The return value is false to
  allow it to be destroyed or true to keep the object.

DESTROYED
  




END_TURN
  










FLOATED
  










HIT
  Indicates that this object is trying to move into another one; that
  other object is the From value of the message. Arg1 and Arg2 are the
  X and Y coordinates of that object, and Arg3 is the current hit value
  (see below). The return value is ORed with the hit value to make the
  new hit value.







|
>
>
>


|
>
>









|
>
>
>


|
>
>
>
>
>
>
>
>
>


|
>
>
>
>
>
>
>
>
>







1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
CREATE
  Sent when the object is created by the Create instruction. This is done
  after the object is created, but before sending any other messages. The
  From is the object that created it. The return value will be used as the
  Arg3 of the SUNK and CREATED messages it might send if appropriate.

CREATED
  Sent to all objects whose Arrivals care about objects in the location
  where an object has just been created. From is the newly created object,
  Arg1 and Arg2 are the X and Y coordinates where the object was created,
  and Arg3 is the return value from the CREATE message.

DEPARTED
  Sent during the trigger phase if the Departed value is nonzero. Arg1 is
  the saved Departed value. The Departed variable will usually be set
  automatically; see the section about variables.

DESTROY
  Received when the object is about to be destroyed. Arg3 is the reason:
  0 for the Destroy or ,Destroy instruction, 1 due to this object moving
  into something sharp, 2 due to something sharp moving into this one,
  or 3 for a conflict with CollisionLayers. The return value is false to
  allow it to be destroyed or true to keep the object.

DESTROYED
  Sent to all objects whose Departures care about objects in the location
  where an object has just been destroyed (if its VisualOnly flag isn't
  set). From is the object which has just been destroyed. Arg3 is the
  reason, as for the DESTROY message.

END_TURN
  During the trigger phase, if no objects are busy, then the ending phase
  will be executed next. This message is sent to all objects during the
  ending phase (unless the ending phase has been suppressed). Arg1 is the
  phase number; this is initially zero at the beginning of each turn, but
  after each ending phase completes, this number is incremented. If the
  return value is true, or if this object has Arrived, Busy, Departed,
  Moved, or UserSignal variables set to nonzero, it will not suppress the
  next ending phase. Otherwise, if this is not the case for any of the
  objects checked, it will suppress the ending phase for the rest of this
  turn (although other phases may still work).

FLOATED
  This message is used in three cases. If an object's Density variable is
  changed, then as each pair is being exchanged, it sends the FLOATED
  message to the object which now has less density. From is the object
  which it has been exchanged with. The return value is used as the Arg3
  of the corresponding SUNK message. The other case this is used is when
  an object moves or is created but is not the least dense object at that
  location. In this case, From is the object which has been moved or
  created, Arg3 is the return value of the corresponding SUNK message,
  and the return value is not used. (The FLOATED and SUNK messages have
  nothing to do with floating and sinking in water.)

HIT
  Indicates that this object is trying to move into another one; that
  other object is the From value of the message. Arg1 and Arg2 are the
  X and Y coordinates of that object, and Arg3 is the current hit value
  (see below). The return value is ORed with the hit value to make the
  new hit value.
1329
1330
1331
1332
1333
1334
1335
1336




1337
1338
1339







1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360








1361
1362
1363
1364
1365
1366
1367
  the Input flag set, or to only the current quiz object if there is one
  (whether or not it has the Input flag). Arg1 is the key code (the Key
  instruction can also be used), Arg2 is the return value of the previous
  KEY message (0 for the first one), and Arg3 is zero for normal input or
  one for a quiz. The return value is passed as Arg2 for the next object.

LASTIMAGE
  





MOVED
  








MOVING
  Called when the object is about to be moved (whether due to Move,
  MoveTo, JumpTo, or any other reason). From is the object that caused
  the move, and Arg1 and Arg2 are the target X and Y coordinates. If the
  return value is true, then the move is aborted.

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.

POSTINIT
  After all INIT messages are sent when the level is initialized, then it
  will send POSTINIT to all objects. Objects which are created during this
  time will not receive POSTINIT messages.

SUNK
  










=== 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.








|
>
>
>
>


|
>
>
>
>
>
>
>




















|
>
>
>
>
>
>
>
>







1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
  the Input flag set, or to only the current quiz object if there is one
  (whether or not it has the Input flag). Arg1 is the key code (the Key
  instruction can also be used), Arg2 is the return value of the previous
  KEY message (0 for the first one), and Arg3 is zero for normal input or
  one for a quiz. The return value is passed as Arg2 for the next object.

LASTIMAGE
  Called during the trigger phase if this object has a one-shot logical
  animation whose logical timer has expired. New animations played during
  or after this time will retain any existing visual animation, but the
  new logical animation replaces the old one. However, there is a maximum
  number of animations that may be sequenced together in this way.

MOVED
  Sent during the trigger phase to all objects which have the Moved flag
  set; this flag is cleared before sending the message, so if it moves
  again it will remember that it moved again. It will not send this
  message again during the same trigger phase, even if the Compatible
  flag is set; it will wait until all other objects have been processed
  during the same trigger phase first. Arg3 is the phase number (see the
  description of END_TURN for details). The Moved variable will usually
  be set automatically; see the section about variables for details.

MOVING
  Called when the object is about to be moved (whether due to Move,
  MoveTo, JumpTo, or any other reason). From is the object that caused
  the move, and Arg1 and Arg2 are the target X and Y coordinates. If the
  return value is true, then the move is aborted.

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.

POSTINIT
  After all INIT messages are sent when the level is initialized, then it
  will send POSTINIT to all objects. Objects which are created during this
  time will not receive POSTINIT messages.

SUNK
  This message is used in three cases. If an object's Density variable is
  changed, then as each pair is being exchanged, it sends the SUNK message
  to the object which now has more density. From is the object which it
  has been exchanged with. Arg3 is the return value from the corresponding
  FLOATED message. The other cases this is used is when an object moves or
  is created but is not the least dense object at that location. In this
  case, From is zero, and the return value is not used. For creation, Arg3
  is the return value of the corresponding CREATE message; for movement,
  Arg3 is always zero. (This has nothing to do with sinking in water.)


=== 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.

1501
1502
1503
1504
1505
1506
1507
1508


* Some bits are masked out of the return value from HIT and HITBY.

* Many variables are limited to 16-bits.

* Moving objects is not allowed during LASTIMAGE processing.

* The way that the trigger phase works is different.











>
>
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
* Some bits are masked out of the return value from HIT and HITBY.

* 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.

Modified fileform1.txt from [bbb40911a8] to [3531e0b394].

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
10      WORD      Number of picture sizes
12      WORD(8)   Picture sizes
28      WORD      Number of words in picture allocation table

File version is 15 for Hero Mesh version 1.1c, and is 16 for Hero Mesh
version 2.0. Other versions (if any) are unknown. The rest of this
document is applicable to file version 16 (differences, if any, are
unknown; file version 15 does not seem to have any differences as far as
I can tell).

Puzzle set number is a number that can be read by the class codes but
otherwise does nothing. It is used by the Hero Hearts puzzle sets to
determine which puzzle set to link to after completing the last level.

The picture sizes are all square; the numbers given are the width (which
is equal to the height) of that picture size. For example, if it says 24







|
|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
10      WORD      Number of picture sizes
12      WORD(8)   Picture sizes
28      WORD      Number of words in picture allocation table

File version is 15 for Hero Mesh version 1.1c, and is 16 for Hero Mesh
version 2.0. Other versions (if any) are unknown. The rest of this
document is applicable to file version 16 (differences, if any, are
unknown; file version 15 does not seem to have any differences as far
as I can tell).

Puzzle set number is a number that can be read by the class codes but
otherwise does nothing. It is used by the Hero Hearts puzzle sets to
determine which puzzle set to link to after completing the last level.

The picture sizes are all square; the numbers given are the width (which
is equal to the height) of that picture size. For example, if it says 24