Initial commit
This commit is contained in:
2890
engines/bagel/hodjnpodj/fuge/fuge.cpp
Normal file
2890
engines/bagel/hodjnpodj/fuge/fuge.cpp
Normal file
File diff suppressed because it is too large
Load Diff
153
engines/bagel/hodjnpodj/fuge/fuge.h
Normal file
153
engines/bagel/hodjnpodj/fuge/fuge.h
Normal file
@@ -0,0 +1,153 @@
|
||||
/* 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_FUGE_FUGE_H
|
||||
#define HODJNPODJ_FUGE_FUGE_H
|
||||
|
||||
#include "bagel/afxwin.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/stdinc.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/sprite.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/text.h"
|
||||
#include "bagel/boflib/error.h"
|
||||
#include "bagel/hodjnpodj/libs/vector.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/button.h"
|
||||
#include "bagel/boflib/sound.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Fuge {
|
||||
|
||||
#define N_ROWS 6
|
||||
#define BRICKS_PER_ROW 16
|
||||
#define N_BRICKS (N_ROWS*BRICKS_PER_ROW)
|
||||
|
||||
class CFugeWindow : public CFrameWnd {
|
||||
public:
|
||||
CFugeWindow();
|
||||
void PlayGame();
|
||||
void PaintScreen();
|
||||
void LoadIniSettings();
|
||||
|
||||
protected:
|
||||
void initMembers();
|
||||
void initStatics();
|
||||
void GameReset();
|
||||
void GamePause();
|
||||
void GameResume();
|
||||
void HandleError(ERROR_CODE);
|
||||
void RealignVectors();
|
||||
ERROR_CODE LoadMasterSprites();
|
||||
void ReleaseMasterSprites();
|
||||
ERROR_CODE LoadMasterSounds();
|
||||
void ReleaseMasterSounds();
|
||||
ERROR_CODE LoadNewPaddle(int);
|
||||
void InitializeJoystick();
|
||||
void RepaintSpriteList(CDC *);
|
||||
void PaintBricks(CDC *);
|
||||
void StartBall();
|
||||
void EndBall();
|
||||
void PaintBall();
|
||||
void LaunchBall();
|
||||
void StartPaddle();
|
||||
void EndPaddle();
|
||||
void PaintPaddle(bool);
|
||||
CVector BallOnPaddle();
|
||||
void StartBricks();
|
||||
void EndBricks();
|
||||
void EraseBrick(CDC *, int);
|
||||
void LoseBall();
|
||||
void BallvsPaddle();
|
||||
void BallvsBrick(double);
|
||||
|
||||
virtual bool OnCommand(WPARAM wParam, LPARAM lParam) override;
|
||||
long OnJoyStick(unsigned int, long);
|
||||
void OnPaint();
|
||||
void OnTimer(uintptr);
|
||||
void OnMouseMove(unsigned int, CPoint);
|
||||
void OnRButtonUp(unsigned int, CPoint);
|
||||
void OnLButtonDown(unsigned int, CPoint);
|
||||
void OnSysChar(unsigned int, unsigned int, unsigned int);
|
||||
void OnSysKeyDown(unsigned int, unsigned int, unsigned int);
|
||||
void OnKeyDown(unsigned int, unsigned int, unsigned int);
|
||||
void OnActivate(unsigned int, CWnd *, bool) override;
|
||||
LRESULT OnMCINotify(WPARAM, LPARAM);
|
||||
LRESULT OnMMIONotify(WPARAM, LPARAM);
|
||||
void OnSoundNotify(CSound *);
|
||||
void OnClose();
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
bool m_bBrickVisible[N_BRICKS] = {};
|
||||
CPoint m_ptOrigin;
|
||||
CRect m_rNewGameButton;
|
||||
CRect m_rBlackHole;
|
||||
CVector m_vBallVector;
|
||||
CVector m_ptBallLocation;
|
||||
CPalette *m_pGamePalette = nullptr;
|
||||
CBmpButton *m_pScrollButton = nullptr;
|
||||
CSprite *m_pBall = nullptr;
|
||||
CSprite *m_pPaddle = nullptr;
|
||||
CSound *m_pSoundTrack = nullptr;
|
||||
|
||||
char * m_pBrickSound = nullptr;
|
||||
char * m_pWallSound = nullptr;
|
||||
char * m_pPaddleSound = nullptr;
|
||||
char * m_pExtraLifeSound = nullptr;
|
||||
HANDLE m_hBrickRes = nullptr;
|
||||
HANDLE m_hWallRes = nullptr;
|
||||
HANDLE m_hPaddleRes = nullptr;
|
||||
HANDLE m_hExtraLifeRes = nullptr;
|
||||
|
||||
int m_nInitNumBalls = 0;
|
||||
int m_nInitStartLevel = 0;
|
||||
int m_nInitBallSpeed = 0;
|
||||
int m_nInitPaddleSize = 0;
|
||||
int m_nGForceFactor = 0;
|
||||
|
||||
double m_fTurboBoost = 0;
|
||||
long m_lScore = 0;
|
||||
long m_lExtraLifeScore = 0;
|
||||
long m_nJoyOrgX = 0;
|
||||
long m_nJoyOrgY = 0;
|
||||
int m_nBricks = 0;
|
||||
int m_nBalls = 0;
|
||||
int m_nBallSpeed = 0;
|
||||
int m_nNumRows = 0;
|
||||
int m_nPaddleCelIndex = 0;
|
||||
int m_nOldSize = -1;
|
||||
|
||||
bool m_bMovingPaddle = false;
|
||||
bool m_bGameActive = false;
|
||||
bool m_bPause = false;
|
||||
bool m_bIgnoreScrollClick = false;
|
||||
bool m_bPaddleHit = false;
|
||||
bool m_bOutterWall = false;
|
||||
bool m_bJoyActive = false;
|
||||
bool m_bBallOnPaddle = false;
|
||||
|
||||
CVector gvCenter;
|
||||
};
|
||||
|
||||
} // namespace Fuge
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
100
engines/bagel/hodjnpodj/fuge/init.cpp
Normal file
100
engines/bagel/hodjnpodj/fuge/init.cpp
Normal file
@@ -0,0 +1,100 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "bagel/afxwin.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/gamedll.h"
|
||||
#include "bagel/hodjnpodj/fuge/fuge.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Fuge {
|
||||
|
||||
HWND FAR PASCAL RunFuge(HWND, LPGAMESTRUCT);
|
||||
|
||||
HINSTANCE hDLLInst;
|
||||
HINSTANCE hExeInst;
|
||||
extern LPGAMESTRUCT pGameParams;
|
||||
|
||||
// global the pointer to the your game's main window
|
||||
HWND ghParentWnd;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Public C interface
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* RunFuge
|
||||
*
|
||||
* FUNCTIONAL DESCRIPTION:
|
||||
*
|
||||
* This is the API function for the DLL. It is what the calling app
|
||||
* calls to invoke poker
|
||||
*
|
||||
* FORMAL PARAMETERS:
|
||||
*
|
||||
* hParentWnd, lpGameInfo
|
||||
*
|
||||
* IMPLICIT INPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* IMPLICIT OUTPUT PARAMETERS:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
* RETURN VALUE:
|
||||
*
|
||||
* n/a
|
||||
*
|
||||
****************************************************************/
|
||||
//extern "C"
|
||||
HWND FAR PASCAL RunFuge(HWND hParentWnd, LPGAMESTRUCT lpGameInfo) {
|
||||
CFugeWindow *pMain;
|
||||
|
||||
pGameParams = lpGameInfo;
|
||||
|
||||
// invoke your game here by creating a pGame for your main window
|
||||
// look at the InitInstance for your game for this
|
||||
|
||||
ghParentWnd = hParentWnd;
|
||||
|
||||
if ((pMain = new CFugeWindow) != nullptr) {
|
||||
|
||||
pMain->ShowWindow(SW_SHOWNORMAL);
|
||||
|
||||
pMain->UpdateWindow();
|
||||
|
||||
pMain->SetActiveWindow();
|
||||
|
||||
// these are used by Rules
|
||||
hDLLInst = (HINSTANCE)GetWindowWord(pMain->m_hWnd, GWW_HINSTANCE);
|
||||
hExeInst = (HINSTANCE)GetWindowWord(hParentWnd, GWW_HINSTANCE);
|
||||
|
||||
if (pGameParams->bPlayingMetagame)
|
||||
pMain->PlayGame();
|
||||
}
|
||||
|
||||
return pMain->m_hWnd; // return the m_hWnd of your main game window
|
||||
}
|
||||
|
||||
} // namespace Fuge
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
37
engines/bagel/hodjnpodj/fuge/init.h
Normal file
37
engines/bagel/hodjnpodj/fuge/init.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HODJNPODJ_FUGE_RESOURCE_H
|
||||
#define HODJNPODJ_FUGE_RESOURCE_H
|
||||
|
||||
#include "bagel/afxwin.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Fuge {
|
||||
|
||||
extern HWND FAR PASCAL RunFuge(HWND, LPGAMESTRUCT);
|
||||
|
||||
} // namespace Fuge
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
59
engines/bagel/hodjnpodj/fuge/resource.h
Normal file
59
engines/bagel/hodjnpodj/fuge/resource.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* 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_FUGE_RESOURCE_H
|
||||
#define HODJNPODJ_FUGE_RESOURCE_H
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Fuge {
|
||||
|
||||
#define IDI_POKER 2
|
||||
#define IDB_MAP 248
|
||||
#define IDI_ICON1 249
|
||||
#define IDI_CESDEMO 249
|
||||
#define IDD_MAIN_SCROLL 250
|
||||
#define IDD_META_SETUP 251
|
||||
#define IDC_PLAY_META 1022
|
||||
#define IDC_RESTORE_GAME 1023
|
||||
#define IDC_PLAY 1023
|
||||
#define IDC_PLAY_MINI 1024
|
||||
#define IDC_CANCEL_PLAY 1024
|
||||
#define IDC_GRAND_TOUR 1025
|
||||
#define IDC_HODJ_SKILL_HARD 1025
|
||||
#define IDC_RESTART_MOVIE 1026
|
||||
#define IDC_HODJ_SKILL_MEDIUM 1026
|
||||
#define IDC_HODJ_SKILL_EASY 1027
|
||||
#define IDC_QUIT_GAME 1028
|
||||
#define IDC_PODJ_SKILL_EASY 1028
|
||||
#define IDC_PODJ_SKILL_MEDIUM 1029
|
||||
#define IDC_PODJ_SKILL_HARD 1030
|
||||
#define IDC_GAMETIME_LONG 1031
|
||||
#define IDC_GAMETIME_MEDIUM 1032
|
||||
#define IDC_GAMETIME_SHORT 1033
|
||||
#define IDC_PODJ_COMPUTER 1034
|
||||
#define IDC_PODJ_HUMAN 1035
|
||||
|
||||
} // namespace Fuge
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
523
engines/bagel/hodjnpodj/fuge/usercfg.cpp
Normal file
523
engines/bagel/hodjnpodj/fuge/usercfg.cpp
Normal file
@@ -0,0 +1,523 @@
|
||||
/* 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/globals.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/text.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/cbofdlg.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/menures.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/button.h"
|
||||
#include "bagel/hodjnpodj/fuge/usercfg.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Fuge {
|
||||
|
||||
#define ID_RESET 104
|
||||
|
||||
#define ID_SCROLL1 105
|
||||
#define ID_SCROLL2 106
|
||||
#define ID_SCROLL3 107
|
||||
#define ID_SCROLL4 108
|
||||
|
||||
#define ID_WALLS 109
|
||||
|
||||
#define PAGE_SIZE 2
|
||||
|
||||
extern const char *INI_SECTION;
|
||||
|
||||
static CColorButton *pOKButton = nullptr; // OKAY button on scroll
|
||||
static CColorButton *pCancelButton = nullptr; // Cancel button on scroll
|
||||
static CColorButton *pDefaultsButton = nullptr; // Defaults button on scroll
|
||||
|
||||
|
||||
CUserCfgDlg::CUserCfgDlg(CWnd *pParent, CPalette *pPalette, unsigned int nID)
|
||||
: CBmpDialog(pParent, pPalette, nID, ".\\ART\\SSCROLL.BMP") {
|
||||
// Inits
|
||||
//
|
||||
m_pScrollBar1 = nullptr;
|
||||
m_pScrollBar2 = nullptr;
|
||||
m_pScrollBar3 = nullptr;
|
||||
m_pScrollBar4 = nullptr;
|
||||
m_pTxtNumBalls = nullptr;
|
||||
m_pTxtStartLevel = nullptr;
|
||||
m_pTxtBallSpeed = nullptr;
|
||||
m_pTxtPaddleSize = nullptr;
|
||||
|
||||
DoModal();
|
||||
}
|
||||
|
||||
void CUserCfgDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CBmpDialog::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
|
||||
void CUserCfgDlg::PutDlgData() {
|
||||
m_pScrollBar1->SetScrollPos(m_nNumBalls);
|
||||
m_pScrollBar2->SetScrollPos(m_nStartLevel);
|
||||
m_pScrollBar3->SetScrollPos(m_nBallSpeed);
|
||||
m_pScrollBar4->SetScrollPos(m_nPaddleSize);
|
||||
|
||||
m_pWallButton->SetCheck(m_bOutterWall);
|
||||
}
|
||||
|
||||
|
||||
void CUserCfgDlg::GetDlgData() {
|
||||
m_nNumBalls = m_pScrollBar1->GetScrollPos();
|
||||
m_nStartLevel = m_pScrollBar2->GetScrollPos();
|
||||
m_nBallSpeed = m_pScrollBar3->GetScrollPos();
|
||||
m_nPaddleSize = m_pScrollBar4->GetScrollPos();
|
||||
|
||||
m_bOutterWall = false;
|
||||
if (m_pWallButton->GetCheck() == 1) {
|
||||
m_bOutterWall = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CUserCfgDlg::OnCommand(WPARAM wParam, LPARAM lParam) {
|
||||
/*
|
||||
* respond to user
|
||||
*/
|
||||
if (HIWORD(lParam) == BN_CLICKED) {
|
||||
|
||||
switch (wParam) {
|
||||
|
||||
case IDOK:
|
||||
m_bSave = true;
|
||||
PostMessage(WM_CLOSE, 0, 0);
|
||||
return false;
|
||||
|
||||
case IDCANCEL:
|
||||
PostMessage(WM_CLOSE, 0, 0);
|
||||
return false;
|
||||
|
||||
/*
|
||||
* reset params to default
|
||||
*/
|
||||
case ID_RESET:
|
||||
|
||||
m_nNumBalls = BALLS_DEF;
|
||||
m_nStartLevel = LEVEL_DEF;
|
||||
m_nBallSpeed = SPEED_DEF;
|
||||
m_nPaddleSize = PSIZE_DEF;
|
||||
m_bOutterWall = false;
|
||||
|
||||
PutDlgData();
|
||||
|
||||
UpdateOptions();
|
||||
break;
|
||||
|
||||
case ID_WALLS:
|
||||
m_bOutterWall = !m_bOutterWall;
|
||||
PutDlgData();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CBmpDialog::OnCommand(wParam, lParam);
|
||||
}
|
||||
|
||||
void CUserCfgDlg::OnHScroll(unsigned int nSBCode, unsigned int nPos, CScrollBar *pScroll) {
|
||||
char buf[40];
|
||||
int nMin, nMax, nVal;
|
||||
CDC *pDC;
|
||||
|
||||
// can't access a null pointer
|
||||
assert(pScroll != nullptr);
|
||||
|
||||
if (pScroll == m_pScrollBar1) {
|
||||
|
||||
nMin = BALLS_MIN;
|
||||
nMax = BALLS_MAX;
|
||||
nVal = m_nNumBalls;
|
||||
|
||||
} else if (pScroll == m_pScrollBar2) {
|
||||
|
||||
nMin = LEVEL_MIN;
|
||||
nMax = LEVEL_MAX;
|
||||
nVal = m_nStartLevel;
|
||||
|
||||
} else if (pScroll == m_pScrollBar3) {
|
||||
|
||||
nMin = SPEED_MIN;
|
||||
nMax = SPEED_MAX;
|
||||
nVal = m_nBallSpeed;
|
||||
|
||||
} else {
|
||||
assert(pScroll == m_pScrollBar4);
|
||||
|
||||
nMin = PSIZE_MIN;
|
||||
nMax = PSIZE_MAX;
|
||||
nVal = m_nPaddleSize;
|
||||
}
|
||||
|
||||
switch (nSBCode) {
|
||||
|
||||
case SB_LEFT:
|
||||
nVal = nMin;
|
||||
break;
|
||||
|
||||
case SB_PAGELEFT:
|
||||
nVal -= PAGE_SIZE;
|
||||
break;
|
||||
|
||||
case SB_LINELEFT:
|
||||
if (nVal > nMin)
|
||||
nVal--;
|
||||
break;
|
||||
|
||||
case SB_RIGHT:
|
||||
nVal = nMax;
|
||||
break;
|
||||
|
||||
case SB_PAGERIGHT:
|
||||
nVal += PAGE_SIZE;
|
||||
break;
|
||||
|
||||
case SB_LINERIGHT:
|
||||
if (nVal < nMax)
|
||||
nVal++;
|
||||
break;
|
||||
|
||||
case SB_THUMBPOSITION:
|
||||
case SB_THUMBTRACK:
|
||||
nVal = nPos;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (nVal < nMin)
|
||||
nVal = nMin;
|
||||
if (nVal > nMax)
|
||||
nVal = nMax;
|
||||
|
||||
pScroll->SetScrollPos(nVal);
|
||||
|
||||
if ((pDC = GetDC()) != nullptr) {
|
||||
|
||||
if (pScroll == m_pScrollBar1) {
|
||||
|
||||
m_nNumBalls = nVal;
|
||||
if (m_pTxtNumBalls != nullptr) {
|
||||
Common::sprintf_s(buf, "Number of Balls: %d", m_nNumBalls);
|
||||
m_pTxtNumBalls->DisplayString(pDC, buf, 14, TEXT_BOLD, RGB(0, 0, 0));
|
||||
}
|
||||
|
||||
} else if (pScroll == m_pScrollBar2) {
|
||||
|
||||
m_nStartLevel = nVal;
|
||||
if (m_pTxtStartLevel != nullptr) {
|
||||
Common::sprintf_s(buf, "Starting Level: %d", m_nStartLevel);
|
||||
m_pTxtStartLevel->DisplayString(pDC, buf, 14, TEXT_BOLD, RGB(0, 0, 0));
|
||||
}
|
||||
|
||||
} else if (pScroll == m_pScrollBar3) {
|
||||
|
||||
m_nBallSpeed = nVal;
|
||||
if (m_pTxtBallSpeed != nullptr) {
|
||||
Common::sprintf_s(buf, "Ball Speed: %d", m_nBallSpeed);
|
||||
m_pTxtBallSpeed->DisplayString(pDC, buf, 14, TEXT_BOLD, RGB(0, 0, 0));
|
||||
}
|
||||
|
||||
} else if (pScroll == m_pScrollBar4) {
|
||||
|
||||
m_nPaddleSize = nVal;
|
||||
if (m_pTxtPaddleSize != nullptr) {
|
||||
Common::sprintf_s(buf, "Paddle Size: %d", m_nPaddleSize);
|
||||
m_pTxtPaddleSize->DisplayString(pDC, buf, 14, TEXT_BOLD, RGB(0, 0, 0));
|
||||
}
|
||||
|
||||
} else {
|
||||
assert(0);
|
||||
}
|
||||
ReleaseDC(pDC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CUserCfgDlg::OnInitDialog() {
|
||||
CRect tmpRect;
|
||||
CDC *pDC;
|
||||
|
||||
CBmpDialog::OnInitDialog();
|
||||
|
||||
if ((pDC = GetDC()) != nullptr) {
|
||||
|
||||
tmpRect.SetRect(22, 22, 135, 35);
|
||||
if ((m_pTxtNumBalls = new CText) != nullptr) {
|
||||
m_pTxtNumBalls->SetupText(pDC, m_pPalette, &tmpRect, JUSTIFY_LEFT);
|
||||
}
|
||||
|
||||
tmpRect.SetRect(22, 35, 92, 53);
|
||||
if ((m_pScrollBar1 = new CScrollBar) != nullptr) {
|
||||
m_pScrollBar1->Create(WS_VISIBLE | WS_CHILD | SBS_HORZ | SBS_BOTTOMALIGN, tmpRect, this, ID_SCROLL1);
|
||||
m_pScrollBar1->SetScrollRange(BALLS_MIN, BALLS_MAX, true);
|
||||
}
|
||||
|
||||
tmpRect.SetRect(22, 57, 135, 70);
|
||||
if ((m_pTxtStartLevel = new CText) != nullptr) {
|
||||
m_pTxtStartLevel->SetupText(pDC, m_pPalette, &tmpRect, JUSTIFY_LEFT);
|
||||
}
|
||||
|
||||
tmpRect.SetRect(22, 70, 92, 88);
|
||||
if ((m_pScrollBar2 = new CScrollBar) != nullptr) {
|
||||
m_pScrollBar2->Create(WS_VISIBLE | WS_CHILD | SBS_HORZ | SBS_BOTTOMALIGN, tmpRect, this, ID_SCROLL2);
|
||||
m_pScrollBar2->SetScrollRange(LEVEL_MIN, LEVEL_MAX, true);
|
||||
}
|
||||
|
||||
tmpRect.SetRect(22, 92, 135, 105);
|
||||
if ((m_pTxtBallSpeed = new CText) != nullptr) {
|
||||
m_pTxtBallSpeed->SetupText(pDC, m_pPalette, &tmpRect, JUSTIFY_LEFT);
|
||||
}
|
||||
|
||||
tmpRect.SetRect(22, 105, 92, 123);
|
||||
if ((m_pScrollBar3 = new CScrollBar) != nullptr) {
|
||||
m_pScrollBar3->Create(WS_VISIBLE | WS_CHILD | SBS_HORZ | SBS_BOTTOMALIGN, tmpRect, this, ID_SCROLL3);
|
||||
m_pScrollBar3->SetScrollRange(SPEED_MIN, SPEED_MAX, true);
|
||||
}
|
||||
|
||||
tmpRect.SetRect(22, 127, 110, 140);
|
||||
if ((m_pTxtPaddleSize = new CText) != nullptr) {
|
||||
m_pTxtPaddleSize->SetupText(pDC, m_pPalette, &tmpRect, JUSTIFY_LEFT);
|
||||
}
|
||||
|
||||
tmpRect.SetRect(22, 140, 92, 158);
|
||||
if ((m_pScrollBar4 = new CScrollBar) != nullptr) {
|
||||
m_pScrollBar4->Create(WS_VISIBLE | WS_CHILD | SBS_HORZ | SBS_BOTTOMALIGN, tmpRect, this, ID_SCROLL4);
|
||||
m_pScrollBar4->SetScrollRange(PSIZE_MIN, PSIZE_MAX, true);
|
||||
}
|
||||
|
||||
ReleaseDC(pDC);
|
||||
}
|
||||
|
||||
if ((pOKButton = new CColorButton) != nullptr) { // build a color QUIT button to let us exit
|
||||
pOKButton->SetPalette(m_pPalette); // set the palette to use
|
||||
pOKButton->SetControl(IDOK, this); // tie to the dialog control
|
||||
}
|
||||
|
||||
if ((pCancelButton = new CColorButton) != nullptr) { // build a color QUIT button to let us exit
|
||||
pCancelButton->SetPalette(m_pPalette); // set the palette to use
|
||||
pCancelButton->SetControl(IDCANCEL, this); // tie to the dialog control
|
||||
}
|
||||
|
||||
if ((pDefaultsButton = new CColorButton) != nullptr) { // build a color QUIT button to let us exit
|
||||
pDefaultsButton->SetPalette(m_pPalette); // set the palette to use
|
||||
pDefaultsButton->SetControl(ID_RESET, this); // tie to the dialog control
|
||||
}
|
||||
|
||||
if ((m_pWallButton = new CCheckButton) != nullptr) {
|
||||
m_pWallButton->SetPalette(m_pPalette);
|
||||
m_pWallButton->SetControl(ID_WALLS, this);
|
||||
}
|
||||
|
||||
m_bSave = false;
|
||||
|
||||
LoadIniSettings();
|
||||
|
||||
PutDlgData();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CUserCfgDlg::OnPaint() {
|
||||
CBmpDialog::OnPaint();
|
||||
|
||||
UpdateOptions();
|
||||
}
|
||||
|
||||
void CUserCfgDlg::UpdateOptions() {
|
||||
char buf[40];
|
||||
CDC *pDC;
|
||||
|
||||
if ((pDC = GetDC()) != nullptr) {
|
||||
|
||||
if (m_pTxtNumBalls != nullptr) {
|
||||
Common::sprintf_s(buf, "Number of Balls: %d", m_nNumBalls);
|
||||
m_pTxtNumBalls->DisplayString(pDC, buf, 14, TEXT_BOLD, RGB(0, 0, 0));
|
||||
}
|
||||
|
||||
if (m_pTxtStartLevel != nullptr) {
|
||||
Common::sprintf_s(buf, "Starting Level: %d", m_nStartLevel);
|
||||
m_pTxtStartLevel->DisplayString(pDC, buf, 14, TEXT_BOLD, RGB(0, 0, 0));
|
||||
}
|
||||
|
||||
if (m_pTxtBallSpeed != nullptr) {
|
||||
Common::sprintf_s(buf, "Ball Speed: %d", m_nBallSpeed);
|
||||
m_pTxtBallSpeed->DisplayString(pDC, buf, 14, TEXT_BOLD, RGB(0, 0, 0));
|
||||
}
|
||||
|
||||
if (m_pTxtPaddleSize != nullptr) {
|
||||
Common::sprintf_s(buf, "Paddle Size: %d", m_nPaddleSize);
|
||||
m_pTxtPaddleSize->DisplayString(pDC, buf, 14, TEXT_BOLD, RGB(0, 0, 0));
|
||||
}
|
||||
|
||||
ReleaseDC(pDC);
|
||||
}
|
||||
}
|
||||
|
||||
bool CUserCfgDlg::OnEraseBkgnd(CDC *) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CUserCfgDlg::OnClose() {
|
||||
if (m_bSave) {
|
||||
|
||||
SaveIniSettings();
|
||||
}
|
||||
|
||||
if (pOKButton != nullptr) { // release the button
|
||||
delete pOKButton;
|
||||
pOKButton = nullptr;
|
||||
}
|
||||
|
||||
if (pCancelButton != nullptr) { // release the button
|
||||
delete pCancelButton;
|
||||
pCancelButton = nullptr;
|
||||
}
|
||||
|
||||
if (pDefaultsButton != nullptr) { // release the button
|
||||
delete pDefaultsButton;
|
||||
pDefaultsButton = nullptr;
|
||||
}
|
||||
|
||||
assert(m_pTxtPaddleSize != nullptr);
|
||||
if (m_pTxtPaddleSize != nullptr) {
|
||||
delete m_pTxtPaddleSize;
|
||||
m_pTxtPaddleSize = nullptr;
|
||||
}
|
||||
|
||||
assert(m_pTxtBallSpeed != nullptr);
|
||||
if (m_pTxtBallSpeed != nullptr) {
|
||||
delete m_pTxtBallSpeed;
|
||||
m_pTxtBallSpeed = nullptr;
|
||||
}
|
||||
|
||||
assert(m_pTxtStartLevel != nullptr);
|
||||
if (m_pTxtStartLevel != nullptr) {
|
||||
delete m_pTxtStartLevel;
|
||||
m_pTxtStartLevel = nullptr;
|
||||
}
|
||||
|
||||
assert(m_pTxtNumBalls != nullptr);
|
||||
if (m_pTxtNumBalls != nullptr) {
|
||||
delete m_pTxtNumBalls;
|
||||
m_pTxtNumBalls = nullptr;
|
||||
}
|
||||
|
||||
//
|
||||
// de-allocate the scroll bars
|
||||
//
|
||||
assert(m_pScrollBar4 != nullptr);
|
||||
if (m_pScrollBar4 != nullptr) {
|
||||
delete m_pScrollBar4;
|
||||
m_pScrollBar4 = nullptr;
|
||||
}
|
||||
assert(m_pScrollBar3 != nullptr);
|
||||
if (m_pScrollBar3 != nullptr) {
|
||||
delete m_pScrollBar3;
|
||||
m_pScrollBar3 = nullptr;
|
||||
}
|
||||
assert(m_pScrollBar2 != nullptr);
|
||||
if (m_pScrollBar2 != nullptr) {
|
||||
delete m_pScrollBar2;
|
||||
m_pScrollBar2 = nullptr;
|
||||
}
|
||||
assert(m_pScrollBar1 != nullptr);
|
||||
if (m_pScrollBar1 != nullptr) {
|
||||
delete m_pScrollBar1;
|
||||
m_pScrollBar1 = nullptr;
|
||||
}
|
||||
|
||||
if (m_pWallButton != nullptr) {
|
||||
delete m_pWallButton;
|
||||
m_pWallButton = nullptr;
|
||||
}
|
||||
|
||||
ClearDialogImage();
|
||||
EndDialog(0);
|
||||
}
|
||||
|
||||
void CUserCfgDlg::ClearDialogImage() {
|
||||
if (pOKButton != nullptr) { // release the button
|
||||
delete pOKButton;
|
||||
pOKButton = nullptr;
|
||||
}
|
||||
|
||||
if (pCancelButton != nullptr) { // release the button
|
||||
delete pCancelButton;
|
||||
pCancelButton = nullptr;
|
||||
}
|
||||
|
||||
if (pDefaultsButton != nullptr) { // release the button
|
||||
delete pDefaultsButton;
|
||||
pDefaultsButton = nullptr;
|
||||
}
|
||||
|
||||
ValidateRect(nullptr);
|
||||
}
|
||||
|
||||
|
||||
void CUserCfgDlg::LoadIniSettings() {
|
||||
m_nNumBalls = GetPrivateProfileInt(INI_SECTION, "NumberOfBalls", BALLS_DEF, INI_FILENAME);
|
||||
if ((m_nNumBalls < BALLS_MIN) || (m_nNumBalls > BALLS_MAX))
|
||||
m_nNumBalls = BALLS_DEF;
|
||||
|
||||
m_nStartLevel = GetPrivateProfileInt(INI_SECTION, "StartingLevel", LEVEL_DEF, INI_FILENAME);
|
||||
if ((m_nStartLevel < LEVEL_MIN) || (m_nStartLevel > LEVEL_MAX))
|
||||
m_nStartLevel = LEVEL_DEF;
|
||||
|
||||
m_nBallSpeed = GetPrivateProfileInt(INI_SECTION, "BallSpeed", SPEED_DEF, INI_FILENAME);
|
||||
if ((m_nBallSpeed < SPEED_MIN) || (m_nBallSpeed > SPEED_MAX))
|
||||
m_nBallSpeed = SPEED_DEF;
|
||||
|
||||
m_nPaddleSize = GetPrivateProfileInt(INI_SECTION, "PaddleSize", PSIZE_DEF, INI_FILENAME);
|
||||
if ((m_nPaddleSize < PSIZE_MIN) || (m_nPaddleSize > PSIZE_MAX))
|
||||
m_nPaddleSize = PSIZE_DEF;
|
||||
|
||||
int outerWall = GetPrivateProfileInt(INI_SECTION, "OutterWall", 0, INI_FILENAME);
|
||||
m_bOutterWall = outerWall != 0;
|
||||
}
|
||||
|
||||
void CUserCfgDlg::SaveIniSettings() {
|
||||
WritePrivateProfileString(INI_SECTION, "NumberOfBalls", Common::String::format("%d", m_nNumBalls).c_str(), INI_FILENAME);
|
||||
WritePrivateProfileString(INI_SECTION, "StartingLevel", Common::String::format("%d", m_nStartLevel).c_str(), INI_FILENAME);
|
||||
WritePrivateProfileString(INI_SECTION, "BallSpeed", Common::String::format("%d", m_nBallSpeed).c_str(), INI_FILENAME);
|
||||
WritePrivateProfileString(INI_SECTION, "PaddleSize", Common::String::format("%d", m_nPaddleSize).c_str(), INI_FILENAME);
|
||||
WritePrivateProfileString(INI_SECTION, "OutterWall", Common::String::format("%d", m_bOutterWall ? 1 : 0).c_str(), INI_FILENAME);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CUserCfgDlg, CBmpDialog)
|
||||
ON_WM_CLOSE()
|
||||
ON_WM_ERASEBKGND()
|
||||
ON_WM_HSCROLL()
|
||||
ON_WM_PAINT()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
} // namespace Fuge
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
101
engines/bagel/hodjnpodj/fuge/usercfg.h
Normal file
101
engines/bagel/hodjnpodj/fuge/usercfg.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/* 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_FUGE_USERCFG_H
|
||||
#define HODJNPODJ_FUGE_USERCFG_H
|
||||
|
||||
#include "bagel/afxwin.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/cbofdlg.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/stdinc.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Fuge {
|
||||
|
||||
#define IDD_USERCFG 100
|
||||
|
||||
#define BALLS_MIN 1
|
||||
#define BALLS_DEF 5
|
||||
#define BALLS_MAX 5
|
||||
|
||||
#define LEVEL_MIN 1
|
||||
#define LEVEL_DEF 6
|
||||
#define LEVEL_MAX 6
|
||||
|
||||
#define SPEED_MIN 1
|
||||
#define SPEED_DEF 6
|
||||
#define SPEED_MAX 10
|
||||
|
||||
#define PSIZE_MIN 0
|
||||
#define PSIZE_DEF 2
|
||||
#define PSIZE_MAX 2
|
||||
|
||||
#define GFORCE_MIN 0
|
||||
#define GFORCE_DEF 0
|
||||
#define GFORCE_MAX 20
|
||||
|
||||
class CUserCfgDlg : public CBmpDialog {
|
||||
public:
|
||||
CUserCfgDlg(CWnd *pParent, CPalette *pPalette, unsigned int);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void DoDataExchange(CDataExchange *) override;
|
||||
virtual bool OnCommand(WPARAM, LPARAM) override;
|
||||
virtual bool OnInitDialog() override;
|
||||
void PutDlgData();
|
||||
void GetDlgData();
|
||||
void LoadIniSettings();
|
||||
void SaveIniSettings();
|
||||
void UpdateOptions();
|
||||
void ClearDialogImage();
|
||||
|
||||
afx_msg bool OnEraseBkgnd(CDC *);
|
||||
void OnHScroll(unsigned int, unsigned int, CScrollBar *);
|
||||
void OnClose();
|
||||
void OnDestroy();
|
||||
void OnPaint();
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
CText *m_pTxtNumBalls = nullptr;
|
||||
CText *m_pTxtStartLevel = nullptr;
|
||||
CText *m_pTxtBallSpeed = nullptr;
|
||||
CText *m_pTxtPaddleSize = nullptr;
|
||||
CScrollBar *m_pScrollBar1 = nullptr;
|
||||
CScrollBar *m_pScrollBar2 = nullptr;
|
||||
CScrollBar *m_pScrollBar3 = nullptr;
|
||||
CScrollBar *m_pScrollBar4 = nullptr;
|
||||
CCheckButton *m_pWallButton = nullptr;
|
||||
|
||||
int m_nNumBalls = 0;
|
||||
int m_nStartLevel = 0;
|
||||
int m_nBallSpeed = 0;
|
||||
int m_nPaddleSize = 0;
|
||||
bool m_bOutterWall = false;
|
||||
|
||||
bool m_bSave = false; // True if should save theses values
|
||||
};
|
||||
|
||||
} // namespace Fuge
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user