Free Hero Mesh

Check-in [091fa5cd59]
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 CONFIG_FUNCTION_ASK_TEXT (full code page capability is not implemented in this function; this may be fixed in future)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 091fa5cd59e13fc80a01ec4c0b2844be7c061dcb
User & Date: user on 2022-12-07 07:16:47
Other Links: manifest | tags
Context
2022-12-27
07:07
Fix a mistake in mbtofhm.c, and document ImageSeq and ImageLoop (presumably, they were used in the MESH:Hero engine before Animate was implemented; a few puzzle sets use them, though; in future they will also be implemented in Free Hero Mesh) check-in: bd67743bfa user: user tags: trunk
2022-12-07
07:16
Implement CONFIG_FUNCTION_ASK_TEXT (full code page capability is not implemented in this function; this may be fixed in future) check-in: 091fa5cd59 user: user tags: trunk
2022-11-07
07:29
Additions to FAQ. check-in: ef8fe744ff user: user tags: trunk
Changes

Modified comconfig.doc from [51d7f6c934] to [84d41654b9].

15
16
17
18
19
20
21









22
23
24
25
26
27
28
  If defined, read resource configuration from the specified file if
  it cannot find the configuration file in the home directory.

CONFIG_EXTRA_SCREEN_INIT
  Can be a C code to be executed after the video mode is set, but before
  any other screen initialization is done.










CONFIG_GLOBAL_HASH_SIZE
  Size of global hash table when reading class definition file. This must
  be less than 65535.

CONFIG_LOCAL_HASH_SIZE
  Size of local hash table when reading class definition file. This must
  be less than 65535.







>
>
>
>
>
>
>
>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  If defined, read resource configuration from the specified file if
  it cannot find the configuration file in the home directory.

CONFIG_EXTRA_SCREEN_INIT
  Can be a C code to be executed after the video mode is set, but before
  any other screen initialization is done.

CONFIG_FUNCTION_ASK_TEXT
  Should be a function or macro taking four arguments, which will ask for
  and accept a single line of text. The first argument is the SDL screen
  object, the second is the prompt text, the third is the code page number
  for the prompt text, and the fourth is the code page number for the
  input. The result is a pointer to a buffer (which the caller need not
  free, and will not write to) containing the null-terminated text, or a
  null pointer if the prompt has been cancelled by the user.

CONFIG_GLOBAL_HASH_SIZE
  Size of global hash table when reading class definition file. This must
  be less than 65535.

CONFIG_LOCAL_HASH_SIZE
  Size of local hash table when reading class definition file. This must
  be less than 65535.
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  processing. Some calculations are not affected by this option.

CONFIG_ERROR_CHECKING
  Define error checking level, where 9 is maximum. Lower numbers might
  improve speed but may make the program crash in some cases and may also
  cause security vulnerabilities.

CONFIG_FUNCTION_ASK_TEXT
  Should be a function or macro taking four arguments, which will ask for
  and accept a single line of text. The first argument is the SDL screen
  object, the second is the prompt text, the third is the code page number
  for the prompt text, and the fourth is the code page number for the
  input. The result is a pointer to a buffer (which the caller need not
  free, and will not write to) containing the null-terminated text, or a
  null pointer if the prompt has been cancelled by the user.

CONFIG_LAUNCHER_PATH
  If defined, then it is the full path to a file to execute if Free Hero
  Mesh has been invoked with no command-line arguments, or if it is given
  the flag to run the launcher program instead. (Maybe this should not be
  implemented; you can run the separate launcher program directly instead.
  Maybe it will be the other way around, if compiled to use AppImage.)








<
<
<
<
<
<
<
<
<







73
74
75
76
77
78
79









80
81
82
83
84
85
86
  processing. Some calculations are not affected by this option.

CONFIG_ERROR_CHECKING
  Define error checking level, where 9 is maximum. Lower numbers might
  improve speed but may make the program crash in some cases and may also
  cause security vulnerabilities.










CONFIG_LAUNCHER_PATH
  If defined, then it is the full path to a file to execute if Free Hero
  Mesh has been invoked with no command-line arguments, or if it is given
  the flag to run the launcher program instead. (Maybe this should not be
  implemented; you can run the separate launcher program directly instead.
  Maybe it will be the other way around, if compiled to use AppImage.)

Modified picture.c from [ff76ebbf80] to [3dfb2527a6].

250
251
252
253
254
255
256



257
258
259
260
261
262
263
    for(xx=0;xx<8;xx++) p[xx+8]=(*f>>xx)&1?fg:bg;
    p+=pitch;
    ++f;
  }
}

const char*screen_prompt(const char*txt) {



  static char*t=0;
  int n=0;
  SDL_Rect r={0,0,screen->w,16};
  int m=r.w>>3;
  SDL_Event ev;
  if(!t) {
    t=malloc(m+2);







>
>
>







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
    for(xx=0;xx<8;xx++) p[xx+8]=(*f>>xx)&1?fg:bg;
    p+=pitch;
    ++f;
  }
}

const char*screen_prompt(const char*txt) {
#ifdef CONFIG_FUNCTION_ASK_TEXT
  return CONFIG_FUNCTION_ASK_TEXT(screen,txt,367,0);
#else
  static char*t=0;
  int n=0;
  SDL_Rect r={0,0,screen->w,16};
  int m=r.w>>3;
  SDL_Event ev;
  if(!t) {
    t=malloc(m+2);
338
339
340
341
342
343
344

345
346
347
348
349
350
351
        break;
      case SDL_MOUSEBUTTONDOWN:
        if(ev.button.button==2) goto paste;
        break;
    }
  }
  return 0;

}

int screen_message(const char*txt) {
  int n=0;
  SDL_Rect r={0,0,0,16};
  SDL_Event ev;
  if(!screen) {







>







341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
        break;
      case SDL_MOUSEBUTTONDOWN:
        if(ev.button.button==2) goto paste;
        break;
    }
  }
  return 0;
#endif
}

int screen_message(const char*txt) {
  int n=0;
  SDL_Rect r={0,0,0,16};
  SDL_Event ev;
  if(!screen) {