Free Hero Mesh

Check-in [5b7677692b]
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 possibility to select levels.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5b7677692bd5608ac659ba6020d79ce40aa9cf26
User & Date: user on 2020-11-17 00:51:29
Other Links: manifest | tags
Context
2020-11-19
00:00
Correct a mistake in the level conversion check-in: 086b55093c user: user tags: trunk
2020-11-17
00:51
Add possibility to select levels. check-in: 5b7677692b user: user tags: trunk
2020-11-16
22:44
Correct some mistakes in the level loading check-in: 8809d628a4 user: user tags: trunk
Changes

Modified edit.c from [9c9daca4d1] to [3d6313a0b5].

312
313
314
315
316
317
318



319
320
321
322
323
324
325
}

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;
    default:
      return prev;
  }







>
>
>







312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
}

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 '^L': // Select level
      load_level(number);
      return 1;
    case '^P': // Play
      return -2;
    case '^Q': // Quit
      return -1;
    default:
      return prev;
  }

Modified heromesh.h from [5840e387ed] to [7f03c73a50].

68
69
70
71
72
73
74

75
76
77
78
79
80
81
#define StackProtection() 0
#endif

unsigned char*read_lump(int sol,int lvl,long*sz,sqlite3_value**us);
void write_lump(int sol,int lvl,long sz,const unsigned char*data);
const char*load_level(int lvl);
void set_cursor(int id);


#define FIL_SOLUTION 1
#define FIL_LEVEL 0
#define LUMP_LEVEL_IDX (-1)
#define LUMP_CLASS_DEF (-2)

// == picture ==







>







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#define StackProtection() 0
#endif

unsigned char*read_lump(int sol,int lvl,long*sz,sqlite3_value**us);
void write_lump(int sol,int lvl,long sz,const unsigned char*data);
const char*load_level(int lvl);
void set_cursor(int id);
const char*log_if_error(const char*t);

#define FIL_SOLUTION 1
#define FIL_LEVEL 0
#define LUMP_LEVEL_IDX (-1)
#define LUMP_CLASS_DEF (-2)

// == picture ==

Modified main.c from [1983533b19] to [eeee5538b3].

790
791
792
793
794
795
796





797
798
799
800
801
802
803
  } else if(*v=='H') {
    v=malloc(strtoll(v+1,0,0));
    fatal("%p %p :: %lld\n",v,stack_protect_mark,(long long)(((char*)stack_protect_mark)-v));
  }
  if(v[1]) stack_protect_mark=((char*)stack_protect_mark)+strtoll(v+1,0,0);
}
#endif






int main(int argc,char**argv) {
  int optind=1;
  while(argc>optind && argv[optind][0]=='-') {
    int i;
    const char*s=argv[optind++];
    if(s[1]=='-' && !s[2]) break;







>
>
>
>
>







790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
  } else if(*v=='H') {
    v=malloc(strtoll(v+1,0,0));
    fatal("%p %p :: %lld\n",v,stack_protect_mark,(long long)(((char*)stack_protect_mark)-v));
  }
  if(v[1]) stack_protect_mark=((char*)stack_protect_mark)+strtoll(v+1,0,0);
}
#endif

const char*log_if_error(const char*t) {
  if(t && main_options['v']) fprintf(stderr,"!! %s\n",t);
  return t;
}

int main(int argc,char**argv) {
  int optind=1;
  while(argc>optind && argv[optind][0]=='-') {
    int i;
    const char*s=argv[optind++];
    if(s[1]=='-' && !s[2]) break;
837
838
839
840
841
842
843


844
845
846
847
848
849
850
  }
  init_usercache();
  load_classes();
  load_level_index();
  optionquery[1]=Q_maxObjects;
  max_objects=strtoll(xrm_get_resource(resourcedb,optionquery,optionquery,2)?:"",0,0)?:0xFFFF0000L;
  annihilate();


  if(main_options['x']) {
    fprintf(stderr,"Ready for executing SQL statements.\n");
    do_sql_mode();
    return 0;
  }
  for(;;) { if(main_options['e']) run_editor(); else run_game(); }
}







>
>







842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
  }
  init_usercache();
  load_classes();
  load_level_index();
  optionquery[1]=Q_maxObjects;
  max_objects=strtoll(xrm_get_resource(resourcedb,optionquery,optionquery,2)?:"",0,0)?:0xFFFF0000L;
  annihilate();
  optionquery[1]=Q_level;
  if(level_ord=strtol(xrm_get_resource(resourcedb,optionquery,optionquery,2)?:"",0,10)) log_if_error(load_level(-level_ord));
  if(main_options['x']) {
    fprintf(stderr,"Ready for executing SQL statements.\n");
    do_sql_mode();
    return 0;
  }
  for(;;) { if(main_options['e']) run_editor(); else run_game(); }
}