Free Hero Mesh

Check-in [eaf7cc8eb1]
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:Add commands into the editor to add objects into the level. (TODO: Add support for dragging)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: eaf7cc8eb12603c064bea155f3ea937556c40328
User & Date: user on 2021-02-09 04:12:57
Other Links: manifest | tags
Context
2021-02-10
04:52
Add an example configuration file. check-in: 8fd8c63a9e user: user tags: trunk
2021-02-09
04:12
Add commands into the editor to add objects into the level. (TODO: Add support for dragging) check-in: eaf7cc8eb1 user: user tags: trunk
2021-02-08
22:35
Improve the documentation for the Input flag check-in: 31c9d6bdd3 user: user tags: trunk
Changes

Modified bindings.doc from [852bf6010f] to [482a34c08c].

94
95
96
97
98
99
100




101
102
103




104
105
106
107
108
109
110
'mx' <command>
  Export a move list. The argument is a operating system command that
  will receive the move list (in the same format as above) on stdin.


=== Editor commands ===





'^c'
  Display the class selection menu.





'mR' <number>
  Select a relative MRU. Negative numbers move up the list, and positive
  numbers move down the list.

'mr' <number>
  Select a MRU, given the MRU number (0 to 31; the top is zero).








>
>
>
>



>
>
>
>







94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
'mx' <command>
  Export a move list. The argument is a operating system command that
  will receive the move list (in the same format as above) on stdin.


=== Editor commands ===

'^a' <location>
  Add an object with the current MRU values to that location, if there
  is not already another object of the same class there.

'^c'
  Display the class selection menu.

'^u' <location>
  Add an object with the current MRU values to that location, even if
  there is already another object of the same class at that location.

'mR' <number>
  Select a relative MRU. Negative numbers move up the list, and positive
  numbers move down the list.

'mr' <number>
  Select a MRU, given the MRU number (0 to 31; the top is zero).

Modified edit.c from [5794ce4c6b] to [24b1ea6d74].

391
392
393
394
395
396
397
398






















399
400




401
402
403




404
405
406
407
408
409
410
        goto redraw;
      case SDL_QUIT:
        exit(0);
        break;
    }
  }
}























static int editor_command(int prev,int cmd,int number,int argc,sqlite3_stmt*args,void*aux) {
  switch(cmd) {




    case '^c': // Select class/image
      class_image_select();
      return 0;




    case '^P': // Play
      return -2;
    case '^Q': // Quit
      return -1;
    case 'go': // Select level
      load_level(number);
      return 1;








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


>
>
>
>



>
>
>
>







391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
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
        goto redraw;
      case SDL_QUIT:
        exit(0);
        break;
    }
  }
}

static void add_object_at(int x,int y,MRU*m,int d) {
  Uint32 n;
  if(x<1 || x>pfwidth || y<1 || y>pfheight || !m || !m->class) return;
  if(d) {
    n=playfield[y*64+x-65];
    while(n!=VOIDLINK) {
      if(objects[n]->class==m->class) return;
      n=objects[n]->up;
    }
  }
  n=objalloc(m->class);
  if(n==VOIDLINK) return;
  objects[n]->x=x;
  objects[n]->y=y;
  objects[n]->image=m->img;
  objects[n]->dir=m->dir;
  objects[n]->misc1=m->misc1;
  objects[n]->misc2=m->misc2;
  objects[n]->misc3=m->misc3;
  pflink(n);
}

static int editor_command(int prev,int cmd,int number,int argc,sqlite3_stmt*args,void*aux) {
  switch(cmd) {
    case '^a': // Add object (no duplicates)
      if(prev) return prev;
      add_object_at(number&63?:64,number/64?:64,mru+curmru,1);
      return 0;
    case '^c': // Select class/image
      class_image_select();
      return 0;
    case '^u': // Add object (allow duplicates)
      if(prev) return prev;
      add_object_at(number&63?:64,number/64?:64,mru+curmru,0);
      return 0;
    case '^P': // Play
      return -2;
    case '^Q': // Quit
      return -1;
    case 'go': // Select level
      load_level(number);
      return 1;

Modified game.c from [627e7b922e] to [0d57595d6a].

717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
        timerflag=0;
        break;
      case SDL_MOUSEBUTTONDOWN:
        if(ev.button.x<left_margin) {
          if(ev.button.y<48) break;
          if(side_mode) {
            // Inventory
            
          } else {
            // Move list
            i=(ev.button.y+4)/16-(screen->h-68)/32-4;
            if(i<0) game_command(0,'- ',-i,0,0,0); else if(i>0) game_command(0,'+ ',i,0,0,0);
            goto replay;
          }
          break;







|







717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
        timerflag=0;
        break;
      case SDL_MOUSEBUTTONDOWN:
        if(ev.button.x<left_margin) {
          if(ev.button.y<48) break;
          if(side_mode) {
            // Inventory
            //TODO
          } else {
            // Move list
            i=(ev.button.y+4)/16-(screen->h-68)/32-4;
            if(i<0) game_command(0,'- ',-i,0,0,0); else if(i>0) game_command(0,'+ ',i,0,0,0);
            goto replay;
          }
          break;