Source:Hack 1.0/mklev.h
Jump to navigation
Jump to search
Below is the full text to mklev.h from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/mklev.h#line123]], for example.
Warning! This is the source code from an old release. For the latest release, see Source code
Screenshots and source code from Hack are used under the CWI license.
1. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */ 2. 3. #include "config.h" 4. 5. #ifdef BSD 6. #include <strings.h> /* declarations for strcat etc. */ 7. #else 8. #include <string.h> /* idem on System V */ 9. #define index strchr 10. #define rindex strrchr 11. #endif BSD 12. 13. #include "def.objclass.h" 14. 15. typedef struct { 16. xchar x,y; 17. } coord; 18. 19. #include "def.monst.h" /* uses coord */ 20. #include "def.gen.h" 21. #include "def.obj.h" 22. 23. extern char *sprintf(); 24. 25. #define BUFSZ 256 /* for getlin buffers */ 26. #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */ 27. 28. #define HWALL 1 /* Level location types */ 29. #define VWALL 2 30. #define SDOOR 3 31. #define SCORR 4 32. #define LDOOR 5 33. #define DOOR 6 /* smallest accessible type */ 34. #define CORR 7 35. #define ROOM 8 36. #define STAIRS 9 37. #ifdef QUEST 38. #define CORR_SYM ':' 39. #else 40. #define CORR_SYM '#' 41. #endif QUEST 42. 43. #define ERRCHAR '{' 44. 45. #define TRAPNUM 9 46. 47. struct rm { 48. char scrsym; 49. unsigned typ:5; 50. unsigned new:1; 51. unsigned seen:1; 52. unsigned lit:1; 53. }; 54. extern struct rm levl[COLNO][ROWNO]; 55. 56. #ifndef QUEST 57. struct mkroom { 58. xchar lx,hx,ly,hy; 59. schar rtype,rlit,doorct,fdoor; 60. }; 61. #define MAXNROFROOMS 15 62. extern struct mkroom rooms[MAXNROFROOMS+1]; 63. #define DOORMAX 100 64. extern coord doors[DOORMAX]; 65. #endif QUEST 66. 67. 68. #include "def.permonst.h" 69. extern struct permonst mons[]; 70. #define PM_ACIDBLOB &mons[7] 71. #define PM_PIERC &mons[17] 72. #define PM_MIMIC &mons[37] 73. #define PM_CHAM &mons[47] 74. #define PM_DEMON &mons[54] 75. #define PM_MINOTAUR &mons[55] /* last in mons array */ 76. #define PM_SHK &mons[56] /* very last */ 77. #define CMNUM 55 /* number of common monsters */ 78. 79. extern long *alloc(); 80. 81. extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */ 82. 83. extern xchar dlevel; 84. #ifdef WIZARD 85. extern boolean wizard; 86. #endif WIZARD 87. #define newstring(x) (char *) alloc((unsigned)(x))