Free Hero Mesh

Check-in [382666e88a]
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:Make control and middle button to draw lines from clicked location for helping with alignment.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 382666e88a9e0ef1694efcd8827e701a111d67fd
User & Date: user on 2023-10-31 23:36:23
Other Links: manifest | tags
Context
2024-05-11
06:16
Start of implementation of the (Trigger) block (currently only syntax is implemented) to control timing/ordering of some events. check-in: ee231f02dd user: user tags: trunk
2023-10-31
23:36
Make control and middle button to draw lines from clicked location for helping with alignment. check-in: 382666e88a user: user tags: trunk
2023-10-18
04:56
Change colour of (X,Y) coordinates to make it easier to read. check-in: 1ca3a03298 user: user tags: trunk
Changes

Modified bindings.doc from [84cdf61435] to [9c9b1b17c1].

264
265
266
267
268
269
270




271
272
273
274
275
276
277

'^Q'
  Quit.

'^Y'
  Sound test. (Does nothing if sound is not configured.)





'go' <level>
  Go to the specified level. If the level number is negative, then it is
  a level order number, otherwise it is a level ID number.


=== Mode-independent commands ===








>
>
>
>







264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281

'^Q'
  Quit.

'^Y'
  Sound test. (Does nothing if sound is not configured.)

'^l' <location>
  Draw lines horizontal, vertical, and diagonal, from the clicked location,
  until the mouse button is released.

'go' <level>
  Go to the specified level. If the level number is negative, then it is
  a level order number, otherwise it is a level ID number.


=== Mode-independent commands ===

Modified default.heromeshrc from [15c07e1dd4] to [336d543bb0].

220
221
222
223
224
225
226

227
228
229
230
?.?.ctrl.G: select 'go',-:Go_To_Level where :Go_To_Level=cast(:Go_To_Level as int) and cast(:Go_To_Level as int)>0;
?.?.ctrl.Q: ^Q
?.?.ctrl.S: ^S
?.?.ctrl.T: ^T
?.?.ctrl.Y: ^Y
?.?.shift.ctrl.M: select ':s';
?.?.f10: select ':x';


! Picture editor macros
?.picedit.macro.M: insert into graph(x,y,c) select s-x-1,y,c from graph where x<s/2;








>




220
221
222
223
224
225
226
227
228
229
230
231
?.?.ctrl.G: select 'go',-:Go_To_Level where :Go_To_Level=cast(:Go_To_Level as int) and cast(:Go_To_Level as int)>0;
?.?.ctrl.Q: ^Q
?.?.ctrl.S: ^S
?.?.ctrl.T: ^T
?.?.ctrl.Y: ^Y
?.?.shift.ctrl.M: select ':s';
?.?.f10: select ':x';
?.?.ctrl.middle: ^l

! Picture editor macros
?.picedit.macro.M: insert into graph(x,y,c) select s-x-1,y,c from graph where x<s/2;

Modified edit.c from [fab4b81851] to [9a00c6e87e].

1848
1849
1850
1851
1852
1853
1854



1855
1856
1857
1858
1859
1860
1861
      return 0;
    case '^c': // Select class/image
      class_image_select();
      return 0;
    case '^e': // Edit Misc/Dir of MRU slot
      mru_edit(mru+curmru);
      return 0;



    case '^s': // String list/edit
      string_list();
      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;







>
>
>







1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
      return 0;
    case '^c': // Select class/image
      class_image_select();
      return 0;
    case '^e': // Edit Misc/Dir of MRU slot
      mru_edit(mru+curmru);
      return 0;
    case '^l': // Draw lines from location
      draw_lines(number%64?:64,number/64);
      return prev;
    case '^s': // String list/edit
      string_list();
      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;

Modified edit.doc from [bc7c806b35] to [7d3fa7cbe5].

247
248
249
250
251
252
253

254
255
256
257
258
259

Mouse (in grid):

  LEFT          Add object
  CTRL+LEFT     Edit Misc/Dir of object
  ALT+LEFT      Add object (allow duplicate)
  SHIFT+LEFT    Set top corner of selection rectangle

  ALT+MIDDLE    Set Misc2/Misc3 of MRU to X/Y
  SHIFT+MIDDLE  Make 1x1 selection rectangle
  RIGHT         Delete object
  CTRL+RIGHT    Copy object to MRU
  SHIFT+RIGHT   Set bottom corner of selection rectangle








>






247
248
249
250
251
252
253
254
255
256
257
258
259
260

Mouse (in grid):

  LEFT          Add object
  CTRL+LEFT     Edit Misc/Dir of object
  ALT+LEFT      Add object (allow duplicate)
  SHIFT+LEFT    Set top corner of selection rectangle
  CTRL+MIDDLE   Show lines
  ALT+MIDDLE    Set Misc2/Misc3 of MRU to X/Y
  SHIFT+MIDDLE  Make 1x1 selection rectangle
  RIGHT         Delete object
  CTRL+RIGHT    Copy object to MRU
  SHIFT+RIGHT   Set bottom corner of selection rectangle

Modified game.c from [4b1de8bd7f] to [64a615a82b].

1421
1422
1423
1424
1425
1426
1427




1428
1429
1430
1431
1432
1433
1434
      sound_test();
      return prev;
    case '^d': // Describe object
      describe_at(number-65);
      return prev;
    case '^g': // Display global variables
      global_examine();




      return prev;
    case '^n': // List objects (bizarro)
      list_objects_at(number-65,bizplayfield,"bizarro ");
      return prev;
    case '^o': // List objects
      list_objects_at(number-65,playfield,"");
      return prev;







>
>
>
>







1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
      sound_test();
      return prev;
    case '^d': // Describe object
      describe_at(number-65);
      return prev;
    case '^g': // Display global variables
      global_examine();
      return prev;
    case '^l': // Draw lines from location
      timerflag=1;
      draw_lines(number%64?:64,number/64);
      return prev;
    case '^n': // List objects (bizarro)
      list_objects_at(number-65,bizplayfield,"bizarro ");
      return prev;
    case '^o': // List objects
      list_objects_at(number-65,playfield,"");
      return prev;

Modified game.doc from [a5b8aab4e8] to [96a141372a].

185
186
187
188
189
190
191

192

193
194
195
  SHIFT+DEL   Delete moves up to mark
  SHIFT+num   Save state 1 to 8
  CTRL+num    Load state 1 to 8
  ALT+num     Exchange state 1 to 8

Mouse (in grid):


  MIDDLE       Describe topmost object

  RIGHT        Inspect objects (main world)
  SHIFT+RIGHT  Inspect objects (bizarro world)








>

>



185
186
187
188
189
190
191
192
193
194
195
196
197
  SHIFT+DEL   Delete moves up to mark
  SHIFT+num   Save state 1 to 8
  CTRL+num    Load state 1 to 8
  ALT+num     Exchange state 1 to 8

Mouse (in grid):

  SHIFT+LEFT   Attempt to move player
  MIDDLE       Describe topmost object
  CTRL+MIDDLE  Show lines
  RIGHT        Inspect objects (main world)
  SHIFT+RIGHT  Inspect objects (bizarro world)

Modified heromesh.h from [99be4437e4] to [85047283e3].

130
131
132
133
134
135
136


137
138
139
140
141
142
143
const char*screen_prompt(const char*txt);
int screen_message(const char*txt);

int scrollbar(int*cur,int page,int max,SDL_Event*ev,SDL_Rect*re);

void draw_popup(const unsigned char*txt);
int modal_draw_popup(const unsigned char*txt);



// == class ==

#define CF_PLAYER 0x01
#define CF_INPUT 0x02
#define CF_COMPATIBLE 0x04
#define CF_QUIZ 0x08







>
>







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
const char*screen_prompt(const char*txt);
int screen_message(const char*txt);

int scrollbar(int*cur,int page,int max,SDL_Event*ev,SDL_Rect*re);

void draw_popup(const unsigned char*txt);
int modal_draw_popup(const unsigned char*txt);

void draw_lines(int x,int y);

// == class ==

#define CF_PLAYER 0x01
#define CF_INPUT 0x02
#define CF_COMPATIBLE 0x04
#define CF_QUIZ 0x08

Modified picture.c from [f537a694cd] to [559e5ca260].

383
384
385
386
387
388
389











































390
391
392
393
394
395
396
            return 0;
        }
        break;
    }
  }
  return -1;
}












































static Uint16 decide_picture_size(int nwantsize,const Uint8*wantsize,const Uint16*havesize,int n) {
  int i,j;
  if(!nwantsize) fatal("Unable to determine what picture size is wanted\n");
  for(i=0;i<nwantsize;i++) if(havesize[j=wantsize[i]]==n) return j;
  for(i=*wantsize;i;--i) if(havesize[i]) return i;
  fatal("Unable to determine what picture size is wanted\n");







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







383
384
385
386
387
388
389
390
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
            return 0;
        }
        break;
    }
  }
  return -1;
}

void draw_lines(int x,int y) {
  Uint8*pix;
  int pitch;
  SDL_Event ev;
  int xx=(x-1)*picture_size+left_margin+picture_size/2;
  int yy=(y-1)*picture_size+picture_size/2;
  set_cursor(XC_cross_reverse);
  if(xx>0 && yy>0 && xx<screen->w && yy<screen->h) {
    SDL_LockSurface(screen);
    pix=screen->pixels;
    pitch=screen->pitch;
    // Diagonal
    for(y=0;y<screen->h;y++) {
      x=xx-yy+y;
      if(x>1 && x<screen->w-2) memcpy(pix+y*pitch+x-2,"\xF0\xF8\xF7\xF8\xF0",5);
      x=xx+yy-y;
      if(x>1 && x<screen->w-2) memcpy(pix+y*pitch+x-2,"\xF0\xF8\xF7\xF8\xF0",5);
    }
    // Vertical
    if(xx+2<screen->w) for(y=0;y<screen->h;y++) pix[y*pitch+xx+2]=0xF0;
    if(xx+1<screen->w) for(y=0;y<screen->h;y++) pix[y*pitch+xx+1]=0xF8;
    for(y=0;y<screen->h;y++) pix[y*pitch+xx]=0xF7;
    if(xx-1>0) for(y=0;y<screen->h;y++) pix[y*pitch+xx-1]=0xF8;
    if(xx-2>0) for(y=0;y<screen->h;y++) pix[y*pitch+xx-2]=0xF0;
    // Horizontal
    if(yy+2<screen->h) memset(pix+(yy+2)*pitch,0xF0,screen->w);
    if(yy+1<screen->h) memset(pix+(yy+1)*pitch,0xF8,screen->w);
    memset(pix+yy*pitch,0xF7,screen->w);
    if(yy-1>0) memset(pix+(yy-1)*pitch,0xF8,screen->w);
    if(yy-2>0) memset(pix+(yy-2)*pitch,0xF0,screen->w);
    SDL_UnlockSurface(screen);
  }
  SDL_Flip(screen);
  while(SDL_WaitEvent(&ev)) switch(ev.type) {
    case SDL_KEYDOWN: case SDL_MOUSEBUTTONDOWN:
    case SDL_KEYUP: case SDL_MOUSEBUTTONUP:
      return;
    case SDL_QUIT:
      SDL_PushEvent(&ev);
      return;
  }
}

static Uint16 decide_picture_size(int nwantsize,const Uint8*wantsize,const Uint16*havesize,int n) {
  int i,j;
  if(!nwantsize) fatal("Unable to determine what picture size is wanted\n");
  for(i=0;i<nwantsize;i++) if(havesize[j=wantsize[i]]==n) return j;
  for(i=*wantsize;i;--i) if(havesize[i]) return i;
  fatal("Unable to determine what picture size is wanted\n");