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

View File

@@ -0,0 +1,95 @@
/* 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_PACKRAT_DIALOGS_H
#define HODJNPODJ_PACKRAT_DIALOGS_H
#include "bagel/hodjnpodj/hnplibs/cbofdlg.h"
#include "bagel/hodjnpodj/packrat/packrat.h"
namespace Bagel {
namespace HodjNPodj {
namespace Packrat {
#define LEVELMAX 36
#define LIVESMAX 5
#define LEVELMIN 1
#define LIVESMIN 1
//////////////////////////////////////////////////////////////////////////////
//////// Options Specific to Pack Rat
//////////////////////////////////////////////////////////////////////////////
class CPackRatOptDlg : public CBmpDialog {
private:
int m_nLives = 0;
int m_nLevel = 0;
CRect rectDisplayLevel;
CRect rectDisplayLives;
public:
CPackRatOptDlg(CWnd* pParent = nullptr, CPalette *pPalette = nullptr, unsigned int = IDD_MINIOPTIONS_DIALOG);
void SetInitialOptions(int = 1, int = 1); // 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 = 0;
long m_lCurrentScore = 0;
int m_nLevel = 0;
public:
CMsgDlg(CWnd* pParent = nullptr, CPalette *pPalette = nullptr, unsigned int = IDD_MESSAGEBOX);
void SetInitialOptions(int, long, int = 0); // 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 Packrat
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,34 @@
/* 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_PACKRAT_GLOBALS_H
#define HODJNPODJ_PACKRAT_GLOBALS_H
// 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
#endif

View 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/packrat/resource.h"
#include "bagel/hodjnpodj/packrat/packrat.h"
namespace Bagel {
namespace HodjNPodj {
namespace Packrat {
HINSTANCE hDLLInst;
HINSTANCE hExeInst;
CMainPackRatWindow *pcwndPackRat = nullptr; // pointer to the poker's main window
CPalette *pTestPalette = nullptr;
/////////////////////////////////////////////////////////////////////////////
// Public C interface
/*****************************************************************
*
* RunPackRat
*
* 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 RunPackRat(HWND hParentWnd, LPGAMESTRUCT lpGameInfo) {
// if the pointer has garbage in it, the clean it out
if (pcwndPackRat != nullptr) {
pcwndPackRat = nullptr;
}
// create a my poker window and show it
pcwndPackRat = new CMainPackRatWindow(hParentWnd, lpGameInfo);
// pcwndPackRat->ShowWindow( SW_SHOWNORMAL );
// pcwndPackRat->UpdateWindow();
pcwndPackRat->SetActiveWindow();
// return the handle to this window
hDLLInst = (HINSTANCE)GetWindowWord(pcwndPackRat->m_hWnd, GWW_HINSTANCE);
hExeInst = (HINSTANCE)GetWindowWord(hParentWnd, GWW_HINSTANCE);
if (lpGameInfo->bPlayingMetagame == false)
MFC::PostMessage(pcwndPackRat->m_hWnd, WM_COMMAND, IDC_OPTION, BN_CLICKED);
return pcwndPackRat->m_hWnd;
}
} // namespace Packrat
} // 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_PACKRAT_DIALOGS_H
#define HODJNPODJ_PACKRAT_DIALOGS_H
#include "bagel/hodjnpodj/packrat/init.h"
namespace Bagel {
namespace HodjNPodj {
namespace Packrat {
extern HWND FAR PASCAL RunPackRat(HWND hParentWnd, LPGAMESTRUCT lpGameInfo);
} // namespace Packrat
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,292 @@
/* 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/hnplibs/text.h"
#include "bagel/hodjnpodj/packrat/resource.h"
#include "bagel/hodjnpodj/packrat/dialogs.h"
namespace Bagel {
namespace HodjNPodj {
namespace Packrat {
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_lCurrentScore = 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();
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, long lScore, int nLevel) {
m_nWhichMsg = nWhichMsg;
m_lCurrentScore = lScore;
m_nLevel = nLevel;
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(20, 40, 200, 60);
CRect rRect2(20, 70, 200, 90);
CRect rRect3(20, 100, 200, 120);
CText txtLine1(pDC, pPackRatOptPalette, &rRect1);
CText txtLine2(pDC, pPackRatOptPalette, &rRect2);
CText txtLine3(pDC, pPackRatOptPalette, &rRect3);
char cDisplay[30];
switch (m_nWhichMsg) {
case 1:
Common::sprintf_s(cDisplay, "Level %i Cleared!", m_nLevel);
txtLine1.DisplayString(pDC, cDisplay, 21, FW_BOLD);
Common::sprintf_s(cDisplay, "Current Score: %li", m_lCurrentScore);
txtLine3.DisplayString(pDC, cDisplay, 21, FW_BOLD);
break;
case 2:
Common::sprintf_s(cDisplay, "Final Score: %li", m_lCurrentScore);
txtLine1.DisplayString(pDC, "Congratulations!", 21, FW_BOLD);
txtLine2.DisplayString(pDC, "All Levels Cleared.", 21, FW_BOLD);
txtLine3.DisplayString(pDC, cDisplay, 21, FW_BOLD);
break;
case 3:
txtLine1.DisplayString(pDC, "You Died!", 21, FW_BOLD);
if (m_nLevel == 1) {
Common::sprintf_s(cDisplay, "You have %i life left.", m_nLevel);
} else {
Common::sprintf_s(cDisplay, "You have %i lives left.", m_nLevel);
}
txtLine2.DisplayString(pDC, cDisplay, 21, FW_BOLD);
Common::sprintf_s(cDisplay, "Current Score: %li", m_lCurrentScore);
txtLine3.DisplayString(pDC, cDisplay, 21, FW_BOLD);
break;
case 4:
Common::sprintf_s(cDisplay, "Final Score: %li", m_lCurrentScore);
txtLine1.DisplayString(pDC, "Game over.", 21, FW_BOLD);
txtLine3.DisplayString(pDC, cDisplay, 21, FW_BOLD);
break;
case 5:
Common::sprintf_s(cDisplay, "Level Cleared!");
txtLine1.DisplayString(pDC, cDisplay, 21, FW_BOLD);
Common::sprintf_s(cDisplay, "Final Score: %li", m_lCurrentScore);
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 Packrat
} // namespace HodjNPodj
} // namespace Bagel

View File

@@ -0,0 +1,451 @@
/* 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/packrat/resource.h"
#include "bagel/hodjnpodj/packrat/dialogs.h"
namespace Bagel {
namespace HodjNPodj {
namespace Packrat {
static CPalette *pPackRatOptPalette;
CText *ptxtLevel = nullptr;
CText *ptxtLives = nullptr;
CColorButton *pPROKButton = nullptr;
CColorButton *pPRCancelButton = nullptr;
/*****************************************************************
*
* CPackRatOptDlg
*
* 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
*
****************************************************************/
CPackRatOptDlg::CPackRatOptDlg(CWnd *pParent, CPalette *pPalette, unsigned int nID) :
CBmpDialog(pParent, pPalette, nID, ".\\ART\\SSCROLL.BMP"),
rectDisplayLevel(43, 60, 174, 73),
rectDisplayLives(43, 101, 174, 114) {
CDC *pDC = GetDC();
pPackRatOptPalette = pPalette;
ptxtLevel = new CText;
ptxtLives = new CText;
ptxtLevel->SetupText(pDC, pPackRatOptPalette, &rectDisplayLevel, JUSTIFY_CENTER);
ptxtLives->SetupText(pDC, pPackRatOptPalette, &rectDisplayLives, JUSTIFY_CENTER);
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 CPackRatOptDlg::OnCommand(WPARAM wParam, LPARAM lParam) {
//int nLevel = 1;
// 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_TOGGLEJOY:
if ( m_bUseJoy ) {
SetDlgItemText( IDC_TOGGLEJOY, "Turn Off Joystick" );
m_bUseJoy = false;
}
else {
SetDlgItemText( IDC_TOGGLEJOY, "Turn On Joystick" );
m_bUseJoy = true;
}
break;
*/
case IDC_MINI_OK:
// calculate current level from
ClearDialogImage();
EndDialog((m_nLevel * 10) + m_nLives);
return 1;
case IDC_MINI_CANCEL:
ClearDialogImage();
EndDialog(0);
return 1;
}
}
return CDialog::OnCommand(wParam, lParam);
}
void CPackRatOptDlg::OnCancel() {
ClearDialogImage();
EndDialog(0);
return;
}
void CPackRatOptDlg::OnOK() {
if (pPROKButton->GetState() & 0x0008)
SendMessage(WM_COMMAND, IDC_MINI_OK, BN_CLICKED);
else
SendMessage(WM_COMMAND, IDC_MINI_CANCEL, BN_CLICKED);
return;
}
void CPackRatOptDlg::ClearDialogImage() {
if (pPROKButton != nullptr) {
delete pPROKButton;
pPROKButton = nullptr;
}
if (pPRCancelButton != nullptr) {
delete pPRCancelButton;
pPRCancelButton = 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 CPackRatOptDlg::SetInitialOptions(int nGameLevel, int nNumOfLives) {
m_nLevel = nGameLevel;
m_nLives = nNumOfLives;
return;
}
bool CPackRatOptDlg::OnInitDialog() {
bool bSuccess;
CBmpDialog::OnInitDialog();
pPROKButton = new CColorButton();
ASSERT(pPROKButton != nullptr);
pPROKButton->SetPalette(pPackRatOptPalette);
bSuccess = pPROKButton->SetControl(IDC_MINI_OK, this);
ASSERT(bSuccess);
pPRCancelButton = new CColorButton();
ASSERT(pPRCancelButton != nullptr);
pPRCancelButton->SetPalette(pPackRatOptPalette);
bSuccess = pPRCancelButton->SetControl(IDC_MINI_CANCEL, 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 CPackRatOptDlg::OnPaint() {
CDC *pDC;
CString strLevel = "Game Level :";
CString strLives = "Number of Lives :";
int nOldBkMode;
CScrollBar *pLevel;
CScrollBar *pLives;
char cDisplay[5];
// call CBmpDialog onpaint, to paint the background
CBmpDialog::OnPaint();
pDC = GetDC();
// now paint in my text with a transparent background
nOldBkMode = pDC->SetBkMode(TRANSPARENT);
pDC->TextOut(43, 47, strLevel);
pDC->TextOut(43, 88, strLives);
pDC->SetBkMode(nOldBkMode);
Common::sprintf_s(cDisplay, "%i", m_nLevel);
ptxtLevel->DisplayString(pDC, cDisplay, 14, FW_BOLD, RGB(0, 0, 100));
Common::sprintf_s(cDisplay, "%i", m_nLives);
ptxtLives->DisplayString(pDC, cDisplay, 14, FW_BOLD, RGB(0, 0, 100));
ReleaseDC(pDC);
pLevel = (CScrollBar *)GetDlgItem(IDC_GAMELEVEL);
pLives = (CScrollBar *)GetDlgItem(IDC_NUMBEROFLIVES);
pLevel->SetScrollRange(LEVELMIN, LEVELMAX, true);
pLives->SetScrollRange(LIVESMIN, LIVESMAX, true);
pLevel->SetScrollPos(m_nLevel, true);
pLives->SetScrollPos(m_nLives, true);
}
/*****************************************************************
*
* 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 CPackRatOptDlg::OnHScroll(unsigned int nSBCode, unsigned int nPos, CScrollBar* pScrollBar) {
int oldAmnt = 0;
int newAmnt = 0;
CDC *pDC;
//int nJunk = 0;
char cDisplay[5];
//nJunk = pScrollBar->GetDlgCtrlID();
// first set the range of the scoll bar
switch (pScrollBar->GetDlgCtrlID()) {
case IDC_GAMELEVEL:
pScrollBar->SetScrollRange(LEVELMIN, LEVELMAX, true);
break;
case IDC_NUMBEROFLIVES:
pScrollBar->SetScrollRange(LIVESMIN, LIVESMAX, true);
break;
}
// 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_LEFT:
switch (pScrollBar->GetDlgCtrlID()) {
case IDC_GAMELEVEL:
newAmnt = LEVELMIN;
break;
case IDC_NUMBEROFLIVES:
newAmnt = LIVESMIN;
break;
}
break;
case SB_RIGHT:
switch (pScrollBar->GetDlgCtrlID()) {
case IDC_GAMELEVEL:
newAmnt = LEVELMAX;
break;
case IDC_NUMBEROFLIVES:
newAmnt = LIVESMAX;
break;
}
break;
case SB_LINELEFT:
case SB_PAGELEFT:
switch (pScrollBar->GetDlgCtrlID()) {
case IDC_GAMELEVEL:
if (oldAmnt != LEVELMIN)
newAmnt--;
else
newAmnt = LEVELMIN;
break;
case IDC_NUMBEROFLIVES:
if (oldAmnt != LIVESMIN)
newAmnt--;
else
newAmnt = LIVESMIN;
break;
}
break;
case SB_LINERIGHT:
case SB_PAGERIGHT:
switch (pScrollBar->GetDlgCtrlID()) {
case IDC_GAMELEVEL:
if (oldAmnt != LEVELMAX)
newAmnt++;
else
newAmnt = LEVELMAX;
break;
case IDC_NUMBEROFLIVES:
if (oldAmnt != LIVESMAX)
newAmnt++;
else
newAmnt = LIVESMAX;
break;
}
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();
switch (pScrollBar->GetDlgCtrlID()) {
case IDC_GAMELEVEL:
m_nLevel = newAmnt;
Common::sprintf_s(cDisplay, "%i", m_nLevel);
ptxtLevel->DisplayString(pDC, cDisplay, 14, FW_BOLD, RGB(0, 0, 100));
break;
case IDC_NUMBEROFLIVES:
m_nLives = newAmnt;
Common::sprintf_s(cDisplay, "%i", m_nLives);
ptxtLives->DisplayString(pDC, cDisplay, 14, FW_BOLD, RGB(0, 0, 100));
break;
}
ReleaseDC(pDC);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
void CPackRatOptDlg::OnDestroy() {
// send a message to the calling app to tell it the user has quit the game
if (pPROKButton != nullptr) {
delete pPROKButton;
pPROKButton = nullptr;
}
if (pPRCancelButton != nullptr) {
delete pPRCancelButton;
pPRCancelButton = nullptr;
}
delete ptxtLevel;
delete ptxtLives;
CBmpDialog::OnDestroy();
}
// Message Map
BEGIN_MESSAGE_MAP(CPackRatOptDlg, CBmpDialog)
//{{AFX_MSG_MAP( CMainPokerWindow )
ON_WM_PAINT()
ON_WM_HSCROLL()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
} // namespace Packrat
} // namespace HodjNPodj
} // namespace Bagel

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,169 @@
/* 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_PACKRAT_PACKRAT_H
#define HODJNPODJ_PACKRAT_PACKRAT_H
#define OINK
#include "bagel/boflib/sound.h"
#include "bagel/hodjnpodj/packrat/globals.h"
#include "bagel/hodjnpodj/packrat/resource.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/sprite.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"
namespace Bagel {
namespace HodjNPodj {
namespace Packrat {
// Button Identifier codes (BIDs)
#define IDC_OPTION 119
#define IDC_JUNK 999
// Sound File Identifiers
// Rules File Identifiers
#define RULESFILE "PACKRAT.TXT"
#define RULES_WAV ".\\SOUND\\PACKRAT.WAV"
// Sound files:
#define GAME_THEME ".\\SOUND\\PACRAT.MID"
#define DEAD_WAV ".\\SOUND\\TAPS.WAV"
#define DOODAD_WAV ".\\SOUND\\DOODAD.WAV"
#define LEVEL_WAV ".\\SOUND\\APPLAUSE.WAV"
#define LASTLEV_WAV ".\\SOUND\\WIN45.WAV"
// 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
/////////////////////////////////////////////////////////////////////////////
// CMainPackRatWindow:
// See game.cpp for the code to the member functions and the message map.
//
class CMainPackRatWindow : public CFrameWnd {
public:
int m_nBadGuySpeed = 0;
int m_nPlayerSpeed = 0;
int m_nGameLevel = 0;
int m_nLives = 0;
private:
HWND m_hCallAppWnd = nullptr;
LPGAMESTRUCT m_lpGameStruct = nullptr;
bool m_bMouseCaptured = false;
int *m_anMazeArray = 0;
int m_nPDirection = 0;
POINT m_ptCurrPLocInGrid = { 0, 0 };
POINT m_ptCurrentPPos = { 0, 0 };
int m_anBDirection[4] = { 0 };
int m_nNumberOfMoves = 0;
int m_nBDirection = 0;
POINT m_aptCurrBLocInGrid[4] = {
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }
};
POINT m_aptCurrentBPos[4] = {
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }
};
int m_nNumberOfObjectsLeft = 0;
long m_lScore = 0;
int m_nMaze = 0;
int m_nNextDir = 0;
bool m_bSuspend = false;
CRect MainRect; // screen area spanned by the game window
CRect OptionRect; // screen area spanned by the game window
CPoint ptBaloon;
CPoint ptLastMouseCoord;
CPoint ptCurrMouseCoord;
CRect rNewGame;
CRect ptScore;
public:
CMainPackRatWindow(HWND, LPGAMESTRUCT);
void initStatics();
void SplashScreen();
static void ReleaseResources();
static void FlushInputEvents();
void MainLoop();
void ResetGame();
int Power(int, int);
private:
void PickUpObject();
void PickUpSuperObject();
void SetNewPlayerPos();
bool SetNewBadGuyPos(int, bool);
void SetMaze();
void SetLevel();
bool PlayerKilled(int);
void KillPlayer(bool = false);
void KillBadGuy(int, bool = false);
void PaintObjects(int = 1);
void MoveBadGuys();
void MovePlayer();
bool CheckMessages();
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 OnRButtonUp(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 void OnDrawItem( int, LPDRAWITEMSTRUCT );
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 Packrat
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,126 @@
/* 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_PACKRAT_RESOURCE_H
#define HODJNPODJ_PACKRAT_RESOURCE_H
namespace Bagel {
namespace HodjNPodj {
namespace Packrat {
#define IDI_PACKRAT 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_HODJD 334
#define IDB_HODJL 335
#define IDB_HODJR 336
#define IDB_HODJU 337
#define IDB_LEMPTY 338
#define IDB_LIVE 339
#define IDB_OPTIONG 340
#define IDB_OPTIONU 341
#define IDB_PODJD 342
#define IDB_PODJL 343
#define IDB_PODJR 344
#define IDB_PODJU 345
#define IDB_SEMPTY 346
#define IDB_TURTLEBD 347
#define IDB_TURTLEBL 348
#define IDB_TURTLEBR 349
#define IDB_TURTLEBU 350
#define IDB_TURTLEFD 351
#define IDB_TURTLEFL 352
#define IDB_TURTLEFR 353
#define IDB_TURTLEFU 354
#define IDB_TURTLEGD 355
#define IDB_TURTLEGL 356
#define IDB_TURTLEGR 357
#define IDB_TURTLEGU 358
#define IDB_BITMAP1 359
#define IDB_BITMAP2 360
#define IDB_BITMAP3 361
#define IDB_BITMAP4 362
#define IDB_BITMAP5 363
#define IDB_BITMAP6 364
#define IDB_BITMAP9 367
#define IDB_BITMAP10 368
#define IDB_BITMAP11 369
#define IDB_BITMAP13 371
#define IDB_BITMAP14 372
#define IDB_BITMAP15 373
#define IDB_BITMAP16 374
#define IDB_BITMAP17 375
#define IDB_BITMAP18 376
#define IDB_BITMAP19 377
#define IDB_BITMAP20 378
#define IDB_BITMAP21 379
#define IDB_BITMAP22 380
#define IDB_BITMAP23 381
#define IDB_BITMAP24 382
#define IDB_BITMAP25 383
#define IDB_BITMAP7 384
#define IDB_BITMAP8 385
#define IDB_BITMAP12 386
#define IDB_BITMAP26 387
#define IDB_BITMAP27 388
#define IDB_BITMAP28 389
#define IDB_BITMAP29 390
#define IDB_BITMAP30 391
#define IDB_BITMAP31 392
#define IDB_BITMAP32 393
#define IDB_BITMAP33 394
#define IDB_BITMAP34 395
#define IDB_BITMAP35 396
#define IDB_BITMAP36 397
#define IDB_BITMAP37 398
#define IDB_BITMAP38 399
#define IDB_BITMAP39 400
#define IDB_BITMAP40 401
#define IDB_BITMAP41 402
#define IDB_BITMAP42 403
#define IDB_BITMAP43 404
#define IDB_BITMAP44 405
#define IDB_BITMAP45 406
#define IDB_BITMAP46 407
#define IDB_BITMAP47 408
#define IDD_MINIOPTIONS_DIALOG 500
#define IDC_MINI_CANCEL 501
#define IDC_MINI_OK 502
#define IDC_TURTLE_SPEED 503
#define IDC_GAMELEVEL 503
#define IDC_PLAYER_SPEED 504
#define IDC_NUMBEROFLIVES 504
#define IDC_TOGGLEJOY 1033
} // namespace Packrat
} // namespace HodjNPodj
} // namespace Bagel
#endif