m_misc.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* Emacs style mode select -*- C++ -*-
  2. *-----------------------------------------------------------------------------
  3. *
  4. *
  5. * PrBoom: a Doom port merged with LxDoom and LSDLDoom
  6. * based on BOOM, a modified and improved DOOM engine
  7. * Copyright (C) 1999 by
  8. * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
  9. * Copyright (C) 1999-2000 by
  10. * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
  11. * Copyright 2005, 2006 by
  12. * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License
  16. * as published by the Free Software Foundation; either version 2
  17. * of the License, or (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  27. * 02111-1307, USA.
  28. *
  29. * DESCRIPTION:
  30. * External non-system-specific stuff, like storing config settings,
  31. * simple file handling, and saving screnshots.
  32. *
  33. *-----------------------------------------------------------------------------*/
  34. #ifndef __M_MISC__
  35. #define __M_MISC__
  36. #include "doomtype.h"
  37. //
  38. // MISC
  39. //
  40. boolean M_WriteFile (char const* name,void* source,int length);
  41. int M_ReadFile (char const* name,byte** buffer);
  42. void M_ScreenShot (void);
  43. void M_DoScreenShot (const char*); // cph
  44. void M_LoadDefaults (void);
  45. void M_SaveDefaults (void);
  46. struct default_s *M_LookupDefault(const char *name); /* killough 11/98 */
  47. // phares 4/21/98:
  48. // Moved from m_misc.c so m_menu.c could see it.
  49. // CPhipps - struct to hold a value in a config file
  50. // Cannot be a union, as it must be initialised
  51. typedef struct default_s
  52. {
  53. const char* name;
  54. /* cph -
  55. * The location struct holds the pointer to the variable holding the
  56. * setting. For int's we do nothing special.
  57. * For strings, the string is actually stored on our heap with Z_Strdup()
  58. * BUT we don't want the rest of the program to be able to modify them,
  59. * so we declare it const. It's not really const though, and m_misc.c and
  60. * m_menu.c cast it back when they need to change it. Possibly this is
  61. * more trouble than it's worth.
  62. */
  63. struct {
  64. int* pi;
  65. const char** ppsz;
  66. } location;
  67. struct {
  68. int i;
  69. const char* psz;
  70. } defaultvalue; // CPhipps - default value
  71. // Limits (for an int)
  72. int minvalue; // jff 3/3/98 minimum allowed value
  73. int maxvalue; // jff 3/3/98 maximum allowed value
  74. enum {
  75. def_none, // Dummy entry
  76. def_str, // A string
  77. def_int, // Integer
  78. def_hex, // Integer (write in hex)
  79. def_bool = def_int, // Boolean
  80. def_key = def_hex, // Key code (byte)
  81. def_mouseb = def_int,// Mouse button
  82. def_colour = def_hex // Colour (256 colour palette entry)
  83. } type; // CPhipps - type of entry
  84. int setupscreen; // phares 4/19/98: setup screen where this appears
  85. int *current; /* cph - MBF-like pointer to current value */
  86. // cph - removed the help strings from the config file
  87. // const char* help; // jff 3/3/98 description of parameter
  88. // CPhipps - remove unused "lousy hack" code
  89. struct setup_menu_s *setup_menu; /* Xref to setup menu item, if any */
  90. } default_t;
  91. #define IS_STRING(dv) ((dv).type == def_str)
  92. // CPhipps - What is the max. key code that X will send us?
  93. #define MAX_KEY 65536
  94. #define MAX_MOUSEB 2
  95. #define UL (-123456789) /* magic number for no min or max for parameter */
  96. #endif