Free Hero Mesh

Check-in [0770ad617e]
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 '^d' and horizontal lines in popup texts
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0770ad617e00739fea35436f9be484a8de5f9b26
User & Date: user on 2020-12-20 21:40:05
Other Links: manifest | tags
Context
2020-12-21
01:20
Implement LocateMe check-in: c32d302e15 user: user tags: trunk
2020-12-20
21:40
Implement '^d' and horizontal lines in popup texts check-in: 0770ad617e user: user tags: trunk
21:17
Implement NewX and NewY check-in: 8f8397ce1b user: user tags: trunk
Changes

Modified bindings.doc from [91d6e26158] to [0aa5695774].

58
59
60
61
62
63
64



65
66
67
68
69
70
71

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

'^T'
  Display the level title popup.




'^o' <location>
  List objects at the specified coordinates.


=== Editor commands ===

'^c'







>
>
>







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

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

'^T'
  Display the level title popup.

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

'^o' <location>
  List objects at the specified coordinates.


=== Editor commands ===

'^c'

Modified game.c from [0e527e4bff] to [718011a9b2].

381
382
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
        goto redraw;
      case SDL_QUIT:
        exit(0);
        break;
    }
  }
}
















static int game_command(int prev,int cmd,int number,int argc,sqlite3_stmt*args,void*aux) {
  switch(cmd) {
    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 '^E': // Edit
      return -2;
    case '^Q': // Quit
      return -1;
    case '^T': // Show title
      modal_draw_popup(level_title);



      return prev;
    case '^o': // List objects
      list_objects_at(number-65);
      return prev;
    case 'go': // Select level
      begin_level(number);
      return 1;







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
















>
>
>







381
382
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
        goto redraw;
      case SDL_QUIT:
        exit(0);
        break;
    }
  }
}

static void describe_at(int xy) {
  unsigned char*s;
  Uint32 n;
  if(xy<0 || xy>=64*64) return;
  n=playfield[xy];
  if(n==VOIDLINK) return;
  while(n!=VOIDLINK && objects[n]->up!=VOIDLINK) n=objects[n]->up;
  if(!classes[objects[n]->class]->gamehelp) return;
  s=sqlite3_mprintf("\x0C\x0E%s:%d\\ %s\x0B\x0F%s",classes[objects[n]->class]->name,objects[n]->image,classes[objects[n]->class]->name,classes[objects[n]->class]->gamehelp);
  if(!s) fatal("Allocation failed\n");
  
  modal_draw_popup(s);
  sqlite3_free(s);
}

static int game_command(int prev,int cmd,int number,int argc,sqlite3_stmt*args,void*aux) {
  switch(cmd) {
    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 '^E': // Edit
      return -2;
    case '^Q': // Quit
      return -1;
    case '^T': // Show title
      modal_draw_popup(level_title);
      return prev;
    case '^d': // Describe object
      describe_at(number-65);
      return prev;
    case '^o': // List objects
      list_objects_at(number-65);
      return prev;
    case 'go': // Select level
      begin_level(number);
      return 1;

Modified picture.c from [b40b537e21] to [e314be6a7b].

563
564
565
566
567
568
569
570




571
572
573
574
575
576
577

typedef struct {
  Uint8 a,h;
  Uint16 w;
} PopLine;

static void pop_bar(int x,int y,PopLine*li,int w) {
  




}

static void pop_char(int x,int y,PopLine*li,Uint8 c,Uint8 v) {
  Uint8*p=screen->pixels;
  Uint16 pitch=screen->pitch;
  int xx,yy;
  const unsigned char*f=fontdata+(v<<3);







|
>
>
>
>







563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581

typedef struct {
  Uint8 a,h;
  Uint16 w;
} PopLine;

static void pop_bar(int x,int y,PopLine*li,int w) {
  Uint8*p=screen->pixels;
  Uint16 pitch=screen->pitch;
  if(x+w>=screen->w || y+8>screen->h) return;
  p+=(y+3)*pitch+x;
  while(w--) *p++=w&1?7:5;
}

static void pop_char(int x,int y,PopLine*li,Uint8 c,Uint8 v) {
  Uint8*p=screen->pixels;
  Uint16 pitch=screen->pitch;
  int xx,yy;
  const unsigned char*f=fontdata+(v<<3);
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
      pop_image(x,y,li+ln,p);
      x+=picture_size;
      p=strchr(p,'\\')?:"";
      if(*p) p++;
      break;
    case 15:
      y+=li[ln++].h;
      pop_bar(bx,y,li+ln,tw);
      y+=8;
      if(ln<64) x=li[ln].a?bx+(tw-li[ln].w)/2:bx;
      break;
    case 16:
      pop_quiz(x,y,li+ln,c,*p);
      if(*p) p++;
      x+=24;







|







741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
      pop_image(x,y,li+ln,p);
      x+=picture_size;
      p=strchr(p,'\\')?:"";
      if(*p) p++;
      break;
    case 15:
      y+=li[ln++].h;
      pop_bar(bx-8,y,li+ln,tw+22);
      y+=8;
      if(ln<64) x=li[ln].a?bx+(tw-li[ln].w)/2:bx;
      break;
    case 16:
      pop_quiz(x,y,li+ln,c,*p);
      if(*p) p++;
      x+=24;