--- mstools/samples/gdidemo/bounce.c 2018/08/09 18:20:01 1.1 +++ mstools/samples/gdidemo/bounce.c 2018/08/09 18:23:51 1.1.1.3 @@ -1,10 +1,16 @@ + +/******************************************************************************\ +* This is a part of the Microsoft Source Code Samples. +* Copyright (C) 1993 Microsoft Corporation. +* All rights reserved. +* This source code is only intended as a supplement to +* Microsoft Development Tools and/or WinHelp documentation. +* See these sources for detailed information regarding the +* Microsoft samples programs. +\******************************************************************************/ + /*---------------------------------------------------------------------------*\ | BOUNCING BALL MODULE -| -| segment: _TEXT (DOS16) -| created: 19-Oct-90 -| history: 19-Oct-90 created. -| \*---------------------------------------------------------------------------*/ #include @@ -21,9 +27,6 @@ VOID XFormPoint(PMYXFORM,LPPOINT); /*---------------------------------------------------------------------------*\ | CREATE BOUNCE WINDOW PROCEDURE | -| created: 20-May-91 -| history: 20-May-91 created. -| \*---------------------------------------------------------------------------*/ HWND FAR CreateBounceWindow(HWND hWndClient, int nItem) { @@ -39,24 +42,21 @@ HWND FAR CreateBounceWindow(HWND hWndCli */ mcs.szClass = BOUNCECLASS; mcs.szTitle = BOUNCETITLE; - mcs.hOwner = hInstance; + mcs.hOwner = hInstance; mcs.x = CW_USEDEFAULT; mcs.y = CW_USEDEFAULT; mcs.cx = CW_USEDEFAULT; mcs.cy = CW_USEDEFAULT; - mcs.style = 0l; + mcs.style = 0l; mcs.lParam = (LONG)nItem; - return((HWND)SendMessage(hWndClient,WM_MDICREATE,NULL,(LONG)(LPMDICREATESTRUCT)&mcs)); + return((HWND)SendMessage(hWndClient,WM_MDICREATE,0,(LONG)(LPMDICREATESTRUCT)&mcs)); } /*---------------------------------------------------------------------------*\ | BOUNCE WINDOW PROCEDURE | -| created: 20-May-91 -| history: 20-May-91 created. -| \*---------------------------------------------------------------------------*/ LONG APIENTRY BounceProc(HWND hWnd, UINT wMsg, WPARAM wParam, LONG lParam) { @@ -97,9 +97,6 @@ LONG APIENTRY BounceProc(HWND hWnd, UINT /*---------------------------------------------------------------------------*\ | BOUNCE CREATE PROCEDURE | -| created: 20-May-91 -| history: 20-May-91 created. -| \*---------------------------------------------------------------------------*/ BOOL BounceCreateProc(HWND hWnd) { @@ -129,9 +126,6 @@ BOOL BounceCreateProc(HWND hWnd) /*---------------------------------------------------------------------------*\ | BOUNCE COMMAND PROCEDURE | -| created: 20-May-91 -| history: 20-May-91 created. -| \*---------------------------------------------------------------------------*/ BOOL BounceCommandProc(HWND hWnd, WPARAM wParam, LONG lParam) { @@ -146,9 +140,6 @@ BOOL BounceCommandProc(HWND hWnd, WPARAM /*---------------------------------------------------------------------------*\ | BOUNCE PAINT PROCEDURE | -| created: 20-May-91 -| history: 20-May-91 created. -| \*---------------------------------------------------------------------------*/ VOID BouncePaintProc(HWND hWnd) { @@ -168,9 +159,6 @@ VOID BouncePaintProc(HWND hWnd) /*---------------------------------------------------------------------------*\ | BOUNCE DESTROY PROCEDURE | -| created: 20-May-91 -| history: 20-May-91 created. -| \*---------------------------------------------------------------------------*/ VOID BounceDestroyProc(HWND hWnd) { @@ -195,9 +183,6 @@ VOID BounceDestroyProc(HWND hWnd) /*---------------------------------------------------------------------------*\ | BOUNCE REFRESH | -| created: 20-May-91 -| history: 20-May-91 created. -| \*---------------------------------------------------------------------------*/ VOID BounceRefresh(HWND hWnd) { @@ -223,7 +208,7 @@ VOID BounceRefresh(HWND hWnd) ballGetDimensions(pbd->hBall2,&pDimensions); ballSetPosition(pbd->hBall2,rect.right-pDimensions.x,0); - xDirection = -((lRandom() % 5)+5); + xDirection = -(((int)lRandom() % 5)+5); yDirection = ((lRandom() % 5)+5); ballSetDirection(pbd->hBall2,xDirection,yDirection); @@ -231,14 +216,14 @@ VOID BounceRefresh(HWND hWnd) ballGetDimensions(pbd->hBall3,&pDimensions); ballSetPosition(pbd->hBall3,0,rect.bottom-pDimensions.y); xDirection = ((lRandom() % 5)+5); - yDirection = -((lRandom() % 5)+5); + yDirection = -((int)(lRandom() % 5)+5); ballSetDirection(pbd->hBall3,xDirection,yDirection); ballGetDimensions(pbd->hBall4,&pDimensions); ballSetPosition(pbd->hBall4,rect.right-pDimensions.x,rect.bottom-pDimensions.y); - xDirection = -((lRandom() % 5)+5); - yDirection = -((lRandom() % 5)+5); + xDirection = -((int)(lRandom() % 5)+5); + yDirection = -((int)(lRandom() % 5)+5); ballSetDirection(pbd->hBall4,xDirection,yDirection); @@ -316,7 +301,7 @@ VOID CheckEdgePosition(HWND hWnd, HANDLE } if((xNewPos+pDim.x) > rect.right) { - xNewDir = -((lRandom() % 5)+5); + xNewDir = -(((int)lRandom() % 5)+5); ballSetPosition(hBall,rect.right-pDim.x,pPos.y); } if(yNewPos < rect.top) @@ -326,7 +311,7 @@ VOID CheckEdgePosition(HWND hWnd, HANDLE } if((yNewPos+pDim.y) > rect.bottom) { - yNewDir = -((lRandom() % 5)+5); + yNewDir = -(((int)lRandom() % 5)+5); ballSetPosition(hBall,pPos.x,rect.bottom-pDim.y); } ballSetDirection(hBall,xNewDir,yNewDir); @@ -338,9 +323,6 @@ VOID CheckEdgePosition(HWND hWnd, HANDLE /*---------------------------------------------------------------------------*\ | CLEAR XFORM | -| created: 31-Oct-90 -| history: 31-Oct-90 created. -| \*---------------------------------------------------------------------------*/ VOID XFormClear(PMYXFORM pXForm) { @@ -360,9 +342,6 @@ VOID XFormClear(PMYXFORM pXForm) /*---------------------------------------------------------------------------*\ | XFORM SCALE | -| created: 31-Oct-90 -| history: 31-Oct-90 created. -| \*---------------------------------------------------------------------------*/ VOID XFormScale(PMYXFORM pXForm, int xScale, int yScale) { @@ -379,12 +358,6 @@ VOID XFormScale(PMYXFORM pXForm, int xSc -/*---------------------------------------------------------------------------*\ -| -| created: 31-Oct-90 -| history: 31-Oct-90 created. -| -\*---------------------------------------------------------------------------*/ VOID XFormTrans(PMYXFORM pXForm, int xTrans, int yTrans) { pXForm->xForm[2][0] = pXForm->xForm[2][0] + xTrans; @@ -395,12 +368,6 @@ VOID XFormTrans(PMYXFORM pXForm, int xTr -/*---------------------------------------------------------------------------*\ -| -| created: 31-Oct-90 -| history: 31-Oct-90 created. -| -\*---------------------------------------------------------------------------*/ VOID XFormPoint(PMYXFORM pXForm, LPPOINT pPoint) { int x,y;