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,200 @@
/* 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_DFA_DFA_H
#define HODJNPODJ_DFA_DFA_H
#include "bagel/boflib/sound.h"
#include "bagel/hodjnpodj/hnplibs/dibdoc.h"
#include "bagel/hodjnpodj/hnplibs/gamedll.h"
#include "bagel/hodjnpodj/dfa/globals.h"
#include "bagel/hodjnpodj/dfa/resource.h"
#include "bagel/hodjnpodj/hnplibs/cbofdlg.h" // header for the options library
#include "bagel/hodjnpodj/hnplibs/mainmenu.h"
#include "bagel/hodjnpodj/hnplibs/button.h"
#include "bagel/hodjnpodj/hnplibs/rules.h"
#include "bagel/hodjnpodj/hnplibs/text.h"
#include "bagel/hodjnpodj/hnplibs/bitmaps.h"
#include "bagel/hodjnpodj/hnplibs/sprite.h"
namespace Bagel {
namespace HodjNPodj {
namespace DFA {
// Button Identifier codes (BIDs)
#define IDC_OPTION 100
#define IDC_LETTERBUTTON 200 // to 480
#define IDC_JUNK 999
// Border width & height
#define SIDE_BORDER 16
#define TOP_BORDER 20
// Rules File Identifiers
#define RULESFILE "DFA.TXT"
#define RULES_WAV ".\\SOUND\\DAMFUR.WAV"
// Sound files:
#define GAME_THEME ".\\SOUND\\DAMFUR.MID"
#define HIT_1_WAV ".\\SOUND\\OW1.WAV"
#define HIT_2_WAV ".\\SOUND\\OW2.WAV"
#define HIT_3_WAV ".\\SOUND\\OW3.WAV"
#define HIT_4_WAV ".\\SOUND\\OW4.WAV"
#define HIT_5_WAV ".\\SOUND\\OW5.WAV"
#define HIT_6_WAV ".\\SOUND\\OW6.WAV"
#define HIT_7_WAV ".\\SOUND\\OW7.WAV"
#define HIT_8_WAV ".\\SOUND\\OW8.WAV"
#define HIT_9_WAV ".\\SOUND\\OW9.WAV"
#define HIT_10_WAV ".\\SOUND\\OW10.WAV"
#define HIT_11_WAV ".\\SOUND\\OW11.WAV"
#define MISS_1_WAV ".\\SOUND\\HAHA.WAV"
#define MISS_2_WAV ".\\SOUND\\MISSED.WAV"
#define MISS_3_WAV ".\\SOUND\\MISSEDME.WAV"
#define TICK_WAV ".\\SOUND\\TICK.WAV"
#define TIME_WAV ".\\SOUND\\BUZZER.WAV"
#define LAKE_WAV ".\\SOUND\\LAKE.WAV"
#define MOUNT_WAV ".\\SOUND\\YODEL.WAV"
#define BEE_WAV ".\\SOUND\\BEE.WAV"
#define WATCH_WAV ".\\SOUND\\CUCKOO.WAV"
#define NUM_HIT_SOUNDS 11 // Number of sounds available for a hit
#define NUM_MISS_SOUNDS 3 // Number of sounds available for a missed hit
#define NUM_BEAVERS 7 // Number of beavers to hit
// Audio EasterEgg area constants
#define LAKE_X 178
#define LAKE_Y 152
#define LAKE_DX 283
#define LAKE_DY 38
#define MOUNT_X 40
#define MOUNT_Y 40
#define MOUNT_DX 510
#define MOUNT_DY 80
#define FLOWERS_X 540
#define FLOWERS_Y 325
#define FLOWERS_DX 82
#define FLOWERS_DY 136
#define WATCH_X 437 // 436
#define WATCH_Y 401 // 401
#define WATCH_DX 70
#define WATCH_DY 60
// Bitmap Identifiers
#define OPTSCROLL "ART\\SSCROLL.BMP"
#define BEAVER1 "ART\\BEAVER1.BMP"
#define BEAVER2 "ART\\BEAVER2.BMP"
#define BEAVER3 "ART\\BEAVER3.BMP"
#define BEAVER4 "ART\\BEAVER4.BMP"
#define BEAVER5 "ART\\BEAVER5.BMP"
#define BEAVER6 "ART\\BEAVER6.BMP"
#define BEAVER7 "ART\\BEAVER7.BMP"
// Button positioning constants
#define OPTION_WIDTH 146
#define OPTION_HEIGHT 23
#define OPTION_LEFT 246
#define OPTION_TOP 0
#define NUMBEROFCOLS 20
#define NUMBEROFROWS 14
/////////////////////////////////////////////////////////////////////////////
// CMainPackRatWindow:
// See game.cpp for the code to the member functions and the message map.
//
class CMainDFAWindow : public CFrameWnd {
public:
unsigned int m_nTimeForGame = 0;
int m_nBeaverDuration = 0;
private:
bool m_bPlaySounds = false; // bool for am I playing a certain # of rounds
HWND m_hCallAppWnd = nullptr;
LPGAMESTRUCT m_lpGameStruct = nullptr;
bool m_bMouseCaptured = false;
long m_lScore = 0;
CRect MainRect; // screen area spanned by the game window
CRect ArtRect; // screen area inside the border trim
CRect OptionRect; // screen area spanned by the option button
CRect rNewGame; // screen area spanned by the name plate
CRect arBeaver[NUM_BEAVERS];
CString aHitFile[NUM_HIT_SOUNDS];
CString aMissFile[NUM_MISS_SOUNDS];
public:
CMainDFAWindow(HWND, LPGAMESTRUCT);
void SplashScreen();
static void ReleaseResources();
static void FlushInputEvents();
void MainLoop();
void ResetGame();
void ClearGrid();
void LoadNewGrid(int = 1);
void CreateNewGrid();
private:
void OnSoundNotify(CSound *pSound);
protected:
virtual bool OnCommand(WPARAM wParam, LPARAM lParam) override;
bool LoadBeaverSounds();
void ReleaseBeaverSounds();
//
// Sound as resource dudes:
//
char *m_pHitSound[NUM_HIT_SOUNDS] = {};
HANDLE m_hHitRes[NUM_HIT_SOUNDS] = {};
char *m_pMissSound[NUM_MISS_SOUNDS] = {};
HANDLE m_hMissRes[NUM_MISS_SOUNDS] = {};
//{{AFX_MSG( CMainPackRatWindow )
afx_msg void OnPaint();
afx_msg void OnClose();
afx_msg void OnDestroy();
afx_msg void OnTimer(uintptr);
afx_msg void OnRButtonDown(unsigned int, CPoint);
afx_msg void OnLButtonDown(unsigned int, CPoint);
afx_msg void OnLButtonUp(unsigned int, CPoint);
afx_msg void OnMouseMove(unsigned int, CPoint);
afx_msg void OnSysKeyDown(unsigned int, unsigned int, unsigned int);
afx_msg void OnKeyDown(unsigned int, unsigned int, unsigned int);
afx_msg bool OnEraseBkgnd(CDC *);
afx_msg void OnActivate(unsigned int nState, CWnd *pWndOther, bool bMinimized) override;
afx_msg LRESULT OnMCINotify(WPARAM, LPARAM);
afx_msg LRESULT OnMMIONotify(WPARAM, LPARAM);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
} // namespace DFA
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,90 @@
/* 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_DFA_DIALOGS_H
#define HODJNPODJ_DFA_DIALOGS_H
#include "bagel/hodjnpodj/hnplibs/cbofdlg.h"
#include "bagel/hodjnpodj/dfa/dfa.h"
namespace Bagel {
namespace HodjNPodj {
namespace DFA {
//////////////////////////////////////////////////////////////////////////////
//////// Options Specific to Word Search
//////////////////////////////////////////////////////////////////////////////
class CDFAOptDlg : public CBmpDialog {
private:
int m_nGameTime = 0;
int m_nBeaverTime = 0;
CRect rDisplayGTime;
CRect rDisplayBTime;
public:
CDFAOptDlg(CWnd* pParent = nullptr, CPalette *pPalette = nullptr, unsigned int = IDD_MINIOPTIONS_DIALOG);
void SetInitialOptions(int = 8, 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 bool OnEraseBkgnd(CDC *pDC);
afx_msg void OnHScroll(unsigned int nSBCode, unsigned int nPos, CScrollBar* pScrollBar);
afx_msg void OnPaint();
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//////////////////////////////////////////////////////////////////////////////
//////// Pack Rat Message Box
//////////////////////////////////////////////////////////////////////////////
class CMsgDlg : public CBmpDialog {
private:
int m_nWhichMsg;
long m_lScore;
public:
CMsgDlg(CWnd* pParent = nullptr, CPalette *pPalette = nullptr, unsigned int = IDD_MESSAGEBOX);
void SetInitialOptions(int, long); // 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 DFA
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,57 @@
/* 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_DFA_ERRORS_H
#define HODJNPODJ_DFA_ERRORS_H
namespace Bagel {
namespace HodjNPodj {
namespace DFA {
//
// error reporting codes
//
typedef unsigned char ERROR_CODE;
#define ERR_NONE 0 // no error
#define ERR_MEMORY 1 // not enough memory
#define ERR_FOPEN 2 // error opening a file
#define ERR_FCLOSE 3 // error closing a file
#define ERR_FREAD 4 // error reading a file
#define ERR_FWRITE 5 // error writing a file
#define ERR_FSEEK 6 // error seeking a file
#define ERR_FDEL 7 // error deleting a file
#define ERR_FFIND 8 // could not find file
#define ERR_FTYPE 9 // invalid file type
#define ERR_PATH 10 // invalid path or filename
#define ERR_DISK 11 // unrecoverable disk error
#define ERR_UNKNOWN 12 // unknown error
#define ERR_FUTURE1 13 // future use
#define ERR_FUTURE2 14 //
#define ERR_FUTURE3 15 //
#define ERR_FUTURE4 16 //
#define ERR_FUTURE5 17 // future use
} // namespace DFA
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,42 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef HODJNPODJ_DFA_GLOBALS_H
#define HODJNPODJ_DFA_GLOBALS_H
namespace Bagel {
namespace HodjNPodj {
namespace DFA {
// Main Window positioning constants
#define GAME_WIDTH 640
#define GAME_HEIGHT 480
#define VK_H 72
#define VK_J 74
#define VK_K 75
#define VK_L 76
} // namespace DFA
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,89 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "bagel/afxwin.h"
#include "bagel/hodjnpodj/dfa/resource.h"
#include "bagel/hodjnpodj/dfa/dfa.h"
namespace Bagel {
namespace HodjNPodj {
namespace DFA {
HINSTANCE hDLLInst;
HINSTANCE hExeInst;
CMainDFAWindow *pMainGameWnd = nullptr; // pointer to the poker's main window
CPalette *pTestPalette = nullptr;
/////////////////////////////////////////////////////////////////////////////
// Public C interface
/*****************************************************************
*
* RunDFA
*
* FUNCTIONAL DESCRIPTION:
*
* This is the API function for the DLL. It is what the calling app
* calls to invoke
*
* FORMAL PARAMETERS:
*
* hParentWnd, lpGameInfo
*
* IMPLICIT INPUT PARAMETERS:
*
* n/a
*
* IMPLICIT OUTPUT PARAMETERS:
*
* n/a
*
* RETURN VALUE:
*
* n/a
*
****************************************************************/
HWND FAR PASCAL RunDFA(HWND hParentWnd, LPGAMESTRUCT lpGameInfo) {
// if the pointer has garbage in it, the clean it out
if (pMainGameWnd != nullptr) {
pMainGameWnd = nullptr;
}
// create a my poker window and show it
pMainGameWnd = new CMainDFAWindow(hParentWnd, lpGameInfo);
pMainGameWnd->ShowWindow(SW_SHOWNORMAL);
pMainGameWnd->UpdateWindow();
pMainGameWnd->SetActiveWindow();
// return the handle to this window
hDLLInst = (HINSTANCE)GetWindowWord(pMainGameWnd->m_hWnd, GWW_HINSTANCE);
hExeInst = (HINSTANCE)GetWindowWord(hParentWnd, GWW_HINSTANCE);
if (!lpGameInfo->bPlayingMetagame)
MFC::PostMessage(pMainGameWnd->m_hWnd, WM_COMMAND, IDC_OPTION, BN_CLICKED);
return pMainGameWnd->m_hWnd;
}
} // namespace DFA
} // 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_DFA_DLLINIT_H
#define HODJNPODJ_DFA_DLLINIT_H
#include "bagel/hodjnpodj/hnplibs/gamedll.h"
namespace Bagel {
namespace HodjNPodj {
namespace DFA {
HWND FAR PASCAL RunDFA(HWND, LPGAMESTRUCT);
} // namespace DFA
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,262 @@
/* 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/dfa/resource.h"
#include "bagel/hodjnpodj/dfa/dialogs.h"
namespace Bagel {
namespace HodjNPodj {
namespace DFA {
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_lScore = 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) {
m_nWhichMsg = nWhichMsg;
m_lScore = lScore;
return;
}
bool CMsgDlg::OnInitDialog() {
bool bSuccess;
CBmpDialog::OnInitDialog();
pMsgOKButton = new CColorButton();
ASSERT(pMsgOKButton != nullptr);
pMsgOKButton->SetPalette(pPackRatOptPalette);
bSuccess = pMsgOKButton->SetControl(IDOK, this);
ASSERT(bSuccess);
return true;
}
/*****************************************************************
*
* OnPaint
*
* FUNCTIONAL DESCRIPTION:
*
* Repaint the screen whenever needed; e.g. when uncovered by an
* overlapping window, when maximized from an icon, and when it the
* window is initially created.
*
* This uses the CBmpDialog Paint as its base, and displays the current
* amount chosen from the scrollbar
*
* This routine is called whenever Windows sends a WM_PAINT message.
* Note that creating a CPaintDC automatically does a BeginPaint and
* an EndPaint call is done when it is destroyed at the end of this
* function. CPaintDC's constructor needs the window (this).
*
* FORMAL PARAMETERS:
*
* n/a
*
* IMPLICIT INPUT PARAMETERS:
*
* n/a
*
* IMPLICIT OUTPUT PARAMETERS:
*
* n/a
*
* RETURN VALUE:
*
* n/a
*
****************************************************************/
void CMsgDlg::OnPaint() {
// call CBmpDialog onpaint, to paint the background
CBmpDialog::OnPaint();
CDC *pDC = GetDC();
// CText(CDC *pDC, CPalette *pPalette, CRect *pRect, int nJustify = JUSTIFY_CENTER);
// bool DisplayString(CDC *pDC, const char* pszText, const int nSize, const int nWeight, const COLORREF crColor = CTEXT_COLOR);
CRect rRect1(16, 40, 200, 50);
CRect rRect2(16, 60, 200, 80);
CRect rRect3(16, 84, 200, 104);
CText txtLine1(pDC, pPackRatOptPalette, &rRect1);
CText txtLine2(pDC, pPackRatOptPalette, &rRect2);
CText txtLine3(pDC, pPackRatOptPalette, &rRect3);
char cDisplay[30];
switch (m_nWhichMsg) {
case 1:
Common::sprintf_s(cDisplay, "Score: %li", m_lScore);
// txtLine1.DisplayString( pDC, "", 21, FW_BOLD );
txtLine2.DisplayString(pDC, "Game over.", 21, FW_BOLD);
txtLine3.DisplayString(pDC, cDisplay, 21, FW_BOLD);
break;
}
ReleaseDC(pDC);
return;
}
void CMsgDlg::OnDestroy() {
// send a message to the calling app to tell it the user has quit the game
if (pMsgOKButton != nullptr) {
delete pMsgOKButton;
pMsgOKButton = nullptr;
}
CBmpDialog::OnDestroy();
}
// Message Map
BEGIN_MESSAGE_MAP(CMsgDlg, CBmpDialog)
//{{AFX_MSG_MAP( CMainPokerWindow )
ON_WM_PAINT()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
} // namespace DFA
} // namespace HodjNPodj
} // namespace Bagel

View File

@@ -0,0 +1,487 @@
/* 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/dfa/resource.h"
#include "bagel/hodjnpodj/dfa/dialogs.h"
namespace Bagel {
namespace HodjNPodj {
namespace DFA {
constexpr int GAMETIMEMAX = 5;
constexpr int GAMETIMEMIN = 1;
constexpr int GAMESTEP = 1;
constexpr int BEAVERTIMEMAX = 4;
constexpr int BEAVERTIMEMIN = 1;
constexpr int BEAVERSTEP = 1;
static CPalette *pPackRatOptPalette;
CText *ptxtGTime;
CText *ptxtBTime;
CColorButton *pDFAOKButton = nullptr;
CColorButton *pDFACancelButton = nullptr;
/*****************************************************************
*
* CDFAOptDlg
*
* 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
*
****************************************************************/
CDFAOptDlg::CDFAOptDlg(CWnd *pParent, CPalette *pPalette, unsigned int nID)
: CBmpDialog(pParent, pPalette, nID, ".\\ART\\SSCROLL.BMP"),
rDisplayGTime(43, 85, 174, 98),
rDisplayBTime(43, 35, 174, 48) {
CDC *pDC = GetDC();
pPackRatOptPalette = pPalette;
ptxtGTime = new CText(pDC, pPackRatOptPalette, &rDisplayGTime, JUSTIFY_CENTER);
ptxtBTime = new CText(pDC, pPackRatOptPalette, &rDisplayBTime, 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 CDFAOptDlg::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 IDC_MINI_OK:
// calculate current level from
ClearDialogImage();
EndDialog(m_nGameTime + (m_nBeaverTime * 1000));
return 1;
case IDC_MINI_CANCEL:
ClearDialogImage();
EndDialog(-1);
return 1;
}
}
return CDialog::OnCommand(wParam, lParam);
}
void CDFAOptDlg::OnCancel() {
ClearDialogImage();
EndDialog(-1);
return;
}
void CDFAOptDlg::OnOK() {
if (pDFAOKButton->GetState() & 0x0008)
SendMessage(WM_COMMAND, IDC_MINI_OK, BN_CLICKED);
else
SendMessage(WM_COMMAND, IDC_MINI_CANCEL, BN_CLICKED);
return;
}
void CDFAOptDlg::ClearDialogImage() {
if (pDFAOKButton != nullptr) {
delete pDFAOKButton;
pDFAOKButton = nullptr;
}
if (pDFACancelButton != nullptr) {
delete pDFACancelButton;
pDFACancelButton = 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 CDFAOptDlg::SetInitialOptions(int nGTime, int nBTime) {
m_nGameTime = nGTime / 15; // get a value of 0 to 4
m_nBeaverTime = nBTime;
return;
}
bool CDFAOptDlg::OnInitDialog() {
bool bSuccess;
CBmpDialog::OnInitDialog();
pDFAOKButton = new CColorButton();
ASSERT(pDFAOKButton != nullptr);
pDFAOKButton->SetPalette(pPackRatOptPalette);
bSuccess = pDFAOKButton->SetControl(IDC_MINI_OK, this);
ASSERT(bSuccess);
pDFACancelButton = new CColorButton();
ASSERT(pDFACancelButton != nullptr);
pDFACancelButton->SetPalette(pPackRatOptPalette);
bSuccess = pDFACancelButton->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 CDFAOptDlg::OnPaint() {
CDC *pDC;
CString strBTime = "Beaver Time (Secs) :";
CString strGTime = "Game Time (Secs) :";
int nOldBkMode;
CScrollBar *pBTime = nullptr;
CScrollBar *pGTime = nullptr;
char cGDisplay[12];
char cBDisplay[12];
// 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, 24, strBTime);
pDC->TextOut(43, 69, strGTime);
pDC->SetBkMode(nOldBkMode);
switch (m_nGameTime) {
case 1:
Common::sprintf_s(cGDisplay, "15");
break;
case 2:
Common::sprintf_s(cGDisplay, "30");
break;
case 3:
Common::sprintf_s(cGDisplay, "45");
break;
case 4:
Common::sprintf_s(cGDisplay, "60");
break;
default:
Common::sprintf_s(cGDisplay, "Unlimited");
break;
}
ptxtGTime->DisplayString(pDC, cGDisplay, 14, FW_BOLD, RGB(0, 0, 0));
pGTime = (CScrollBar *)GetDlgItem(IDC_GAMETIME);
pGTime->SetScrollRange(GAMETIMEMIN, GAMETIMEMAX, true);
if (m_nGameTime == 0)
pGTime->SetScrollPos(GAMETIMEMAX, true);
else
pGTime->SetScrollPos(m_nGameTime, true);
switch (m_nBeaverTime) {
case 1:
Common::sprintf_s(cBDisplay, ".5");
break;
case 2:
Common::sprintf_s(cBDisplay, "1");
break;
case 3:
Common::sprintf_s(cBDisplay, "1.5");
break;
default:
Common::sprintf_s(cBDisplay, "2");
break;
}
ptxtBTime->DisplayString(pDC, cBDisplay, 14, FW_BOLD, RGB(0, 0, 0));
pBTime = (CScrollBar *)GetDlgItem(IDC_BEAVERDUR);
pBTime->SetScrollRange(BEAVERTIMEMIN, BEAVERTIMEMAX, true);
pBTime->SetScrollPos(m_nBeaverTime, true);
pGTime = nullptr;
pBTime = nullptr;
ReleaseDC(pDC);
}
/*****************************************************************
*
* 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 CDFAOptDlg::OnHScroll(unsigned int nSBCode, unsigned int nPos, CScrollBar* pScrollBar) {
int oldAmnt = 0;
int newAmnt = 0;
CDC *pDC;
char cGDisplay[12];
char cBDisplay[12];
// first set the range of the scoll bar
if (pScrollBar->GetDlgCtrlID() == IDC_GAMETIME)
pScrollBar->SetScrollRange(GAMETIMEMIN, GAMETIMEMAX, true);
if (pScrollBar->GetDlgCtrlID() == IDC_BEAVERDUR)
pScrollBar->SetScrollRange(BEAVERTIMEMIN, BEAVERTIMEMAX, true);
// get the scroll bar's current position, i.e. the current amount set
oldAmnt = pScrollBar->GetScrollPos();
newAmnt = oldAmnt;
// switching off of what the scroll bar wants to do, act accordingly.
switch (nSBCode) {
case SB_LINELEFT:
case SB_PAGELEFT:
case SB_LEFT:
newAmnt --;
if (pScrollBar->GetDlgCtrlID() == IDC_BEAVERDUR) {
if (newAmnt < BEAVERTIMEMIN)
newAmnt = BEAVERTIMEMIN;
} else {
newAmnt = MAX<int>(newAmnt, GAMETIMEMIN);
}
break;
case SB_LINERIGHT:
case SB_PAGERIGHT:
case SB_RIGHT:
newAmnt ++;
if (pScrollBar->GetDlgCtrlID() == IDC_BEAVERDUR) {
if (newAmnt > BEAVERTIMEMAX)
newAmnt = BEAVERTIMEMAX;
} else {
if (newAmnt > GAMETIMEMAX)
newAmnt = GAMETIMEMAX;
}
break;
case SB_THUMBPOSITION:
case SB_THUMBTRACK:
newAmnt = nPos;
break;
}
// set the scroll bar to the new position
if (pScrollBar->GetDlgCtrlID() == IDC_GAMETIME)
m_nGameTime = newAmnt;
if (pScrollBar->GetDlgCtrlID() == IDC_BEAVERDUR)
m_nBeaverTime = newAmnt;
pScrollBar->SetScrollPos(newAmnt, true);
// set the current amount to the new amount just set
// and paint this new amount onto the screen
pDC = GetDC();
if (pScrollBar->GetDlgCtrlID() == IDC_GAMETIME) {
switch (m_nGameTime) {
case 1:
Common::sprintf_s(cGDisplay, "15");
break;
case 2:
Common::sprintf_s(cGDisplay, "30");
break;
case 3:
Common::sprintf_s(cGDisplay, "45");
break;
case 4:
Common::sprintf_s(cGDisplay, "60");
break;
default:
Common::sprintf_s(cGDisplay, "Unlimited");
break;
}
ptxtGTime->DisplayString(pDC, cGDisplay, 14, FW_BOLD, RGB(0, 0, 0));
}
if (pScrollBar->GetDlgCtrlID() == IDC_BEAVERDUR) {
switch (m_nBeaverTime) {
case 1:
Common::sprintf_s(cBDisplay, ".5");
break;
case 2:
Common::sprintf_s(cBDisplay, "1");
break;
case 3:
Common::sprintf_s(cBDisplay, "1.5");
break;
default:
Common::sprintf_s(cBDisplay, "2");
break;
}
ptxtBTime->DisplayString(pDC, cBDisplay, 14, FW_BOLD, RGB(0, 0, 0));
}
ReleaseDC(pDC);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
bool CDFAOptDlg::OnEraseBkgnd(CDC *pDC) {
return true;
}
void CDFAOptDlg::OnDestroy() {
// send a message to the calling app to tell it the user has quit the game
if (pDFAOKButton != nullptr) {
delete pDFAOKButton;
pDFAOKButton = nullptr;
}
if (pDFACancelButton != nullptr) {
delete pDFACancelButton;
pDFACancelButton = nullptr;
}
delete ptxtBTime;
delete ptxtGTime;
CBmpDialog::OnDestroy();
}
// Message Map
BEGIN_MESSAGE_MAP(CDFAOptDlg, CBmpDialog)
//{{AFX_MSG_MAP( CMainPokerWindow )
ON_WM_PAINT()
ON_WM_HSCROLL()
ON_WM_DESTROY()
ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
} // namespace DFA
} // namespace HodjNPodj
} // namespace Bagel

View File

@@ -0,0 +1,48 @@
/* 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_DFA_RESOURCE_H
#define HODJNPODJ_DFA_RESOURCE_H
namespace Bagel {
namespace HodjNPodj {
namespace DFA {
#define IDI_DFA 2
#define IDC_OPTIONS 202
#define IDC_RULES 230
#define IDC_CANCEL 250
#define IDC_QUIT 251
#define IDB_PODJRIGHT 330
#define IDD_MESSAGEBOX 333
#define IDD_MINIOPTIONS_DIALOG 500
#define IDC_MINI_CANCEL 501
#define IDC_MINI_OK 502
#define IDC_GAMETIME 504
#define IDC_BEAVERDUR 505
} // namespace DFA
} // namespace HodjNPodj
} // namespace Bagel
#endif