Initial commit
This commit is contained in:
1765
engines/bagel/hodjnpodj/beacon/beacon.cpp
Normal file
1765
engines/bagel/hodjnpodj/beacon/beacon.cpp
Normal file
File diff suppressed because it is too large
Load Diff
171
engines/bagel/hodjnpodj/beacon/beacon.h
Normal file
171
engines/bagel/hodjnpodj/beacon/beacon.h
Normal file
@@ -0,0 +1,171 @@
|
||||
/* 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_BEACON_BEACON_H
|
||||
#define HODJNPODJ_BEACON_BEACON_H
|
||||
|
||||
#include "bagel/boflib/sound.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Beacon {
|
||||
|
||||
#define ABS(a) ( (a > 0) ? (a) : (-a) )
|
||||
|
||||
// Border info
|
||||
#define TOP_BORDER 24 //25
|
||||
#define BOTTOM_BORDER 16
|
||||
#define SIDE_BORDER 16
|
||||
|
||||
#define BEACON_TIMER 1
|
||||
#define MIN_SPEED 0
|
||||
#define MAX_SPEED 2
|
||||
#define SPEED_BASE 70
|
||||
#define SPEED_STEP 10
|
||||
|
||||
#define NUM_BEAMS 120
|
||||
#define CHANGE_BEAM 144
|
||||
#define START_ENTRY 55 // Starting entry of available palette slots
|
||||
#define BUTTON_ENTRY 176 // First entry of the Button palette slots
|
||||
|
||||
#define GRID_WIDTH 8 //5 // Number of pixels
|
||||
#define GRID_HEIGHT 8 //5
|
||||
|
||||
// Game playing area
|
||||
#define ART_WIDTH 488
|
||||
#define ART_HEIGHT 440
|
||||
|
||||
#define NUM_BUTTONS 16 // Number of buttons
|
||||
#define NUM_COLUMNS (ART_WIDTH / GRID_WIDTH)
|
||||
#define NUM_ROWS (ART_HEIGHT / GRID_HEIGHT)
|
||||
|
||||
// Lighthouse bitmap placement
|
||||
#define LTHOUSE_OFFSET_X 20
|
||||
#define LTHOUSE_OFFSET_Y 15
|
||||
#define LTHOUSE_WIDTH 50
|
||||
#define LTHOUSE_HEIGHT 70
|
||||
|
||||
// Start area
|
||||
#define START_OFFSET_X 36 // GRID_WIDTH * 4.5
|
||||
#define START_OFFSET_Y 28 // GRID_HEIGHT * 3.5
|
||||
#define START_WIDTH 72 // GRID_WIDTH * 9
|
||||
#define START_HEIGHT 88 // GRID_HEIGHT * 11
|
||||
|
||||
// Color Button placement
|
||||
#define BLOCK_SPACE_X 6
|
||||
#define BLOCK_SPACE_Y 6
|
||||
#define BLOCK_OFFSET_X (ART_WIDTH + SIDE_BORDER + BLOCK_SPACE_X)
|
||||
#define BLOCK_OFFSET_Y 74 // TOP_BORDER + 50
|
||||
#define BLOCK_WIDTH 50
|
||||
#define BLOCK_HEIGHT 40
|
||||
|
||||
#define SELECT_COLOR 0 // Always use Black for highlighting selected beacon color
|
||||
#define HILITE_BORDER 4 // The highlighting frame is three pixels wide
|
||||
#define XTRALITE_TRIM 42 // Color Index of lightest trim color
|
||||
#define LITE_TRIM 30 // Color Index of light trim color
|
||||
#define MEDIUM_TRIM 45 // Color Index of medium trim color
|
||||
#define DARK_TRIM 46 // Color Index of dark trim color
|
||||
|
||||
// Starting value defaults
|
||||
#define MAX_SWEEPS 300
|
||||
#define MIN_SWEEPS 5
|
||||
|
||||
// Sound files
|
||||
#define MID_SOUND ".\\sound\\bong.wav"
|
||||
#define PICK_SOUND ".\\sound\\pick.wav"
|
||||
#define LOSE_SOUND ".\\sound\\buzzer.wav"
|
||||
#define WIN_SOUND ".\\SOUND\\SOUNDWON.WAV"
|
||||
|
||||
#define GAME_THEME ".\\sound\\beacon.mid"
|
||||
#define RULES_WAV ".\\SOUND\\BEACON.WAV"
|
||||
#define RULES_TEXT "BEACON.TXT"
|
||||
|
||||
// Backdrop bitmaps
|
||||
#define MAINSCREEN ".\\ART\\BEACBRDR.BMP"
|
||||
#define BEAMSCREEN ".\\ART\\BEAMS3.BMP"
|
||||
|
||||
// Artwork data file constants
|
||||
#define DATA_FILE ".\\BEACON.DAT"
|
||||
#define MAX_FILE_LENGTH 20
|
||||
|
||||
// New Game button area
|
||||
#define NEWGAME_LOCATION_X 15
|
||||
#define NEWGAME_LOCATION_Y 0
|
||||
#define NEWGAME_WIDTH 217
|
||||
#define NEWGAME_HEIGHT 20
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// CMainWindow:
|
||||
// See game.cpp for the code to the member functions and the message map.
|
||||
//
|
||||
class CMainWindow : public CFrameWnd {
|
||||
private:
|
||||
struct BLOCK {
|
||||
CRect rLocation;
|
||||
unsigned int nColorIndex;
|
||||
} colorBlock[NUM_BUTTONS];
|
||||
|
||||
void initStatics();
|
||||
|
||||
public:
|
||||
CMainWindow();
|
||||
void NewGame();
|
||||
void DrawBeams(CDC *pDC);
|
||||
void MoveBeam();
|
||||
void CheckUnderBeam();
|
||||
void SetBeamEntries(CDC *pDC);
|
||||
static void DrawPart(CDC *pDC, CPoint Src, CPoint Dst, int nWidth, int nHeight);
|
||||
static bool CompareColors(CDC *pDC, CPoint point);
|
||||
static bool UnderLighthouse(CPoint point);
|
||||
static bool InPictureSquare(CPoint point);
|
||||
static CPoint PointToGrid(CPoint point);
|
||||
bool LoadArtWork(CDC *pDC);
|
||||
|
||||
//added data members:
|
||||
private:
|
||||
void OnSoundNotify(CSound *pSound);
|
||||
|
||||
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 OnKeyDown(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 OnLButtonUp(unsigned int nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(unsigned int nFlags, CPoint point);
|
||||
afx_msg void OnClose();
|
||||
afx_msg LRESULT OnMCINotify(WPARAM, LPARAM);
|
||||
afx_msg LRESULT OnMMIONotify(WPARAM, LPARAM);
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
} // namespace Beacon
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
45
engines/bagel/hodjnpodj/beacon/globals.h
Normal file
45
engines/bagel/hodjnpodj/beacon/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_BEACON_GLOBALS_H
|
||||
#define HODJNPODJ_BEACON_GLOBALS_H
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Beacon {
|
||||
|
||||
// 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 24
|
||||
|
||||
} // namespace Beacon
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
69
engines/bagel/hodjnpodj/beacon/init.cpp
Normal file
69
engines/bagel/hodjnpodj/beacon/init.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
/* 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 "bagel/hodjnpodj/beacon/beacon.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Beacon {
|
||||
|
||||
HINSTANCE hDLLInst;
|
||||
HINSTANCE hExeInst;
|
||||
|
||||
LPGAMESTRUCT pGameInfo;
|
||||
|
||||
// global the pointer to the your game's main window
|
||||
HWND ghParentWnd;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Public C interface
|
||||
|
||||
HWND FAR PASCAL RunBeac(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 Beacon
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
65
engines/bagel/hodjnpodj/beacon/init.h
Normal file
65
engines/bagel/hodjnpodj/beacon/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_BEACON_GAMEDLL_H
|
||||
#define HODJNPODJ_BEACON_GAMEDLL_H
|
||||
|
||||
#include "bagel/afxwin.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Beacon {
|
||||
|
||||
/**
|
||||
****************************************************************
|
||||
*
|
||||
* RunBeac
|
||||
*
|
||||
* 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 RunBeac(HWND hParentWnd, LPGAMESTRUCT lpGameInfo);
|
||||
|
||||
} // namespace Beacon
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
387
engines/bagel/hodjnpodj/beacon/optndlg.cpp
Normal file
387
engines/bagel/hodjnpodj/beacon/optndlg.cpp
Normal file
@@ -0,0 +1,387 @@
|
||||
/* 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/beacon/globals.h"
|
||||
#include "bagel/hodjnpodj/beacon/resource.h"
|
||||
#include "bagel/hodjnpodj/beacon/beacon.h"
|
||||
#include "bagel/hodjnpodj/beacon/optndlg.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/text.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Beacon {
|
||||
|
||||
static CPalette *pSubOptionsPalette;
|
||||
static CColorButton *pOKButton = nullptr; // OKAY button on scroll
|
||||
static CColorButton *pCancelButton = nullptr; // Cancel button on scroll
|
||||
static CCheckButton *pAutoButton = nullptr; // Framed check box
|
||||
static CCheckButton *pChangeButton = nullptr; // Framed check box
|
||||
|
||||
CText *m_pScoreText = nullptr;
|
||||
CText *m_pSweepsText = nullptr;
|
||||
CText *m_pSpeedText = nullptr;
|
||||
|
||||
int m_nSweepSettings[15] = {MIN_SWEEPS, 10, 15, 20, 30, 40, 50, 60, 80, 100, 120, 150, 200, 250, MAX_SWEEPS}; // 14 factors
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// COptnDlg dialog
|
||||
|
||||
|
||||
COptnDlg::COptnDlg(CWnd* pParent, CPalette* pPalette)
|
||||
: CBmpDialog(pParent, pPalette, IDD_SUBOPTIONS, ".\\ART\\SSCROLL.BMP") {
|
||||
//{{AFX_DATA_INIT(COptnDlg)
|
||||
m_bAutomatic = false;
|
||||
m_bChangeAtTwelve = false;
|
||||
m_nSweeps = 0;
|
||||
m_nSpeed = MIN_SPEED;
|
||||
nSweepSets = 15;
|
||||
pSubOptionsPalette = pPalette;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
COptnDlg::~COptnDlg() {
|
||||
if (m_pScoreText != nullptr)
|
||||
delete m_pScoreText;
|
||||
if (m_pSweepsText != nullptr)
|
||||
delete m_pSweepsText;
|
||||
if (m_pSpeedText != nullptr)
|
||||
delete m_pSpeedText;
|
||||
|
||||
CBmpDialog::OnDestroy();
|
||||
}
|
||||
|
||||
void COptnDlg::DoDataExchange(CDataExchange* pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(COptnDlg)
|
||||
DDX_Control(pDX, IDC_NUMSWEEPS, m_ScrollSweeps);
|
||||
DDX_Control(pDX, IDC_SPEED, m_ScrollSpeed);
|
||||
//}}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_AUTOMATIC, COptnDlg::OnAutomatic)
|
||||
ON_BN_CLICKED(IDC_CHANGE, COptnDlg::OnChangeAtTwelve)
|
||||
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();
|
||||
|
||||
CDC *pDC;
|
||||
CRect statRect;
|
||||
int i;
|
||||
|
||||
pDC = GetDC();
|
||||
|
||||
// mSpeedTable[0] = "Leaky Rowboat";
|
||||
// mSpeedTable[1] = "Kayak";
|
||||
// mSpeedTable[2] = "Fishing Trawler";
|
||||
mSpeedTable[0] = "Rowboat";
|
||||
mSpeedTable[1] = "Dinghy";
|
||||
mSpeedTable[2] = "Hovercraft";
|
||||
|
||||
statRect.SetRect(LEFT_SIDE, 35, LEFT_SIDE + 185, 50);
|
||||
if ((m_pScoreText = new CText()) != nullptr) {
|
||||
(*m_pScoreText).SetupText(pDC, pSubOptionsPalette, &statRect, JUSTIFY_LEFT);
|
||||
}
|
||||
|
||||
statRect.SetRect(LEFT_SIDE, 20, LEFT_SIDE + 185, 35);
|
||||
if ((m_pSweepsText = new CText()) != nullptr) {
|
||||
(*m_pSweepsText).SetupText(pDC, pSubOptionsPalette, &statRect, JUSTIFY_LEFT);
|
||||
}
|
||||
|
||||
m_ScrollSweeps.SetScrollRange(0, nSweepSets - 1, 0);
|
||||
for (i = 0; i < (int)nSweepSets; i++) {
|
||||
if (m_nSweepSettings[i] == (int)m_nSweeps)
|
||||
m_ScrollSweeps.SetScrollPos(i, true);
|
||||
}
|
||||
|
||||
statRect.SetRect(LEFT_SIDE, 70, LEFT_SIDE + 115, 88);
|
||||
if ((m_pSpeedText = new CText()) != nullptr) {
|
||||
(*m_pSpeedText).SetupText(pDC, pSubOptionsPalette, &statRect, JUSTIFY_LEFT);
|
||||
}
|
||||
|
||||
m_ScrollSpeed.SetScrollRange(MIN_SPEED, MAX_SPEED, 0);
|
||||
m_ScrollSpeed.SetScrollPos(m_nSpeed, true);
|
||||
|
||||
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 ((pAutoButton = new CCheckButton) != nullptr) { // build a color QUIT button to let us exit
|
||||
(*pAutoButton).SetPalette(pSubOptionsPalette); // set the palette to use
|
||||
(*pAutoButton).SetControl(IDC_AUTOMATIC, this); // tie to the dialog control
|
||||
}
|
||||
((CWnd *)this)->CheckDlgButton(IDC_AUTOMATIC, m_bAutomatic); // Set the Auto option box
|
||||
|
||||
if ((pChangeButton = new CCheckButton) != nullptr) { // build a color QUIT button to let us exit
|
||||
(*pChangeButton).SetPalette(pSubOptionsPalette); // set the palette to use
|
||||
(*pChangeButton).SetControl(IDC_CHANGE, this); // tie to the dialog control
|
||||
}
|
||||
((CWnd *)this)->CheckDlgButton(IDC_CHANGE, m_bChangeAtTwelve); // Set the Auto option box
|
||||
|
||||
ReleaseDC(pDC);
|
||||
|
||||
return true; // return true unless you set the focus to a control
|
||||
}
|
||||
|
||||
|
||||
bool COptnDlg::OnEraseBkgnd(CDC *pDC) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void COptnDlg::OnDestroy() {
|
||||
CBmpDialog::OnDestroy();
|
||||
}
|
||||
|
||||
|
||||
bool COptnDlg::OnCommand(WPARAM wParam, LPARAM lParam) {
|
||||
|
||||
if (HIWORD(lParam) == BN_CLICKED) {
|
||||
|
||||
switch (wParam) {
|
||||
|
||||
case IDC_AUTOMATIC:
|
||||
m_bAutomatic = !m_bAutomatic;
|
||||
((CWnd *)this)->CheckDlgButton(IDC_AUTOMATIC, m_bAutomatic);
|
||||
break;
|
||||
|
||||
case IDC_CHANGE:
|
||||
m_bChangeAtTwelve = !m_bChangeAtTwelve;
|
||||
((CWnd *)this)->CheckDlgButton(IDC_CHANGE, m_bChangeAtTwelve);
|
||||
break;
|
||||
|
||||
case IDOK:
|
||||
ClearDialogImage();
|
||||
EndDialog(IDOK);
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
ClearDialogImage();
|
||||
EndDialog(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
} // end switch
|
||||
} // end if
|
||||
|
||||
return true;
|
||||
|
||||
} // end OnCommand
|
||||
|
||||
|
||||
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:
|
||||
NewPos++;
|
||||
break;
|
||||
case SB_PAGERIGHT:
|
||||
NewPos += NUM_BUTTONS;
|
||||
break;
|
||||
case SB_RIGHT:
|
||||
NewPos = pMax;
|
||||
break;
|
||||
case SB_LINELEFT:
|
||||
NewPos--;
|
||||
break;
|
||||
case SB_PAGELEFT:
|
||||
NewPos -= NUM_BUTTONS;
|
||||
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() {
|
||||
unsigned int OldValue;
|
||||
CDC *pDC;
|
||||
char msg[64];
|
||||
|
||||
pDC = GetDC();
|
||||
|
||||
OldValue = m_nSweeps;
|
||||
m_nSweeps = m_nSweepSettings[m_ScrollSweeps.GetScrollPos()];
|
||||
if (OldValue != m_nSweeps) {
|
||||
if (m_nSweeps == MAX_SWEEPS)
|
||||
Common::sprintf_s(msg, "Number of Sweeps: Unlimited");
|
||||
else
|
||||
Common::sprintf_s(msg, "Number of Sweeps: %d", m_nSweeps);
|
||||
(*m_pSweepsText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
}
|
||||
|
||||
OldValue = m_nSpeed;
|
||||
m_nSpeed = m_ScrollSpeed.GetScrollPos();
|
||||
if (OldValue != m_nSpeed) {
|
||||
Common::sprintf_s(msg, "Speed: %s", mSpeedTable[m_nSpeed].c_str());
|
||||
(*m_pSpeedText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
}
|
||||
|
||||
ReleaseDC(pDC);
|
||||
}
|
||||
|
||||
|
||||
void COptnDlg::OnAutomatic() {
|
||||
m_bAutomatic = !m_bAutomatic;
|
||||
((CWnd *)this)->CheckDlgButton(IDC_AUTOMATIC, m_bAutomatic);
|
||||
}
|
||||
|
||||
void COptnDlg::OnChangeAtTwelve() {
|
||||
m_bChangeAtTwelve = !m_bChangeAtTwelve;
|
||||
((CWnd *)this)->CheckDlgButton(IDC_CHANGE, m_bChangeAtTwelve);
|
||||
}
|
||||
|
||||
void COptnDlg::OnOK() {
|
||||
ClearDialogImage();
|
||||
EndDialog(IDOK);
|
||||
}
|
||||
|
||||
void COptnDlg::OnCancel() {
|
||||
ClearDialogImage();
|
||||
EndDialog(0);
|
||||
}
|
||||
|
||||
void COptnDlg::OnPaint() {
|
||||
CDC *pDC;
|
||||
char msg[64];
|
||||
|
||||
CBmpDialog::OnPaint();
|
||||
|
||||
pDC = GetDC();
|
||||
|
||||
Common::sprintf_s(msg, "(Effective on New Game)");
|
||||
(*m_pScoreText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
|
||||
if (m_nSweeps == MAX_SWEEPS)
|
||||
Common::sprintf_s(msg, "Number of Sweeps: Unlimited");
|
||||
else
|
||||
Common::sprintf_s(msg, "Number of Sweeps: %d", m_nSweeps);
|
||||
(*m_pSweepsText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
|
||||
Common::sprintf_s(msg, "Speed: %s", mSpeedTable[m_nSpeed].c_str());
|
||||
(*m_pSpeedText).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 (pAutoButton != nullptr) { // release the button
|
||||
delete pAutoButton;
|
||||
pAutoButton = nullptr;
|
||||
}
|
||||
|
||||
if (pChangeButton != nullptr) { // release the button
|
||||
delete pChangeButton;
|
||||
pChangeButton = nullptr;
|
||||
}
|
||||
|
||||
ValidateRect(nullptr);
|
||||
}
|
||||
|
||||
} // namespace Beacon
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
86
engines/bagel/hodjnpodj/beacon/optndlg.h
Normal file
86
engines/bagel/hodjnpodj/beacon/optndlg.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/* 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_BEACON_OPTNDLG_H
|
||||
#define HODJNPODJ_BEACON_OPTNDLG_H
|
||||
|
||||
#include "bagel/hodjnpodj/beacon/resource.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/cbofdlg.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/text.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Beacon {
|
||||
|
||||
#define LEFT_SIDE 30
|
||||
#define OPTIONS_COLOR RGB(0, 0, 0) // Color of the stats info CText
|
||||
#define NUM_SPEEDS 3
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// COptnDlg dialog
|
||||
|
||||
class COptnDlg : public CBmpDialog {
|
||||
// Construction
|
||||
public:
|
||||
COptnDlg(CWnd* pParent = nullptr, CPalette *pPalette = nullptr); // standard constructor
|
||||
~COptnDlg(); // destructor
|
||||
void UpdateScrollbars();
|
||||
void ClearDialogImage();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(COptnDlg)
|
||||
enum { IDD = IDD_SUBOPTIONS };
|
||||
CScrollBar m_ScrollSweeps;
|
||||
CScrollBar m_ScrollSpeed;
|
||||
bool m_bAutomatic = false;
|
||||
bool m_bChangeAtTwelve = false;
|
||||
unsigned int m_nSweeps = 0;
|
||||
unsigned int m_nSpeed = 0;
|
||||
unsigned int nSweepSets = 0;
|
||||
CString mSpeedTable [NUM_SPEEDS];
|
||||
//}}AFX_DATA
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(COptnDlg)
|
||||
virtual bool OnCommand(WPARAM wParam, LPARAM lParam) override;
|
||||
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 OnAutomatic();
|
||||
afx_msg void OnChangeAtTwelve();
|
||||
afx_msg void OnDestroy();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
} // namespace Beacon
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
45
engines/bagel/hodjnpodj/beacon/resource.h
Normal file
45
engines/bagel/hodjnpodj/beacon/resource.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_BATTLEFISH_USERCFG_H
|
||||
#define HODJNPODJ_BATTLEFISH_USERCFG_H
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Battlefish {
|
||||
|
||||
|
||||
#define IDD_SUBOPTIONS 115
|
||||
|
||||
#define IDB_BEACON_BMP 301
|
||||
|
||||
#define IDC_RULES 1002
|
||||
|
||||
#define IDC_NUMSWEEPS 1021
|
||||
#define IDC_SPEED 1023
|
||||
#define IDC_CHANGE 1024
|
||||
#define IDC_AUTOMATIC 1025
|
||||
|
||||
} // namespace Beacon
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user