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.

100 lines
2.3 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: fstate.cxx
  3. *
  4. * FLEX_STATE
  5. *
  6. * Copyright (c) 1995 Microsoft Corporation
  7. *
  8. \**************************************************************************/
  9. #include <stdio.h>
  10. #include <string.h>
  11. #include <stdlib.h>
  12. #include <math.h>
  13. #include <sys/types.h>
  14. #include <sys/timeb.h>
  15. #include <time.h>
  16. #include <windows.h>
  17. #include "sspipes.h"
  18. #include "fstate.h"
  19. #include "nstate.h"
  20. #include "npipe.h"
  21. #include "fpipe.h"
  22. /******************************Public*Routine******************************\
  23. * FLEX_STATE constructor
  24. *
  25. * Jul. 95 [marcfo]
  26. *
  27. \**************************************************************************/
  28. FLEX_STATE::FLEX_STATE( STATE *pState )
  29. {
  30. bTexture = pState->bTexture;
  31. Reset();
  32. }
  33. /**************************************************************************\
  34. * Reset
  35. *
  36. * Reset a frame of normal pipes.
  37. *
  38. \**************************************************************************/
  39. void
  40. FLEX_STATE::Reset( )
  41. {
  42. // Choose a random scheme for each frame
  43. if( ss_iRand(2) ) // 50/50
  44. scheme = SC_EXTRUDED_XC;
  45. else
  46. scheme = SC_TURNOMANIA;
  47. }
  48. /**************************************************************************\
  49. * OKToUseChase
  50. *
  51. * Determines if we can use chase mode for flex pipes
  52. *
  53. \**************************************************************************/
  54. BOOL
  55. FLEX_STATE::OKToUseChase( )
  56. {
  57. return scheme != SC_TURNOMANIA;
  58. }
  59. /**************************************************************************\
  60. * NewPipe
  61. *
  62. * Create a new pipe, based on current drawing scheme
  63. *
  64. \**************************************************************************/
  65. PIPE*
  66. FLEX_STATE::NewPipe( STATE *pState )
  67. {
  68. if( scheme == SC_TURNOMANIA )
  69. return new TURNING_FLEX_PIPE( pState );
  70. else
  71. return new REGULAR_FLEX_PIPE( pState );
  72. }
  73. /**************************************************************************\
  74. * GetMaxPipesPerFrame
  75. *
  76. \**************************************************************************/
  77. int
  78. FLEX_STATE::GetMaxPipesPerFrame( )
  79. {
  80. if( scheme == SC_TURNOMANIA ) {
  81. return TURNOMANIA_PIPE_COUNT;
  82. if( bTexture )
  83. return TURNOMANIA_PIPE_COUNT / 2;
  84. } else {
  85. return bTexture ? NORMAL_TEX_PIPE_COUNT : NORMAL_PIPE_COUNT;
  86. }
  87. }