abstract
| - Below is the full text to vision.h from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[SLASH'EM 0.0.7E7F2/vision.h#line123]], for example. The latest source code for vanilla NetHack is at Source code. 1. /* SCCS Id: @(#)vision.h 3.4 1995/01/26 */ 2. /* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */ 3. /* NetHack may be freely redistributed. See license for details. */ 4. 5. #ifndef VISION_H 6. #define VISION_H 7. 8. #if 0 /* (moved to decl.h) */ 9. extern boolean vision_full_recalc; /* TRUE if need vision recalc */ 10. extern char **viz_array; /* could see/in sight row pointers */ 11. extern char *viz_rmin; /* min could see indices */ 12. extern char *viz_rmax; /* max could see indices */ 13. #endif 14. #define COULD_SEE 0x1 /* location could be seen, if it were lit */ 15. #define IN_SIGHT 0x2 /* location can be seen */ 16. #define TEMP_LIT 0x4 /* location is temporarily lit */ 17. 18. /* 19. * Light source sources 20. */ 21. #define LS_OBJECT 0 22. #define LS_MONSTER 1 23. /* WAC Added a new light source temp type 24. * This is meant to be called within a function and destroyed before 25. * control is returned to user. They are NOT saved. Used for light 26. * sourcing spells, explosions, etc. 27. */ 28. #define LS_TEMP 2 29. /* 30. * cansee() - Returns true if the hero can see the location. 31. * 32. * couldsee() - Returns true if the hero has a clear line of sight to 33. * the location. 34. */ 35. #define cansee(x,y) (viz_array[y][x] & IN_SIGHT) 36. #define couldsee(x,y) (viz_array[y][x] & COULD_SEE) 37. #define templit(x,y) (viz_array[y][x] & TEMP_LIT) 38. 39. /* 40. * The following assume the monster is not blind. 41. * 42. * m_cansee() - Returns true if the monster can see the given location. 43. * 44. * m_canseeu() - Returns true if the monster could see the hero. Assumes 45. * that if the hero has a clear line of sight to the monster's 46. * location and the hero is visible, then monster can see the 47. * hero. 48. */ 49. #define m_cansee(mtmp,x2,y2) clear_path((mtmp)->mx,(mtmp)->my,(x2),(y2)) 50. 51. #define m_canseeu(m) ((!Invis || perceives((m)->data)) && \ 52. !(Underwater || u.uburied || (m)->mburied) ? \ 53. couldsee((m)->mx,(m)->my) : 0) 54. 55. /* 56. * Circle information 57. */ 58. #define MAX_RADIUS 15 /* this is in points from the source */ 59. 60. /* Use this macro to get a list of distances of the edges (see vision.c). */ 61. #define circle_ptr(z) (&circle_data[(int)circle_start[z]]) 62. 63. #endif /* VISION_H */
|