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.

182 lines
2.6 KiB

  1. #ifdef PM
  2. #include <cstd.h>
  3. #define INCL_WIN
  4. #define INCL_GPI
  5. #include <os2.h>
  6. INT _acrtused = 0;
  7. #endif
  8. #ifdef WIN
  9. #include <windows.h>
  10. #include <port1632.h>
  11. #endif
  12. #include "std.h"
  13. #include "scrsave.h"
  14. INT rand();
  15. INT dxScreen, dyScreen;
  16. #define wtDown 0
  17. #define wtUp 1
  18. #define wtLeft 2
  19. #define wtRight 3
  20. #define wtIn 4
  21. #define wtOut 5
  22. #define wtMax 6
  23. INT wt;
  24. INT x, y;
  25. BOOL EXPENTRY ScrSaveProc(INT ssm, LPVOID l1, LONG_PTR l2, LONG_PTR l3)
  26. {
  27. CHAR FAR * lpsz;
  28. CHAR FAR * lpch;
  29. BOOL fDone = FALSE;
  30. switch (ssm)
  31. {
  32. default:
  33. return fFalse;
  34. case SSM_OPEN:
  35. lpsz = (PSZ) l1;
  36. lpch = "Wipe Out";
  37. while ((*lpsz++ = *lpch++) != '\0')
  38. ;
  39. lpsz = (PSZ) l2;
  40. lpch = "Various Wipes, then Random\n\nby Brad Christian";
  41. while ((*lpsz++ = *lpch++) != '\0')
  42. ;
  43. #ifdef PM
  44. dxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
  45. dyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
  46. #endif
  47. #ifdef WIN
  48. dxScreen = GetSystemMetrics(SM_CXSCREEN);
  49. dyScreen = GetSystemMetrics(SM_CYSCREEN);
  50. #endif
  51. break;
  52. case SSM_BLANK:
  53. switch (wt = WRand(wtMax))
  54. {
  55. case wtDown:
  56. y = dyScreen;
  57. break;
  58. case wtUp:
  59. y = 0;
  60. break;
  61. case wtLeft:
  62. x = dxScreen;
  63. break;
  64. case wtRight:
  65. x = 0;
  66. break;
  67. case wtIn:
  68. x = 0;
  69. y = 0;
  70. break;
  71. case wtOut:
  72. x = dxScreen / 2;
  73. y = dyScreen / 2;
  74. break;
  75. }
  76. break;
  77. case SSM_ANIMATE:
  78. {
  79. RECT rect;
  80. switch (wt)
  81. {
  82. case wtDown:
  83. if (y <= 0)
  84. fDone = TRUE;
  85. rect.left = 0;
  86. rect.right = dxScreen;
  87. rect.top = y;
  88. rect.bottom = y - 16;
  89. y -= 16;
  90. break;
  91. case wtUp:
  92. if (y >= dyScreen - 1)
  93. fDone = TRUE;
  94. rect.left = 0;
  95. rect.right = dxScreen;
  96. rect.top = y + 16;
  97. rect.bottom = y;
  98. y += 16;
  99. break;
  100. case wtLeft:
  101. if (x <= 0)
  102. fDone = TRUE;
  103. rect.left = x;
  104. rect.right = x + 16;
  105. rect.top = dyScreen;
  106. rect.bottom = 0;
  107. x -= 16;
  108. break;
  109. case wtRight:
  110. if (x >= dxScreen - 1)
  111. fDone = TRUE;
  112. rect.left = x;
  113. rect.right = x + 16;
  114. rect.top = dyScreen;
  115. rect.bottom = 0;
  116. x += 16;
  117. break;
  118. case wtIn:
  119. fDone = fTrue; // REVIEW
  120. break;
  121. case wtOut:
  122. if (x <= 0 && y <= 0)
  123. fDone = TRUE;
  124. rect.left = x;
  125. rect.right = dxScreen - x;
  126. rect.bottom = y;
  127. rect.top = dyScreen - y;
  128. x -= 8;
  129. y -= 8;
  130. break;
  131. }
  132. #ifdef PM
  133. WinFillRect((HPS) l1, &rect, CLR_BLACK);
  134. #endif
  135. #ifdef WIN
  136. PatBlt((HDC) l1, rect.left, rect.top,
  137. rect.right - rect.left,
  138. rect.bottom - rect.top, BLACKNESS);
  139. #endif
  140. if (fDone)
  141. ScrChooseRandomServer();
  142. }
  143. break;
  144. }
  145. return fTrue;
  146. }