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.

84 lines
2.1 KiB

  1. //-----------------------------------------------------------------------------
  2. // File: fstate.cpp
  3. //
  4. // Desc: FLEX_STATE
  5. //
  6. // Copyright (c) 1994-2000 Microsoft Corporation
  7. //-----------------------------------------------------------------------------
  8. #include "stdafx.h"
  9. //-----------------------------------------------------------------------------
  10. // Name: FLEX_STATE constructor
  11. // Desc:
  12. //-----------------------------------------------------------------------------
  13. FLEX_STATE::FLEX_STATE( STATE *pMainState )
  14. {
  15. m_pMainState = pMainState;
  16. Reset();
  17. }
  18. //-----------------------------------------------------------------------------
  19. // Name: Reset
  20. // Desc: Reset a frame of normal pipes.
  21. //-----------------------------------------------------------------------------
  22. void FLEX_STATE::Reset( )
  23. {
  24. // Choose a random scheme for each frame
  25. if( CPipesScreensaver::iRand(2) ) // 50/50
  26. m_scheme = SC_EXTRUDED_XC;
  27. else
  28. m_scheme = SC_TURNOMANIA;
  29. }
  30. //-----------------------------------------------------------------------------
  31. // Name: OKToUseChase
  32. // Desc: Determines if we can use chase mode for flex pipes
  33. //-----------------------------------------------------------------------------
  34. BOOL FLEX_STATE::OKToUseChase()
  35. {
  36. return m_scheme != SC_TURNOMANIA;
  37. }
  38. //-----------------------------------------------------------------------------
  39. // Name: NewPipe
  40. // Desc: Create a new pipe, based on current drawing scheme
  41. //-----------------------------------------------------------------------------
  42. PIPE* FLEX_STATE::NewPipe( STATE *pState )
  43. {
  44. if( m_scheme == SC_TURNOMANIA )
  45. return new TURNING_FLEX_PIPE( pState );
  46. else
  47. return new REGULAR_FLEX_PIPE( pState );
  48. }
  49. //-----------------------------------------------------------------------------
  50. // Name: GetMaxPipesPerFrame
  51. // Desc:
  52. //-----------------------------------------------------------------------------
  53. int FLEX_STATE::GetMaxPipesPerFrame( )
  54. {
  55. if( m_scheme == SC_TURNOMANIA )
  56. {
  57. return TURNOMANIA_PIPE_COUNT;
  58. }
  59. else
  60. {
  61. return m_pMainState->m_bUseTexture ? NORMAL_TEX_PIPE_COUNT : NORMAL_PIPE_COUNT;
  62. }
  63. }