Initial commit
This commit is contained in:
1994
engines/bagel/hodjnpodj/artparts/artparts.cpp
Normal file
1994
engines/bagel/hodjnpodj/artparts/artparts.cpp
Normal file
File diff suppressed because it is too large
Load Diff
211
engines/bagel/hodjnpodj/artparts/artparts.h
Normal file
211
engines/bagel/hodjnpodj/artparts/artparts.h
Normal file
@@ -0,0 +1,211 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HODJNPODJ_ARTPARTS_ARTPARTS_H
|
||||
#define HODJNPODJ_ARTPARTS_ARTPARTS_H
|
||||
|
||||
#include "bagel/boflib/sound.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/button.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/text.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace ArtParts {
|
||||
|
||||
// Border info
|
||||
#define SIDE_BORDER 20
|
||||
#define TOP_BORDER 28 //32
|
||||
#define BOTTOM_BORDER 20 //16
|
||||
#define HILITE_BORDER 3
|
||||
|
||||
// Art Parts constants
|
||||
#define ART_WIDTH 600
|
||||
#define ART_HEIGHT 432
|
||||
|
||||
// For the "frame" of correct pieces around the artwork:
|
||||
#define FRAME_WIDTH 4
|
||||
#define FRAME_HEIGHT 4
|
||||
|
||||
// Starting value defaults
|
||||
#define MAX_COLUMNS 30
|
||||
#define MIN_COLUMNS 1
|
||||
|
||||
#define MAX_ROWS 24
|
||||
#define MIN_ROWS 1
|
||||
|
||||
#define START_COLUMNS 4
|
||||
#define START_ROWS 4
|
||||
|
||||
// Timer constants
|
||||
#define MIN_TIME 0 // 15 Seconds
|
||||
#define MAX_TIME 600 // 180 Seconds = 3 minute max
|
||||
#define TIMER_START 0 // Increment scrollbar in steps of 15 Secs
|
||||
#define TIMER_MAX 12 // if Time > MAX_TIME, No Time Limit
|
||||
|
||||
#define DISPLAY_TIMER 1
|
||||
#define SHOW_TIMER 2
|
||||
#define MS_SCALE 1000 // Scale seconds to milliseconds
|
||||
|
||||
#define CLICK_TIME 1000 // Every Second, update timer clock
|
||||
#define PAUSE_TIME 3000 // Wait three seconds before erasing hint screen
|
||||
|
||||
// Sound files
|
||||
#define PICK_SOUND ".\\sound\\pickart.wav"
|
||||
#define SWITCH_SOUND ".\\sound\\moveart.wav"
|
||||
#define WIN_SOUND ".\\sound\\sound146.wav"
|
||||
#define UNDO_SOUND ".\\sound\\sound355.wav"
|
||||
#define LOSE_SOUND ".\\sound\\buzzer.wav"
|
||||
#define RULES_WAV ".\\sound\\artparts.wav"
|
||||
|
||||
#define GAME_THEME ".\\sound\\artparts.mid"
|
||||
|
||||
// Backdrop bitmaps
|
||||
#define MAINSCREEN ".\\ART\\ARTPART1.BMP"
|
||||
#define FRAMESCREEN ".\\ART\\ARTPART1.BMP"
|
||||
#define TEXTSCREEN ".\\ART\\ARTTEMP.BMP"
|
||||
|
||||
#define DATA_FILE "artfiles.dat"
|
||||
#define MAX_FILE_LENGTH 20 // Longest Art file name length allowed
|
||||
|
||||
// New Game button area
|
||||
#define NEWGAME_LOCATION_X 70
|
||||
#define NEWGAME_LOCATION_Y 5
|
||||
#define NEWGAME_WIDTH 113
|
||||
#define NEWGAME_HEIGHT 13
|
||||
|
||||
// Time Display area
|
||||
#define TIME_LOCATION_X 457
|
||||
#define TIME_LOCATION_Y 4
|
||||
#define TIME_WIDTH 117
|
||||
#define TIME_HEIGHT 16
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// CMainWindow:
|
||||
// See game.cpp for the code to the member functions and the message map.
|
||||
//
|
||||
class CMainWindow : public CFrameWnd {
|
||||
public:
|
||||
CMainWindow();
|
||||
~CMainWindow();
|
||||
|
||||
bool LoadArtWork();
|
||||
void DrawPart(const CPoint &Src, const CPoint &Dst, int nWidth, int nHeight);
|
||||
void SwitchAreas(const CRect &Src, const CRect &Dst);
|
||||
void InitValues();
|
||||
void NewGame();
|
||||
void CheckForWin();
|
||||
void ShowOutOfPlace();
|
||||
|
||||
//added data members:
|
||||
bool m_bPlaying = false; // Flag True if playing, False if setting options
|
||||
bool m_bNewGame = false; // Flag to check if a new game is being played
|
||||
bool m_bFirst = false; // Flag to check if the first area is being selected
|
||||
CPoint First;
|
||||
CPoint Second;
|
||||
CPoint Center;
|
||||
CPoint UpLeft;
|
||||
CRect BaseRect; // The part that is the base of the select area
|
||||
CRect OldRect; // The last area highlighted
|
||||
CRect HiLiteRect; // The new area to highlight
|
||||
CRect SrcRect; // The area to be moved
|
||||
CRect DstRect; // The destination of the moving area
|
||||
|
||||
void SplashScreen();
|
||||
void SplashScratch();
|
||||
void SplashScratchPaint();
|
||||
|
||||
private:
|
||||
POINT Grid[MAX_COLUMNS][MAX_ROWS]; // Location of the art parts
|
||||
|
||||
CBmpButton *m_pScrollButton = nullptr;
|
||||
CBitmap *pScratch1 = nullptr, // Off-screen bitmap of current positions
|
||||
*pScratch2 = nullptr, // Off-screen bitmap of new positions
|
||||
*pOldBmp1 = nullptr,
|
||||
*pOldBmp2 = nullptr;
|
||||
CPalette *pOldPal1 = nullptr,
|
||||
*pOldPal2 = nullptr;
|
||||
CDC *pScratch1DC = nullptr,
|
||||
*pScratch2DC = nullptr;
|
||||
CText *m_pTimeText = nullptr; // Time to be posted in Locale box of screen
|
||||
CBitmap *pLocaleBitmap = nullptr, // Locale of game bitmap for title bar
|
||||
*pBlankBitmap = nullptr; // Blank area of locale for time display
|
||||
|
||||
bool bStartOkay = true;
|
||||
bool bGameStarted = false; // becomes true at start time, false at game end
|
||||
bool bSwitched = false; // flag for undo -- only true after a part switch
|
||||
bool bSuccess;
|
||||
bool m_bIgnoreScrollClick;
|
||||
bool m_bShowOutOfPlace = false;
|
||||
char szCurrentArt[64] = {};
|
||||
|
||||
static CPalette *pGamePalette; // Palette of current artwork
|
||||
static int nSeconds;
|
||||
static int nMinutes;
|
||||
static int nLastPick;
|
||||
static int m_nTime; // Time is in SECONDS
|
||||
static int m_nRows; // Number of rows in the artwork grid
|
||||
static int m_nColumns; // Number of columns in the artwork grid
|
||||
static int m_nWidth; // The Width of each Part
|
||||
static int m_nHeight; // The Height of each Part
|
||||
static float m_nScore; // The current percentage of correctly placed parts
|
||||
static bool bFramed; // Framed (hint) mode is turned off by default
|
||||
|
||||
static int tempTime; // temporary holding places
|
||||
static int tempRows; //...for options changes,
|
||||
static int tempColumns; //...which only get used
|
||||
static bool tempFramed; //...when NewGame is called.
|
||||
|
||||
CSound *pGameSound = nullptr; // Game theme song
|
||||
|
||||
private:
|
||||
void initStatics();
|
||||
void OnSoundNotify(CSound *pSound);
|
||||
static bool CopyPaletteContents(CPalette *pSource, CPalette *pDest);
|
||||
void MyFocusRect(CDC *pDC, CRect rect, int nDrawMode);
|
||||
static void GetSubOptions(CWnd *pParentWind);
|
||||
|
||||
protected:
|
||||
virtual bool OnCommand(WPARAM wParam, LPARAM lParam) override;
|
||||
|
||||
//{{AFX_MSG( CMainWindow )
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
|
||||
afx_msg void OnSysKeyDown(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
|
||||
afx_msg void OnTimer(uintptr nIDEvent);
|
||||
afx_msg void OnLButtonDown(unsigned int nFlags, CPoint point);
|
||||
afx_msg void OnRButtonDown(unsigned int nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(unsigned int nFlags, CPoint point);
|
||||
afx_msg void OnMButtonDown(unsigned int nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(unsigned int nFlags, CPoint point);
|
||||
afx_msg void OnKeyDown(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
|
||||
afx_msg void OnClose();
|
||||
afx_msg LRESULT OnMCINotify(WPARAM, LPARAM);
|
||||
afx_msg LRESULT OnMMIONotify(WPARAM, LPARAM);
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
} // namespace ArtParts
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
45
engines/bagel/hodjnpodj/artparts/globals.h
Normal file
45
engines/bagel/hodjnpodj/artparts/globals.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HODJNPODJ_ARTPARTS_GLOBALS_H
|
||||
#define HODJNPODJ_ARTPARTS_GLOBALS_H
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace ArtParts {
|
||||
|
||||
// Main Window positioning constants
|
||||
#define GAME_WIDTH 640
|
||||
#define GAME_HEIGHT 480
|
||||
|
||||
// Scroll button size and positioning information
|
||||
#define IDC_SCROLL 850
|
||||
|
||||
#define SCROLL_BUTTON_X 250
|
||||
#define SCROLL_BUTTON_Y 0
|
||||
#define SCROLL_BUTTON_DX 140
|
||||
#define SCROLL_BUTTON_DY 23
|
||||
|
||||
} // namespace ArtParts
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
71
engines/bagel/hodjnpodj/artparts/init.cpp
Normal file
71
engines/bagel/hodjnpodj/artparts/init.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "bagel/afxwin.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/gamedll.h"
|
||||
#include "artparts.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace ArtParts {
|
||||
|
||||
HWND FAR PASCAL RunArtp(HWND, LPGAMESTRUCT);
|
||||
|
||||
HINSTANCE hDLLInst;
|
||||
HINSTANCE hExeInst;
|
||||
|
||||
LPGAMESTRUCT pGameInfo;
|
||||
|
||||
// global the pointer to the your game's main window
|
||||
HWND ghParentWnd;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Public C interface
|
||||
|
||||
HWND FAR PASCAL RunArtp(HWND hParentWnd, LPGAMESTRUCT lpGameInfo) {
|
||||
CMainWindow *pMain;
|
||||
|
||||
pGameInfo = lpGameInfo;
|
||||
|
||||
// invoke your game here by creating a pGame for your main window
|
||||
// look at the InitInstance for your game for this
|
||||
|
||||
ghParentWnd = hParentWnd;
|
||||
|
||||
if ((pMain = new CMainWindow) != nullptr) {
|
||||
|
||||
// pMain->ShowWindow(SW_SHOWNORMAL);
|
||||
|
||||
// pMain->UpdateWindow();
|
||||
|
||||
pMain->SetActiveWindow();
|
||||
}
|
||||
|
||||
// these must be set in this function
|
||||
hDLLInst = (HINSTANCE)GetWindowWord(pMain->m_hWnd, GWW_HINSTANCE);
|
||||
hExeInst = (HINSTANCE)GetWindowWord(hParentWnd, GWW_HINSTANCE);
|
||||
|
||||
return pMain->m_hWnd; // return the m_hWnd of your main game window
|
||||
}
|
||||
|
||||
} // namespace ArtParts
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
65
engines/bagel/hodjnpodj/artparts/init.h
Normal file
65
engines/bagel/hodjnpodj/artparts/init.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HODJNPODJ_ARTPARTS_GAMEDLL_H
|
||||
#define HODJNPODJ_ARTPARTS_GAMEDLL_H
|
||||
|
||||
#include "bagel/afxwin.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace ArtParts {
|
||||
|
||||
/**
|
||||
*****************************************************************
|
||||
*
|
||||
* RunArtp
|
||||
*
|
||||
* FUNCTIONAL DESCRIPTION:
|
||||
*
|
||||
* This is the API function for the DLL. It is what the calling app
|
||||
* calls to invoke poker
|
||||
*
|
||||
* FORMAL PARAMETERS:
|
||||
*
|
||||
* hParentWnd, lpGameInfo
|
||||
*
|
||||
* IMPLICIT INPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* IMPLICIT OUTPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* RETURN VALUE:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
***************************************************************
|
||||
*/
|
||||
extern HWND FAR PASCAL RunArtp(HWND hParentWnd, LPGAMESTRUCT lpGameInfo);
|
||||
|
||||
} // namespace ArtParts
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
378
engines/bagel/hodjnpodj/artparts/optndlg.cpp
Normal file
378
engines/bagel/hodjnpodj/artparts/optndlg.cpp
Normal file
@@ -0,0 +1,378 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "bagel/hodjnpodj/hnplibs/stdafx.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/button.h"
|
||||
#include "bagel/hodjnpodj/artparts/globals.h"
|
||||
#include "bagel/hodjnpodj/artparts/resource.h"
|
||||
#include "bagel/hodjnpodj/artparts/artparts.h"
|
||||
#include "bagel/hodjnpodj/artparts/optndlg.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/text.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace ArtParts {
|
||||
|
||||
static CPalette *pSubOptionsPalette;
|
||||
static CColorButton *pOKButton = nullptr; // OKAY button on scroll
|
||||
static CColorButton *pCancelButton = nullptr; // Cancel button on scroll
|
||||
static CCheckButton *pFramedButton = nullptr; // Framed check box
|
||||
|
||||
|
||||
CText *m_pPartsText = nullptr;
|
||||
CText *m_pColumnText = nullptr;
|
||||
CText *m_pRowText = nullptr;
|
||||
CText *m_pTimerText = nullptr;
|
||||
|
||||
int m_nColumnFactors[14] = {1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 25, 30}; // 14 factors
|
||||
int m_nRowFactors[11] = {1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24}; // 11 factors
|
||||
int m_nTimeScale[12] = {15, 30, 45, 60, 75, 90, 120, 180, 240, 300, 600, 700};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// COptnDlg dialog
|
||||
|
||||
|
||||
COptnDlg::COptnDlg(CWnd* pParent, CPalette* pPalette)
|
||||
: CBmpDialog(pParent, pPalette, IDD_SUBOPTIONS, ".\\ART\\SSCROLL.BMP") {
|
||||
//{{AFX_DATA_INIT(COptnDlg)
|
||||
m_nTime = MIN_TIME;
|
||||
m_nColumns = MIN_COLUMNS;
|
||||
m_nRows = MIN_ROWS;
|
||||
m_nNumParts = m_nColumns * m_nRows;
|
||||
nCFacs = 14;
|
||||
nRFacs = 11;
|
||||
m_bFramed = false;
|
||||
pSubOptionsPalette = pPalette;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
COptnDlg::~COptnDlg() {
|
||||
if (m_pPartsText != nullptr)
|
||||
delete m_pPartsText;
|
||||
if (m_pColumnText != nullptr)
|
||||
delete m_pColumnText;
|
||||
if (m_pRowText != nullptr)
|
||||
delete m_pRowText;
|
||||
if (m_pTimerText != nullptr)
|
||||
delete m_pTimerText;
|
||||
// if( m_pFramedText != nullptr )
|
||||
// delete m_pFramedText;
|
||||
|
||||
CBmpDialog::OnDestroy();
|
||||
}
|
||||
|
||||
void COptnDlg::DoDataExchange(CDataExchange* pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(COptnDlg)
|
||||
DDX_Control(pDX, IDC_NUMCOLUMNS, m_ScrollColumns);
|
||||
DDX_Control(pDX, IDC_NUMROWS, m_ScrollRows);
|
||||
DDX_Control(pDX, IDC_TIMELIMIT, m_ScrollTime);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(COptnDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(COptnDlg)
|
||||
ON_WM_HSCROLL()
|
||||
ON_WM_CREATE()
|
||||
ON_WM_ERASEBKGND()
|
||||
ON_WM_PAINT()
|
||||
ON_BN_CLICKED(IDC_FRAMED, COptnDlg::OnFramed)
|
||||
ON_WM_DESTROY()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// COptnDlg message handlers
|
||||
|
||||
int COptnDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) {
|
||||
if (CBmpDialog::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool COptnDlg::OnInitDialog() {
|
||||
CBmpDialog::OnInitDialog();
|
||||
int i;
|
||||
|
||||
CDC *pDC;
|
||||
CRect statRect;
|
||||
|
||||
pDC = GetDC();
|
||||
|
||||
statRect.SetRect(LEFT_SIDE, 45, LEFT_SIDE + 100, 60);
|
||||
if ((m_pPartsText = new CText()) != nullptr) {
|
||||
(*m_pPartsText).SetupText(pDC, pSubOptionsPalette, &statRect, JUSTIFY_LEFT);
|
||||
}
|
||||
|
||||
statRect.SetRect(LEFT_SIDE, 65, LEFT_SIDE + 100, 80);
|
||||
if ((m_pColumnText = new CText()) != nullptr) {
|
||||
(*m_pColumnText).SetupText(pDC, pSubOptionsPalette, &statRect, JUSTIFY_LEFT);
|
||||
}
|
||||
|
||||
m_ScrollColumns.SetScrollRange(0, nCFacs - 1, 0); // Array starts at zero, so
|
||||
for (i = 0; i < nCFacs; i++) {
|
||||
if (m_nColumnFactors[i] == m_nColumns)
|
||||
m_ScrollColumns.SetScrollPos(i, true);
|
||||
}
|
||||
|
||||
statRect.SetRect(LEFT_SIDE, 99, LEFT_SIDE + 100, 114);
|
||||
if ((m_pRowText = new CText()) != nullptr) {
|
||||
(*m_pRowText).SetupText(pDC, pSubOptionsPalette, &statRect, JUSTIFY_LEFT);
|
||||
}
|
||||
|
||||
m_ScrollRows.SetScrollRange(0, nRFacs - 1, 0); //...last element is Max - 1
|
||||
for (i = 0; i < nRFacs; i++) {
|
||||
if (m_nRowFactors[i] == m_nRows)
|
||||
m_ScrollRows.SetScrollPos(i, true);
|
||||
}
|
||||
|
||||
m_nNumParts = m_nColumns * m_nRows;
|
||||
|
||||
statRect.SetRect(LEFT_SIDE, 132, LEFT_SIDE + 100, 146);
|
||||
if ((m_pTimerText = new CText()) != nullptr) {
|
||||
(*m_pTimerText).SetupText(pDC, pSubOptionsPalette, &statRect, JUSTIFY_LEFT);
|
||||
}
|
||||
|
||||
m_ScrollTime.SetScrollRange(TIMER_START, TIMER_MAX - 1, 0);
|
||||
if (m_nTime == 0) m_nTime = m_nTimeScale[TIMER_MAX - 1];
|
||||
for (i = 0; i < TIMER_MAX; i++) {
|
||||
if (m_nTimeScale[i] == m_nTime)
|
||||
m_ScrollTime.SetScrollPos(i, true);
|
||||
}
|
||||
|
||||
ReleaseDC(pDC);
|
||||
|
||||
statRect.SetRect(155, 45, 205, 60);
|
||||
|
||||
if ((pOKButton = new CColorButton) != nullptr) { // build a color QUIT button to let us exit
|
||||
(*pOKButton).SetPalette(pSubOptionsPalette); // set the palette to use
|
||||
(*pOKButton).SetControl(IDOK, this); // tie to the dialog control
|
||||
}
|
||||
|
||||
if ((pCancelButton = new CColorButton) != nullptr) { // build a color QUIT button to let us exit
|
||||
(*pCancelButton).SetPalette(pSubOptionsPalette); // set the palette to use
|
||||
(*pCancelButton).SetControl(IDCANCEL, this); // tie to the dialog control
|
||||
}
|
||||
|
||||
if ((pFramedButton = new CCheckButton) != nullptr) { // build a color QUIT button to let us exit
|
||||
(*pFramedButton).SetPalette(pSubOptionsPalette); // set the palette to use
|
||||
(*pFramedButton).SetControl(IDC_FRAMED, this); // tie to the dialog control
|
||||
}
|
||||
((CWnd *)this)->CheckDlgButton(IDC_FRAMED, m_bFramed); // Set the frame option box
|
||||
|
||||
return true; // return true unless you set the focus to a control
|
||||
}
|
||||
|
||||
|
||||
bool COptnDlg::OnEraseBkgnd(CDC *pDC) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void COptnDlg::OnDestroy() {
|
||||
CBmpDialog::OnDestroy();
|
||||
}
|
||||
|
||||
|
||||
void COptnDlg::OnHScroll(unsigned int nSBCode, unsigned int nPos, CScrollBar* pScrollBar) {
|
||||
int pMin,
|
||||
pMax;
|
||||
int OldPos = pScrollBar->GetScrollPos();
|
||||
int NewPos = OldPos;
|
||||
|
||||
pScrollBar->GetScrollRange(&pMin, &pMax);
|
||||
|
||||
switch (nSBCode) {
|
||||
case SB_LINERIGHT:
|
||||
case SB_PAGERIGHT:
|
||||
NewPos ++;
|
||||
break;
|
||||
case SB_RIGHT:
|
||||
NewPos = pMax;
|
||||
break;
|
||||
case SB_LINELEFT:
|
||||
case SB_PAGELEFT:
|
||||
NewPos--;
|
||||
break;
|
||||
case SB_LEFT:
|
||||
NewPos = pMin;
|
||||
break;
|
||||
case SB_THUMBPOSITION:
|
||||
case SB_THUMBTRACK:
|
||||
NewPos = nPos;
|
||||
break;
|
||||
}
|
||||
|
||||
if (NewPos < pMin) NewPos = pMin;
|
||||
if (NewPos > pMax) NewPos = pMax;
|
||||
|
||||
if (NewPos != OldPos) { //To prevent "flicker"
|
||||
(*pScrollBar).SetScrollPos(NewPos, true); //...only update when
|
||||
} //...changed
|
||||
|
||||
UpdateScrollbars();
|
||||
|
||||
CDialog::OnHScroll(nSBCode, NewPos, pScrollBar);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* UpdateScrollbars
|
||||
*
|
||||
* FUNCTIONAL DESCRIPTION:
|
||||
*
|
||||
* Updates data adjusted with scrollbars
|
||||
*
|
||||
* FORMAL PARAMETERS:
|
||||
*
|
||||
* none
|
||||
*
|
||||
* IMPLICIT INPUT PARAMETERS:
|
||||
*
|
||||
* CScrollbar pScrollTime, pScrollColumns, pScrollRows
|
||||
*
|
||||
* IMPLICIT OUTPUT PARAMETERS:
|
||||
*
|
||||
* int m_nTime, m_nNumParts, m_nColumns, m_nRows
|
||||
*
|
||||
* RETURN VALUE:
|
||||
*
|
||||
* void
|
||||
*
|
||||
****************************************************************/
|
||||
void COptnDlg::UpdateScrollbars() {
|
||||
int OldValue;
|
||||
CDC *pDC;
|
||||
char msg[64];
|
||||
int nMins, nSecs;
|
||||
|
||||
pDC = GetDC();
|
||||
|
||||
OldValue = m_nTime;
|
||||
m_nTime = m_nTimeScale[m_ScrollTime.GetScrollPos()];
|
||||
if (OldValue != m_nTime) {
|
||||
if (m_nTime == m_nTimeScale[TIMER_MAX - 1])
|
||||
Common::sprintf_s(msg, "Time Limit: None");
|
||||
else {
|
||||
nMins = m_nTime / 60;
|
||||
nSecs = m_nTime % 60;
|
||||
|
||||
Common::sprintf_s(msg, "Time Limit: %02d:%02d", nMins, nSecs);
|
||||
}
|
||||
(*m_pTimerText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
}
|
||||
|
||||
OldValue = m_nColumns;
|
||||
m_nColumns = m_nColumnFactors[m_ScrollColumns.GetScrollPos()];
|
||||
if (OldValue != m_nColumns) {
|
||||
Common::sprintf_s(msg, "Columns: %d", m_nColumns);
|
||||
(*m_pColumnText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
}
|
||||
|
||||
OldValue = m_nRows;
|
||||
m_nRows = m_nRowFactors[m_ScrollRows.GetScrollPos()];
|
||||
if (OldValue != m_nRows) {
|
||||
Common::sprintf_s(msg, "Rows: %d", m_nRows);
|
||||
(*m_pRowText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
}
|
||||
|
||||
OldValue = m_nNumParts;
|
||||
m_nNumParts = m_nColumns * m_nRows;
|
||||
if (OldValue != m_nNumParts) {
|
||||
Common::sprintf_s(msg, "Parts: %d", m_nNumParts);
|
||||
(*m_pPartsText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
}
|
||||
|
||||
ReleaseDC(pDC);
|
||||
}
|
||||
|
||||
|
||||
void COptnDlg::OnFramed() {
|
||||
m_bFramed = !m_bFramed;
|
||||
((CWnd *)this)->CheckDlgButton(IDC_FRAMED, m_bFramed);
|
||||
}
|
||||
|
||||
void COptnDlg::OnOK() {
|
||||
if (m_nTime > MAX_TIME) m_nTime = MIN_TIME;
|
||||
ClearDialogImage();
|
||||
EndDialog(IDOK);
|
||||
}
|
||||
|
||||
void COptnDlg::OnCancel() {
|
||||
ClearDialogImage();
|
||||
EndDialog(0);
|
||||
}
|
||||
|
||||
void COptnDlg::OnPaint() {
|
||||
CDC *pDC;
|
||||
char msg[64];
|
||||
int nMins, nSecs;
|
||||
|
||||
CBmpDialog::OnPaint();
|
||||
|
||||
pDC = GetDC();
|
||||
|
||||
Common::sprintf_s(msg, "Parts: %d", m_nNumParts);
|
||||
(*m_pPartsText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
|
||||
Common::sprintf_s(msg, "Columns: %d", m_nColumns);
|
||||
(*m_pColumnText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
|
||||
Common::sprintf_s(msg, "Rows: %d", m_nRows);
|
||||
(*m_pRowText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
|
||||
if (m_nTime == m_nTimeScale[TIMER_MAX - 1])
|
||||
Common::sprintf_s(msg, "Time Limit: None");
|
||||
else {
|
||||
nMins = m_nTime / 60;
|
||||
nSecs = m_nTime % 60;
|
||||
Common::sprintf_s(msg, "Time Limit: %02d:%02d", nMins, nSecs);
|
||||
}
|
||||
(*m_pTimerText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
|
||||
ReleaseDC(pDC);
|
||||
|
||||
}
|
||||
|
||||
void COptnDlg::ClearDialogImage() {
|
||||
if (pOKButton != nullptr) { // release the button
|
||||
delete pOKButton;
|
||||
pOKButton = nullptr;
|
||||
}
|
||||
|
||||
if (pCancelButton != nullptr) { // release the button
|
||||
delete pCancelButton;
|
||||
pCancelButton = nullptr;
|
||||
}
|
||||
|
||||
if (pFramedButton != nullptr) { // release the button
|
||||
delete pFramedButton;
|
||||
pFramedButton = nullptr;
|
||||
}
|
||||
|
||||
ValidateRect(nullptr);
|
||||
}
|
||||
|
||||
} // namespace ArtParts
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
89
engines/bagel/hodjnpodj/artparts/optndlg.h
Normal file
89
engines/bagel/hodjnpodj/artparts/optndlg.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HODJNPODJ_ARTPARTS_OPTNDLG_H
|
||||
#define HODJNPODJ_ARTPARTS_OPTNDLG_H
|
||||
|
||||
#include "bagel/hodjnpodj/hnplibs/cbofdlg.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/text.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace ArtParts {
|
||||
|
||||
#define LEFT_SIDE 30
|
||||
#define OPTIONS_COLOR RGB(0, 0, 0) // Color of the stats info CText
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// COptnDlg dialog
|
||||
|
||||
class COptnDlg : public CBmpDialog {
|
||||
// Construction
|
||||
public:
|
||||
COptnDlg(CWnd* pParent = nullptr, CPalette *pPalette = nullptr); // standard constructor
|
||||
~COptnDlg(); // destructor
|
||||
void UpdateScrollbars();
|
||||
void ClearDialogImage();
|
||||
|
||||
int m_nTime = 0;
|
||||
int m_nRows = 0;
|
||||
int m_nColumns = 0;
|
||||
int m_nMins = 0;
|
||||
int m_nSecs = 0;
|
||||
float m_nScore = 0.0;
|
||||
bool m_bFramed = false;
|
||||
int m_nNumParts = 0;
|
||||
|
||||
int nCFacs = 0;
|
||||
int nRFacs = 0;
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(COptnDlg)
|
||||
enum { IDD = IDD_SUBOPTIONS };
|
||||
CScrollBar m_ScrollTime;
|
||||
CScrollBar m_ScrollColumns;
|
||||
CScrollBar m_ScrollRows;
|
||||
//}}AFX_DATA
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(COptnDlg)
|
||||
virtual bool OnInitDialog() override;
|
||||
afx_msg void OnHScroll(unsigned int nSBCode, unsigned int nPos, CScrollBar* pScrollBar);
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg bool OnEraseBkgnd(CDC *pDC);
|
||||
virtual void OnOK() override;
|
||||
virtual void OnCancel() override;
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnFramed();
|
||||
afx_msg void OnDestroy();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
} // namespace ArtParts
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
47
engines/bagel/hodjnpodj/artparts/resource.h
Normal file
47
engines/bagel/hodjnpodj/artparts/resource.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HODJNPODJ_ARTPARTS_RESOURCE_H
|
||||
#define HODJNPODJ_ARTPARTS_RESOURCE_H
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace ArtParts {
|
||||
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// App Studio generated include file.
|
||||
// Used by GAME.RC
|
||||
//
|
||||
#define IDD_SUBOPTIONS 115
|
||||
|
||||
//#define IDB_LOCALE_BMP 301
|
||||
|
||||
#define IDC_RULES 1002
|
||||
#define IDC_NUMCOLUMNS 1021
|
||||
#define IDC_NUMROWS 1022
|
||||
#define IDC_TIMELIMIT 1023
|
||||
#define IDC_FRAMED 1025
|
||||
|
||||
} // namespace ArtParts
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user