Free Hero Mesh

Check-in [0393bebb68]
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 replay marks.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0393bebb685538bac668dbba810c2d74dd4612f6
User & Date: user on 2021-01-04 02:44:39
Other Links: manifest | tags
Context
2021-01-04
06:29
Improvement of comments in heromesh.h check-in: 7b83e02ee7 user: user tags: trunk
02:44
Implement replay marks. check-in: 0393bebb68 user: user tags: trunk
00:39
Start to implement replay. (The replay implementation is not yet complete; it doesn't display the replay list anywhere, nor does it save it, nor replay solutions.) check-in: 1c62f22813 user: user tags: trunk
Changes

Modified bindings.doc from [29b885bccc] to [6ef576a661].

55
56
57
58
59
60
61









62
63
64
65
66
67
68
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77







+
+
+
+
+
+
+
+
+








'- ' <count>
  Rewind that many moves.

'= ' <count>
  Restart and replay that many moves.

'^<'
  Rewind to mark.

'^>'
  Replay to mark.

'^M'
  Set the replay mark position.

'^T'
  Display the level title popup.

'^d' <location>
  Display the pop-up help text of the object at the location.

'^o' <location>

Modified game.c from [6ca5fb9cf3] to [ba2cd038c4].

407
408
409
410
411
412
413
414

415

416
417
418
419
420
421
422
423
424
425
426
427

428
429
430
431
432
433
434
435
436







437
438



439
440
441
442
443
444
445
407
408
409
410
411
412
413

414
415
416
417
418
419
420
421
422
423
424
425
426
427

428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456







-
+

+











-
+









+
+
+
+
+
+
+


+
+
+







    case '\' ': // Play a move
      if(inputs_count>=inputs_size) {
        inputs=realloc(inputs,inputs_size+=32);
        if(!inputs) fatal("Allocation failed\n");
      }
      inputs[inputs_count++]=number;
      return 0;
    case '+ ': // Replay
    case '+ ': replay: // Replay
      if(number>replay_count-replay_pos) number=replay_count-replay_pos;
      if(number<=0) return prev;
      if(inputs_count+number>=inputs_size) {
        inputs=realloc(inputs,inputs_size+=number+1);
        if(!inputs) fatal("Allocation failed\n");
      }
      memcpy(inputs+inputs_count,replay_list+replay_pos,number);
      inputs_count+=number;
      return 0;
    case '- ': // Rewind
      number=replay_pos-number;
      if(number<0) number=0;
      //fallthru
    case '= ': // Restart
    case '= ': restart: // Restart
      begin_level(level_id);
      if(!number) return 1;
      if(number>replay_count) number=replay_count;
      if(number>=inputs_size) {
        inputs=realloc(inputs,inputs_size=number+1);
        if(!inputs) fatal("Allocation failed\n");
      }
      memcpy(inputs,replay_list,inputs_count=number);
      return 1;
    case '^<': // Rewind to mark
      number=replay_mark;
      goto restart;
    case '^>': // Replay to mark
      inputs_count=0;
      number=replay_mark-replay_pos;
      goto replay;
    case '^E': // Edit
      return -2;
    case '^M': // Mark replay position
      replay_mark=replay_pos+inputs_count;
      return prev;
    case '^Q': // Quit
      return -1;
    case '^T': // Show title
      modal_draw_popup(level_title);
      return prev;
    case '^d': // Describe object
      describe_at(number-65);