Initial commit
This commit is contained in:
1263
engines/bagel/hodjnpodj/garfunkle/garfunkle.cpp
Normal file
1263
engines/bagel/hodjnpodj/garfunkle/garfunkle.cpp
Normal file
File diff suppressed because it is too large
Load Diff
241
engines/bagel/hodjnpodj/garfunkle/garfunkle.h
Normal file
241
engines/bagel/hodjnpodj/garfunkle/garfunkle.h
Normal file
@@ -0,0 +1,241 @@
|
||||
/* 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_GARFUNKLE_GARFUNKLE_H
|
||||
#define HODJNPODJ_GARFUNKLE_GARFUNKLE_H
|
||||
|
||||
#include "bagel/boflib/sound.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Garkfunkle {
|
||||
|
||||
#define PLAY_FACTOR 150 // Multiply MilliSeconds by SpeedFactor for tenths of Seconds
|
||||
#define ANIM_SLEEP 200 // Milliseconds
|
||||
|
||||
// Button Identifier codes (BIDs)
|
||||
#define IDC_A 100
|
||||
#define IDC_B 101
|
||||
#define IDC_C 102
|
||||
#define IDC_D 103
|
||||
#define IDC_E 104
|
||||
#define IDC_F 105
|
||||
#define IDC_START 106
|
||||
|
||||
// Win condition values
|
||||
#define LOW_WIN 8 // Minimum number of notes in completed
|
||||
#define MEDIUM_WIN 10 //...sequence required to receive info
|
||||
#define HIGH_WIN 12 //...when playing from the metagame
|
||||
|
||||
// Backdrop bitmaps
|
||||
#define MAINSCREEN ".\\ART\\GARFEMPT.BMP"
|
||||
#define RIBBON ".\\ART\\RIBBON.BMP"
|
||||
|
||||
#define RIBBON_X 139
|
||||
#define RIBBON_Y 332
|
||||
|
||||
#define SIGN_COLOR RGB( 0, 0, 0 ) // Color of the sign text
|
||||
#define SIGN_LOCATION_X 117
|
||||
#define SIGN_LOCATION_Y 310
|
||||
#define SIGN_WIDTH 33
|
||||
#define SIGN_HEIGHT 30
|
||||
|
||||
#define VIOLIN_LOCATION_X 199
|
||||
#define VIOLIN_LOCATION_Y 210
|
||||
#define VIOLIN_WIDTH 57
|
||||
#define VIOLIN_HEIGHT 96
|
||||
|
||||
#define CELLO_LOCATION_X 257
|
||||
#define CELLO_LOCATION_Y 206
|
||||
#define CELLO_WIDTH 63
|
||||
#define CELLO_HEIGHT 101
|
||||
|
||||
#define DRUM_LOCATION_X 321
|
||||
#define DRUM_LOCATION_Y 208
|
||||
#define DRUM_WIDTH 57
|
||||
#define DRUM_HEIGHT 92
|
||||
|
||||
#define SAX_LOCATION_X 380
|
||||
#define SAX_LOCATION_Y 208
|
||||
#define SAX_WIDTH 55
|
||||
#define SAX_HEIGHT 99
|
||||
|
||||
#define HARP_LOCATION_X 141
|
||||
#define HARP_LOCATION_Y 194
|
||||
#define HARP_WIDTH 56
|
||||
#define HARP_HEIGHT 107
|
||||
|
||||
#define CLARINET_LOCATION_X 444
|
||||
#define CLARINET_LOCATION_Y 180
|
||||
#define CLARINET_WIDTH 46
|
||||
#define CLARINET_HEIGHT 127
|
||||
|
||||
#define NEWGAME_LOCATION_X 15
|
||||
#define NEWGAME_LOCATION_Y 0
|
||||
#define NEWGAME_WIDTH 217
|
||||
#define NEWGAME_HEIGHT 20
|
||||
|
||||
#define SIGN_LOCATION_X 117
|
||||
#define SIGN_LOCATION_Y 310
|
||||
#define SIGN_WIDTH 33
|
||||
#define SIGN_HEIGHT 30
|
||||
|
||||
#define WOODRIGHT_LOCATION_X 460
|
||||
#define WOODRIGHT_LOCATION_Y 25
|
||||
#define WOODRIGHT_WIDTH 164
|
||||
#define WOODRIGHT_HEIGHT 137
|
||||
|
||||
#define WOODLEFT_LOCATION_X 17
|
||||
#define WOODLEFT_LOCATION_Y 25
|
||||
#define WOODLEFT_WIDTH 137
|
||||
#define WOODLEFT_HEIGHT 148
|
||||
|
||||
#define BENCH_LOCATION_X 17
|
||||
#define BENCH_LOCATION_Y 404
|
||||
#define BENCH_WIDTH 610
|
||||
#define BENCH_HEIGHT 62
|
||||
|
||||
// Simon Button constants
|
||||
#define MIN_BUTTONS 3
|
||||
#define MAX_BUTTONS 6
|
||||
#define MAX_SEQUENCE 25
|
||||
|
||||
// Playback speed constants
|
||||
#define MIN_SPEED 0
|
||||
#define MAX_SPEED 11
|
||||
#define NUM_SPEEDS 12
|
||||
#define SLOW_DOWN 1 // take off this amount from time between notes on playback
|
||||
|
||||
#define PLAYER_TIMER 3 // can't wait forever for a note!
|
||||
#define ANIM_TIMER 4 // time to change frames
|
||||
#define TIME_LIMIT 10000 // 10 seconds for player response
|
||||
#define PAUSE_TIME 50 // in milliseconds, so = 1/2 sec
|
||||
#define INCREMENT_RATE 5 // rate by which speed is increased
|
||||
|
||||
#define RULES_TEXT "GARFUNK.TXT" // rules file
|
||||
|
||||
#define WIN_SOUND ".\\SOUND\\FANFARE1.WAV"
|
||||
#define WRONG_SOUND ".\\SOUND\\SOSORRY.WAV"
|
||||
#define SLOW_SOUND ".\\SOUND\\ALARM.WAV"
|
||||
#define SIGN_1_SOUND ".\\SOUND\\SIGN1.WAV"
|
||||
#define SIGN_2_SOUND ".\\SOUND\\SIGN2.WAV"
|
||||
#define SIGN_3_SOUND ".\\SOUND\\SIGN3.WAV"
|
||||
#define SIGN_4_SOUND ".\\SOUND\\SIGN4.WAV"
|
||||
#define SIGN_5_SOUND ".\\SOUND\\SIGN5.WAV"
|
||||
#define BENCH_SOUND ".\\SOUND\\MYSEAT.WAV"
|
||||
#define TREES_SOUND ".\\SOUND\\TIMBER.WAV"
|
||||
#define RULES_SOUND ".\\SOUND\\GARFUNK.WAV"
|
||||
|
||||
#define NUM_SIGN_SOUNDS 5
|
||||
|
||||
#define VIOLIN_SOUND ".\\SOUND\\viol2.mid"
|
||||
#define CELLO_SOUND ".\\SOUND\\cello2.mid"
|
||||
#define DRUM_SOUND ".\\SOUND\\DRUM2.MID" //drum.mid" //DRUM.WAV"
|
||||
#define SAX_SOUND ".\\SOUND\\sax2.mid"
|
||||
#define HARP_SOUND ".\\SOUND\\harp2.mid"
|
||||
#define CLARINET_SOUND ".\\SOUND\\clar2.mid"
|
||||
|
||||
#define VIOLIN_ANIM ".\\ART\\violin2.bmp"
|
||||
#define CELLO_ANIM ".\\ART\\cello2.bmp"
|
||||
#define DRUM_ANIM ".\\ART\\drums2.bmp"
|
||||
#define SAX_ANIM ".\\ART\\sax2.bmp"
|
||||
#define HARP_ANIM ".\\ART\\harp2.bmp"
|
||||
#define CLARINET_ANIM ".\\ART\\clari2.bmp"
|
||||
|
||||
#define VIOLIN_CELS 14
|
||||
#define CELLO_CELS 16
|
||||
#define DRUM_CELS 20
|
||||
#define SAX_CELS 14
|
||||
#define HARP_CELS 17
|
||||
#define CLARINET_CELS 18
|
||||
|
||||
#define VIOLIN_OFFSET_X 2
|
||||
#define CELLO_OFFSET_X 4
|
||||
#define DRUM_OFFSET_X 0
|
||||
#define SAX_OFFSET_X 2
|
||||
#define HARP_OFFSET_X 2
|
||||
#define CLARINET_OFFSET_X 5
|
||||
|
||||
#define VIOLIN_OFFSET_Y 16
|
||||
#define CELLO_OFFSET_Y 5
|
||||
#define DRUM_OFFSET_Y 3
|
||||
#define SAX_OFFSET_Y 4
|
||||
#define HARP_OFFSET_Y 0
|
||||
#define CLARINET_OFFSET_Y 4
|
||||
|
||||
//bool wait_awhile(int);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// CMainWindow:
|
||||
// See game.cpp for the code to the member functions and the message map.
|
||||
//
|
||||
class CMainWindow : public CFrameWnd {
|
||||
public:
|
||||
CMainWindow();
|
||||
bool GetNewSequence(const char* pszFileName);
|
||||
bool GetNewSequence(int nLength);
|
||||
void ActivateButtons(unsigned int nNumActive, bool bState);
|
||||
void PlayBackSeries(int nNumNotes);
|
||||
void NewGame();
|
||||
void StartAnimation();
|
||||
void StopAnimation();
|
||||
bool wait_awhile(int nHundSecs);
|
||||
|
||||
//added data members:
|
||||
void SplashScreen();
|
||||
|
||||
private:
|
||||
void initStatics();
|
||||
void OnSoundNotify(CSound *pSound);
|
||||
|
||||
CRect rectMusic[MAX_BUTTONS]; // Musician locations
|
||||
|
||||
protected:
|
||||
virtual bool OnCommand(WPARAM wParam, LPARAM lParam) override;
|
||||
void OnDestroy();
|
||||
|
||||
//{{AFX_MSG( CMainWindow )
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
|
||||
afx_msg void OnSysChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
|
||||
afx_msg void OnKeyDown(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
|
||||
afx_msg void OnSysKeyDown(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
|
||||
// afx_msg void OnKeyUp(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
|
||||
afx_msg void OnTimer(uintptr nIDEvent);
|
||||
afx_msg void OnLButtonDown(unsigned int nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(unsigned int nFlags, CPoint point);
|
||||
afx_msg void OnRButtonDown(unsigned int nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(unsigned int nFlags, CPoint point);
|
||||
afx_msg void OnActivate(unsigned int, CWnd*, bool) override;
|
||||
afx_msg void OnClose();
|
||||
afx_msg LRESULT OnMCINotify(WPARAM, LPARAM);
|
||||
afx_msg LRESULT OnMMIONotify(WPARAM, LPARAM);
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
} // namespace Garfunkle
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
96
engines/bagel/hodjnpodj/garfunkle/init.cpp
Normal file
96
engines/bagel/hodjnpodj/garfunkle/init.cpp
Normal file
@@ -0,0 +1,96 @@
|
||||
/* 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/garfunkle/garfunkle.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Garkfunkle {
|
||||
|
||||
HINSTANCE hDLLInst;
|
||||
HINSTANCE hExeInst;
|
||||
|
||||
LPGAMESTRUCT pGameInfo;
|
||||
|
||||
// global the pointer to the your game's main window
|
||||
HWND ghParentWnd;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Public C interface
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* RunGarf
|
||||
*
|
||||
* 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 RunGarf(HWND hParentWnd, LPGAMESTRUCT lpGameInfo) {
|
||||
CMainWindow *pMain;
|
||||
|
||||
pGameInfo = lpGameInfo;
|
||||
|
||||
// invoke your game here by creating a pGame for your main window
|
||||
// look at the InitInstance for your game for this
|
||||
|
||||
ghParentWnd = hParentWnd;
|
||||
|
||||
if ((pMain = new CMainWindow) != nullptr) {
|
||||
|
||||
// pMain->ShowWindow(SW_SHOWNORMAL);
|
||||
|
||||
// pMain->UpdateWindow();
|
||||
|
||||
pMain->SetActiveWindow();
|
||||
}
|
||||
|
||||
// these must be set in this function
|
||||
hDLLInst = (HINSTANCE)GetWindowWord(pMain->m_hWnd, GWW_HINSTANCE);
|
||||
hExeInst = (HINSTANCE)GetWindowWord(hParentWnd, GWW_HINSTANCE);
|
||||
|
||||
return pMain->m_hWnd; // return the m_hWnd of your main game window
|
||||
}
|
||||
|
||||
} // namespace Garfunkle
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
35
engines/bagel/hodjnpodj/garfunkle/init.h
Normal file
35
engines/bagel/hodjnpodj/garfunkle/init.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/* 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_GARFUNKLE_GAMEDLL_H
|
||||
#define HODJNPODJ_GARFUNKLE_GAMEDLL_H
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Garkfunkle {
|
||||
|
||||
extern HWND FAR PASCAL RunGarf(HWND hParentWnd, LPGAMESTRUCT lpGameInfo);
|
||||
|
||||
} // namespace Garfunkle
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
161
engines/bagel/hodjnpodj/garfunkle/note.cpp
Normal file
161
engines/bagel/hodjnpodj/garfunkle/note.cpp
Normal file
@@ -0,0 +1,161 @@
|
||||
/* 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/garfunkle/note.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Garkfunkle {
|
||||
|
||||
CNote *CNote::m_pNoteHead = nullptr; // pointer to list of linked notes
|
||||
CNote *CNote::m_pNoteTail = nullptr; // pointer to tail of list of linked notes
|
||||
|
||||
IMPLEMENT_DYNCREATE(CNote, CObject)
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* CNote()
|
||||
*
|
||||
* Parameters: none
|
||||
*
|
||||
* Return Value: none
|
||||
*
|
||||
* Description: Constructor for note class.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
CNote::CNote() {
|
||||
m_nValue = 1;
|
||||
m_pNext = nullptr; // it is not yet in the sprite chain and
|
||||
m_pPrev = nullptr; // ... thus has no links to other sprites
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* ~CNote()
|
||||
*
|
||||
* Parameters: none
|
||||
*
|
||||
* Return Value: none
|
||||
*
|
||||
* Description: Destructor for note class.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
CNote::~CNote() {
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* SetValue()
|
||||
*
|
||||
* Parameters:
|
||||
* int nValue value which identifies the button associated with the note
|
||||
*
|
||||
* Return Value: none
|
||||
*
|
||||
* Description: Identify the button to be played at this point in the sequence
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
void CNote::SetValue(int nValue) {
|
||||
m_nValue = nValue; // identify the button to be played
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* LinkNote()
|
||||
*
|
||||
* Parameters: none
|
||||
*
|
||||
* Return Value: none
|
||||
*
|
||||
* Description: Link this note into the list by placing it at the
|
||||
* the tail of the list
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
void CNote::LinkNote() {
|
||||
m_pNext = nullptr; // link note onto tail of list
|
||||
m_pPrev = m_pNoteTail; //... by pointing it back at the current
|
||||
//... tail, making it the tail, and
|
||||
if (m_pNoteTail) //... pointing it at nullptr (the list terminator)
|
||||
(*m_pNoteTail).m_pNext = this;
|
||||
else
|
||||
m_pNoteHead = this;
|
||||
m_pNoteTail = this;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* UnLinkNote()
|
||||
*
|
||||
* Parameters: none
|
||||
*
|
||||
* Return Value: none
|
||||
*
|
||||
* Description: Remove this sprite from the sprite chain and point its
|
||||
* neighbors at each other to fill the gap
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
void CNote::UnLinkNote() {
|
||||
if (m_pPrev) // disconnect us from the note chain
|
||||
(*m_pPrev).m_pNext = m_pNext; // ... by pointing the one before us, and
|
||||
else // ... the one after us, at each other
|
||||
m_pNoteHead = m_pNext; // special case the instances where the
|
||||
// ... note to be removed is the first
|
||||
if (m_pNext) // ... or the last in the list, update
|
||||
(*m_pNext).m_pPrev = m_pPrev; // ... the head of chain pointer
|
||||
else
|
||||
m_pNoteTail = m_pPrev;
|
||||
|
||||
m_pNext = m_pPrev = nullptr;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* FlushNoteList()
|
||||
*
|
||||
* Parameters: none
|
||||
*
|
||||
* Return Value: none
|
||||
*
|
||||
* Description: Remove all notes from the chain and delete them via
|
||||
* the standard destructor
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
void CNote::FlushNoteList() {
|
||||
CNote *pNote;
|
||||
|
||||
while ((pNote = CNote::GetNoteHead())) {
|
||||
(*pNote).UnLinkNote();
|
||||
delete pNote;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Garfunkle
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
75
engines/bagel/hodjnpodj/garfunkle/note.h
Normal file
75
engines/bagel/hodjnpodj/garfunkle/note.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* 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_GARFUNKLE_NOTE_H
|
||||
#define HODJNPODJ_GARFUNKLE_NOTE_H
|
||||
|
||||
#include "bagel/hodjnpodj/hnplibs/dibapi.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Garkfunkle {
|
||||
|
||||
class CNote : public CObject {
|
||||
DECLARE_DYNCREATE(CNote)
|
||||
|
||||
// Constructors
|
||||
public:
|
||||
CNote(); // use "new" operator to create notes, then SetValue
|
||||
|
||||
// Destructors
|
||||
public:
|
||||
~CNote();
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
void SetValue(int nValue);
|
||||
int GetValue() const {
|
||||
return m_nValue;
|
||||
}
|
||||
void LinkNote();
|
||||
void UnLinkNote();
|
||||
CNote *GetNextNote() const {
|
||||
return m_pNext;
|
||||
}
|
||||
CNote *GetPrevNote() const {
|
||||
return m_pPrev;
|
||||
}
|
||||
|
||||
static CNote *GetNoteHead() {
|
||||
return m_pNoteHead;
|
||||
}
|
||||
static void FlushNoteList();
|
||||
|
||||
private:
|
||||
int m_nValue = 0;
|
||||
CNote *m_pNext = nullptr; // pointer to next note in chain
|
||||
CNote *m_pPrev = nullptr; // pointer to previous note in chain
|
||||
|
||||
static CNote *m_pNoteHead; // pointer to linked chain of notes
|
||||
static CNote *m_pNoteTail; // pointer to tail of list of notes
|
||||
};
|
||||
|
||||
} // namespace Garfunkle
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
355
engines/bagel/hodjnpodj/garfunkle/optndlg.cpp
Normal file
355
engines/bagel/hodjnpodj/garfunkle/optndlg.cpp
Normal file
@@ -0,0 +1,355 @@
|
||||
/* 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/globals.h"
|
||||
#include "bagel/hodjnpodj/garfunkle/resource.h"
|
||||
#include "bagel/hodjnpodj/garfunkle/garfunkle.h"
|
||||
#include "bagel/hodjnpodj/garfunkle/optndlg.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Garkfunkle {
|
||||
|
||||
static CPalette *pSubOptionsPalette;
|
||||
static CColorButton *pOKButton = nullptr; // OKAY button on scroll
|
||||
static CColorButton *pCancelButton = nullptr; // Cancel button on scroll
|
||||
static CRadioButton *pGameButton = nullptr;
|
||||
static CRadioButton *pMusicButton = nullptr;
|
||||
|
||||
CText *m_pButtonsText = nullptr;
|
||||
CText *m_pSpeedText = nullptr;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// COptnDlg dialog
|
||||
|
||||
|
||||
COptnDlg::COptnDlg(CWnd* pParent, CPalette* pPalette)
|
||||
: CBmpDialog(pParent, pPalette, IDD_SUBOPTIONS, ".\\ART\\SSCROLL.BMP") {
|
||||
//{{AFX_DATA_INIT(COptnDlg)
|
||||
m_nSpeed = MIN_SPEED;
|
||||
m_nNumButtons = MAX_BUTTONS;
|
||||
m_bPlayGame = true;
|
||||
pSubOptionsPalette = pPalette;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
COptnDlg::~COptnDlg() {
|
||||
if (m_pButtonsText != nullptr)
|
||||
delete m_pButtonsText;
|
||||
if (m_pSpeedText != nullptr)
|
||||
delete m_pSpeedText;
|
||||
|
||||
CBmpDialog::OnDestroy();
|
||||
}
|
||||
|
||||
void COptnDlg::DoDataExchange(CDataExchange* pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(COptnDlg)
|
||||
DDX_Control(pDX, IDC_NUMBUTTONS, m_ScrollButtons);
|
||||
DDX_Control(pDX, IDC_SPEED, m_ScrollSpeed);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(COptnDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(COptnDlg)
|
||||
ON_WM_HSCROLL()
|
||||
ON_WM_CREATE()
|
||||
ON_WM_ERASEBKGND()
|
||||
ON_WM_PAINT()
|
||||
ON_WM_DESTROY()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// COptnDlg message handlers
|
||||
|
||||
int COptnDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) {
|
||||
if (CBmpDialog::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool COptnDlg::OnInitDialog() {
|
||||
CBmpDialog::OnInitDialog();
|
||||
|
||||
CDC *pDC;
|
||||
CRect statRect;
|
||||
|
||||
pDC = GetDC();
|
||||
|
||||
mSpeedTable[0] = "Way Largo";
|
||||
mSpeedTable[1] = "Largo";
|
||||
mSpeedTable[2] = "Adagio";
|
||||
mSpeedTable[3] = "Andante";
|
||||
mSpeedTable[4] = "Andantino";
|
||||
mSpeedTable[5] = "Moderato";
|
||||
mSpeedTable[6] = "Allegretto";
|
||||
mSpeedTable[7] = "Allegro";
|
||||
mSpeedTable[8] = "Vivace";
|
||||
mSpeedTable[9] = "Presto";
|
||||
mSpeedTable[10] = "Prestissimo";
|
||||
mSpeedTable[11] = "Way Prestissimo";
|
||||
|
||||
statRect.SetRect(LEFT_SIDE, 26, LEFT_SIDE + 175, 41);
|
||||
if ((m_pButtonsText = new CText()) != nullptr) {
|
||||
(*m_pButtonsText).SetupText(pDC, pSubOptionsPalette, &statRect, JUSTIFY_LEFT);
|
||||
}
|
||||
|
||||
m_ScrollButtons.SetScrollRange(MIN_BUTTONS, MAX_BUTTONS, 0);
|
||||
m_ScrollButtons.SetScrollPos(m_nNumButtons, true);
|
||||
|
||||
statRect.SetRect(LEFT_SIDE, 65, LEFT_SIDE + 175, 80);
|
||||
if ((m_pSpeedText = new CText()) != nullptr) {
|
||||
(*m_pSpeedText).SetupText(pDC, pSubOptionsPalette, &statRect, JUSTIFY_LEFT);
|
||||
}
|
||||
|
||||
m_ScrollSpeed.SetScrollRange(MIN_SPEED, MAX_SPEED, 0);
|
||||
m_ScrollSpeed.SetScrollPos(m_nSpeed, true);
|
||||
|
||||
if ((pOKButton = new CColorButton) != nullptr) { // build a color QUIT button to let us exit
|
||||
(*pOKButton).SetPalette(pSubOptionsPalette); // set the palette to use
|
||||
(*pOKButton).SetControl(IDOK, this); // tie to the dialog control
|
||||
}
|
||||
|
||||
if ((pCancelButton = new CColorButton) != nullptr) { // build a color QUIT button to let us exit
|
||||
(*pCancelButton).SetPalette(pSubOptionsPalette); // set the palette to use
|
||||
(*pCancelButton).SetControl(IDCANCEL, this); // tie to the dialog control
|
||||
}
|
||||
|
||||
if ((pGameButton = new CRadioButton) != nullptr) { // build a color QUIT button to let us exit
|
||||
(*pGameButton).SetPalette(pSubOptionsPalette); // set the palette to use
|
||||
(*pGameButton).SetControl(IDC_PLAYGAME, this); // tie to the dialog control
|
||||
}
|
||||
|
||||
|
||||
if ((pMusicButton = new CRadioButton) != nullptr) { // build a color QUIT button to let us exit
|
||||
(*pMusicButton).SetPalette(pSubOptionsPalette); // set the palette to use
|
||||
(*pMusicButton).SetControl(IDC_PLAYMUSIC, this); // tie to the dialog control
|
||||
}
|
||||
|
||||
|
||||
ReleaseDC(pDC);
|
||||
|
||||
return true; // return true unless you set the focus to a control
|
||||
}
|
||||
|
||||
void COptnDlg::OnDestroy() {
|
||||
CBmpDialog::OnDestroy();
|
||||
}
|
||||
|
||||
|
||||
bool COptnDlg::OnCommand(WPARAM wParam, LPARAM lParam) {
|
||||
|
||||
if (HIWORD(lParam) == BN_CLICKED) {
|
||||
|
||||
switch (wParam) {
|
||||
|
||||
case IDC_PLAYGAME:
|
||||
m_bPlayGame = true;
|
||||
(*pGameButton).SetCheck(m_bPlayGame);
|
||||
(*pMusicButton).SetCheck(!m_bPlayGame);
|
||||
break;
|
||||
|
||||
case IDC_PLAYMUSIC:
|
||||
m_bPlayGame = false;
|
||||
(*pGameButton).SetCheck(m_bPlayGame);
|
||||
(*pMusicButton).SetCheck(!m_bPlayGame);
|
||||
break;
|
||||
|
||||
case IDOK:
|
||||
ClearDialogImage();
|
||||
EndDialog(IDOK);
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
ClearDialogImage();
|
||||
EndDialog(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
} // end switch
|
||||
} // end if
|
||||
|
||||
return true;
|
||||
|
||||
} // end OnCommand
|
||||
|
||||
|
||||
bool COptnDlg::OnEraseBkgnd(CDC *pDC) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void COptnDlg::OnHScroll(unsigned int nSBCode, unsigned int nPos, CScrollBar* pScrollBar) {
|
||||
int pMin,
|
||||
pMax;
|
||||
int OldPos = pScrollBar->GetScrollPos();
|
||||
int NewPos = OldPos;
|
||||
|
||||
pScrollBar->GetScrollRange(&pMin, &pMax);
|
||||
|
||||
switch (nSBCode) {
|
||||
case SB_LINERIGHT:
|
||||
case SB_PAGERIGHT:
|
||||
NewPos++;
|
||||
break;
|
||||
case SB_RIGHT:
|
||||
NewPos = pMax;
|
||||
break;
|
||||
case SB_LINELEFT:
|
||||
case SB_PAGELEFT:
|
||||
NewPos--;
|
||||
break;
|
||||
case SB_LEFT:
|
||||
NewPos = pMin;
|
||||
break;
|
||||
case SB_THUMBPOSITION:
|
||||
case SB_THUMBTRACK:
|
||||
NewPos = nPos;
|
||||
break;
|
||||
}
|
||||
|
||||
if (NewPos < pMin) NewPos = pMin;
|
||||
if (NewPos > pMax) NewPos = pMax;
|
||||
|
||||
if (NewPos != OldPos) { //To prevent "flicker"
|
||||
(*pScrollBar).SetScrollPos(NewPos, true); //...only update when
|
||||
} //...changed
|
||||
|
||||
UpdateScrollbars();
|
||||
|
||||
CDialog::OnHScroll(nSBCode, NewPos, pScrollBar);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* UpdateScrollbars
|
||||
*
|
||||
* FUNCTIONAL DESCRIPTION:
|
||||
*
|
||||
* Updates data adjusted with scrollbars
|
||||
*
|
||||
* FORMAL PARAMETERS:
|
||||
*
|
||||
* none
|
||||
*
|
||||
* IMPLICIT INPUT PARAMETERS:
|
||||
*
|
||||
* CScrollbar pScrollTime, pScrollColumns, pScrollRows
|
||||
*
|
||||
* IMPLICIT OUTPUT PARAMETERS:
|
||||
*
|
||||
* int m_nTime, m_nNumParts, m_nColumns, m_nRows
|
||||
*
|
||||
* RETURN VALUE:
|
||||
*
|
||||
* void
|
||||
*
|
||||
****************************************************************/
|
||||
void COptnDlg::UpdateScrollbars() {
|
||||
int OldValue;
|
||||
CDC *pDC;
|
||||
char msg[64];
|
||||
|
||||
pDC = GetDC();
|
||||
|
||||
OldValue = m_nNumButtons;
|
||||
m_nNumButtons = m_ScrollButtons.GetScrollPos();
|
||||
if (OldValue != m_nNumButtons) {
|
||||
Common::sprintf_s(msg, "Number of Musicians: %d", m_nNumButtons);
|
||||
(*m_pButtonsText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
}
|
||||
|
||||
OldValue = m_nSpeed;
|
||||
m_nSpeed = m_ScrollSpeed.GetScrollPos();
|
||||
if (OldValue != m_nSpeed) {
|
||||
Common::sprintf_s(msg, "Speed: %s", mSpeedTable[m_nSpeed].c_str());
|
||||
(*m_pSpeedText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
}
|
||||
|
||||
ReleaseDC(pDC);
|
||||
}
|
||||
|
||||
void COptnDlg::OnOK() {
|
||||
ClearDialogImage();
|
||||
EndDialog(IDOK);
|
||||
}
|
||||
|
||||
void COptnDlg::OnCancel() {
|
||||
ClearDialogImage();
|
||||
EndDialog(0);
|
||||
}
|
||||
|
||||
void COptnDlg::OnPaint() {
|
||||
CDC *pDC;
|
||||
char msg[64];
|
||||
|
||||
CBmpDialog::OnPaint();
|
||||
|
||||
pDC = GetDC();
|
||||
|
||||
Common::sprintf_s(msg, "Number of Musicians: %d", m_nNumButtons);
|
||||
(*m_pButtonsText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
|
||||
Common::sprintf_s(msg, "Speed: %s", mSpeedTable[m_nSpeed].c_str());
|
||||
(*m_pSpeedText).DisplayString(pDC, msg, 14, FW_BOLD, OPTIONS_COLOR);
|
||||
|
||||
(*pGameButton).SetCheck(m_bPlayGame);
|
||||
(*pMusicButton).SetCheck(!m_bPlayGame);
|
||||
|
||||
ReleaseDC(pDC);
|
||||
|
||||
}
|
||||
|
||||
void COptnDlg::ClearDialogImage() {
|
||||
if (pOKButton != nullptr) { // release the button
|
||||
delete pOKButton;
|
||||
pOKButton = nullptr;
|
||||
}
|
||||
|
||||
if (pCancelButton != nullptr) { // release the button
|
||||
delete pCancelButton;
|
||||
pCancelButton = nullptr;
|
||||
}
|
||||
|
||||
if (pGameButton != nullptr) { // release the button
|
||||
delete pGameButton;
|
||||
pGameButton = nullptr;
|
||||
}
|
||||
|
||||
if (pMusicButton != nullptr) { // release the button
|
||||
delete pMusicButton;
|
||||
pMusicButton = nullptr;
|
||||
}
|
||||
|
||||
ValidateRect(nullptr);
|
||||
}
|
||||
|
||||
} // namespace Garfunkle
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
82
engines/bagel/hodjnpodj/garfunkle/optndlg.h
Normal file
82
engines/bagel/hodjnpodj/garfunkle/optndlg.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/* 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_GARFUNKLE_OPTNDLG_H
|
||||
#define HODJNPODJ_GARFUNKLE_OPTNDLG_H
|
||||
|
||||
#include "bagel/hodjnpodj/garfunkle/resource.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/cbofdlg.h"
|
||||
#include "bagel/hodjnpodj/hnplibs/text.h"
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Garkfunkle {
|
||||
|
||||
#define LEFT_SIDE 26
|
||||
#define OPTIONS_COLOR RGB(0, 0, 0) // Color of the stats info CText
|
||||
#define NUM_SPEEDS 12
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// COptnDlg dialog
|
||||
|
||||
class COptnDlg : public CBmpDialog {
|
||||
// Construction
|
||||
public:
|
||||
COptnDlg(CWnd* pParent = nullptr, CPalette *pPalette = nullptr); // standard constructor
|
||||
~COptnDlg(); // destructor
|
||||
void UpdateScrollbars();
|
||||
void ClearDialogImage();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(COptnDlg)
|
||||
enum { IDD = IDD_SUBOPTIONS };
|
||||
CScrollBar m_ScrollButtons;
|
||||
CScrollBar m_ScrollSpeed;
|
||||
bool m_bPlayGame;
|
||||
int m_nNumButtons;
|
||||
int m_nSpeed;
|
||||
CString mSpeedTable [NUM_SPEEDS];
|
||||
//}}AFX_DATA
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(COptnDlg)
|
||||
virtual bool OnInitDialog() override;
|
||||
virtual bool OnCommand(WPARAM wParam, LPARAM lParam) override;
|
||||
afx_msg void OnHScroll(unsigned int nSBCode, unsigned int nPos, CScrollBar* pScrollBar);
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg bool OnEraseBkgnd(CDC *pDC);
|
||||
virtual void OnOK() override;
|
||||
virtual void OnCancel() override;
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnDestroy();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
} // namespace Garfunkle
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
46
engines/bagel/hodjnpodj/garfunkle/resource.h
Normal file
46
engines/bagel/hodjnpodj/garfunkle/resource.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* 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_GARFUNKLE_RESOURCE_H
|
||||
#define HODJNPODJ_GARFUNKLE_RESOURCE_H
|
||||
|
||||
namespace Bagel {
|
||||
namespace HodjNPodj {
|
||||
namespace Garkfunkle {
|
||||
|
||||
#define IDC_SCROLL 114
|
||||
|
||||
#define IDD_SUBOPTIONS 115
|
||||
|
||||
#define IDD_RULES_DIALOG 900
|
||||
|
||||
#define IDC_RULES 1002
|
||||
|
||||
#define IDC_NUMBUTTONS 1021
|
||||
#define IDC_SPEED 1022
|
||||
#define IDC_PLAYGAME 1023
|
||||
#define IDC_PLAYMUSIC 1024
|
||||
|
||||
} // namespace Garfunkle
|
||||
} // namespace HodjNPodj
|
||||
} // namespace Bagel
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user