Initial commit
This commit is contained in:
241
engines/bagel/hodjnpodj/wordsearch/c1btndlg.cpp
Normal file
241
engines/bagel/hodjnpodj/wordsearch/c1btndlg.cpp
Normal file
@@ -0,0 +1,241 @@
|
||||
/* 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/cbofdlg.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/text.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/button.h"
|
||||
#include "bagel/hodjnpodj/wordsearch/wordlist.h"
|
||||
#include "bagel/hodjnpodj/wordsearch/c1btndlg.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace WordSearch {
|
||||
|
||||
#define TEXT_COLOR RGB(0, 0, 0) // displayed text color
|
||||
|
||||
#define MESSAGE_COL 16 // first message box positioning
|
||||
#define MESSAGE_ROW 60
|
||||
|
||||
#define MESSAGE_WIDTH 175 // standard message box dims
|
||||
#define MESSAGE_HEIGHT 20
|
||||
|
||||
#define MESSAGE2_ROW_OFFSET ( MESSAGE_HEIGHT + 4 ) // Row offset from first
|
||||
// message box
|
||||
|
||||
#define IDD_1BTNDLG 321
|
||||
|
||||
extern CString *astrGameList[WORDSPERLIST];
|
||||
extern CString *astrGameListDisplay[WORDSPERLIST];
|
||||
extern CText *atxtDisplayWord[WORDSPERLIST];
|
||||
|
||||
|
||||
|
||||
C1ButtonDialog::C1ButtonDialog(CWnd *pParent, CPalette *pPalette, char *pszButton1Text, char *pszText1, char *pszText2)
|
||||
: CBmpDialog(pParent, pPalette, IDD_1BTNDLG, ".\\ART\\WLSTSCRL.BMP", 16, 25) {
|
||||
assert(pParent != nullptr);
|
||||
assert(pPalette != nullptr);
|
||||
assert(pszText1 != nullptr);
|
||||
assert(pszButton1Text != nullptr);
|
||||
|
||||
// Initialize all members
|
||||
//
|
||||
m_pPalette = pPalette;
|
||||
m_pszMessage1 = pszText1;
|
||||
m_pszMessage2 = pszText2;
|
||||
m_pszButton1Text = pszButton1Text;
|
||||
|
||||
m_cTextMessage1 = nullptr;
|
||||
m_cTextMessage2 = nullptr;
|
||||
|
||||
//{{AFX_DATA_INIT(C1ButtonDialog)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
void C1ButtonDialog::ClearDialogImage() {
|
||||
if (m_pButton1 != nullptr) { // release the 1st button
|
||||
delete m_pButton1;
|
||||
m_pButton1 = nullptr;
|
||||
}
|
||||
|
||||
ValidateRect(nullptr);
|
||||
}
|
||||
|
||||
void C1ButtonDialog::OnDestroy() {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < WORDSPERLIST; i++) {
|
||||
delete m_cWordList[i];
|
||||
m_cWordList[i] = nullptr;
|
||||
}
|
||||
|
||||
if (m_cTextMessage1 != nullptr) {
|
||||
delete m_cTextMessage1;
|
||||
m_cTextMessage1 = nullptr;
|
||||
}
|
||||
|
||||
if (m_cTextMessage2 != nullptr) {
|
||||
delete m_cTextMessage2;
|
||||
m_cTextMessage2 = nullptr;
|
||||
}
|
||||
|
||||
CBmpDialog::OnDestroy();
|
||||
}
|
||||
|
||||
void C1ButtonDialog::DoDataExchange(CDataExchange* pDX) {
|
||||
CBmpDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(C1ButtonDialog)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(C1ButtonDialog, CBmpDialog)
|
||||
//{{AFX_MSG_MAP(C1ButtonDialog)
|
||||
ON_WM_PAINT()
|
||||
ON_WM_ERASEBKGND()
|
||||
ON_WM_DESTROY()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// C1ButtonDialog message handlers
|
||||
|
||||
bool C1ButtonDialog::OnInitDialog() {
|
||||
CRect statsRect; // game stats displays
|
||||
int nStat_col_offset; // game stats placement
|
||||
int nStat_row_offset;
|
||||
int nStatWidth, nStatHeight;
|
||||
bool bAssertCheck;
|
||||
CDC *pDC;
|
||||
int i;
|
||||
|
||||
CBmpDialog::OnInitDialog();
|
||||
|
||||
pDC = GetDC();
|
||||
|
||||
nStat_col_offset = MESSAGE_COL;
|
||||
nStat_row_offset = MESSAGE_ROW;
|
||||
nStatWidth = MESSAGE_WIDTH;
|
||||
nStatHeight = MESSAGE_HEIGHT;
|
||||
statsRect.SetRect(
|
||||
nStat_col_offset,
|
||||
nStat_row_offset,
|
||||
nStat_col_offset + nStatWidth,
|
||||
nStat_row_offset + nStatHeight
|
||||
);
|
||||
|
||||
if ((m_cTextMessage1 = new CText()) != nullptr) {
|
||||
bAssertCheck = (*m_cTextMessage1).SetupText(pDC, m_pPalette, &statsRect, JUSTIFY_CENTER);
|
||||
ASSERT(bAssertCheck); // initialize the text objext
|
||||
}
|
||||
|
||||
nStat_row_offset += MESSAGE2_ROW_OFFSET;
|
||||
statsRect.SetRect(
|
||||
nStat_col_offset,
|
||||
nStat_row_offset,
|
||||
nStat_col_offset + nStatWidth,
|
||||
nStat_row_offset + nStatHeight
|
||||
);
|
||||
|
||||
if ((m_cTextMessage2 = new CText()) != nullptr) {
|
||||
bAssertCheck = (*m_cTextMessage2).SetupText(pDC, m_pPalette, &statsRect, JUSTIFY_CENTER);
|
||||
ASSERT(bAssertCheck); // initialize the text objext
|
||||
}
|
||||
|
||||
nStat_col_offset = 0;
|
||||
nStat_row_offset = 30;
|
||||
for (i = 0; i < WORDSPERLIST; i++) {
|
||||
statsRect.SetRect(
|
||||
nStat_col_offset,
|
||||
nStat_row_offset + (12 * i),
|
||||
nStat_col_offset + nStatWidth,
|
||||
nStat_row_offset + (12 * i) + nStatHeight
|
||||
);
|
||||
if ((m_cWordList[i] = new CText()) != nullptr) {
|
||||
bAssertCheck = (*m_cWordList[i]).SetupText(pDC, m_pPalette, &statsRect, JUSTIFY_CENTER);
|
||||
ASSERT(bAssertCheck); // initialize the text objext
|
||||
}
|
||||
}
|
||||
|
||||
ReleaseDC(pDC);
|
||||
|
||||
if ((m_pButton1 = new CColorButton) != nullptr) { // build the first color button
|
||||
(*m_pButton1).SetPalette(m_pPalette); // set the palette to use
|
||||
(*m_pButton1).SetControl(IDOK, this); // tie to the dialog control
|
||||
(*m_pButton1).SetWindowText(m_pszButton1Text);
|
||||
}
|
||||
|
||||
return true; // return true unless you set the focus to a control
|
||||
}
|
||||
|
||||
void C1ButtonDialog::OnPaint() {
|
||||
CDC *pDC;
|
||||
int i;
|
||||
char buf[30];
|
||||
|
||||
CBmpDialog::OnPaint();
|
||||
// Do not call CDialog::OnPaint() for painting messages
|
||||
|
||||
pDC = GetDC();
|
||||
/*
|
||||
if ( m_pszMessage1 != nullptr ) {
|
||||
bAssertCheck = (*m_cTextMessage1).DisplayString(pDC, m_pszMessage1, 21, FW_BOLD, TEXT_COLOR);
|
||||
ASSERT(bAssertCheck);
|
||||
}
|
||||
|
||||
if ( m_pszMessage2 != nullptr ) {
|
||||
bAssertCheck = (*m_cTextMessage2).DisplayString(pDC, m_pszMessage2, 21, FW_BOLD, TEXT_COLOR);
|
||||
ASSERT(bAssertCheck);
|
||||
}
|
||||
*/
|
||||
for (i = 0; i < WORDSPERLIST; i++) {
|
||||
if ((*astrGameList)[i].IsEmpty()) {
|
||||
Common::sprintf_s(buf, "%s", (*astrGameListDisplay)[i].c_str());
|
||||
m_cWordList[i]->DisplayString(pDC, buf, 12, FW_BOLD);
|
||||
} else {
|
||||
Common::sprintf_s(buf, "%s", (*astrGameListDisplay)[i].c_str());
|
||||
m_cWordList[i]->DisplayShadowedString(pDC, buf, 12, FW_BOLD, (COLORREF)RGB(0, 255, 255));
|
||||
}
|
||||
}
|
||||
|
||||
ReleaseDC(pDC);
|
||||
}
|
||||
|
||||
void C1ButtonDialog::OnOK() {
|
||||
ClearDialogImage();
|
||||
EndDialog(IDOK);
|
||||
}
|
||||
|
||||
void C1ButtonDialog::OnCancel() {
|
||||
ClearDialogImage();
|
||||
EndDialog(IDCANCEL);
|
||||
}
|
||||
|
||||
bool C1ButtonDialog::OnEraseBkgnd(CDC *) {
|
||||
// Prevents refreshing of background
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace WordSearch
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
77
engines/bagel/hodjnpodj/wordsearch/c1btndlg.h
Normal file
77
engines/bagel/hodjnpodj/wordsearch/c1btndlg.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/* 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_WORDSEARCH_C1BTNDLG_H
|
||||
#define HODJNPODJ_WORDSEARCH_C1BTNDLG_H
|
||||
|
||||
#include "bagel/afxwin.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace WordSearch {
|
||||
|
||||
#define CBUTTON1 IDOK
|
||||
#define CBUTTON2 IDCANCEL
|
||||
|
||||
class C1ButtonDialog : public CBmpDialog {
|
||||
public:
|
||||
|
||||
// standard constructor
|
||||
C1ButtonDialog(CWnd *, CPalette *, char *, char *, char *pszText2 = nullptr);
|
||||
|
||||
private:
|
||||
void ClearDialogImage();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(C1ButtonDialog)
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX) override; // DDX/DDV support
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(C1ButtonDialog)
|
||||
afx_msg void OnPaint();
|
||||
virtual void OnOK() override;
|
||||
virtual void OnCancel() override;
|
||||
virtual bool OnInitDialog() override;
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg bool OnEraseBkgnd(CDC *pDC);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
CText *m_cTextMessage1 = nullptr;
|
||||
CText *m_cTextMessage2 = nullptr;
|
||||
CText *m_cWordList[WORDSPERLIST] = {};
|
||||
char *m_pszMessage1 = nullptr;
|
||||
char *m_pszMessage2 = nullptr;
|
||||
char *m_pszButton1Text = nullptr;
|
||||
CColorButton *m_pButton1 = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Poker
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
243
engines/bagel/hodjnpodj/wordsearch/clongdlg.cpp
Normal file
243
engines/bagel/hodjnpodj/wordsearch/clongdlg.cpp
Normal file
@@ -0,0 +1,243 @@
|
||||
/* 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/cbofdlg.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/text.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/button.h"
|
||||
#include "bagel/hodjnpodj/wordsearch/wordlist.h"
|
||||
#include "bagel/hodjnpodj/wordsearch/clongdlg.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace WordSearch {
|
||||
|
||||
#define MESSAGE_COL 16 // first message box positioning
|
||||
#define MESSAGE_ROW 60
|
||||
|
||||
#define MESSAGE_WIDTH 175 // standard message box dims
|
||||
#define MESSAGE_HEIGHT 20
|
||||
|
||||
#define MESSAGE2_ROW_OFFSET ( MESSAGE_HEIGHT + 4 ) // Row offset from first
|
||||
// message box
|
||||
|
||||
#define IDD_1BTNDLG 321
|
||||
|
||||
extern CString *astrGameList[WORDSPERLIST];
|
||||
extern CString *astrGameListDisplay[WORDSPERLIST];
|
||||
extern CText *atxtDisplayWord[WORDSPERLIST];
|
||||
extern int anWordIndex[NUMBEROFLISTS][WORDSPERLIST]; // Key to alphabetical order of words
|
||||
extern int nWordList; // Which is the current list index
|
||||
|
||||
|
||||
|
||||
CLongDialog::CLongDialog(CWnd *pParent, CPalette *pPalette,
|
||||
const char *pszButton1Text, const char *pszText1,
|
||||
const char *pszText2)
|
||||
: CBmpDialog(pParent, pPalette, IDD_1BTNDLG, ".\\ART\\WLSTSCRL.BMP", 16, 25) {
|
||||
assert(pParent != nullptr);
|
||||
assert(pPalette != nullptr);
|
||||
assert(pszText1 != nullptr);
|
||||
assert(pszButton1Text != nullptr);
|
||||
|
||||
// Initialize all members
|
||||
//
|
||||
m_pPalette = pPalette;
|
||||
m_pszMessage1 = pszText1;
|
||||
m_pszMessage2 = pszText2;
|
||||
m_pszButton1Text = pszButton1Text;
|
||||
|
||||
m_cTextMessage1 = nullptr;
|
||||
m_cTextMessage2 = nullptr;
|
||||
|
||||
//{{AFX_DATA_INIT(CLongDialog)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
void CLongDialog::ClearDialogImage() {
|
||||
if (m_pButton1 != nullptr) { // release the 1st button
|
||||
delete m_pButton1;
|
||||
m_pButton1 = nullptr;
|
||||
}
|
||||
|
||||
ValidateRect(nullptr);
|
||||
}
|
||||
|
||||
void CLongDialog::OnDestroy() {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < WORDSPERLIST; i++) {
|
||||
delete m_cWordList[i];
|
||||
m_cWordList[i] = nullptr;
|
||||
}
|
||||
|
||||
if (m_cTextMessage1 != nullptr) {
|
||||
delete m_cTextMessage1;
|
||||
m_cTextMessage1 = nullptr;
|
||||
}
|
||||
|
||||
if (m_cTextMessage2 != nullptr) {
|
||||
delete m_cTextMessage2;
|
||||
m_cTextMessage2 = nullptr;
|
||||
}
|
||||
|
||||
CBmpDialog::OnDestroy();
|
||||
}
|
||||
|
||||
void CLongDialog::DoDataExchange(CDataExchange* pDX) {
|
||||
CBmpDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CLongDialog)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CLongDialog, CBmpDialog)
|
||||
//{{AFX_MSG_MAP(CLongDialog)
|
||||
ON_WM_PAINT()
|
||||
ON_WM_ERASEBKGND()
|
||||
ON_WM_DESTROY()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CLongDialog message handlers
|
||||
|
||||
bool CLongDialog::OnInitDialog() {
|
||||
CRect statsRect; // game stats displays
|
||||
int nStat_col_offset; // game stats placement
|
||||
int nStat_row_offset;
|
||||
int nStatWidth, nStatHeight;
|
||||
bool bAssertCheck;
|
||||
CDC *pDC;
|
||||
int i;
|
||||
|
||||
CBmpDialog::OnInitDialog();
|
||||
|
||||
pDC = GetDC();
|
||||
|
||||
nStat_col_offset = MESSAGE_COL;
|
||||
nStat_row_offset = MESSAGE_ROW;
|
||||
nStatWidth = MESSAGE_WIDTH;
|
||||
nStatHeight = MESSAGE_HEIGHT;
|
||||
statsRect.SetRect(
|
||||
nStat_col_offset,
|
||||
nStat_row_offset,
|
||||
nStat_col_offset + nStatWidth,
|
||||
nStat_row_offset + nStatHeight
|
||||
);
|
||||
|
||||
if ((m_cTextMessage1 = new CText()) != nullptr) {
|
||||
bAssertCheck = (*m_cTextMessage1).SetupText(pDC, m_pPalette, &statsRect, JUSTIFY_CENTER);
|
||||
ASSERT(bAssertCheck); // initialize the text objext
|
||||
}
|
||||
|
||||
nStat_row_offset += MESSAGE2_ROW_OFFSET;
|
||||
statsRect.SetRect(
|
||||
nStat_col_offset,
|
||||
nStat_row_offset,
|
||||
nStat_col_offset + nStatWidth,
|
||||
nStat_row_offset + nStatHeight
|
||||
);
|
||||
|
||||
if ((m_cTextMessage2 = new CText()) != nullptr) {
|
||||
bAssertCheck = (*m_cTextMessage2).SetupText(pDC, m_pPalette, &statsRect, JUSTIFY_CENTER);
|
||||
ASSERT(bAssertCheck); // initialize the text objext
|
||||
}
|
||||
|
||||
nStat_col_offset = 0;
|
||||
nStat_row_offset = 30;
|
||||
for (i = 0; i < WORDSPERLIST; i++) {
|
||||
statsRect.SetRect(
|
||||
nStat_col_offset,
|
||||
nStat_row_offset + (12 * i),
|
||||
nStat_col_offset + nStatWidth,
|
||||
nStat_row_offset + (12 * i) + nStatHeight
|
||||
);
|
||||
if ((m_cWordList[i] = new CText()) != nullptr) {
|
||||
bAssertCheck = (*m_cWordList[i]).SetupText(pDC, m_pPalette, &statsRect, JUSTIFY_CENTER);
|
||||
ASSERT(bAssertCheck); // initialize the text objext
|
||||
}
|
||||
}
|
||||
|
||||
ReleaseDC(pDC);
|
||||
|
||||
if ((m_pButton1 = new CColorButton) != nullptr) { // build the first color button
|
||||
(*m_pButton1).SetPalette(m_pPalette); // set the palette to use
|
||||
(*m_pButton1).SetControl(IDOK, this); // tie to the dialog control
|
||||
(*m_pButton1).SetWindowText(m_pszButton1Text);
|
||||
}
|
||||
|
||||
return true; // return true unless you set the focus to a control
|
||||
}
|
||||
|
||||
void CLongDialog::OnPaint() {
|
||||
CDC *pDC;
|
||||
int nWordIndex,
|
||||
nCurrent,
|
||||
nDisplayWord = 0;
|
||||
int i;
|
||||
char buf[30];
|
||||
|
||||
CBmpDialog::OnPaint();
|
||||
// Do not call CDialog::OnPaint() for painting messages
|
||||
|
||||
pDC = GetDC();
|
||||
|
||||
for (i = 0; i < WORDSPERLIST; i++) {
|
||||
for (nCurrent = 0; nCurrent < WORDSPERLIST; nCurrent++) { // Go thru the wordlist
|
||||
nWordIndex = anWordIndex[nWordList][nCurrent]; // Get the word's order index
|
||||
if (nWordIndex == i) { // if this is the i-th entry
|
||||
nDisplayWord = nCurrent;
|
||||
break; //...display it!
|
||||
}
|
||||
}
|
||||
if ((*astrGameList)[nDisplayWord].IsEmpty()) {
|
||||
Common::sprintf_s(buf, "%s", (*astrGameListDisplay)[nDisplayWord].c_str());
|
||||
m_cWordList[i]->DisplayString(pDC, buf, 12, FW_BOLD, TEXT_COLOR);
|
||||
} else {
|
||||
Common::sprintf_s(buf, "%s", (*astrGameListDisplay)[nDisplayWord].c_str());
|
||||
m_cWordList[i]->DisplayString(pDC, buf, 12, FW_BOLD, RED_TEXT);
|
||||
} //Shadowed
|
||||
}
|
||||
|
||||
ReleaseDC(pDC);
|
||||
}
|
||||
|
||||
void CLongDialog::OnOK() {
|
||||
ClearDialogImage();
|
||||
EndDialog(IDOK);
|
||||
}
|
||||
|
||||
void CLongDialog::OnCancel() {
|
||||
ClearDialogImage();
|
||||
EndDialog(IDCANCEL);
|
||||
}
|
||||
|
||||
bool CLongDialog::OnEraseBkgnd(CDC *) {
|
||||
// Prevents refreshing of background
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace WordSearch
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
77
engines/bagel/hodjnpodj/wordsearch/clongdlg.h
Normal file
77
engines/bagel/hodjnpodj/wordsearch/clongdlg.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/* 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_WORDSEARCH_CLONGDLG_H
|
||||
#define HODJNPODJ_WORDSEARCH_CLONGDLG_H
|
||||
|
||||
#include "bagel/afxwin.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace WordSearch {
|
||||
|
||||
#define CBUTTON1 IDOK
|
||||
#define CBUTTON2 IDCANCEL
|
||||
|
||||
class CLongDialog : public CBmpDialog {
|
||||
public:
|
||||
// standard constructor
|
||||
CLongDialog(CWnd *, CPalette *, const char *,
|
||||
const char *, const char *pszText2 = nullptr);
|
||||
|
||||
private:
|
||||
void ClearDialogImage();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(C1ButtonDialog)
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(C1ButtonDialog)
|
||||
afx_msg void OnPaint();
|
||||
virtual void OnOK() override;
|
||||
virtual void OnCancel() override;
|
||||
virtual bool OnInitDialog() override;
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg bool OnEraseBkgnd(CDC *pDC);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
CText *m_cTextMessage1 = nullptr;
|
||||
CText *m_cTextMessage2 = nullptr;
|
||||
CText *m_cWordList[WORDSPERLIST] = {};
|
||||
const char *m_pszMessage1 = nullptr;
|
||||
const char *m_pszMessage2 = nullptr;
|
||||
const char *m_pszButton1Text = nullptr;
|
||||
CColorButton *m_pButton1 = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Poker
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
89
engines/bagel/hodjnpodj/wordsearch/dialogs.h
Normal file
89
engines/bagel/hodjnpodj/wordsearch/dialogs.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_WORDSEARCH_DIALOGS_H
|
||||
#define HODJNPODJ_WORDSEARCH_DIALOGS_H
|
||||
|
||||
#include "bagel/hodjnpodj/hnplibs/cbofdlg.h"
|
||||
#include "bagel/hodjnpodj/wordsearch/wordsearch.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace WordSearch {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////// Options Specific to Word Search
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
class CWSOptDlg : public CBmpDialog {
|
||||
private:
|
||||
int m_nGameTime = 0;
|
||||
bool m_bShowWord = false;
|
||||
bool m_bWordForwardOnly = false;
|
||||
CRect rDisplayTime;
|
||||
|
||||
public:
|
||||
CWSOptDlg(CWnd* pParent = nullptr, CPalette *pPalette = nullptr, unsigned int = IDD_MINIOPTIONS_DIALOG);
|
||||
void SetInitialOptions(int = 0, bool = true, bool = false); // Sets the private members
|
||||
void ClearDialogImage();
|
||||
bool OnInitDialog() override;
|
||||
|
||||
protected:
|
||||
//{{AFX_MSG(COptions)
|
||||
virtual void OnCancel() override;
|
||||
virtual void OnOK() override;
|
||||
virtual bool OnCommand(WPARAM, LPARAM) override;
|
||||
afx_msg void OnHScroll(unsigned int nSBCode, unsigned int nPos, CScrollBar* pScrollBar);
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnDestroy();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////// Pack Rat Message Box
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
class CMsgDlg : public CBmpDialog {
|
||||
private:
|
||||
int m_nWhichMsg;
|
||||
long m_nWordsLeft;
|
||||
|
||||
public:
|
||||
CMsgDlg(CWnd* pParent = nullptr, CPalette *pPalette = nullptr, unsigned int = IDD_MESSAGEBOX);
|
||||
void SetInitialOptions(int, int); // Sets the private members
|
||||
void ClearDialogImage();
|
||||
bool OnInitDialog() override;
|
||||
|
||||
protected:
|
||||
//{{AFX_MSG(COptions)
|
||||
virtual void OnCancel() override;
|
||||
virtual void OnOK() override;
|
||||
virtual bool OnCommand(WPARAM, LPARAM) override;
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnDestroy();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
} // namespace Poker
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
42
engines/bagel/hodjnpodj/wordsearch/globals.h
Normal file
42
engines/bagel/hodjnpodj/wordsearch/globals.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/* 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_WORDSEARCH_GLOBALS_H
|
||||
#define HODJNPODJ_WORDSEARCH_GLOBALS_H
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace WordSearch {
|
||||
|
||||
// Main Window positioning constants
|
||||
#define GAME_WIDTH 640
|
||||
#define GAME_HEIGHT 480
|
||||
|
||||
#define VK_H 72
|
||||
#define VK_J 74
|
||||
#define VK_K 75
|
||||
#define VK_L 76
|
||||
|
||||
} // namespace Poker
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
88
engines/bagel/hodjnpodj/wordsearch/init.cpp
Normal file
88
engines/bagel/hodjnpodj/wordsearch/init.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
/* 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/wordsearch/resource.h"
|
||||
#include "bagel/hodjnpodj/wordsearch/wordsearch.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace WordSearch {
|
||||
|
||||
HINSTANCE hDLLInst;
|
||||
HINSTANCE hExeInst;
|
||||
|
||||
CMainWSWindow *pMainGameWnd = nullptr; // pointer to the poker's main window
|
||||
CPalette *pTestPalette = nullptr;
|
||||
HCURSOR hGameCursor;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Public C interface
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* RunPoker
|
||||
*
|
||||
* 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
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
HWND FAR PASCAL RunWordSearch(HWND hParentWnd, LPGAMESTRUCT lpGameInfo) {
|
||||
|
||||
// if the pointer has garbage in it, the clean it out
|
||||
if (pMainGameWnd != nullptr) {
|
||||
pMainGameWnd = nullptr;
|
||||
}
|
||||
|
||||
// create a my poker window and show it
|
||||
pMainGameWnd = new CMainWSWindow(hParentWnd, lpGameInfo);
|
||||
pMainGameWnd->ShowWindow(SW_SHOWNORMAL);
|
||||
pMainGameWnd->UpdateWindow();
|
||||
pMainGameWnd->SetActiveWindow();
|
||||
// return the handle to this window
|
||||
hDLLInst = (HINSTANCE)GetWindowWord(pMainGameWnd->m_hWnd, GWW_HINSTANCE);
|
||||
hExeInst = (HINSTANCE)GetWindowWord(hParentWnd, GWW_HINSTANCE);
|
||||
if (lpGameInfo->bPlayingMetagame == false)
|
||||
MFC::PostMessage(pMainGameWnd->m_hWnd, WM_COMMAND, IDC_OPTION, BN_CLICKED);
|
||||
return pMainGameWnd->m_hWnd;
|
||||
}
|
||||
|
||||
} // namespace WordSearch
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
37
engines/bagel/hodjnpodj/wordsearch/init.h
Normal file
37
engines/bagel/hodjnpodj/wordsearch/init.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/* 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_WORDSEARCH_DLLINIT_H
|
||||
#define HODJNPODJ_WORDSEARCH_DLLINIT_H
|
||||
|
||||
#include "bagel/hodjnpodj/hnplibs/gamedll.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace WordSearch {
|
||||
|
||||
extern HWND FAR PASCAL RunWordSearch(HWND hParentWnd, LPGAMESTRUCT lpGameInfo);
|
||||
|
||||
} // namespace WordSearch
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
272
engines/bagel/hodjnpodj/wordsearch/msgdlg.cpp
Normal file
272
engines/bagel/hodjnpodj/wordsearch/msgdlg.cpp
Normal file
@@ -0,0 +1,272 @@
|
||||
/* 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/button.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/stdafx.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/text.h"
|
||||
#include "bagel/hodjnpodj/wordsearch/resource.h"
|
||||
#include "bagel/hodjnpodj/wordsearch/dialogs.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace WordSearch {
|
||||
|
||||
static CPalette *pPackRatOptPalette;
|
||||
|
||||
CColorButton *pMsgOKButton = nullptr;
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* CMsgDlg
|
||||
*
|
||||
* FUNCTIONAL DESCRIPTION:
|
||||
*
|
||||
* Constructor sends the input to the CBmpDialog constructor and
|
||||
* the intializes the private members
|
||||
*
|
||||
* FORMAL PARAMETERS:
|
||||
*
|
||||
* Those needed to contruct a CBmpDialog dialog: pParent,pPalette, nID
|
||||
*
|
||||
* IMPLICIT INPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* IMPLICIT OUTPUT PARAMETERS:
|
||||
*
|
||||
* private member m_nCurrenLEVEL
|
||||
* globals rectDisplayAmount and pSeLEVELPalette
|
||||
*
|
||||
* RETURN VALUE:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
****************************************************************/
|
||||
CMsgDlg::CMsgDlg(CWnd *pParent, CPalette *pPalette, unsigned int nID)
|
||||
: CBmpDialog(pParent, pPalette, nID, ".\\ART\\SSCROLL.BMP") {
|
||||
pPackRatOptPalette = pPalette;
|
||||
m_nWhichMsg = 1;
|
||||
m_nWordsLeft = 0L;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* OnCommand
|
||||
*
|
||||
* FUNCTIONAL DESCRIPTION:
|
||||
*
|
||||
* Process the "Set" and "Cancel" buttons
|
||||
*
|
||||
* This function is called when a WM_COMMAND message is issued,
|
||||
* typically in order to process control related activities.
|
||||
*
|
||||
* FORMAL PARAMETERS:
|
||||
*
|
||||
* wParam identifier for the button to be processed
|
||||
* lParam type of message to be processed
|
||||
*
|
||||
* IMPLICIT INPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* IMPLICIT OUTPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* RETURN VALUE:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
****************************************************************/
|
||||
bool CMsgDlg::OnCommand(WPARAM wParam, LPARAM lParam) {
|
||||
// What ever button is clicked, end the dialog and send the ID of the button
|
||||
// clicked as the return from the dialog
|
||||
if (HIWORD(lParam) == BN_CLICKED) {
|
||||
switch (wParam) {
|
||||
case IDOK:
|
||||
ClearDialogImage();
|
||||
CDialog::EndDialog(0);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return CDialog::OnCommand(wParam, lParam);
|
||||
}
|
||||
|
||||
void CMsgDlg::OnCancel() {
|
||||
ClearDialogImage();
|
||||
EndDialog(0);
|
||||
return;
|
||||
}
|
||||
|
||||
void CMsgDlg::OnOK() {
|
||||
ClearDialogImage();
|
||||
EndDialog(0);
|
||||
return;
|
||||
}
|
||||
|
||||
void CMsgDlg::ClearDialogImage() {
|
||||
|
||||
if (pMsgOKButton != nullptr) {
|
||||
delete pMsgOKButton;
|
||||
pMsgOKButton = nullptr;
|
||||
}
|
||||
|
||||
ValidateRect(nullptr);
|
||||
|
||||
return;
|
||||
}
|
||||
/*****************************************************************
|
||||
*
|
||||
* SetInitialOptions
|
||||
*
|
||||
* FUNCTIONAL DESCRIPTION:
|
||||
*
|
||||
* This sets the privates to the inputted values
|
||||
*
|
||||
* FORMAL PARAMETERS:
|
||||
*
|
||||
* lCurrenLEVEL = the current amount the user has
|
||||
*
|
||||
* IMPLICIT INPUT PARAMETERS:
|
||||
*
|
||||
* m_nCurrenLEVEL = (int)min( AMOUNTMAX, lCurrenLEVEL)
|
||||
*
|
||||
* IMPLICIT OUTPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* RETURN VALUE:
|
||||
*
|
||||
*
|
||||
****************************************************************/
|
||||
void CMsgDlg::SetInitialOptions(int nWhichMsg, int nWords) {
|
||||
m_nWhichMsg = nWhichMsg;
|
||||
m_nWordsLeft = nWords;
|
||||
return;
|
||||
}
|
||||
|
||||
bool CMsgDlg::OnInitDialog() {
|
||||
bool bSuccess;
|
||||
|
||||
CBmpDialog::OnInitDialog();
|
||||
|
||||
pMsgOKButton = new CColorButton();
|
||||
ASSERT(pMsgOKButton != nullptr);
|
||||
pMsgOKButton->SetPalette(pPackRatOptPalette);
|
||||
bSuccess = pMsgOKButton->SetControl(IDOK, this);
|
||||
ASSERT(bSuccess);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* OnPaint
|
||||
*
|
||||
* FUNCTIONAL DESCRIPTION:
|
||||
*
|
||||
* Repaint the screen whenever needed; e.g. when uncovered by an
|
||||
* overlapping window, when maximized from an icon, and when it the
|
||||
* window is initially created.
|
||||
*
|
||||
* This uses the CBmpDialog Paint as its base, and displays the current
|
||||
* amount chosen from the scrollbar
|
||||
*
|
||||
* This routine is called whenever Windows sends a WM_PAINT message.
|
||||
* Note that creating a CPaintDC automatically does a BeginPaint and
|
||||
* an EndPaint call is done when it is destroyed at the end of this
|
||||
* function. CPaintDC's constructor needs the window (this).
|
||||
*
|
||||
* FORMAL PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* IMPLICIT INPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* IMPLICIT OUTPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* RETURN VALUE:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
****************************************************************/
|
||||
void CMsgDlg::OnPaint() {
|
||||
// call CBmpDialog onpaint, to paint the background
|
||||
CBmpDialog::OnPaint();
|
||||
|
||||
CDC *pDC = GetDC();
|
||||
// CText(CDC *pDC, CPalette *pPalette, CRect *pRect, int nJustify = JUSTIFY_CENTER);
|
||||
// bool DisplayString(CDC *pDC, const char* pszText, const int nSize, const int nWeight, const COLORREF crColor = CTEXT_COLOR);
|
||||
|
||||
CRect rRect1(16, 36, 200, 56);
|
||||
CRect rRect2(16, 60, 200, 80);
|
||||
CRect rRect3(16, 84, 200, 104);
|
||||
CText txtLine1(pDC, pPackRatOptPalette, &rRect1);
|
||||
CText txtLine2(pDC, pPackRatOptPalette, &rRect2);
|
||||
CText txtLine3(pDC, pPackRatOptPalette, &rRect3);
|
||||
char cDisplay[30];
|
||||
|
||||
switch (m_nWhichMsg) {
|
||||
case 1:
|
||||
txtLine1.DisplayString(pDC, "Congratulations!", 21, FW_BOLD);
|
||||
txtLine2.DisplayString(pDC, "You found every", 21, FW_BOLD);
|
||||
txtLine3.DisplayString(pDC, "word in the grid.", 21, FW_BOLD);
|
||||
break;
|
||||
case 2:
|
||||
if (m_nWordsLeft == 1)
|
||||
Common::sprintf_s(cDisplay, "You had %li word left.", m_nWordsLeft);
|
||||
else
|
||||
Common::sprintf_s(cDisplay, "You had %li words left.", m_nWordsLeft);
|
||||
|
||||
txtLine2.DisplayString(pDC, "Game over.", 21, FW_BOLD);
|
||||
txtLine3.DisplayString(pDC, cDisplay, 21, FW_BOLD);
|
||||
break;
|
||||
}
|
||||
ReleaseDC(pDC);
|
||||
return;
|
||||
}
|
||||
|
||||
void CMsgDlg::OnDestroy() {
|
||||
// send a message to the calling app to tell it the user has quit the game
|
||||
if (pMsgOKButton != nullptr) {
|
||||
delete pMsgOKButton;
|
||||
pMsgOKButton = nullptr;
|
||||
}
|
||||
|
||||
CBmpDialog::OnDestroy();
|
||||
}
|
||||
|
||||
// Message Map
|
||||
BEGIN_MESSAGE_MAP(CMsgDlg, CBmpDialog)
|
||||
//{{AFX_MSG_MAP( CMainPokerWindow )
|
||||
ON_WM_PAINT()
|
||||
ON_WM_DESTROY()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
} // namespace WordSearch
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
590
engines/bagel/hodjnpodj/wordsearch/optdlg.cpp
Normal file
590
engines/bagel/hodjnpodj/wordsearch/optdlg.cpp
Normal file
@@ -0,0 +1,590 @@
|
||||
/* 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/button.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/stdafx.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/text.h"
|
||||
#include "bagel/hodjnpodj/wordsearch/resource.h"
|
||||
#include "bagel/hodjnpodj/wordsearch/dialogs.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace WordSearch {
|
||||
|
||||
#define GAMETIMEMAX 12
|
||||
#define GAMETIMEMIN 1
|
||||
#define GAMESTEP 1
|
||||
#define GAMEJUMP 1
|
||||
|
||||
static CPalette *pPackRatOptPalette;
|
||||
CText *ptxtTime;
|
||||
|
||||
CColorButton *pOKButton = nullptr;
|
||||
CColorButton *pCancelButton = nullptr;
|
||||
CCheckButton *pWordForwardButton = nullptr;
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* CWSOptDlg
|
||||
*
|
||||
* FUNCTIONAL DESCRIPTION:
|
||||
*
|
||||
* Constructor sends the input to the CBmpDialog constructor and
|
||||
* the intializes the private members
|
||||
*
|
||||
* FORMAL PARAMETERS:
|
||||
*
|
||||
* Those needed to contruct a CBmpDialog dialog: pParent,pPalette, nID
|
||||
*
|
||||
* IMPLICIT INPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* IMPLICIT OUTPUT PARAMETERS:
|
||||
*
|
||||
* private member m_nCurrenLEVEL
|
||||
* globals rectDisplayAmount and pSeLEVELPalette
|
||||
*
|
||||
* RETURN VALUE:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
****************************************************************/
|
||||
CWSOptDlg::CWSOptDlg(CWnd *pParent, CPalette *pPalette, unsigned int nID)
|
||||
: CBmpDialog(pParent, pPalette, nID, ".\\ART\\SSCROLL.BMP"),
|
||||
rDisplayTime(35, 90, 200, 110) {
|
||||
CDC *pDC = GetDC();
|
||||
|
||||
pPackRatOptPalette = pPalette;
|
||||
|
||||
ptxtTime = new CText(pDC, pPackRatOptPalette, &rDisplayTime, JUSTIFY_LEFT);
|
||||
|
||||
ReleaseDC(pDC);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* OnCommand
|
||||
*
|
||||
* FUNCTIONAL DESCRIPTION:
|
||||
*
|
||||
* Process the "Set" and "Cancel" buttons
|
||||
*
|
||||
* This function is called when a WM_COMMAND message is issued,
|
||||
* typically in order to process control related activities.
|
||||
*
|
||||
* FORMAL PARAMETERS:
|
||||
*
|
||||
* wParam identifier for the button to be processed
|
||||
* lParam type of message to be processed
|
||||
*
|
||||
* IMPLICIT INPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* IMPLICIT OUTPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* RETURN VALUE:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
****************************************************************/
|
||||
bool CWSOptDlg::OnCommand(WPARAM wParam, LPARAM lParam) {
|
||||
|
||||
int nReturn = 0;
|
||||
// What ever button is clicked, end the dialog and send the ID of the button
|
||||
// clicked as the return from the dialog
|
||||
if (HIWORD(lParam) == BN_CLICKED) {
|
||||
switch (wParam) {
|
||||
|
||||
case IDC_MINI_BWTOGGLE:
|
||||
if (m_bWordForwardOnly) {
|
||||
m_bWordForwardOnly = false;
|
||||
pWordForwardButton->SetCheck(false);
|
||||
} else {
|
||||
m_bWordForwardOnly = true;
|
||||
pWordForwardButton->SetCheck(true);
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_MINI_OK:
|
||||
// calculate current level from
|
||||
|
||||
switch (m_nGameTime) {
|
||||
case 1:
|
||||
nReturn = 15;
|
||||
break;
|
||||
case 2:
|
||||
nReturn = 30;
|
||||
break;
|
||||
case 3:
|
||||
nReturn = 45;
|
||||
break;
|
||||
case 4:
|
||||
nReturn = 60;
|
||||
break;
|
||||
case 5:
|
||||
nReturn = 75;
|
||||
break;
|
||||
case 6:
|
||||
nReturn = 90;
|
||||
break;
|
||||
case 7:
|
||||
nReturn = 120;
|
||||
break;
|
||||
case 8:
|
||||
nReturn = 180;
|
||||
break;
|
||||
case 9:
|
||||
nReturn = 240;
|
||||
break;
|
||||
case 10:
|
||||
nReturn = 300;
|
||||
break;
|
||||
case 11:
|
||||
nReturn = 600;
|
||||
break;
|
||||
default:
|
||||
nReturn = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_bShowWord) {
|
||||
nReturn += 1000;
|
||||
} else {
|
||||
nReturn += 2000;
|
||||
}
|
||||
|
||||
if (m_bWordForwardOnly) {
|
||||
nReturn += 10000;
|
||||
} else {
|
||||
nReturn += 20000;
|
||||
}
|
||||
|
||||
ClearDialogImage();
|
||||
EndDialog(nReturn);
|
||||
return 1;
|
||||
|
||||
case IDC_MINI_CANCEL:
|
||||
ClearDialogImage();
|
||||
EndDialog(-1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return CDialog::OnCommand(wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
void CWSOptDlg::OnCancel() {
|
||||
ClearDialogImage();
|
||||
EndDialog(-1);
|
||||
return;
|
||||
}
|
||||
|
||||
void CWSOptDlg::OnOK() {
|
||||
ClearDialogImage();
|
||||
EndDialog(-1);
|
||||
return;
|
||||
}
|
||||
|
||||
void CWSOptDlg::ClearDialogImage() {
|
||||
|
||||
if (pOKButton != nullptr) {
|
||||
delete pOKButton;
|
||||
pOKButton = nullptr;
|
||||
}
|
||||
if (pCancelButton != nullptr) {
|
||||
delete pCancelButton;
|
||||
pCancelButton = nullptr;
|
||||
}
|
||||
if (pWordForwardButton != nullptr) {
|
||||
delete pWordForwardButton;
|
||||
pWordForwardButton = nullptr;
|
||||
}
|
||||
|
||||
ValidateRect(nullptr);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* SetInitialOptions
|
||||
*
|
||||
* FUNCTIONAL DESCRIPTION:
|
||||
*
|
||||
* This sets the privates to the inputted values
|
||||
*
|
||||
* FORMAL PARAMETERS:
|
||||
*
|
||||
* lCurrenLEVEL = the current amount the user has
|
||||
*
|
||||
* IMPLICIT INPUT PARAMETERS:
|
||||
*
|
||||
* m_nCurrenLEVEL = (int)min( AMOUNTMAX, lCurrenLEVEL)
|
||||
*
|
||||
* IMPLICIT OUTPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* RETURN VALUE:
|
||||
*
|
||||
*
|
||||
****************************************************************/
|
||||
void CWSOptDlg::SetInitialOptions(int nTime, bool bShowWords, bool bWFO) {
|
||||
switch (nTime) {
|
||||
case 15:
|
||||
m_nGameTime = 1;
|
||||
break;
|
||||
case 30:
|
||||
m_nGameTime = 2;
|
||||
break;
|
||||
case 45:
|
||||
m_nGameTime = 3;
|
||||
break;
|
||||
case 60:
|
||||
m_nGameTime = 4;
|
||||
break;
|
||||
case 75:
|
||||
m_nGameTime = 5;
|
||||
break;
|
||||
case 90:
|
||||
m_nGameTime = 6;
|
||||
break;
|
||||
case 120:
|
||||
m_nGameTime = 7;
|
||||
break;
|
||||
case 180:
|
||||
m_nGameTime = 8;
|
||||
break;
|
||||
case 240:
|
||||
m_nGameTime = 9;
|
||||
break;
|
||||
case 300:
|
||||
m_nGameTime = 10;
|
||||
break;
|
||||
case 600:
|
||||
m_nGameTime = 11;
|
||||
break;
|
||||
default:
|
||||
m_nGameTime = 12;
|
||||
break;
|
||||
}
|
||||
m_bShowWord = bShowWords;
|
||||
m_bWordForwardOnly = bWFO;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool CWSOptDlg::OnInitDialog() {
|
||||
bool bSuccess;
|
||||
|
||||
CBmpDialog::OnInitDialog();
|
||||
|
||||
pOKButton = new CColorButton();
|
||||
ASSERT(pOKButton != nullptr);
|
||||
pOKButton->SetPalette(pPackRatOptPalette);
|
||||
bSuccess = pOKButton->SetControl(IDC_MINI_OK, this);
|
||||
ASSERT(bSuccess);
|
||||
|
||||
pCancelButton = new CColorButton();
|
||||
ASSERT(pCancelButton != nullptr);
|
||||
pCancelButton->SetPalette(pPackRatOptPalette);
|
||||
bSuccess = pCancelButton->SetControl(IDC_MINI_CANCEL, this);
|
||||
ASSERT(bSuccess);
|
||||
|
||||
pWordForwardButton = new CCheckButton();
|
||||
ASSERT(pWordForwardButton != nullptr);
|
||||
pWordForwardButton->SetPalette(pPackRatOptPalette);
|
||||
bSuccess = pWordForwardButton->SetControl(IDC_MINI_BWTOGGLE, this);
|
||||
ASSERT(bSuccess);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* OnPaint
|
||||
*
|
||||
* FUNCTIONAL DESCRIPTION:
|
||||
*
|
||||
* Repaint the screen whenever needed; e.g. when uncovered by an
|
||||
* overlapping window, when maximized from an icon, and when it the
|
||||
* window is initially created.
|
||||
*
|
||||
* This uses the CBmpDialog Paint as its base, and displays the current
|
||||
* amount chosen from the scrollbar
|
||||
*
|
||||
* This routine is called whenever Windows sends a WM_PAINT message.
|
||||
* Note that creating a CPaintDC automatically does a BeginPaint and
|
||||
* an EndPaint call is done when it is destroyed at the end of this
|
||||
* function. CPaintDC's constructor needs the window (this).
|
||||
*
|
||||
* FORMAL PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* IMPLICIT INPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* IMPLICIT OUTPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* RETURN VALUE:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
****************************************************************/
|
||||
void CWSOptDlg::OnPaint() {
|
||||
CDC *pDC;
|
||||
CString strTime = "Time Limit: ";
|
||||
//int nOldBkMode;
|
||||
|
||||
CScrollBar *pTime;
|
||||
|
||||
char cDisplay[64];
|
||||
|
||||
// call CBmpDialog onpaint, to paint the background
|
||||
CBmpDialog::OnPaint();
|
||||
|
||||
if (m_bWordForwardOnly) {
|
||||
pWordForwardButton->SetCheck(1);
|
||||
} else {
|
||||
pWordForwardButton->SetCheck(0);
|
||||
}
|
||||
|
||||
pDC = GetDC();
|
||||
|
||||
// now paint in my text with a transparent background
|
||||
// nOldBkMode = pDC->SetBkMode( TRANSPARENT );
|
||||
// pDC->TextOut( 43, 73, strTime.c_str());
|
||||
// pDC->SetBkMode( nOldBkMode );
|
||||
|
||||
switch (m_nGameTime) {
|
||||
case 1:
|
||||
Common::sprintf_s(cDisplay, "%s15 Seconds", strTime.c_str());
|
||||
break;
|
||||
case 2:
|
||||
Common::sprintf_s(cDisplay, "%s30 Seconds", strTime.c_str());
|
||||
break;
|
||||
case 3:
|
||||
Common::sprintf_s(cDisplay, "%s45 Seconds", strTime.c_str());
|
||||
break;
|
||||
case 4:
|
||||
Common::sprintf_s(cDisplay, "%s60 Seconds", strTime.c_str());
|
||||
break;
|
||||
case 5:
|
||||
Common::sprintf_s(cDisplay, "%s75 Seconds", strTime.c_str());
|
||||
break;
|
||||
case 6:
|
||||
Common::sprintf_s(cDisplay, "%s90 Seconds", strTime.c_str());
|
||||
break;
|
||||
case 7:
|
||||
Common::sprintf_s(cDisplay, "%s2 Minutes", strTime.c_str());
|
||||
break;
|
||||
case 8:
|
||||
Common::sprintf_s(cDisplay, "%s3 Minutes", strTime.c_str());
|
||||
break;
|
||||
case 9:
|
||||
Common::sprintf_s(cDisplay, "%s4 Minutes", strTime.c_str());
|
||||
break;
|
||||
case 10:
|
||||
Common::sprintf_s(cDisplay, "%s5 Minutes", strTime.c_str());
|
||||
break;
|
||||
case 11:
|
||||
Common::sprintf_s(cDisplay, "%s10 Minutes", strTime.c_str());
|
||||
break;
|
||||
default:
|
||||
Common::sprintf_s(cDisplay, "%sUnlimited", strTime.c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
ptxtTime->DisplayString(pDC, cDisplay, 14, FW_BOLD, RGB(0, 0, 0));
|
||||
|
||||
ReleaseDC(pDC);
|
||||
|
||||
pTime = new CScrollBar;
|
||||
|
||||
pTime = (CScrollBar *)GetDlgItem(IDC_GAMETIME);
|
||||
|
||||
pTime->SetScrollRange(GAMETIMEMIN, GAMETIMEMAX, true);
|
||||
if (m_nGameTime == 0)
|
||||
pTime->SetScrollPos(GAMETIMEMAX, true);
|
||||
else
|
||||
pTime->SetScrollPos(m_nGameTime, true);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* OnHScroll
|
||||
*
|
||||
* FUNCTIONAL DESCRIPTION:
|
||||
*
|
||||
* This is the functionality of the scroll bar
|
||||
*
|
||||
* FORMAL PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* IMPLICIT INPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* IMPLICIT OUTPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* RETURN VALUE:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
****************************************************************/
|
||||
void CWSOptDlg::OnHScroll(unsigned int nSBCode, unsigned int nPos, CScrollBar* pScrollBar) {
|
||||
int oldAmnt = 0;
|
||||
int newAmnt = 0;
|
||||
CDC *pDC;
|
||||
//int nJunk = 0;
|
||||
char cDisplay[64];
|
||||
CString strTime = "Time Limit: ";
|
||||
|
||||
//nJunk = pScrollBar->GetDlgCtrlID();
|
||||
|
||||
// first set the range of the scoll bar
|
||||
if (pScrollBar->GetDlgCtrlID() == IDC_GAMETIME)
|
||||
pScrollBar->SetScrollRange(GAMETIMEMIN, GAMETIMEMAX, true);
|
||||
|
||||
// get the scroll bar's current position, i.e. the current amount set
|
||||
oldAmnt = pScrollBar->GetScrollPos();
|
||||
newAmnt = oldAmnt;
|
||||
|
||||
// switching off of what the scroll bar wants to do, act accordingly.
|
||||
switch (nSBCode) {
|
||||
case SB_LINELEFT:
|
||||
case SB_PAGELEFT:
|
||||
case SB_LEFT:
|
||||
newAmnt --;
|
||||
if (newAmnt < GAMETIMEMIN)
|
||||
newAmnt = GAMETIMEMIN;
|
||||
break;
|
||||
case SB_LINERIGHT:
|
||||
case SB_PAGERIGHT:
|
||||
case SB_RIGHT:
|
||||
newAmnt ++;
|
||||
if (newAmnt > GAMETIMEMAX)
|
||||
newAmnt = GAMETIMEMAX;
|
||||
break;
|
||||
case SB_THUMBPOSITION:
|
||||
case SB_THUMBTRACK:
|
||||
newAmnt = nPos;
|
||||
break;
|
||||
}
|
||||
|
||||
// set the scroll bar to the new position
|
||||
pScrollBar->SetScrollPos(newAmnt, true);
|
||||
|
||||
// set the current amount to the new amount just set
|
||||
// and paint this new amount onto the screen
|
||||
|
||||
pDC = GetDC();
|
||||
if (pScrollBar->GetDlgCtrlID() == IDC_GAMETIME) {
|
||||
m_nGameTime = newAmnt;
|
||||
switch (m_nGameTime) {
|
||||
case 1:
|
||||
Common::sprintf_s(cDisplay, "%s15 Seconds", strTime.c_str());
|
||||
break;
|
||||
case 2:
|
||||
Common::sprintf_s(cDisplay, "%s30 Seconds", strTime.c_str());
|
||||
break;
|
||||
case 3:
|
||||
Common::sprintf_s(cDisplay, "%s45 Seconds", strTime.c_str());
|
||||
break;
|
||||
case 4:
|
||||
Common::sprintf_s(cDisplay, "%s60 Seconds", strTime.c_str());
|
||||
break;
|
||||
case 5:
|
||||
Common::sprintf_s(cDisplay, "%s75 Seconds", strTime.c_str());
|
||||
break;
|
||||
case 6:
|
||||
Common::sprintf_s(cDisplay, "%s90 Seconds", strTime.c_str());
|
||||
break;
|
||||
case 7:
|
||||
Common::sprintf_s(cDisplay, "%s2 Minutes", strTime.c_str());
|
||||
break;
|
||||
case 8:
|
||||
Common::sprintf_s(cDisplay, "%s3 Minutes", strTime.c_str());
|
||||
break;
|
||||
case 9:
|
||||
Common::sprintf_s(cDisplay, "%s4 Minutes", strTime.c_str());
|
||||
break;
|
||||
case 10:
|
||||
Common::sprintf_s(cDisplay, "%s5 Minutes", strTime.c_str());
|
||||
break;
|
||||
case 11:
|
||||
Common::sprintf_s(cDisplay, "%s10 Minutes", strTime.c_str());
|
||||
break;
|
||||
default:
|
||||
Common::sprintf_s(cDisplay, "%sUnlimited", strTime.c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
ptxtTime->DisplayString(pDC, cDisplay, 14, FW_BOLD, RGB(0, 0, 0));
|
||||
}
|
||||
ReleaseDC(pDC);
|
||||
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
|
||||
}
|
||||
|
||||
void CWSOptDlg::OnDestroy() {
|
||||
// send a message to the calling app to tell it the user has quit the game
|
||||
if (pOKButton != nullptr)
|
||||
delete pOKButton;
|
||||
|
||||
if (pCancelButton != nullptr)
|
||||
delete pCancelButton;
|
||||
|
||||
if (pWordForwardButton != nullptr)
|
||||
delete pWordForwardButton;
|
||||
|
||||
if (ptxtTime != nullptr)
|
||||
delete ptxtTime;
|
||||
|
||||
CBmpDialog::OnDestroy();
|
||||
}
|
||||
|
||||
// Message Map
|
||||
BEGIN_MESSAGE_MAP(CWSOptDlg, CBmpDialog)
|
||||
//{{AFX_MSG_MAP( CMainPokerWindow )
|
||||
ON_WM_PAINT()
|
||||
ON_WM_HSCROLL()
|
||||
ON_WM_DESTROY()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
} // namespace WordSearch
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
108
engines/bagel/hodjnpodj/wordsearch/resource.h
Normal file
108
engines/bagel/hodjnpodj/wordsearch/resource.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/* 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_WORDSEARCH_RESOURCE_H
|
||||
#define HODJNPODJ_WORDSEARCH_RESOURCE_H
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace WordSearch {
|
||||
|
||||
#define IDI_WORDSRCH 2
|
||||
#define IDC_OPTIONS 202
|
||||
#define IDB_LSCROLLB 210
|
||||
#define IDB_LSCROLLM 211
|
||||
#define IDB_LSCROLLT 212
|
||||
#define IDB_SSCROLL 213
|
||||
#define IDB_OPTIONSCROLL 220
|
||||
#define IDC_RULES 230
|
||||
#define IDC_CANCEL 250
|
||||
#define IDC_QUIT 251
|
||||
#define IDB_PODJRIGHT 330
|
||||
#define IDD_MESSAGEBOX 333
|
||||
#define IDB_OPTIONG 359
|
||||
#define IDB_OPTIONU 360
|
||||
#define IDB_LETTERA 361
|
||||
#define IDB_LETTERB 362
|
||||
#define IDB_LETTERC 363
|
||||
#define IDB_LETTERD 364
|
||||
#define IDB_LETTERE 365
|
||||
#define IDB_LETTERF 366
|
||||
#define IDB_LETTERG 367
|
||||
#define IDB_LETTERH 368
|
||||
#define IDB_LETTERI 369
|
||||
#define IDB_LETTERJ 370
|
||||
#define IDB_LETTERK 371
|
||||
#define IDB_LETTERL 372
|
||||
#define IDB_LETTERM 373
|
||||
#define IDB_LETTERN 374
|
||||
#define IDB_LETTERO 375
|
||||
#define IDB_LETTERP 376
|
||||
#define IDB_LETTERQ 377
|
||||
#define IDB_LETTERR 378
|
||||
#define IDB_LETTERS 379
|
||||
#define IDB_LETTERT 380
|
||||
#define IDB_LETTERU 381
|
||||
#define IDB_LETTERV 382
|
||||
#define IDB_LETTERW 383
|
||||
#define IDB_LETTERX 384
|
||||
#define IDB_LETTERY 385
|
||||
#define IDB_LETTERZ 386
|
||||
#define IDB_LETTERA_D 387
|
||||
#define IDB_LETTERB_D 388
|
||||
#define IDB_LETTERC_D 389
|
||||
#define IDB_LETTERD_D 390
|
||||
#define IDB_LETTERE_D 391
|
||||
#define IDB_LETTERF_D 392
|
||||
#define IDB_LETTERG_D 393
|
||||
#define IDB_LETTERH_D 394
|
||||
#define IDB_LETTERI_D 395
|
||||
#define IDB_LETTERJ_D 396
|
||||
#define IDB_LETTERK_D 397
|
||||
#define IDB_LETTERL_D 398
|
||||
#define IDB_LETTERM_D 399
|
||||
#define IDB_LETTERN_D 400
|
||||
#define IDB_LETTERO_D 401
|
||||
#define IDB_LETTERP_D 402
|
||||
#define IDB_LETTERQ_D 403
|
||||
#define IDB_LETTERR_D 404
|
||||
#define IDB_LETTERS_D 405
|
||||
#define IDB_LETTERT_D 406
|
||||
#define IDB_LETTERU_D 407
|
||||
#define IDB_LETTERV_D 408
|
||||
#define IDB_LETTERW_D 409
|
||||
#define IDB_LETTERX_D 410
|
||||
#define IDB_LETTERY_D 411
|
||||
#define IDB_LETTERZ_D 412
|
||||
#define IDD_MINIOPTIONS_DIALOG 500
|
||||
#define IDC_MINI_CANCEL 501
|
||||
#define IDC_MINI_OK 502
|
||||
#define IDC_GAMELEVEL 503
|
||||
#define IDC_MINI_WLTOGGLE 503
|
||||
#define IDC_NUMBEROFLIVES 504
|
||||
#define IDC_GAMETIME 504
|
||||
#define IDC_MINI_BWTOGGLE 1035
|
||||
|
||||
} // namespace Poker
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
1531
engines/bagel/hodjnpodj/wordsearch/wordlist.cpp
Normal file
1531
engines/bagel/hodjnpodj/wordsearch/wordlist.cpp
Normal file
File diff suppressed because it is too large
Load Diff
44
engines/bagel/hodjnpodj/wordsearch/wordlist.h
Normal file
44
engines/bagel/hodjnpodj/wordsearch/wordlist.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* 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_WORDSEARCH_WORDLIST_H
|
||||
#define HODJNPODJ_WORDSEARCH_WORDLIST_H
|
||||
|
||||
#include "bagel/afxwin.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace WordSearch {
|
||||
|
||||
#define WORDSPERLIST 25
|
||||
#define NUMBEROFLISTS 50
|
||||
|
||||
#define TEXT_COLOR RGB(0, 0, 0) // found word text color
|
||||
#define UNFOUND_COLOR RGB(0, 167, 200) // Still not found words color
|
||||
#define DK_CYAN RGB(0, 167, 255) // Still not found words color
|
||||
#define DK_SKY RGB(0, 67, 160) // Still not found words color
|
||||
#define RED_TEXT RGB(226, 28, 21) // Still not found words color
|
||||
|
||||
} // namespace Poker
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
1742
engines/bagel/hodjnpodj/wordsearch/wordsearch.cpp
Normal file
1742
engines/bagel/hodjnpodj/wordsearch/wordsearch.cpp
Normal file
File diff suppressed because it is too large
Load Diff
197
engines/bagel/hodjnpodj/wordsearch/wordsearch.h
Normal file
197
engines/bagel/hodjnpodj/wordsearch/wordsearch.h
Normal file
@@ -0,0 +1,197 @@
|
||||
/* 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_WORDSEARCH_WORDSEARCH_H
|
||||
#define HODJNPODJ_WORDSEARCH_WORDSEARCH_H
|
||||
|
||||
#include "bagel/boflib/sound.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/dibdoc.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/gamedll.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/cbofdlg.h" // header for the options library
|
||||
#include "bagel/hodjnpodj/hnplibs/mainmenu.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/button.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/rules.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/text.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/bitmaps.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/sprite.h"
|
||||
#include "bagel/hodjnpodj/wordsearch/globals.h"
|
||||
#include "bagel/hodjnpodj/wordsearch/resource.h"
|
||||
#include "bagel/hodjnpodj/wordsearch/wordlist.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace WordSearch {
|
||||
|
||||
// Button Identifier codes (BIDs)
|
||||
#define IDC_OPTION 100
|
||||
#define IDC_LETTERBUTTON 200 // to 480
|
||||
#define IDC_JUNK 999
|
||||
|
||||
// Art File Identifiers
|
||||
#define SPLASHSPEC ".\\ART\\WORDSRCH.BMP"
|
||||
#define ALLLETTERS ".\\ART\\LETTERS.BMP"
|
||||
#define TIMERSPRITE ".\\ART\\DASYTIMR.BMP"
|
||||
|
||||
// Timer info
|
||||
#define GAMETIMER 99
|
||||
#define TIMERSPRITECELS 13
|
||||
|
||||
// Rules File Identifiers
|
||||
#define RULESFILE "WORDSRCH.TXT"
|
||||
#define RULES_WAV ".\\SOUND\\WORDSRCH.WAV"
|
||||
|
||||
// Sound files:
|
||||
#define GAME_THEME ".\\SOUND\\WORDSRCH.MID"
|
||||
#define COW_WAV ".\\SOUND\\SLURP2.WAV"
|
||||
#define CHICKEN_WAV ".\\SOUND\\BRAWK.WAV"
|
||||
#define PIG_WAV ".\\SOUND\\OINK.WAV"
|
||||
#define FLOWER_WAV ".\\SOUND\\LOVESME.WAV"
|
||||
#define FIND_WAV ".\\SOUND\\TINYBELL.WAV"
|
||||
#define NOPE_WAV ".\\SOUND\\NOPE.WAV"
|
||||
#define TRYAGAIN_WAV ".\\SOUND\\TRYAGAIN.WAV"
|
||||
#define TICK_WAV ".\\SOUND\\TICK.WAV"
|
||||
#define TIMEOUT_WAV ".\\SOUND\\BUZZER.WAV"
|
||||
#define ALLFOUND_WAV ".\\SOUND\\APPLAUSE.WAV"
|
||||
|
||||
// Anim files:
|
||||
#define COW_ANIM ".\\ART\\COW.BMP"
|
||||
#define CHICKEN_ANIM ".\\ART\\CHICKEN.BMP"
|
||||
#define PIG_ANIM ".\\ART\\PIG.BMP"
|
||||
|
||||
// Easter Egg info
|
||||
#define COW_X 40 //38
|
||||
#define COW_Y 47 //43
|
||||
#define COW_DX 132
|
||||
#define COW_DY 182
|
||||
#define NUM_COW_CELS 13
|
||||
#define COW_SLEEP 100 //100 150 for slurp.wav
|
||||
|
||||
#define CHICKEN_X 16 //14
|
||||
#define CHICKEN_Y 165 //156
|
||||
#define CHICKEN_DX 62 //82
|
||||
#define CHICKEN_DY 53 //71
|
||||
#define NUM_CHICKEN_CELS 11 //22
|
||||
#define CHICKEN_SLEEP 175
|
||||
|
||||
#define PIG_X 43
|
||||
#define PIG_Y 343
|
||||
#define PIG_DX 153
|
||||
#define PIG_DY 122
|
||||
#define NUM_PIG_CELS 28
|
||||
#define PIG_SLEEP 100
|
||||
|
||||
#define FLOWER_X 513
|
||||
#define FLOWER_Y 388
|
||||
#define FLOWER_DX 110
|
||||
#define FLOWER_DY 75
|
||||
|
||||
// Bitmap Identifiers
|
||||
#define OPTSCROLL "ART\\OPTSCRL.BMP"
|
||||
|
||||
// Button positioning constants
|
||||
#define OPTION_WIDTH 146
|
||||
#define OPTION_HEIGHT 23
|
||||
#define OPTION_LEFT 246
|
||||
#define OPTION_TOP 0
|
||||
|
||||
#define NUMBEROFCOLS 20
|
||||
#define NUMBEROFROWS 14
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// CMainPackRatWindow:
|
||||
// See game.cpp for the code to the member functions and the message map.
|
||||
//
|
||||
|
||||
class CMainWSWindow : public CFrameWnd {
|
||||
public:
|
||||
unsigned int m_nTimeForGame = 0;
|
||||
bool m_bShowWordList = false;
|
||||
bool m_bWordsForwardOnly = false;
|
||||
|
||||
private:
|
||||
bool m_bPlaySounds = false; // bool for am I playing a certain # of rounds
|
||||
HWND m_hCallAppWnd = nullptr;
|
||||
LPGAMESTRUCT m_lpGameStruct = nullptr;
|
||||
bool m_bMouseCaptured = false;
|
||||
long m_lScore = 0;
|
||||
CString m_alpszCurrectGrid[NUMBEROFROWS * NUMBEROFCOLS];
|
||||
bool m_bNoGrid = false;
|
||||
CRect MainRect; // screen area spanned by the game window
|
||||
CRect OptionRect; // screen area spanned by the option button
|
||||
CRect rNewGame;
|
||||
CRect rRefreshRect;
|
||||
CRect arLetterButt[NUMBEROFROWS * NUMBEROFCOLS];
|
||||
CRect arScreenGrid[NUMBEROFROWS][NUMBEROFCOLS];
|
||||
CRect rScore;
|
||||
CString astrCurrentDisplay[NUMBEROFROWS];
|
||||
|
||||
char acGameGrid[NUMBEROFROWS][NUMBEROFCOLS] = {};
|
||||
CRect arWordDisplay[WORDSPERLIST];
|
||||
|
||||
CString _strGameList[WORDSPERLIST];
|
||||
CString _strGameListDisplay[WORDSPERLIST];
|
||||
CText _txtDisplayWord[WORDSPERLIST];
|
||||
|
||||
public:
|
||||
CMainWSWindow(HWND, LPGAMESTRUCT);
|
||||
|
||||
void SplashScreen();
|
||||
|
||||
static void ReleaseResources();
|
||||
static void FlushInputEvents();
|
||||
void MainLoop();
|
||||
void ResetGame();
|
||||
void ClearGrid();
|
||||
void LoadNewGrid(int = 1);
|
||||
void CreateNewGrid();
|
||||
|
||||
private:
|
||||
void OnSoundNotify(CSound *pSound);
|
||||
|
||||
protected:
|
||||
virtual bool OnCommand(WPARAM wParam, LPARAM lParam) override;
|
||||
|
||||
//{{AFX_MSG( CMainPackRatWindow )
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg void OnTimer(uintptr);
|
||||
afx_msg void OnLButtonDown(unsigned int, CPoint);
|
||||
afx_msg void OnLButtonUp(unsigned int, CPoint);
|
||||
afx_msg void OnRButtonDown(unsigned int, CPoint);
|
||||
afx_msg void OnMouseMove(unsigned int, CPoint);
|
||||
afx_msg void OnKeyDown(unsigned int, unsigned int, unsigned int);
|
||||
afx_msg void OnSysKeyDown(unsigned int, unsigned int, unsigned int);
|
||||
afx_msg bool OnEraseBkgnd(CDC *);
|
||||
afx_msg void OnActivate(unsigned int nState, CWnd *pWndOther, bool bMinimized) override;
|
||||
afx_msg LRESULT OnMCINotify(WPARAM, LPARAM);
|
||||
afx_msg LRESULT OnMMIONotify(WPARAM, LPARAM);
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
} // namespace Poker
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user