Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.4 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: pipe.h
  3. *
  4. * PIPE base class
  5. *
  6. * Copyright (c) 1995 Microsoft Corporation
  7. *
  8. \**************************************************************************/
  9. #ifndef __pipe_h__
  10. #define __pipe_h__
  11. #include "sscommon.h"
  12. #include "state.h"
  13. // pipe drawing status
  14. enum {
  15. PIPE_ACTIVE,
  16. PIPE_STUCK,
  17. PIPE_OUT_OF_NODES
  18. };
  19. // pipe types
  20. enum {
  21. TYPE_NORMAL,
  22. TYPE_FLEX_REGULAR,
  23. TYPE_FLEX_TURNING
  24. };
  25. // ways pipe choose directions
  26. enum {
  27. CHOOSE_DIR_RANDOM_WEIGHTED,
  28. CHOOSE_DIR_CHASE // when chasing a lead pipe
  29. };
  30. // ways pipe choose start positions
  31. enum {
  32. CHOOSE_STARTPOS_RANDOM,
  33. CHOOSE_STARTPOS_FURTHEST // furthest from last position
  34. };
  35. /**************************************************************************\
  36. *
  37. * PIPE class
  38. *
  39. * - Describes a pipe that draws thru the node array
  40. * - Could have more than one pipe drawing in each array at same time
  41. * - Pipe has position and direction in node array
  42. *
  43. \**************************************************************************/
  44. class STATE;
  45. class PIPE {
  46. public:
  47. int type;
  48. IPOINT3D curPos; // current node position of pipe
  49. STATE *pState; // for state value access
  50. void SetChooseDirectionMethod( int method );
  51. void SetChooseStartPosMethod( int method );
  52. int ChooseNewDirection();
  53. BOOL IsStuck(); // if pipe is stuck or not
  54. BOOL NowhereToRun(){ return status == PIPE_OUT_OF_NODES; }
  55. protected:
  56. BOOL bTexture;
  57. float radius; // ideal radius (fluctuates for FPIPE)
  58. int status; // ACTIVE/STUCK/STOPPED, etc.
  59. int lastDir; // last direction taken by pipe
  60. int notchVec; // current notch vector
  61. PIPE( STATE *state );
  62. int weightStraight; // current weighting of going straight
  63. BOOL SetStartPos(); // starting node position
  64. void ChooseMaterial();
  65. void DrawTeapot();
  66. void UpdateCurrentPosition( int dir );
  67. void TranslateToCurrentPosition();
  68. private:
  69. int chooseDirMethod;
  70. int chooseStartPosMethod;
  71. int GetBestDirsForChase( int *bestDirs );
  72. };
  73. extern void align_plusz( int newDir );
  74. extern GLint notchTurn[NUM_DIRS][NUM_DIRS][NUM_DIRS];
  75. #endif // __pipe_h__