FVI.H 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
  12. */
  13. /*
  14. * $Source: f:/miner/source/main/rcs/fvi.h $
  15. * $Revision: 2.1 $
  16. * $Author: john $
  17. * $Date: 1995/03/20 18:15:58 $
  18. *
  19. * Header for fvi.c
  20. *
  21. * $Log: fvi.h $
  22. * Revision 2.1 1995/03/20 18:15:58 john
  23. * Added code to not store the normals in the segment structure.
  24. *
  25. * Revision 2.0 1995/02/27 11:32:02 john
  26. * New version 2.0, which has no anonymous unions, builds with
  27. * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
  28. *
  29. * Revision 1.10 1995/02/02 14:07:58 matt
  30. * Fixed confusion about which segment you are touching when you're
  31. * touching a wall. This manifested itself in spurious lava burns.
  32. *
  33. * Revision 1.9 1994/12/04 22:48:04 matt
  34. * Physics & FVI now only build seglist for player objects, and they
  35. * responsilby deal with buffer full conditions
  36. *
  37. * Revision 1.8 1994/10/31 12:28:01 matt
  38. * Added new function object_intersects_wall()
  39. *
  40. * Revision 1.7 1994/10/10 13:10:00 matt
  41. * Increased max_fvi_segs
  42. *
  43. * Revision 1.6 1994/09/25 00:38:29 matt
  44. * Made the 'find the point in the bitmap where something hit' system
  45. * publicly accessible.
  46. *
  47. * Revision 1.5 1994/08/01 13:30:35 matt
  48. * Made fvi() check holes in transparent walls, and changed fvi() calling
  49. * parms to take all input data in query structure.
  50. *
  51. * Revision 1.4 1994/07/13 21:47:59 matt
  52. * FVI() and physics now keep lists of segments passed through which the
  53. * trigger code uses.
  54. *
  55. * Revision 1.3 1994/07/08 14:27:26 matt
  56. * Non-needed powerups don't get picked up now; this required changing FVI to
  57. * take a list of ingore objects rather than just one ignore object.
  58. *
  59. * Revision 1.2 1994/06/09 09:58:39 matt
  60. * Moved find_vector_intersection() from physics.c to new file fvi.c
  61. *
  62. * Revision 1.1 1994/06/09 09:26:14 matt
  63. * Initial revision
  64. *
  65. *
  66. */
  67. #ifndef _FVI_H
  68. #define _FVI_H
  69. #include "vecmat.h"
  70. #include "segment.h"
  71. #include "object.h"
  72. //return values for find_vector_intersection() - what did we hit?
  73. #define HIT_NONE 0 //we hit nothing
  74. #define HIT_WALL 1 //we hit - guess - a wall
  75. #define HIT_OBJECT 2 //we hit an object - which one? no way to tell...
  76. #define HIT_BAD_P0 3 //start point not is specified segment
  77. #define MAX_FVI_SEGS 100
  78. //this data structure gets filled in by find_vector_intersection()
  79. typedef struct fvi_info {
  80. int hit_type; //what sort of intersection
  81. vms_vector hit_pnt; //where we hit
  82. int hit_seg; //what segment hit_pnt is in
  83. int hit_side; //if hit wall, which side
  84. int hit_side_seg; //what segment the hit side is in
  85. int hit_object; //if object hit, which object
  86. vms_vector hit_wallnorm; //if hit wall, ptr to its surface normal
  87. int n_segs; //how many segs we went through
  88. int seglist[MAX_FVI_SEGS]; //list of segs vector went through
  89. } fvi_info;
  90. //flags for fvi query
  91. #define FQ_CHECK_OBJS 1 //check against objects?
  92. #define FQ_TRANSWALL 2 //go through transparent walls
  93. #define FQ_TRANSPOINT 4 //go through trans wall if hit point is transparent
  94. #define FQ_GET_SEGLIST 8 //build a list of segments
  95. //this data contains the parms to fvi()
  96. typedef struct fvi_query {
  97. vms_vector *p0,*p1;
  98. int startseg;
  99. fix rad;
  100. short thisobjnum;
  101. int *ignore_obj_list;
  102. int flags;
  103. } fvi_query;
  104. //Find out if a vector intersects with anything.
  105. //Fills in hit_data, an fvi_info structure (see above).
  106. //Parms:
  107. // p0 & startseg describe the start of the vector
  108. // p1 the end of the vector
  109. // rad the radius of the cylinder
  110. // thisobjnum used to prevent an object with colliding with itself
  111. // ingore_obj_list NULL, or ptr to a list of objnums to ignore, terminated with -1
  112. // check_obj_flag determines whether collisions with objects are checked
  113. //Returns the hit_data->hit_type
  114. int find_vector_intersection(fvi_query *fq,fvi_info *hit_data);
  115. //finds the uv coords of the given point on the given seg & side
  116. //fills in u & v
  117. find_hitpoint_uv(fix *u,fix *v,vms_vector *pnt,segment *seg,int sidenum,int facenum);
  118. //Returns true if the object is through any walls
  119. int object_intersects_wall(object *objp);
  120. #endif
  121.