Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,111 @@
/* 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_PEGGLE_GAME_H
#define HODJNPODJ_PEGGLE_GAME_H
#include "bagel/hodjnpodj/hnplibs/sprite.h"
#include "bagel/boflib/sound.h"
namespace Bagel {
namespace HodjNPodj {
namespace Peggle {
#define NARRATIVESPEC ".\\SOUND\\PEGG.WAV"
#define RULESSPEC "PEGGLE.TXT"
// Button positioning constants
#define QUIT_BUTTON_WIDTH 50
#define QUIT_BUTTON_HEIGHT 20
#define QUIT_BUTTON_OFFSET_X 10
#define QUIT_BUTTON_OFFSET_Y 10
#define RESTART_BUTTON_WIDTH 63
#define RESTART_BUTTON_HEIGHT 39
#define RESTART_BUTTON_OFFSET_X 10
#define RESTART_BUTTON_OFFSET_Y 150
#define INIT_BUTTON_WIDTH 80
#define INIT_BUTTON_HEIGHT 30
#define INIT_BUTTON_OFFSET_X 280
#define INIT_BUTTON_OFFSET_Y 20
void SetUpBoard(CDC *pDC);
void UndoMove(CDC *pDC);
/////////////////////////////////////////////////////////////////////////////
// CMainWindow:
// See game.cpp for the code to the member functions and the message map.
//
class CMainWindow : public CFrameWnd {
public:
CMainWindow(HWND);
void initStatics();
void SplashScreen();
static void UpdatePegPosition(CDC *pDC, CSprite *pSprite, int x, int y);
static CPoint GridToPoint(int i, int j);
static CPoint PointToGrid(CPoint point);
static void UndoMove(CDC *pDC);
void UndoTurn();
private:
bool m_bProgramActive = false;
HWND m_hCallAppWnd = nullptr;
CRect ScrollRect;
void OnSoundNotify(CSound *pSound);
protected:
virtual bool OnCommand(WPARAM wParam, LPARAM lParam) override;
//{{AFX_MSG( CMainWindow )
afx_msg void OnPaint();
afx_msg void OnLButtonDown(unsigned int, CPoint);
afx_msg void OnLButtonUp(unsigned int, CPoint);
afx_msg void OnLButtonDblClk(unsigned int, CPoint);
afx_msg void OnMButtonDown(unsigned int, CPoint);
afx_msg void OnMButtonUp(unsigned int, CPoint);
afx_msg void OnMButtonDblClk(unsigned int, CPoint);
afx_msg void OnRButtonDown(unsigned int, CPoint);
afx_msg void OnRButtonUp(unsigned int, CPoint);
afx_msg void OnRButtonDblClk(unsigned int, CPoint);
afx_msg void OnMouseMove(unsigned int nFlags, CPoint point);
afx_msg void OnChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
afx_msg void OnSysChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
afx_msg void OnClose();
afx_msg void OnDestroy();
afx_msg void OnKeyDown(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
afx_msg void OnActivateApp(bool bActive, HTASK hTask);
afx_msg LRESULT OnMCINotify(WPARAM, LPARAM);
afx_msg LRESULT OnMMIONotify(WPARAM, LPARAM);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
} // namespace Peggle
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,186 @@
/* 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_PEGGLE_GAME2_H
#define HODJNPODJ_PEGGLE_GAME2_H
namespace Bagel {
namespace HodjNPodj {
namespace Peggle {
// Sprite identification types
#define SPRITE_GLASS 0
#define SPRITE_HOLE 1
#define SPRITE_INVALID 2
// midi sound file
#define GAME_THEME ".\\SOUND\\PEGGLEBO.MID"
// Wave sound files
#define WAV_UNDO ".\\SOUND\\SOUND208.WAV"
#define WAV_WON ".\\SOUND\\SOUNDWON.WAV"
#define WAV_DONE ".\\SOUND\\SOUND216.WAV"
#define WAV_MOVE ".\\SOUND\\SOUND169.WAV"
#define WAV_NOMOVE ".\\SOUND\\OLD169.WAV"
// Title display offsets
#define TITLE_X 14
#define TITLE_Y 3
#define TITLE_DX 219
#define TITLE_DY 17
// Bottle display offsets
#define BOTTLE_X 195
#define BOTTLE_Y 84
#define BOTTLE_DX 46
#define BOTTLE_DY 149
// DART display offsets
#define DART_X 268
#define DART_Y 106
#define DART_DX 279
#define DART_DY 63
#define NUM_DART_CELS 21
// DART Easter Egg hotspot offsets
#define EE_DART_X 487
#define EE_DART_Y 108
#define EE_DART_DX 58
#define EE_DART_DY 60
// KEG display offsets
#define KEG_X 15
#define KEG_Y 121
#define KEG_DX 125
#define KEG_DY 40
#define NUM_KEG_CELS 17
#define KEG_CEL_OFFSET 7
// STOOL display offsets
#define STOOL_X 14
#define STOOL_Y 148
#define STOOL_DX 98
#define STOOL_DY 125
#define NUM_STOOL_CELS 25
#define DART_SLEEP 80 // In milliseconds 70
#define KEG_SLEEP 115 // In milliseconds 150 130
#define STOOL_SLEEP 55 // In milliseconds
// Audio easter egg info:
#define NET_X 205
#define NET_Y 35
#define NET_DX 122
#define NET_DY 50
#define NET_SOUND ".\\SOUND\\ANCHORS.WAV"
#define OAR_X 20
#define OAR_Y 53
#define OAR_DX 185
#define OAR_DY 52
#define OAR_SOUND ".\\SOUND\\ROWBOAT.WAV"
#define SIGN_X 355
#define SIGN_Y 25
#define SIGN_DX 67
#define SIGN_DY 36
#define SIGN_SOUND ".\\SOUND\\TAVERN.WAV"
#define TABLE_X 314
#define TABLE_Y 170
#define TABLE_DX 122
#define TABLE_DY 42
#define TABLE_SOUND ".\\SOUND\\FRINIGHT.WAV"
#define CANDLENR_X 595
#define CANDLENR_Y 208
#define CANDLENR_DX 30
#define CANDLENR_DY 50
#define CANDLEFR_X 530
#define CANDLEFR_Y 183
#define CANDLEFR_DX 20
#define CANDLEFR_DY 20
#define CANDLE_SOUND ".\\SOUND\\STNICMSG.WAV"
// Board display offsets
#define CROSS_BOARD_DX 210
#define CROSS_BOARD_DY 194
#define CROSS_PLUS_BOARD_DX 210
#define CROSS_PLUS_BOARD_DY 194
#define TRI_BOARD_DX 305
#define TRI_BOARD_DY 224
#define TRI_PLUS_BOARD_DX 304
#define TRI_PLUS_BOARD_DY 197
// Shot glass display offsets
#define CROSS_SHOTGLASS_DX 10
#define CROSS_SHOTGLASS_DDX 31
#define CROSS_SHOTGLASS_DDDX 3
#define CROSS_SHOTGLASS_DY 27
#define CROSS_PLUS_SHOTGLASS_DX 10
#define CROSS_PLUS_SHOTGLASS_DDX 31
#define CROSS_PLUS_SHOTGLASS_DDDX 3
#define CROSS_PLUS_SHOTGLASS_DY 27
#define TRI_SHOTGLASS_DX 24
#define TRI_SHOTGLASS_DY 27
#define TRI_PLUS_SHOTGLASS_DX 24
#define TRI_PLUS_SHOTGLASS_DY 27
// Array Status:
#define EMPTY 0
#define PEGGED 1
#define NO_HOLE 2
// Board Selection:
#define BOARD_COUNT 4
#define BOARD_BASE 10
#define CROSS 10
#define CROSS_PLUS 11
#define TRIANGLE 12
#define TRIANGLE_PLUS 13
#define GRID_SIZE 7 // may be changed later
// Sprite size:
#define SPRITE_SIZE_DX 15
#define SPRITE_SIZE_DY 25
#define HAND_SIZE 48
} // namespace Peggle
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,92 @@
/* 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/stdafx.h"
#include "bagel/hodjnpodj/peggle/game.h"
namespace Bagel {
namespace HodjNPodj {
namespace Peggle {
#define SYSCOLORS 19
bool bHasPalette = true; // whether the display is palette driven
int nColorDepth = 8; // display's bits per pixel
int nScreenWidth = 640, // screen size
nScreenHeight = 480;
// Windows color parameters that can be modified
int syscolorelements[SYSCOLORS] = {
COLOR_BTNFACE,
COLOR_BTNHIGHLIGHT,
COLOR_BTNSHADOW,
COLOR_BTNTEXT
};
// Place to save Windows colors being altered
uint32 oldsyscolorvalues[SYSCOLORS];
// 8-Bit 256 color parameter values for Windows
uint32 syscolorvalues_8bit[SYSCOLORS] = {
RGB(207, 103, 123),
RGB(187, 147, 107),
RGB(147, 99, 79),
RGB(123, 75, 67),
};
// Non-Palette oriented color parameter values for Windows
uint32 syscolorvalues_moby[SYSCOLORS] = {
RGB(207, 103, 123),
RGB(187, 147, 107),
RGB(147, 99, 79),
RGB(123, 75, 67),
};
// Set the default colors used by Windows controls
void WINAPI WindowsInit() {
int i;
HDC hDC;
hDC = GetDC(nullptr); // get screen's device context
nScreenWidth = GetDeviceCaps(hDC, HORZRES);
nScreenHeight = GetDeviceCaps(hDC, VERTRES);
bHasPalette = ((GetDeviceCaps(hDC, RASTERCAPS) & RC_PALETTE) ? true : false);
nColorDepth = GetDeviceCaps(hDC, PLANES) * GetDeviceCaps(hDC, BITSPIXEL);
ReleaseDC(nullptr, hDC);
for (i = 0; i < SYSCOLORS; i++) {
oldsyscolorvalues[i] = GetSysColor(syscolorelements[i]);
}
}
// Reset the default Windows control colors
void WINAPI WindowsCleanup() {
}
} // namespace Peggle
} // namespace HodjNPodj
} // namespace Bagel

View File

@@ -0,0 +1,36 @@
/* 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_PEGGLE_GAMEINIT_H
#define HODJNPODJ_PEGGLE_GAMEINIT_H
namespace Bagel {
namespace HodjNPodj {
namespace Peggle {
extern void WindowsInit();
extern void WindowsCleanup();
} // namespace Peggle
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,97 @@
/* 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/stdafx.h"
#include "bagel/hodjnpodj/hnplibs/button.h"
#include "bagel/hodjnpodj/hnplibs/gamedll.h"
#include "bagel/hodjnpodj/peggle/resource.h"
#include "bagel/hodjnpodj/peggle/init.h"
#include "bagel/hodjnpodj/peggle/game.h"
namespace Bagel {
namespace HodjNPodj {
namespace Peggle {
HINSTANCE hDLLInst;
HINSTANCE hExeInst;
extern CSprite *pCursorSprite;
extern CSprite *pShotGlass;
extern CSprite *pTableSlot;
extern CSprite *pInvalidSlot;
extern CPalette *pGamePalette;
extern CBmpButton *pScrollButton;
CMainWindow *pcwndPeggle = nullptr;
LPGAMESTRUCT pGameInfo;
/////////////////////////////////////////////////////////////////////////////
// Public C interface
/*****************************************************************
*
* RunPeggle
*
* 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 RunPeggle(HWND hParentWnd, LPGAMESTRUCT lpGameInfo) {
pGameInfo = lpGameInfo;
// if the pointer has garbage in it, the clean it out
if (pcwndPeggle != nullptr) {
pcwndPeggle = nullptr;
}
// create a my window and show it
pcwndPeggle = new CMainWindow(hParentWnd);
pcwndPeggle->ShowWindow(SW_SHOWNORMAL);
pcwndPeggle->UpdateWindow();
pcwndPeggle->SetActiveWindow();
// return the handle to this window
hDLLInst = (HINSTANCE)GetWindowWord(pcwndPeggle->m_hWnd, GWW_HINSTANCE);
hExeInst = (HINSTANCE)GetWindowWord(hParentWnd, GWW_HINSTANCE);
return pcwndPeggle->m_hWnd;
}
} // namespace Peggle
} // namespace HodjNPodj
} // namespace Bagel

View 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_PEGGLE_GAMEINIT_H
#define HODJNPODJ_PEGGLE_GAMEINIT_H
#include "bagel/afxwin.h"
namespace Bagel {
namespace HodjNPodj {
namespace Peggle {
extern HWND RunPeggle(HWND hParentWnd, LPGAMESTRUCT lpGameInfo);
} // namespace Peggle
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,119 @@
/* 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/bitmaps.h"
#include "bagel/hodjnpodj/hnplibs/button.h"
#include "bagel/hodjnpodj/hnplibs/rules.h"
#include "bagel/hodjnpodj/hnplibs/gamedll.h"
#include "bagel/hodjnpodj/hnplibs/text.h"
#include "bagel/hodjnpodj/hnplibs/audiocfg.h"
#include "bagel/hodjnpodj/peggle/resource.h"
#include "bagel/hodjnpodj/peggle/options.h"
#include "bagel/hodjnpodj/peggle/optndlg.h"
#include "bagel/hodjnpodj/peggle/game.h"
namespace Bagel {
namespace HodjNPodj {
namespace Peggle {
extern LPGAMESTRUCT pGameInfo;
extern CPalette *pOptionsPalette;
void COptions::OnLButtonDown(unsigned int nFlags, CPoint point) {
CDialog::OnLButtonDown(nFlags, point);
}
void COptions::OnMouseMove(unsigned int nFlags, CPoint point) {
CDialog::OnMouseMove(nFlags, point);
}
void COptions::OnClickedRules() {
CWnd *pControl = nullptr;
CRules RulesDlg(this, RULESSPEC, pOptionsPalette, ((*pGameInfo).bSoundEffectsEnabled ? NARRATIVESPEC : nullptr));
RulesDlg.DoModal(); // invoke the help dialog box
SetDefID(IDC_OPTIONS_OPTIONS);
SetDefID(IDC_OPTIONS_RETURN);
pControl = GetDlgItem(IDC_OPTIONS_RETURN);
GotoDlgCtrl(pControl);
}
void COptions::OnClickedNewgame() {
ClearDialogImage();
EndDialog(IDC_NEWGAME);
}
void COptions::OnClickedOptions() {
CWnd *pControl = nullptr;
COptnDlg OptionsDlg(this, pOptionsPalette); // Call Specific Game
if (OptionsDlg.DoModal() == IDOK) { // save values set in dialog box
ClearDialogImage();
EndDialog(IDC_RESTART) ;
} else {
SetDefID(IDC_OPTIONS_RULES);
SetDefID(IDC_OPTIONS_RETURN);
pControl = GetDlgItem(IDC_OPTIONS_RETURN);
GotoDlgCtrl(pControl);
}
}
void COptions::OnClickedAudio() {
CWnd *pControl = nullptr;
CAudioCfgDlg dlgAudioCfg(this, pOptionsPalette, IDD_AUDIOCFG);
if (pGameInfo != nullptr) {
pGameInfo->bMusicEnabled = GetPrivateProfileInt("Meta", "Music", true, "HODJPODJ.INI");
pGameInfo->bSoundEffectsEnabled = GetPrivateProfileInt("Meta", "SoundEffects", true, "HODJPODJ.INI");
}
SetDefID(IDC_OPTIONS_RULES);
SetDefID(IDC_OPTIONS_RETURN);
pControl = GetDlgItem(IDC_OPTIONS_RETURN);
GotoDlgCtrl(pControl);
}
void COptions::OnClickedReturn() {
ClearDialogImage();
EndDialog(IDC_RETURN) ; // successful completion
}
void COptions::OnClickedQuit() {
ClearDialogImage();
EndDialog(IDC_QUIT) ; // unsuccessful completion
}
} // namespace Peggle
} // namespace HodjNPodj
} // namespace Bagel

View File

@@ -0,0 +1,85 @@
/* 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_PEGGLE_OPTIONS_H
#define HODJNPODJ_PEGGLE_OPTIONS_H
#include "bagel/hodjnpodj/hnplibs/dibdoc.h"
#include "bagel/hodjnpodj/globals.h"
#include "bagel/hodjnpodj/peggle/optres.h"
namespace Bagel {
namespace HodjNPodj {
namespace Peggle {
class COptions : public CDialog {
// Construction
public:
COptions(CWnd* pParent, CPalette *pPalette, int iDlgId);
void ClearDialogImage();
void RefreshBackground();
int m_iDlgId = 0; // dialog id
CWnd *m_pDlgParentWnd = nullptr;
CBitmap *m_pDlgBackground = nullptr;
private:
CRect OptionsRect, OkayRect;
// Dialog Data
//{{AFX_DATA(COptions)
enum { IDD = IDD_OPTIONS_DIALOG };
// 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(COptions)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
virtual bool OnInitDialog() override;
afx_msg bool OnEraseBkgnd(CDC *pDC);
virtual void OnOK() override;
afx_msg void OnPaint();
afx_msg void OnShowWindow(bool bShow, unsigned int nStatus);
afx_msg void OnSize(unsigned int nType, int cx, int cy);
afx_msg void OnMouseMove(unsigned int nFlags, CPoint point);
afx_msg void OnLButtonDown(unsigned int nFlags, CPoint point);
afx_msg void OnClickedRules() ;
afx_msg void OnClickedNewgame() ;
afx_msg void OnClickedOptions() ;
afx_msg void OnClickedAudio() ;
afx_msg void OnClickedReturn();
afx_msg void OnClickedQuit();
afx_msg void OnDestroy();
// afx_msg void OnActivate(unsigned int nState, CWnd *pWndOther, bool bMinimized);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
} // namespace Peggle
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,298 @@
/* 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/text.h"
#include "bagel/hodjnpodj/hnplibs/button.h"
#include "bagel/hodjnpodj/globals.h"
#include "bagel/hodjnpodj/peggle/resource.h"
#include "bagel/hodjnpodj/peggle/options.h"
#include "bagel/hodjnpodj/peggle/optndlg.h"
#include "bagel/hodjnpodj/peggle/game2.h"
namespace Bagel {
namespace HodjNPodj {
namespace Peggle {
CPalette *pSubOptionsPalette;
CBmpButton *m_pTriButton = nullptr;
CBmpButton *m_pTriPButton = nullptr;
CBmpButton *m_pCroButton = nullptr;
CBmpButton *m_pCroPButton = nullptr;
static CCheckButton *pRandomButton = nullptr; // Framed check box
extern int8 BoardSelected;
extern bool bRandomBoard;
static char chNewBoard;
static bool m_bRandom;
/////////////////////////////////////////////////////////////////////////////
// COptnDlg dialog
COptnDlg::COptnDlg(CWnd* pParent, CPalette* pPalette)
: COptions(pParent, pPalette, IDD_SUBOPTIONS)
// : CDialog(COptnDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(COptnDlg)
pSubOptionsPalette = pPalette;
//}}AFX_DATA_INIT
}
void COptnDlg::DoDataExchange(CDataExchange* pDX) {
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COptnDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COptnDlg, CDialog)
//{{AFX_MSG_MAP(COptnDlg)
ON_WM_PAINT()
ON_WM_CREATE()
ON_WM_ERASEBKGND()
ON_BN_CLICKED(IDC_SUB_OKAY, COptnDlg::OnClickedOkay)
ON_BN_CLICKED(IDC_SUB_CANCEL, COptnDlg::OnClickedCancel)
ON_BN_CLICKED(IDC_SUB_CROSS, COptnDlg::OnClickedCross)
ON_BN_CLICKED(IDC_SUB_CROSSPLUS, COptnDlg::OnClickedCrossPlus)
ON_BN_CLICKED(IDC_SUB_TRIANGLE, COptnDlg::OnClickedTriangle)
ON_BN_CLICKED(IDC_SUB_TRIANGLEPLUS, COptnDlg::OnClickedTrianglePlus)
ON_BN_CLICKED(IDC_RANDOM, COptnDlg::OnRandom)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COptnDlg message handlers
int COptnDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) {
if (COptions::OnCreate(lpCreateStruct) == -1)
return -1;
return 0;
}
bool COptnDlg::OnInitDialog() {
bool bSuccess;
CRect myRect;
COptions::OnInitDialog();
chNewBoard = BoardSelected;
m_bRandom = bRandomBoard;
m_pTriButton = new CBmpButton;
ASSERT(m_pTriButton != nullptr);
myRect.SetRect(TRIANGLE_X, TRIANGLE_Y, TRIANGLE_X + OPTN_BUTTON_WIDTH, TRIANGLE_Y + OPTN_BUTTON_HEIGHT);
bSuccess = (*m_pTriButton).Create(nullptr, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE, myRect, this, IDC_SUB_TRIANGLE);
ASSERT(bSuccess);
bSuccess = (*m_pTriButton).LoadBitmaps("TRIUP", "TRIDOWN", nullptr, nullptr);
ASSERT(bSuccess);
m_pCroButton = new CBmpButton;
ASSERT(m_pCroButton != nullptr);
myRect.SetRect(CROSS_X, CROSS_Y, CROSS_X + OPTN_BUTTON_WIDTH, CROSS_Y + OPTN_BUTTON_HEIGHT);
bSuccess = (*m_pCroButton).Create(nullptr, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE, myRect, this, IDC_SUB_CROSS);
ASSERT(bSuccess);
bSuccess = (*m_pCroButton).LoadBitmaps("CROUP", "CRODOWN", nullptr, nullptr);
ASSERT(bSuccess);
m_pTriPButton = new CBmpButton;
ASSERT(m_pTriPButton != nullptr);
myRect.SetRect(TRIANGLEPLUS_X, TRIANGLEPLUS_Y,
TRIANGLEPLUS_X + OPTN_BUTTON_WIDTH, TRIANGLEPLUS_Y + OPTN_BUTTON_HEIGHT);
bSuccess = (*m_pTriPButton).Create(nullptr, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE, myRect, this, IDC_SUB_TRIANGLEPLUS);
ASSERT(bSuccess);
bSuccess = (*m_pTriPButton).LoadBitmaps("TRIPUP", "TRIPDOWN", nullptr, nullptr);
ASSERT(bSuccess);
m_pCroPButton = new CBmpButton;
ASSERT(m_pCroPButton != nullptr);
myRect.SetRect(CROSSPLUS_X, CROSSPLUS_Y, CROSSPLUS_X + OPTN_BUTTON_WIDTH, CROSSPLUS_Y + OPTN_BUTTON_HEIGHT);
bSuccess = (*m_pCroPButton).Create(nullptr, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE, myRect, this, IDC_SUB_CROSSPLUS);
ASSERT(bSuccess);
bSuccess = (*m_pCroPButton).LoadBitmaps("CROPUP", "CROPDOWN", nullptr, nullptr);
ASSERT(bSuccess);
if ((pRandomButton = new CCheckButton) != nullptr) { // build a color QUIT button to let us exit
(*pRandomButton).SetPalette(pSubOptionsPalette); // set the palette to use
(*pRandomButton).SetControl(IDC_RANDOM, this); // tie to the dialog control
}
((CWnd *)this)->CheckDlgButton(IDC_RANDOM, m_bRandom); // Set the Auto option box
if (!m_bRandom) { // If not randomly selecting board
switch (chNewBoard) {
case CROSS:
(*m_pCroButton).SendMessage(BM_SETSTATE, true, 0L);
break;
case CROSS_PLUS:
(*m_pCroPButton).SendMessage(BM_SETSTATE, true, 0L);
break;
case TRIANGLE:
(*m_pTriButton).SendMessage(BM_SETSTATE, true, 0L);
break;
default: //case TRIANGLE_PLUS:
(*m_pTriPButton).SendMessage(BM_SETSTATE, true, 0L);
break;
} // end switch
}
return true; // return true unless you set the focus to a control
}
void COptnDlg::OnDestroy() {
bool bUpdateNeeded;
if (m_pDlgBackground != nullptr) {
delete m_pDlgBackground;
m_pDlgBackground = nullptr;
bUpdateNeeded = (*m_pDlgParentWnd).GetUpdateRect(nullptr, false);
if (bUpdateNeeded)
(*m_pDlgParentWnd).ValidateRect(nullptr);
}
if (pRandomButton != nullptr) { // release the button
delete pRandomButton;
pRandomButton = nullptr;
}
CDialog::OnDestroy();
}
bool COptnDlg::OnEraseBkgnd(CDC *pDC) {
return true;
}
void COptnDlg::OnClickedOkay() {
COptnDlg::OnOK();
}
void COptnDlg::OnOK() {
if ((chNewBoard != BoardSelected) || (m_bRandom != bRandomBoard)) {
BoardSelected = chNewBoard;
bRandomBoard = m_bRandom;
COptions::ClearDialogImage();
EndDialog(IDOK);
} else {
COptions::ClearDialogImage();
EndDialog(0);
}
}
void COptnDlg::OnClickedCancel() {
COptnDlg::OnCancel();
}
void COptnDlg::OnCancel() {
COptions::ClearDialogImage();
EndDialog(0);
}
void COptnDlg::OnPaint() {
COptions::OnPaint();
}
void COptnDlg::OnRandom() {
m_bRandom = !m_bRandom;
((CWnd *)this)->CheckDlgButton(IDC_RANDOM, m_bRandom);
(*m_pCroPButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pTriButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pTriPButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pCroButton).SendMessage(BM_SETSTATE, false, 0L);
}
void COptnDlg::OnClickedCross() {
if (m_bRandom) {
m_bRandom = false;
((CWnd *)this)->CheckDlgButton(IDC_RANDOM, m_bRandom);
}
chNewBoard = CROSS;
(*m_pCroPButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pTriButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pTriPButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pCroButton).SendMessage(BM_SETSTATE, true, 0L);
}
void COptnDlg::OnClickedCrossPlus() {
if (m_bRandom) {
m_bRandom = false;
((CWnd *)this)->CheckDlgButton(IDC_RANDOM, m_bRandom);
}
chNewBoard = CROSS_PLUS;
(*m_pCroButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pTriButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pTriPButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pCroPButton).SendMessage(BM_SETSTATE, true, 0L);
}
void COptnDlg::OnClickedTriangle() {
if (m_bRandom) {
m_bRandom = false;
((CWnd *)this)->CheckDlgButton(IDC_RANDOM, m_bRandom);
}
chNewBoard = TRIANGLE;
(*m_pCroButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pCroPButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pTriPButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pTriButton).SendMessage(BM_SETSTATE, true, 0L);
}
void COptnDlg::OnClickedTrianglePlus() {
if (m_bRandom) {
m_bRandom = false;
((CWnd *)this)->CheckDlgButton(IDC_RANDOM, m_bRandom);
}
chNewBoard = TRIANGLE_PLUS;
(*m_pCroButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pCroPButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pTriButton).SendMessage(BM_SETSTATE, false, 0L);
(*m_pTriPButton).SendMessage(BM_SETSTATE, true, 0L);
}
} // namespace Peggle
} // namespace HodjNPodj
} // namespace Bagel

View File

@@ -0,0 +1,83 @@
/* 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_PEGGLE_OPTNDLG_H
#define HODJNPODJ_PEGGLE_OPTNDLG_H
#include "bagel/hodjnpodj/peggle/options.h"
namespace Bagel {
namespace HodjNPodj {
namespace Peggle {
#define OPTN_BUTTON_WIDTH 50
#define OPTN_BUTTON_HEIGHT 47
#define CROSS_X 40
#define CROSS_Y 27
#define TRIANGLE_X 40
#define TRIANGLE_Y 76
#define CROSSPLUS_X 125
#define CROSSPLUS_Y 27
#define TRIANGLEPLUS_X 125
#define TRIANGLEPLUS_Y 76
/////////////////////////////////////////////////////////////////////////////
// COptnDlg dialog
class COptnDlg : public COptions {
// Construction
public:
COptnDlg(CWnd* pParent = nullptr, CPalette *pPalette = nullptr); // standard constructor
// Dialog Data
//{{AFX_DATA(COptnDlg)
enum { IDD = IDD_SUBOPTIONS };
//}}AFX_DATA
// Implementation
protected:
virtual void DoDataExchange(CDataExchange *pDX) override; // DDX/DDV support
// Generated message map functions
//{{AFX_MSG(COptnDlg)
virtual bool OnInitDialog() override;
afx_msg 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 OnClickedOkay() ;
afx_msg void OnClickedCancel() ;
afx_msg void OnClickedCross() ;
afx_msg void OnClickedCrossPlus() ;
afx_msg void OnClickedTriangle() ;
afx_msg void OnClickedTrianglePlus() ;
afx_msg void OnRandom();
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
} // namespace Peggle
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,55 @@
/* 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_PEGGLE_OPTRES_H
#define HODJNPODJ_PEGGLE_OPTRES_H
namespace Bagel {
namespace HodjNPodj {
namespace Peggle {
#define IDC_OPTIONS_ARROWUP 503
#define IDC_OPTIONS_ARROWDN 504
#define ID_OPTIONS_CODES 450
#define IDR_BITMAP_SCROLL 451
#define IDD_OPTIONS_DIALOG 452
#define IDC_OPTIONS_RETURN 453
#define IDC_OPTIONS_QUIT 454
#define IDC_OPTIONS_RULES 455
#define IDC_OPTIONS_NEWGAME 456
#define IDC_OPTIONS_OPTIONS 457
#define IDC_OPTIONS_AUDIO 458
#define IDC_SUB_OKAY 9
#define IDC_SUB_CANCEL 10
#define IDC_SUB_CROSS 11
#define IDC_SUB_CROSSPLUS 12
#define IDC_SUB_TRIANGLE 13
#define IDC_SUB_TRIANGLEPLUS 14
} // namespace Peggle
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,398 @@
/* 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/globals.h"
#include "bagel/hodjnpodj/hnplibs/stdafx.h"
#include "bagel/hodjnpodj/hnplibs/gamedll.h"
#include "bagel/hodjnpodj/hnplibs/bitmaps.h"
#include "bagel/hodjnpodj/hnplibs/button.h"
#include "bagel/hodjnpodj/peggle/options.h"
#include "bagel/hodjnpodj/peggle/resource.h"
#include "bagel/hodjnpodj/hodjnpodj.h"
namespace Bagel {
namespace HodjNPodj {
namespace Peggle {
extern LPGAMESTRUCT pGameInfo;
extern CBmpButton *m_pTriButton;
extern CBmpButton *m_pTriPButton;
extern CBmpButton *m_pCroButton;
extern CBmpButton *m_pCroPButton;
CPalette *pOptionsPalette = nullptr;
static CColorButton *pRulesButton = nullptr;
static CColorButton *pNewgameButton = nullptr;
static CColorButton *pOptionsButton = nullptr;
static CColorButton *pAudioButton = nullptr;
static CColorButton *pReturnButton = nullptr;
static CColorButton *pQuitButton = nullptr;
static CColorButton *pOkayButton = nullptr;
static CColorButton *pCancelButton = nullptr;
/////////////////////////////////////////////////////////////////////////////
// COptions dialog
COptions::COptions(CWnd* pParent, CPalette *pPalette, int iDlgId)
: CDialog(iDlgId, pParent) {
pOptionsPalette = pPalette;
m_iDlgId = iDlgId ; // dialog id
if (pParent == nullptr)
m_pDlgParentWnd = ((CWnd *)this)->GetParent();
else
m_pDlgParentWnd = pParent ;
//{{AFX_DATA_INIT(COptions)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void COptions::DoDataExchange(CDataExchange* pDX) {
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COptions)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COptions, CDialog)
//{{AFX_MSG_MAP(COptions)
ON_WM_CREATE()
ON_WM_ERASEBKGND()
ON_WM_PAINT()
ON_WM_SHOWWINDOW()
ON_WM_SIZE()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDOWN()
ON_WM_NCMOUSEMOVE()
ON_BN_CLICKED(IDC_OPTIONS_RULES, COptions::OnClickedRules)
ON_BN_CLICKED(IDC_OPTIONS_NEWGAME, COptions::OnClickedNewgame)
ON_BN_CLICKED(IDC_OPTIONS_OPTIONS, COptions::OnClickedOptions)
ON_BN_CLICKED(IDC_OPTIONS_AUDIO, COptions::OnClickedAudio)
ON_BN_CLICKED(IDC_OPTIONS_RETURN, COptions::OnClickedReturn)
ON_BN_CLICKED(IDC_OPTIONS_QUIT, COptions::OnClickedQuit)
ON_WM_DESTROY()
// ON_WM_ACTIVATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COptions message handlers
void COptions::OnOK() {
ClearDialogImage();
CDialog::EndDialog(IDC_OPTIONS_QUIT);
}
bool COptions::OnInitDialog() {
bool bSuccess;
CWnd *pButton;
CDC *pDC;
CDialog::OnInitDialog(); // do basic dialog initialization
CRect cDlgRect, cWindRect ;
int iDlgWidth, iDlgHeight ; // size of dialog box
CWnd * pMainWnd ; // main window for application
pMainWnd = m_pDlgParentWnd ; // get dialog box parent
while (pMainWnd->GetParent()) { // while it has a parent
pMainWnd = pMainWnd->GetParent();
} // use it
// get the parent window's rectangular bounds
(*pMainWnd).GetWindowRect(&cWindRect); // get pos/size of parent
// ((CWnd *)this)->GetWindowRect(&cDlgRect); // get pos/size of dialog
cDlgRect.SetRect(0, 0, 222, 210);
// center the dialog box on the screen
iDlgWidth = cDlgRect.right - cDlgRect.left ; // dlg box width
cDlgRect.left = (cWindRect.right + cWindRect.left - iDlgWidth) / 2 ;
cDlgRect.right = cDlgRect.left + iDlgWidth ;
iDlgHeight = cDlgRect.bottom - cDlgRect.top ; // dlg box height
cDlgRect.top = (cWindRect.bottom + cWindRect.top - iDlgHeight) / 2 ;
cDlgRect.bottom = cDlgRect.top + iDlgHeight ;
MoveWindow(&cDlgRect, false) ; // center window, don't repaint
pDC = GetDC();
ASSERT(pDC != nullptr);
m_pDlgBackground = FetchScreenBitmap(pDC, pOptionsPalette, 0, 0, iDlgWidth, iDlgHeight);
ASSERT(m_pDlgBackground != nullptr);
ReleaseDC(pDC);
if (m_iDlgId == IDD_OPTIONS_DIALOG) {
pRulesButton = new CColorButton();
ASSERT(pRulesButton != nullptr);
(*pRulesButton).SetPalette(pOptionsPalette);
bSuccess = (*pRulesButton).SetControl(IDC_OPTIONS_RULES, this);
pNewgameButton = new CColorButton();
ASSERT(pNewgameButton != nullptr);
(*pNewgameButton).SetPalette(pOptionsPalette);
bSuccess = (*pNewgameButton).SetControl(IDC_OPTIONS_NEWGAME, this);
pOptionsButton = new CColorButton();
ASSERT(pOptionsButton != nullptr);
(*pOptionsButton).SetPalette(pOptionsPalette);
bSuccess = (*pOptionsButton).SetControl(IDC_OPTIONS_OPTIONS, this);
pAudioButton = new CColorButton();
ASSERT(pAudioButton != nullptr);
(*pAudioButton).SetPalette(pOptionsPalette);
bSuccess = (*pAudioButton).SetControl(IDC_OPTIONS_AUDIO, this);
pReturnButton = new CColorButton();
ASSERT(pReturnButton != nullptr);
(*pReturnButton).SetPalette(pOptionsPalette);
bSuccess = (*pReturnButton).SetControl(IDC_OPTIONS_RETURN, this);
pQuitButton = new CColorButton();
ASSERT(pQuitButton != nullptr);
(*pQuitButton).SetPalette(pOptionsPalette);
bSuccess = (*pQuitButton).SetControl(IDC_OPTIONS_QUIT, this);
} else if (m_iDlgId == IDD_SUBOPTIONS) {
pOkayButton = new CColorButton();
ASSERT(pOkayButton != nullptr);
(*pOkayButton).SetPalette(pOptionsPalette);
bSuccess = (*pOkayButton).SetControl(IDC_SUB_OKAY, this);
pCancelButton = new CColorButton();
ASSERT(pCancelButton != nullptr);
(*pCancelButton).SetPalette(pOptionsPalette);
bSuccess = (*pCancelButton).SetControl(IDC_SUB_CANCEL, this);
}
if (g_engine->isDemo()) {
if (m_iDlgId == IDD_OPTIONS_DIALOG) {
pButton = GetDlgItem(IDC_OPTIONS_OPTIONS); // get the window for the options button
ASSERT(pButton != nullptr); // ... and verify we have it
(*pButton).EnableWindow(false);
}
} else {
if ((*pGameInfo).bPlayingMetagame) {
if (m_iDlgId == IDD_OPTIONS_DIALOG) {
pButton = GetDlgItem(IDC_OPTIONS_OPTIONS); // get the window for the options button
ASSERT(pButton != nullptr); // ... and verify we have it
(*pButton).EnableWindow(false);
pButton = GetDlgItem(IDC_OPTIONS_NEWGAME); // get the window for the options button
ASSERT(pButton != nullptr); // ... and verify we have it
(*pButton).EnableWindow(false);
}
}
}
(void)bSuccess; // suppress unused variable warning
return true; // return true unless focused on a control
}
void COptions::OnDestroy() {
bool bUpdateNeeded;
if (m_iDlgId == IDD_OPTIONS_DIALOG) {
if (pRulesButton != nullptr)
delete pRulesButton;
if (pNewgameButton != nullptr)
delete pNewgameButton;
if (pOptionsButton != nullptr)
delete pOptionsButton;
if (pAudioButton != nullptr)
delete pAudioButton;
if (pReturnButton != nullptr)
delete pReturnButton;
if (pQuitButton != nullptr)
delete pQuitButton;
} else if (m_iDlgId == IDD_SUBOPTIONS) {
if (pOkayButton != nullptr)
delete pOkayButton;
if (pCancelButton != nullptr)
delete pCancelButton;
if (m_pTriButton != nullptr)
delete m_pTriButton;
if (m_pTriPButton != nullptr)
delete m_pTriPButton;
if (m_pCroButton != nullptr)
delete m_pCroButton;
if (m_pCroPButton != nullptr)
delete m_pCroPButton;
}
if (m_pDlgBackground != nullptr) {
delete m_pDlgBackground;
m_pDlgBackground = nullptr;
bUpdateNeeded = (*m_pDlgParentWnd).GetUpdateRect(nullptr, false);
if (bUpdateNeeded)
(*m_pDlgParentWnd).ValidateRect(nullptr);
}
CDialog::OnDestroy();
}
/*
void COptions::OnActivate(unsigned int nState, CWnd *pWndOther, bool bMinimized)
{
if (!bMinimized)
switch(nState) {
case WA_ACTIVE:
case WA_CLICKACTIVE:
InvalidateRect(nullptr,false);
break;
}
}
*/
bool COptions::OnEraseBkgnd(CDC *pDC) {
return true;
}
void COptions::OnPaint() {
bool bSuccess;
CPalette *pPalOld = nullptr;
InvalidateRect(nullptr, false);
CPaintDC dc(this); // device context for painting
RefreshBackground();
if (pOptionsPalette != nullptr) {
pPalOld = dc.SelectPalette(pOptionsPalette, false);
dc.RealizePalette();
}
bSuccess = PaintMaskedDIB(&dc, pOptionsPalette, ".\\art\\oscroll.bmp", 0, 0);
ASSERT(bSuccess);
if (pOptionsPalette != nullptr)
dc.SelectPalette(pPalOld, false);
}
void COptions::ClearDialogImage() {
if (m_pDlgBackground != nullptr) {
if (m_iDlgId == IDD_OPTIONS_DIALOG) {
if (pRulesButton != nullptr)
delete pRulesButton;
if (pNewgameButton != nullptr)
delete pNewgameButton;
if (pOptionsButton != nullptr)
delete pOptionsButton;
if (pAudioButton != nullptr)
delete pAudioButton;
if (pReturnButton != nullptr)
delete pReturnButton;
if (pQuitButton != nullptr)
delete pQuitButton;
pRulesButton = nullptr;
pNewgameButton = nullptr;
pOptionsButton = nullptr;
pReturnButton = nullptr;
pQuitButton = nullptr;
pAudioButton = nullptr;
} else if (m_iDlgId == IDD_SUBOPTIONS) {
if (pOkayButton != nullptr)
delete pOkayButton;
if (pCancelButton != nullptr)
delete pCancelButton;
if (m_pTriButton != nullptr)
delete m_pTriButton;
if (m_pTriPButton != nullptr)
delete m_pTriPButton;
if (m_pCroButton != nullptr)
delete m_pCroButton;
if (m_pCroPButton != nullptr)
delete m_pCroPButton;
pOkayButton = nullptr;
pCancelButton = nullptr;
m_pTriButton = nullptr;
m_pTriPButton = nullptr;
m_pCroButton = nullptr;
m_pCroPButton = nullptr;
}
InvalidateRect(nullptr, false);
RefreshBackground();
ValidateRect(nullptr);
}
}
void COptions::RefreshBackground() {
bool bSuccess;
CDC *pDC;
CPalette *pPalOld = nullptr;
if (m_pDlgBackground == nullptr)
return;
pDC = GetDC();
if (pOptionsPalette != nullptr) {
pPalOld = (*pDC).SelectPalette(pOptionsPalette, false);
(*pDC).RealizePalette();
}
bSuccess = PaintBitmap(pDC, pOptionsPalette, m_pDlgBackground, 0, 0);
ASSERT(bSuccess);
if (pOptionsPalette != nullptr)
(*pDC).SelectPalette(pPalOld, false);
ReleaseDC(pDC);
}
void COptions::OnShowWindow(bool bShow, unsigned int nStatus) {
CDialog::OnShowWindow(bShow, nStatus);
// TODO: Add your message handler code here
}
void COptions::OnSize(unsigned int nType, int cx, int cy) {
CDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
}
int COptions::OnCreate(LPCREATESTRUCT lpCreateStruct) {
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
return 0;
}
} // namespace Peggle
} // namespace HodjNPodj
} // namespace Bagel

View File

@@ -0,0 +1,60 @@
/* 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_PEGGLE_RESOURCE_H
#define HODJNPODJ_PEGGLE_RESOURCE_H
namespace Bagel {
namespace HodjNPodj {
namespace Peggle {
#define IDD_SUBOPTIONS 115
#define IDD_AUDIOCFG 463
#define IDC_RULES 1000
#define IDC_SCROLL 1001
#define IDC_NEWGAME 1002
#define IDC_RETURN 1003
#define IDC_QUIT 1004
#define IDC_RESTART 1005
#define HAND 105
#define RESTARTDISABLED 110
#define RESTARTFOCUS 111
#define RESTARTUP 112
#define RESTARTDOWN 113
#define IDD_SUBDIALOGX 116
#define IDC_SUBBUTTON1 2000
#define IDC_SUBBUTTON2 2001
#define IDC_SUBBUTTON3 2002
#define IDC_SUBOK 2002
#define IDC_SUBCANCEL 2003
#define IDC_RANDOM 2005
} // namespace Peggle
} // namespace HodjNPodj
} // namespace Bagel
#endif

View 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_PEGGLE_TRACERES_H
#define HODJNPODJ_PEGGLE_TRACERES_H
namespace Bagel {
namespace HodjNPodj {
namespace Peggle {
#define IDD_PROMPT 101
#define _APS_NEXT_SYMED_VALUE 101
#define _APS_NEXT_RESOURCE_VALUE 102
#define IDC_BIT0 256
#define IDC_BIT1 257
#define IDC_BIT2 258
#define IDC_BIT3 259
#define IDC_BIT4 260
#define IDC_ENABLEALL 512
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_COMMAND_VALUE 40001
} // namespace Peggle
} // namespace HodjNPodj
} // namespace Bagel
#endif