void IsIntersection(int x, int y) { int win_x = CheckX(x); int win_y = CheckY(y); if(win_x == YES && win_y == YES) { WinMessage(); display_type = PAUSE; NewGame(); } }
/* * WinMain - main windows entry point */ int PASCAL WinMain( HINSTANCE inst, HINSTANCE previnst, LPSTR cmd, int show) { HINSTANCE newinst; HANDLE h; MSG msg; parm_data parm; command_data cmddat; char FAR_PTR *cmdline; char filename[_MAX_PATH]; /* * are we the first? if so, winexec another one of ourselves * and then start sampling */ if( !previnst ) { SharedMemory = NULL; StartWDebug386(); if( !WDebug386 ) { WinMessage( "Could not find WDEBUG.386" ); return( FALSE ); } if( !MsgInit( inst ) ) fatal(); cmddat.nCmdShow = SW_NORMAL; if( cmd == NULL || cmd[0] == 0 ) { if( !GetFileName( inst, show, filename ) ) { CloseShop(); return( FALSE ); } cmdline = filename; } else { cmddat.nCmdShow = SW_MINIMIZE; cmdline = cmd; } h = GlobalAlloc( GMEM_SHARE | GMEM_FIXED | GMEM_ZEROINIT, sizeof( shared_data ) ); if( h == NULL ) { CloseShop(); return( FALSE ); } SharedMemory = MK_FP( h,0 ); WaitForFirst = TRUE; /* tell our counterpart to wait for us before starting the timer */ cmddat.always2= 2; parm.wEnvSeg = 0; parm.lpCmdLine = (char far *) ""; parm.lpCmdShow = (void far *) &cmddat; parm.dwReserved = 0; newinst = LoadModule( "wsamplew.exe", (LPVOID) &parm ); if( (UINT)newinst < 32 ) { WinMessage( MsgArray[MSG_SAMPLE_12-ERR_FIRST_MESSAGE] ); CloseShop(); return( FALSE ); } /* * wait for our counterpart to initialize - if he fails, * then we must die too */ do { GetIData( newinst, (void near *)&IsSecondOK, sizeof( IsSecondOK ) ); MessageLoop(); } while( !IsSecondOK ); if( IsSecondOK == NOT_OK ) { WinMessage( MsgArray[MSG_SAMPLE_12-ERR_FIRST_MESSAGE] ); CloseShop(); return( FALSE ); } /* * get data created by our counterpart */ GetIData( newinst, &OutputWindow, sizeof( OutputWindow ) ); GetIData( newinst, &MainWindowHandle, sizeof( MainWindowHandle ) ); GetIData( newinst, &SampSave, sizeof( SampSave) ); /* * start the sampler - our other half will be re-started * once we have loaded the task to be sampled. */ sample_main( cmdline ); CloseShop(); SendMessage( MainWindowHandle, WM_CLOSE, 0, 0 ); return( FALSE ); } else { /* * we are the second instance (the guy who waits for * timer events and then tries to write the sample file) * init our windows stuff, then wait for the first instance * to start the samplee, set a timer, and go */ PrevInstance = previnst; if( !MsgInit( inst ) ) fatal(); if( !WindowsInit( inst, show ) ) { IsSecondOK = NOT_OK; return( FALSE ); } IsSecondOK = A_OK; do { GetIData( previnst, (void near *)&WaitForFirst, sizeof( WaitForFirst ) ); MessageLoop(); } while( WaitForFirst ); GetIData( previnst, (void near *) &Samples, sizeof( Samples ) ); GetIData( previnst, &SharedMemory, sizeof( SharedMemory ) ); KillTimer( MainWindowHandle, TIMER_ID ); SetTimer( MainWindowHandle, TIMER_ID, 4500, 0L); /* 4.5 seconds */ } /* * main message loop for the second instance */ while( GetMessage( &msg, NULL, 0, 0 ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } return( FALSE ); } /* WinMain */