예제 #1
0
BOOL WINPROC EXPORT DlgRoomPuzzleStart (HWND hWnd,UINT wMsg,WPARAM wParam,LPARAM lParam)
{
    BOOL bHandled = TRUE;

    switch (wMsg)
    {
        case WM_COMMAND:
            switch (wParam)
            {
                case HS_PUZZLE_EASY:
				case IDOK:
                    iHardness = 1;
                    if (CheckRegistration (TRUE))
                        GoRoom (hInstAstral, RM_PUZZLE, FALSE);
                    break;                    
                case HS_PUZZLE_TOUGH:
                    iHardness = 2;
                    if (CheckRegistration (TRUE))
                        GoRoom (hInstAstral, RM_PUZZLE, FALSE);
                    break;                    
                case HS_PUZZLE_HARD:
                    iHardness = 3;
                    if (CheckRegistration (TRUE))
                        GoRoom (hInstAstral, RM_PUZZLE, FALSE);
                    break;                    
                default:
                    bHandled = FALSE;
            }
            break;
        default:
            bHandled = FALSE;    
    }

    if (!bHandled)
        bHandled = DefRoomProc (hWnd,wMsg,wParam,lParam);
    return bHandled;
}
예제 #2
0
BOOL WINPROC EXPORT DlgRoomDot2Dot (HWND hWnd,UINT wMsg,WPARAM wParam,LPARAM lParam)
{
    BOOL bHandled = TRUE;
    char szTemp[MAX_PATH];
    HWND hImageCtrl;

    switch (wMsg)
    {
        case WM_COMMAND:
            switch (wParam)
            {
            case HS_COVER:
				ShowControls(hWnd, TRUE);
				ShowCoverAnimatedButtons(hWnd, TRUE);
                break;
                
            case HS_SHOW_ME:
                iActiveDot = 0;
				bPlaying = FALSE;
				UpdateDot2DotImage(hWnd, NULL);
                break;
                
            case HS_COLORME_ME:
                RemoveCodedBackground();
                GoPaintApp (hWnd,szPreview);
                break;
                
            case HS_TAB1:
            case HS_TAB2:
            case HS_TAB3:
            case HS_TAB4:
            case HS_TAB5:
            case HS_TAB6:
            case HS_TAB7:
            case HS_TAB8:
                {
                    BOOL    bLoad;

					ShowCoverAnimatedButtons(hWnd, FALSE);
					ShowControls(hWnd, FALSE);
                    hImageCtrl = GetDlgItem(hWnd, IDC_HIDDEN_IMAGE);
                    
                    if (hImageCtrl)
                    {
                		wsprintf (szTemp,GetString (IDS_CIRCUS, NULL),wParam - HS_TAB1 + 1);
                        PathCat (szPreview,Control.PouchPath,szTemp);
                        bLoad = AstralImageLoad( 0, szPreview, TRUE, FALSE);
                        if (bLoad && lpImage)
                        {
							bPlaying = TRUE;
                            SetWindowLong(hImageCtrl, GWL_IMAGE,
                                (long) ImgGetBase (lpImage));
                            SetWindowLong(hImageCtrl, GWL_IMAGE_TOOLPROC,
                                (long) Dot2DotProc);
							InitPoints();
                            ImgSetPixelProc(Dot2DotPixelProc);
                            ShowWindow(hImageCtrl, SW_SHOW);
                            UpdateDot2DotImage(hWnd, NULL);
                        }
                    }
                        
                        
                } // HS_TABS
				SoundStartID(HS_XTRA_CIRCUS, FALSE, 0);
                break;
                
                default:
                    bHandled = FALSE;
            } // switch (wParam)
            break;
                          
        case WM_INITDIALOG:
            hDot2DotWnd = hWnd;
			ShowControls(hWnd, TRUE);
            bHandled = FALSE;           // allow DefRoomProc to be called.
            break;

        case WM_DESTROY:
            ImgSetPixelProc(NULL);      // make sure our proc is no longer used
            bHandled = FALSE;           // allow DefRoomProc to be called
            break;

        case WM_PAINT:
            hImageCtrl = GetDlgItem(hWnd, IDC_HIDDEN_IMAGE);
            DefRoomProc (hWnd,wMsg,wParam,lParam);
			UpdateWindow(hImageCtrl);
            PaintDot2Dots(hImageCtrl);
            break;
            
        default:
            bHandled = FALSE;    
    } // switch (wMsg)

    if (!bHandled)
        bHandled = DefRoomProc (hWnd,wMsg,wParam,lParam);
    return bHandled;
}
예제 #3
0
BOOL WINPROC EXPORT DlgRoomMazes (HWND hWnd,UINT wMsg,WPARAM wParam,LPARAM lParam)
{
    BOOL bHandled = TRUE;
    char szTemp[MAX_PATH];
    HWND hCtl;

    switch (wMsg)
    {
    case WM_COMMAND:
        switch (wParam)
        {
        case HS_COVER:
			StopAnimation();
			ShowCoverAnimatedButtons(hWnd, TRUE);
            hCtl = GetDlgItem (hWnd,IDC_HIDDEN_IMAGE);
            ShowWindow (hCtl,SW_HIDE);
            if (idCurrentRoom == RM_MAILMAZE)
            {
                hCtl = GetDlgItem (hWnd,HS_LOGO_MAILMAZE);
                ShowWindow (hCtl,SW_SHOW);
                hCtl = GetDlgItem (hWnd,HS_XTRA_MAILMAZE);
                ShowWindow (hCtl,SW_HIDE);
                hCtl = GetDlgItem (hWnd,HS_RESTART);
                ShowWindow (hCtl,SW_HIDE);
            }
            else if (idCurrentRoom == RM_MAZES)
            {
                hCtl = GetDlgItem (hWnd,HS_LOGO_MAZES);
                ShowWindow (hCtl,SW_SHOW);
                hCtl = GetDlgItem (hWnd,HS_XTRA_MAZES);
                ShowWindow (hCtl,SW_HIDE);
                hCtl = GetDlgItem (hWnd,HS_RESTART);
                ShowWindow (hCtl,SW_HIDE);
            }
            bHandled = FALSE;
            break;
        case HS_TAB1:
        case HS_TAB2:
        case HS_TAB3:
        case HS_TAB4:
        case HS_TAB5:
        case HS_TAB6:
        case HS_TAB7:
        case HS_TAB8:
			StopAnimation();
			ShowCoverAnimatedButtons(hWnd, FALSE);
            bTrack = FALSE;
            if (idCurrentRoom == RM_MAILMAZE)
                wsprintf (szTemp,GetString (IDS_MAILMAZE,NULL),wParam - HS_TAB1 + 1);
            else if (idCurrentRoom == RM_MAZES)
                wsprintf (szTemp,GetString (IDS_MAZES,NULL),wParam - HS_TAB1 + 1);
            PathCat (szPreview,Control.PouchPath,szTemp);
            AstralImageLoad (IDN_ART,szPreview,MAYBE,NO);
            if (lpImage)
            {
                bShowSolution = bSolved = FALSE;
                ImgSetPixelProc (MazePixelProc);
                hCtl = GetDlgItem (hWnd,IDC_HIDDEN_IMAGE);
                SetWindowLong (hCtl,GWL_IMAGE,(long) ImgGetBase (lpImage));
                SetWindowLong (hCtl,GWL_IMAGE_TOOLPROC,(long)MazeToolProc);
                ShowWindow (hCtl,SW_SHOW);
                InvalidateRect (hCtl,NULL,FALSE);
                if (idCurrentRoom == RM_MAILMAZE)
                {
                    hCtl = GetDlgItem (hWnd,HS_LOGO_MAILMAZE);
                    ShowWindow (hCtl,SW_HIDE);
                    hCtl = GetDlgItem (hWnd,HS_XTRA_MAILMAZE);
                    ShowWindow (hCtl,SW_SHOW);
                    hCtl = GetDlgItem (hWnd,HS_RESTART);
                    ShowWindow (hCtl,SW_SHOW);
                }
                else if (idCurrentRoom == RM_MAZES)
                {
                    hCtl = GetDlgItem (hWnd,HS_LOGO_MAZES);
                    ShowWindow (hCtl,SW_HIDE);
                    hCtl = GetDlgItem (hWnd,HS_XTRA_MAZES);
                    ShowWindow (hCtl,SW_SHOW);
                    hCtl = GetDlgItem (hWnd,HS_RESTART);
                    ShowWindow (hCtl,SW_SHOW);
                }
                bHandled = FALSE;
            }
#ifdef STUDIO			
				SoundStartID(HS_XTRA_MAILMAZE, FALSE, 0);
#else
				SoundStartID(HS_XTRA_MAZES, FALSE, 0);
#endif			
            break;
        case HS_COLORME:
			StopAnimation();
            GoPaintApp (hWnd,szPreview);
            break;
        case HS_SHOWME:
        case HS_RESTART:
            bTrack = FALSE;
            bShowSolution = (wParam == HS_SHOWME);
            hCtl = GetDlgItem (hWnd,IDC_HIDDEN_IMAGE);
			StopAnimation();
            InvalidateRect (hCtl,NULL,FALSE);
            UpdateWindow (hCtl);
			if (wParam == HS_SHOWME)
				StartAnimation(hCtl);
            break;
        default:
            bHandled = FALSE;
        }
        break;
    case WM_INITDIALOG:
        hMazePen = CreatePen (PS_SOLID,3,RGB (0,0,255));
        bHandled = FALSE;
        break;
    case WM_DESTROY:
		StopAnimation();
        ImgSetPixelProc (NULL);
        if (hMazePen)
        {
            DeleteObject (hMazePen);
            hMazePen = 0;
        }
        bHandled = FALSE;
        break;
    default:
        bHandled = FALSE;
    }
    if (!bHandled)
        bHandled = DefRoomProc (hWnd,wMsg,wParam,lParam);
    return bHandled;
}
예제 #4
0
BOOL WINPROC EXPORT DlgRoomPuzzle (HWND hWnd,UINT wMsg,WPARAM wParam,LPARAM lParam)
{
    BOOL bHandled = TRUE;

    switch (wMsg)
    {
        case WM_COMMAND:
            switch (wParam)
            {
                case HS_COVER:
                    // There is no cover in this room, but this keeps
                    // DefRoomProc from disabling ShowMe.
                    break;
                    
                case HS_BACKPUZZLE:
				case IDCANCEL:
                    GoRoom (hInstAstral, RM_PUZZLESTART, FALSE);
                    break;                    
                case HS_PUZZLE_NEWGAME:
                    ShowAllObjects(hWnd, TRUE);
                    LoadBackgroundImage(hWnd);
                    PrepareGuesses(hWnd);
                    break;                    
                case HS_SHOWME:
                case HS_SHOWMEPUZZLE:
                    bFinished = TRUE;
                    SetDlgItemText(hWnd, IDC_PUZZLE_NAME, szGuess);
                    ShowAllObjects(hWnd, FALSE);
                    break;                    
                default:
                    bHandled = FALSE;
            } // switch (wParam)
            break;
            
        case WM_KEYDOWN:
            ProcessKey(hWnd, wParam);
            break;

        case WM_INITDIALOG:
            hPuzzleWnd = hWnd;
            SetPuzzleFonts(hWnd);
            LoadPuzzleImage(hWnd);
            LoadBackgroundImage(hWnd);
            PrepareGuesses(hWnd);
            SetFocus(hWnd);
            bHandled = FALSE;           // allow DefRoomProc to be called.
            break;

        case WM_DESTROY:
            if (hItalicFont)
                DeleteObject(hItalicFont);
            if (hNormalFont)
                DeleteObject(hNormalFont);
            bHandled = FALSE;   // allow DefRoomProc to be called
			hPuzzleWnd = 0;
            break;
            
        default:
            bHandled = FALSE;    
    } // switch (wMsg)

    if (!bHandled)
        bHandled = DefRoomProc (hWnd,wMsg,wParam,lParam);

// ----------This crap hangs the app-----------
//    if (wMsg != WM_KILLFOCUS  && 
//        wMsg != WM_CLOSE      &&
//        wMsg != WM_SYSKEYDOWN &&
//        wMsg != WM_SYSKEYUP   &&
//        wMsg != WM_SYSCHAR    &&
//        wMsg != WM_DESTROY    &&
//        wMsg != WM_NCDESTROY)
//        SetFocus(hWnd);

    return bHandled;
}
예제 #5
0
BOOL WINPROC EXPORT DlgRoomWhoAreYou (HWND hWnd,UINT wMsg,WPARAM wParam,LPARAM lParam)
{
	STRING	szTmp;
	WORD	wKey;
	int		iTmp;
    BOOL	bHandled = TRUE;
	int		iPtSize = 30;

	if (wMsg == WM_INITDIALOG)
	{
#ifdef _MAC	
		RECT rEdit;
#endif		
		DefRoomProc (hWnd, wMsg, wParam, lParam);

		if (LoadString (hInstAstral, IDS_FONT_NORMAL, szTmp, sizeof(szTmp)))
		{
			hDlgFont = (HFONT)NULL;
			hDlgFont = CreateFont (-iPtSize,		// Height
									0,				// Width
									0,				// Escapement
									0,				// Orientation
									0,				// Weight
									0,				// Italic
									0,				// Underline
									0,				// Strikeout
									0,				// Charset
									0,				// OutputPrecision
									0,				// ClipPrecision
									0,				// Quality
									0,				// PitchAndFamily
		  							(PSTR)szTmp);	// Typeface Name

			if (hDlgFont != NULL)
			{
				SendDlgItemMessage (hWnd, IDC_WHO_BUTTON1, WM_SETFONT, (WPARAM)hDlgFont, 0L);
				SendDlgItemMessage (hWnd, IDC_WHO_BUTTON2, WM_SETFONT, (WPARAM)hDlgFont, 0L);
				SendDlgItemMessage (hWnd, IDC_WHO_BUTTON3, WM_SETFONT, (WPARAM)hDlgFont, 0L);
				SendDlgItemMessage (hWnd, IDC_WHO_BUTTON4, WM_SETFONT, (WPARAM)hDlgFont, 0L);
				SendDlgItemMessage (hWnd, IDC_WHO_NEWBUTTON, WM_SETFONT, (WPARAM)hDlgFont, 0L);
				SendDlgItemMessage (hWnd, IDC_WHO_EDIT, WM_SETFONT, (WPARAM)hDlgFont, 0L);
			}
		}
		
		
#ifdef _MAC	
		// Make sure the edit control is exactly the same size as the radio button.
		// Without this hack, it is smaller on the mac.
		
		if (LoadString (hInstAstral, IDS_IM_NEW, szTmp, sizeof(szTmp)))
			SetDlgItemText (hWnd, IDC_WHO_EDIT, szTmp);

		GetClientRect(GetDlgItem(hWnd, IDC_WHO_NEWBUTTON), &rEdit);	
		SetWindowPos(
			GetDlgItem(hWnd, IDC_WHO_EDIT),
			NULL,
			0, 0,
			RectWidth(&rEdit),
			RectHeight(&rEdit),
			SWP_NOMOVE | SWP_NOZORDER);
#endif		
		
		// initially hide the edit control
    	ShowWindow (GetDlgItem(hWnd, IDC_WHO_EDIT), SW_HIDE);

		if (LoadString (hInstAstral, IDS_IM_NEW, szTmp, sizeof(szTmp)))
			SetDlgItemText (hWnd, IDC_WHO_NEWBUTTON, szTmp);

		DoInit (hWnd);

    	ShowWindow (GetDlgItem(hWnd, IDOK), SW_HIDE);
		fButtonHidden = FALSE;
		bHandled = TRUE;
	}
    else if (wMsg == WM_CLOSE)
    {
        AstralDlgEnd (hWnd,TRUE|2);
		bHandled = TRUE;
    }
    else if (wMsg == WM_COMMAND)
    {
		switch (wParam)
		{
			// Go To Room hotspot
			case HS_WHO:
				if (CheckUsername (hWnd))
				{
					DeleteObject (hDlgFont);
        			GoRoom (hInstAstral, RM_ARTROOM, FALSE);
				}
				bHandled = TRUE;
				break;

			// I'm New button
			case IDC_WHO_NEWBUTTON:
#ifndef _MAC	// This problem doesn't exist on the mac			
				if (! fNoUsers)	// hack for Windows focus problem
#endif				
				{
					CheckRadioButton (hWnd, IDC_WHO_BUTTON1,
					  IDC_WHO_NEWBUTTON, IDC_WHO_NEWBUTTON);
    				ShowWindow (GetDlgItem(hWnd, IDC_WHO_NEWBUTTON), SW_HIDE);
    				ShowWindow (GetDlgItem(hWnd, IDC_WHO_EDIT), SW_SHOW);

					if (LoadString (hInstAstral, IDS_YOUR_NAME, szTmp,
				  	sizeof(szTmp)))
						SetDlgItemText (hWnd, IDC_WHO_EDIT, szTmp);

					SetFocus (GetDlgItem (hWnd, IDC_WHO_EDIT));
					SendDlgItemMessage (hWnd, IDC_WHO_EDIT, EM_SETSEL, 0,
				  	  MAKELONG(0, -1) );
				}
				iButtonIndex = 4;
				fNoUsers = FALSE;
				bHandled = TRUE;
				fButtonHidden = TRUE;
				break;

			// Scroll names down
			case HS_WHO_UPARROW:
				if (iUserCount > 4)
				{
					iTmp = iUserIndex;
					if (iUserIndex > 0)
                    {
						iUserIndex--;
                    	ShowWindow (GetDlgItem(hWnd, HS_WHO_DNARROW), SW_SHOW);

						if (iUserIndex == 0)
                    		ShowWindow (GetDlgItem(hWnd, HS_WHO_UPARROW), SW_HIDE);
                    }
                    else
            			ShowWindow (GetDlgItem(hWnd, HS_WHO_UPARROW), SW_HIDE);

					if (iUserIndex != iTmp)
						UpdateButtons (hWnd, iUserIndex, iUserCount);
				}
				bHandled = TRUE;
				break;

			// Scroll names up
			case HS_WHO_DNARROW:
				if (iUserCount > 4)
				{
					iTmp = iUserIndex;
					if (iUserIndex < (iUserCount - 4))
                    {
						iUserIndex++;
                    	ShowWindow (GetDlgItem(hWnd, HS_WHO_UPARROW), SW_SHOW);

						if (iUserIndex +4 >= iUserCount)
                    		ShowWindow (GetDlgItem(hWnd, HS_WHO_DNARROW), SW_HIDE);
                    }
                    else
            			ShowWindow (GetDlgItem(hWnd, HS_WHO_DNARROW), SW_HIDE);

					if (iUserIndex != iTmp)
						UpdateButtons (hWnd, iUserIndex, iUserCount);
				}
				bHandled = TRUE;
				break;

			case IDC_WHO_BUTTON1:
				HandleButton (hWnd, 0);
        		bHandled = TRUE;
				// if they click twice on same control - validate and continue
				if ((iButtonIndex == 0) && (CheckUsername (hWnd)))
				{
					DeleteObject (hDlgFont);
        			GoRoom (hInstAstral, RM_ARTROOM, FALSE);
				}
				iButtonIndex = 0;
				break;

			case IDC_WHO_BUTTON2:
				HandleButton (hWnd, 1);
        		bHandled = TRUE;
				if ((iButtonIndex == 1) && (CheckUsername (hWnd)))
				{
					DeleteObject (hDlgFont);
        			GoRoom (hInstAstral, RM_ARTROOM, FALSE);
				}
				iButtonIndex = 1;
				break;

			case IDC_WHO_BUTTON3:
				HandleButton (hWnd, 2);
        		bHandled = TRUE;
				if ((iButtonIndex == 2) && (CheckUsername (hWnd)))
				{
					DeleteObject (hDlgFont);
        			GoRoom (hInstAstral, RM_ARTROOM, FALSE);
				}
				iButtonIndex = 2;
				break;

			case IDC_WHO_BUTTON4:
				HandleButton (hWnd, 3);
        		bHandled = TRUE;
				if ((iButtonIndex == 3) && (CheckUsername (hWnd)))
				{
					DeleteObject (hDlgFont);
        			GoRoom (hInstAstral, RM_ARTROOM, FALSE);
				}
				iButtonIndex = 3;
				break;

			case IDC_WHO_DELNAME:
				if (Control.CurrentUser[0] != 0)
				{
					if (! (GetNumberIniEntries() ))
					{
						if (GetUserNameByDir (Control.CurrentUser, szTmp))
						{
							DeleteUserName (szTmp);
							lstrcpy (szTmp, Control.WorkPath);
							lstrcat (szTmp, Control.CurrentUser);
#ifdef WIN32
							RemoveDirectory (szTmp);
#else
							_rmDir (szTmp);
#endif							
							clr ((LPTR)Control.CurrentUser, sizeof(Control.CurrentUser));
							DoInit (hWnd);
						}
					}
				}
        		bHandled = TRUE;
				break;

			case IDOK:
				bHandled = TRUE;
				if (CheckUsername (hWnd))
				{
					DeleteObject (hDlgFont);
       				GoRoom (hInstAstral, RM_ARTROOM, FALSE);
				}
				break;

			default:
        		bHandled = FALSE;
				break;
		}
    }
    else if (wMsg == WM_CHAR)
	{
		wKey = (WORD)lParam;
		if (wKey == VK_DELETE)
		{
			GetUserNameString (iUserIndex, szTmp);
		}
	}
    else
        bHandled = FALSE;

    if (! bHandled)
        bHandled = DefRoomProc (hWnd, wMsg, wParam, lParam);

    return bHandled;
}