Initial commit

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

View File

@@ -0,0 +1,791 @@
/* 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/sprite.h"
#include "bagel/hodjnpodj/crypt/globals.h"
#include "bagel/hodjnpodj/crypt/crypt.h"
#include "bagel/hodjnpodj/hodjnpodj.h"
#include "bagel/metaengine.h"
namespace Bagel {
namespace HodjNPodj {
namespace Crypt {
/*****************************************************************
*
* CCryptogram
*
* FUNCTIONAL DESCRIPTION:
*
* Initializes members.
*
* FORMAL PARAMETERS:
*
* None
*
* IMPLICIT INPUT PARAMETERS:
*
* None
*
* IMPLICIT OUTPUT PARAMETERS:
*
* None
*
* RETURN VALUE:
*
* None
*
****************************************************************/
CCryptogram::CCryptogram(CDC *pDC) {
m_cRecordGram = new CCryptRecord();
m_cPaintGram = new CPaintGram(pDC);
m_cStats = new CStats();
/********************************************************
* Solved switch is used to prevent further user updates *
* after cryptogram is solved. *
********************************************************/
bIsGameOver = false; // Initialize solved switch
BagelMetaEngine::setKeybindingMode(KBMODE_MINIMAL);
}
/*****************************************************************
*
* ~Cryptogram
*
* FUNCTIONAL DESCRIPTION:
*
* Destructor
*
* FORMAL PARAMETERS:
*
* n/a
*
* IMPLICIT INPUT PARAMETERS:
*
* n/a
*
* IMPLICIT OUTPUT PARAMETERS:
*
* n/a
*
* RETURN VALUE:
*
* n/a
*
****************************************************************/
CCryptogram::~CCryptogram() {
if (m_cStats != nullptr)
delete m_cStats;
if (m_cPaintGram != nullptr)
delete m_cPaintGram;
if (m_cRecordGram != nullptr)
delete m_cRecordGram;
BagelMetaEngine::setKeybindingMode(KBMODE_NORMAL);
}
/*****************************************************************
*
* DrawGram
*
* FUNCTIONAL DESCRIPTION:
*
* [Description of function]
*
* FORMAL PARAMETERS:
*
* [Show arguments]
*
* IMPLICIT INPUT PARAMETERS:
*
* [External data read]
*
* IMPLICIT OUTPUT PARAMETERS:
*
* [External data modified]
*
* RETURN VALUE:
*
* [Discuss return value]
*
****************************************************************/
bool CCryptogram::DrawGram(CDC *pDC) {
bIsGameOver = false;
if (m_cRecordGram->GetRecord(m_cStats->ResetGame()) == false) // Attempt to get the record
return false;
m_cPaintGram->ClearGram(pDC);
m_cPaintGram->PaintAlphabet(pDC);
CreateCryptMap(m_cStats->m_nLettersSolved);
MarkSolvedLetters(pDC);
m_cPaintGram->InitGramPosition(m_cRecordGram);
m_cPaintGram->PaintGram(pDC, m_chEncryptGram);
return true;
}
void CCryptogram::DrawSource(CDC *pDC) {
m_cPaintGram->HiLiteOff(pDC);
m_cPaintGram->PaintGram(pDC, m_cRecordGram->GetSource());
}
void CCryptogram::MarkSolvedLetters(CDC *pDC) {
int i;
for (i = 0; i < ALPHABET; i++) { // flip thru Crypt Map
if (m_nCryptMap[DECRYPT_MAP][i] == i) // Does letter rep itself?
m_cPaintGram->RevealOn( // yes - Mark char as solved
pDC,
m_cPaintGram->IndexToChar(i)
);
} // end for
}
void CCryptogram::SolveCryptogram(CDC *pDC) {
int nReplaceCode;
int nAlphaCode;
int nGramCode;
int i;
for (i = 0; i < ALPHABET; i++) { // flip thru Crypt Map
if ((m_nCryptMap[DECRYPT_MAP][i] != i) && // Any chars rep another char?
(m_nCryptMap[DECRYPT_MAP][i] != NOT_USED)) {
nAlphaCode = m_cPaintGram->IndexToChar(i); // Replace this char
nGramCode = m_cPaintGram->IndexToChar(m_nCryptMap[DECRYPT_MAP][i]);
nReplaceCode = UpdateCryptMap(nGramCode, nAlphaCode); // Update internal rep
if (nReplaceCode != NOT_USED) { // New char used in gram?
m_cPaintGram->ReplaceLetter(pDC, m_cPaintGram->GetCharType(nAlphaCode), // Yes - swap w/temp char
m_cPaintGram->SetLimboTypeOn(nReplaceCode)); // ...Temporarily set it's code to limbo
m_cPaintGram->ReplaceLetter(pDC, nGramCode, m_cPaintGram->GetCharType(nAlphaCode)); // swap old char with new char
m_cPaintGram->ReplaceLetter(pDC, m_cPaintGram->SetLimboTypeOn(nReplaceCode), // Turn all limbo types off
m_cPaintGram->SetLimboTypeOff(nReplaceCode));
} else { // New char was not used in gram...
m_cPaintGram->ReplaceLetter(pDC, nGramCode, m_cPaintGram->GetCharType(nAlphaCode)); // ...simply replace old with new.
}
m_cPaintGram->UsedOff(pDC, nGramCode); // Turn used code off on old char since it's not being used anymore
m_cPaintGram->UsedOn(pDC, nAlphaCode); // Turn used code on new char now appearing in cryptogram
} // end if
} // end for
}
/*****************************************************************
*
* HandleUserUpdate
*
* FUNCTIONAL DESCRIPTION:
*
* Processes user interaction with the displayed cryptogram.
* Will modify both internal cryptogram representation by calling
* appropriate CCryptogram members, and visual crytogram rep by
* calling CPaintGram members.
*
* FORMAL PARAMETERS:
*
* pDC - used for visual updating
* cpointClicked - place where user clicked
*
* IMPLICIT INPUT PARAMETERS:
*
* m_cPaintGram member
*
* IMPLICIT OUTPUT PARAMETERS:
*
* modifies m_cPaintGram
*
* RETURN VALUE:
*
* void
*
****************************************************************/
bool CCryptogram::HandleUserUpdate(CDC *pDC, CPoint cpointClicked) {
CSprite *pSprite;
int nClickedCode;
int nHiLiteCode;
int nReplaceCode;
int nAlphaCode;
int nGramCode;
/*****************************
* Cryptogram already solved? *
*****************************/
if (bIsGameOver == true) {
//MessageBeep(-1); // No - exit
return false;
}
pSprite = m_cPaintGram->m_cDisplayLetters->Touched(cpointClicked);
/********************************
* Clicked on letter anywhere? *
********************************/
if (pSprite == nullptr) {
//MessageBeep(-1); // No - exit
return false;
}
/********************
* Symbol hilited? *
********************/
nClickedCode = (*pSprite).GetTypeCode();
if (m_cPaintGram->IsSymbolChar(nClickedCode) == true) {
return false; // Yes - do not hilite symbols
}
/********************
* Anything hilited? *
********************/
if (m_cPaintGram->IsHiLiteOn() == false) {
m_cPaintGram->HiLiteOn(pDC, nClickedCode); // No - hilite letter
return false;
}
/****************************************************************
* Was the letter clicked same as the letter currenly hilited? *
****************************************************************/
if (m_cPaintGram->IsHiLiteType(nClickedCode) == true) {
m_cPaintGram->HiLiteOff(pDC); // Yes - toggle hilite to off state
return false;
}
/************************************************************
* Was the area clicked same as the area currenly hilited? *
************************************************************/
nHiLiteCode = m_cPaintGram->GetHiLiteType(pDC);
ASSERT(nHiLiteCode);
if (
(m_cPaintGram->IsGramType(nClickedCode) &&
m_cPaintGram->IsGramType(nHiLiteCode)) ||
(m_cPaintGram->IsAlphabetType(nClickedCode) &&
m_cPaintGram->IsAlphabetType(nHiLiteCode))
) {
m_cPaintGram->HiLiteOff(pDC); // Yes - turn hilite off
m_cPaintGram->HiLiteOn(pDC, nClickedCode); // ...hilite new char
return false; // out of here.
}
/************************************************************
* User wants to switch letters. *
* Need to update internal cryptogram and visual reps. *
************************************************************/
if (m_cPaintGram->IsAlphabetType(nHiLiteCode) == true) { // Is the hilited char in the alphabet region?
nAlphaCode = nHiLiteCode; // Yes - assign it the alpha code
nGramCode = nClickedCode;
} else {
nAlphaCode = nClickedCode; // No - swap around clicked code
nGramCode = nHiLiteCode;
}
nReplaceCode = UpdateCryptMap(nGramCode, nAlphaCode); // Update internal rep
if (nReplaceCode != NOT_USED) { // New char used in gram?
/****************************************************************
* These next lines introduces the "LimboType." From the fact *
* that the new letter, "nAlphaCode," is already somewhere in *
* the displayed cryptogram, two additional letters need *
* replacing -- not just the old letter, "nGramCode," with the *
* new. The following algorithm was used to resolve this: *
* - The new char currently displayed needs to be replaced *
* with another temp char, "nReplaced," which is the *
* old char + LimboType. *
* - Next all old chars are replaced with the new char. Note *
* that the "old char + LimboType" will not be replaced with *
* the new char. *
* - Finally, set back temp char, "old + limbo," with old *
* char. *
* *
* That's what the next three lines do respectively. *
****************************************************************/
m_cPaintGram->ReplaceLetter(pDC, m_cPaintGram->GetCharType(nAlphaCode), // Yes - swap w/temp char
m_cPaintGram->SetLimboTypeOn(nReplaceCode)); // ...Temporarily set it's code to limbo
m_cPaintGram->ReplaceLetter(pDC, nGramCode, m_cPaintGram->GetCharType(nAlphaCode)); // swap old char with new char
m_cPaintGram->ReplaceLetter(pDC, m_cPaintGram->SetLimboTypeOn(nReplaceCode), // Turn all limbo types off
m_cPaintGram->SetLimboTypeOff(nReplaceCode));
} else { // New char was not used in gram...
m_cPaintGram->ReplaceLetter(pDC, nGramCode, m_cPaintGram->GetCharType(nAlphaCode)); // ...simply replace old with new.
}
m_cPaintGram->HiLiteOff(pDC); // Turn hilite off
m_cPaintGram->UsedOff(pDC, nGramCode); // Turn used code off on old char since it's not being used anymore
m_cPaintGram->UsedOn(pDC, nAlphaCode); // Turn used code on new char now appearing in cryptogram
return IsSolved();
}
/*****************************************************************
*
* HandleUserUpdate
*
* FUNCTIONAL DESCRIPTION:
*
* Processes user interaction with the displayed cryptogram.
* Will modify both internal cryptogram representation by calling
* appropriate CCryptogram members, and visual crytogram rep by
* calling CPaintGram members.
*
* FORMAL PARAMETERS:
*
* pDC - used for visual updating
* cpointClicked - place where user clicked
*
* IMPLICIT INPUT PARAMETERS:
*
* m_cPaintGram member
*
* IMPLICIT OUTPUT PARAMETERS:
*
* modifies m_cPaintGram
*
* RETURN VALUE:
*
* void
*
****************************************************************/
bool CCryptogram::HandleUserUpdate(CDC *pDC, unsigned int nChar) {
char nNewChar = toupper(nChar);
int nHiLiteCode;
int nReplaceCode;
int nAlphaCode;
int nGramCode;
/*****************************
* Cryptogram already solved? *
*****************************/
if (bIsGameOver == true) {
//MessageBeep(-1); // No - exit
return false;
}
/****************************************
* Is this a valid alphabetical letter? *
****************************************/
if (Common::isAlpha(nNewChar) == false) {
MessageBeep(-1); // No - exit
return false;
}
/********************
* Anything hilited? *
********************/
if (m_cPaintGram->IsHiLiteOn() == false) {
m_cPaintGram->HiLiteOn(pDC, nNewChar); // Turn hilite on that spec char
return false;
}
/*******************************
* Hilite in cryptogram region? *
*******************************/
nHiLiteCode = m_cPaintGram->GetHiLiteType(pDC);
ASSERT(nHiLiteCode);
if (m_cPaintGram->IsGramType(nHiLiteCode) == false) {
MessageBeep(-1); // No - exit
return false;
}
/*************************************
* Hilite same char as user typed in? *
*************************************/
if (nHiLiteCode == nNewChar) {
m_cPaintGram->HiLiteOff(pDC); // Turn hilite off
return false;
}
nAlphaCode = nNewChar;
nGramCode = nHiLiteCode;
/************************************************************
* User wants to switch letters. *
* Need to update internal cryptogram and visual reps. *
************************************************************/
nReplaceCode = UpdateCryptMap(nGramCode, nAlphaCode); // Update internal rep
if (nReplaceCode != NOT_USED) { // New char used in gram?
/****************************************************************
* These next lines introduces the "LimboType." From the fact *
* that the new letter, "nAlphaCode," is already somewhere in *
* the displayed cryptogram, two additional letters need *
* replacing -- not just the old letter, "nGramCode," with the *
* new. The following algorithm was used to resolve this: *
* - The new char currently displayed needs to be replaced *
* with another temp char, "nReplaced," which is the *
* old char + LimboType. *
* - Next all old chars are replaced with the new char. Note *
* that the "old char + LimboType" will not be replaced with *
* the new char. *
* - Finally, set back temp char, "old + limbo," with old *
* char. *
* *
* That's what the next three lines do respectively. *
****************************************************************/
m_cPaintGram->ReplaceLetter(pDC, m_cPaintGram->GetCharType(nAlphaCode), // Yes - swap w/temp char
m_cPaintGram->SetLimboTypeOn(nReplaceCode)); // ...Temporarily set it's code to limbo
m_cPaintGram->ReplaceLetter(pDC, nGramCode, m_cPaintGram->GetCharType(nAlphaCode)); // swap old char with new char
m_cPaintGram->ReplaceLetter(pDC, m_cPaintGram->SetLimboTypeOn(nReplaceCode), // Turn all limbo types off
m_cPaintGram->SetLimboTypeOff(nReplaceCode));
} else { // New char was not used in gram...
m_cPaintGram->ReplaceLetter(pDC, nGramCode, m_cPaintGram->GetCharType(nAlphaCode)); // ...simply replace old with new.
}
m_cPaintGram->HiLiteOff(pDC); // Turn hilite off
m_cPaintGram->UsedOff(pDC, nGramCode); // Turn used code off on old char since it's not being used anymore
m_cPaintGram->UsedOn(pDC, nAlphaCode); // Turn used code on new char now appearing in cryptogram
return IsSolved();
}
/*****************************************************************
*
* Encrypt
*
* FUNCTIONAL DESCRIPTION:
*
* Uses the Crypt Map to encode the phrase, as it originally
* appears.
*
* FORMAL PARAMETERS:
*
* None
*
* IMPLICIT INPUT PARAMETERS:
*
* m_cRecordGram - to obtain the original phrase.
* m_nCryptMap - to encrypt phrase
*
* IMPLICIT OUTPUT PARAMETERS:
*
* m_chEncrptGram - updated according to structure of
* m_nCryptMap.
*
* RETURN VALUE:
*
* void
*
****************************************************************/
void CCryptogram::Encrypt() {
int i;
/*******************
* Reset workbench. *
*******************/
Common::strcpy_s(m_chEncryptGram, m_cRecordGram->GetGram()); // Acquire copy of original
/*****************************************
* Encrypt entire string using crypt map. *
*****************************************/
for (i = 0; m_chEncryptGram[i] != 0; i++) {
if ((m_cPaintGram->IsAlphaChar(m_chEncryptGram[i]) == true) && // Is this a char?
(m_nCryptMap[DECRYPT_MAP][m_cPaintGram->CharToIndex(m_chEncryptGram[i])] != NOT_USED) // and should this char be encrypted?
) {
m_chEncryptGram[i] = m_cPaintGram->IndexToChar(
m_nCryptMap[DECRYPT_MAP][
m_cPaintGram->CharToIndex(m_chEncryptGram[i])
]
);
}
}
}
/*****************************************************************
*
* CreateEncryptMap
*
* FUNCTIONAL DESCRIPTION:
*
* Creates an En-Cryption Map Key by randomally selecting
* unique representations for each alphabetical letter.
*
* FORMAL PARAMETERS:
*
* nLettersSolved - number of characters not encrypted
*
* IMPLICIT INPUT PARAMETERS:
*
* m_nCryptMap - Resets En-Cryption Map Key
*
* IMPLICIT OUTPUT PARAMETERS:
*
* m_nCryptMap - Complete En-Cryption Map Key with exactly
* nLettersSolved chars mapped to themselves.
*
* RETURN VALUE:
*
* void
*
****************************************************************/
void CCryptogram::CreateCryptMap(int nLettersSolved) {
int nEncryptCode; // encrypted value
int nDecryptCode; // normal/decrypted value
bool bIsUsed; // tells if encrypt-decrypt map was used
int i, j; // index
/*******************
* Reset workbench. *
*******************/
Common::strcpy_s(m_chEncryptGram, m_cRecordGram->GetGram()); // Acquire copy of original
for (i = 0; i < ALPHABET; i++) { // Reset cryptmap
m_nCryptMap[DECRYPT_MAP][i] = NOT_USED;
m_nCryptMap[ENCRYPT_MAP][i] = NOT_USED;
}
/****************************************************
* Create encryption map based on letters in phrase. *
****************************************************/
for (i = 0; m_chEncryptGram[i] != 0; i++) {
if (m_cPaintGram->IsAlphaChar(m_chEncryptGram[i]) == true) { // Is this a char?
nDecryptCode = m_cPaintGram->CharToIndex(m_chEncryptGram[i]);
bIsUsed = (m_nCryptMap[DECRYPT_MAP][nDecryptCode] != NOT_USED);
if (bIsUsed == true) // Char already encrypted?
continue; // Yes - loop to next char in text
/******************************
* Find an unused encrypt map. *
******************************/
do {
nEncryptCode = brand() % ALPHABET;
bIsUsed = (m_nCryptMap[ENCRYPT_MAP][nEncryptCode] != NOT_USED);
} while (bIsUsed == true || nEncryptCode == nDecryptCode); // find unused map
/**************************************
* Record new encrypt/decrypt mapping. *
**************************************/
m_nCryptMap[DECRYPT_MAP][nDecryptCode] = nEncryptCode;
m_nCryptMap[ENCRYPT_MAP][nEncryptCode] = nDecryptCode;
}
}
/************************************************************************
* Decrypt letters solved given as function arg. *
* To keep letters solved random (as opposed to decrypting A, B, and C *
* in order) it seemed easier to change the map after it was fully *
* encrypted, provided from above. *
************************************************************************/
for (i = 0; i < nLettersSolved ; i++) {
for (j = 0; j < ALPHABET; j++) { // Are there any letters left to decrypt?
if (
m_nCryptMap[DECRYPT_MAP][j] != NOT_USED && // in the quote and
m_nCryptMap[DECRYPT_MAP][j] != j // not already solved
) {
bIsUsed = true; // Yes - so break
break;
} else
bIsUsed = false; // No - not this letter, keep looking
}
if (bIsUsed == false) // Any letters left to decrypt?
break; // No - by pass loop.
do {
nDecryptCode = brand() % ALPHABET; // find used char
bIsUsed = (
m_nCryptMap[DECRYPT_MAP][nDecryptCode] != NOT_USED && // in quote and
m_nCryptMap[DECRYPT_MAP][nDecryptCode] != nDecryptCode // not already solved
);
} while (bIsUsed == false);
nEncryptCode = m_nCryptMap[DECRYPT_MAP][nDecryptCode]; // gets corres decoder
/********************************************************************
* Need to know if the decrypted letter was used in the encryption *
* map before. If it was, then another encryption letter needs to *
* be used in it's place. *
********************************************************************/
bIsUsed = (m_nCryptMap[ENCRYPT_MAP][nDecryptCode] != NOT_USED);
if (bIsUsed == true) { // Decrypted letter used before?
m_nCryptMap[DECRYPT_MAP][m_nCryptMap[ENCRYPT_MAP][nDecryptCode]] = nEncryptCode; // Yes - Swap around encrypted chars
m_nCryptMap[ENCRYPT_MAP][nEncryptCode] = m_nCryptMap[ENCRYPT_MAP][nDecryptCode];
} else {
m_nCryptMap[ENCRYPT_MAP][nEncryptCode] = NOT_USED; // No - Mark encryption map as unused
}
/********************************************************************
* ENCRYPT_MAP is a reversed mirror of DECRYPT_MAP. I.e. if *
* "A points to X" in the DECRYPT_MAP, then "X points to A" in the *
* ENCRYPT_MAP. Specific reasons for assigning both sides of map *
* to "nDecryptCode" are tricky...8-]. Think about it. *
********************************************************************/
m_nCryptMap[DECRYPT_MAP][nDecryptCode] = nDecryptCode; // Match Decrypt map
m_nCryptMap[ENCRYPT_MAP][nDecryptCode] = nDecryptCode; // ...with Encrypt map
}
Encrypt(); // Create the real thing...update internal rep.
}
/*****************************************************************
*
* UpdateGramChar
*
* FUNCTIONAL DESCRIPTION:
*
* Replaces old char, "nOldType," with new char, "nNewType," in
* Crypt Map. Handles specific case when new char appears in
* Crypt Map prior to replacement.
*
* FORMAL PARAMETERS:
*
* nOldType - type code of old char
* nNewType - type code of new char
*
* IMPLICIT INPUT PARAMETERS:
*
* m_nCryptMap - En-Cryption Map Key
*
* IMPLICIT OUTPUT PARAMETERS:
*
* m_nCryptMap - nOldType is remapped to nNewType
*
* RETURN VALUE:
*
* nReplaceCode - value of any additional character that may
* need replacing.
*
****************************************************************/
int CCryptogram::UpdateCryptMap(int nOldType, int nNewType) {
int nOldIndex; // Crypt Map index equivalent of nOldType
int nNewIndex; // index equivalent of nNewType
int nEncryptCode; // old type
int nDecryptCode; // decryption map corresponding to old type
int nReplaceCode; // temporary old type
nOldIndex = m_cPaintGram->CharToIndex(m_cPaintGram->GetCharType(nOldType));
nNewIndex = m_cPaintGram->CharToIndex(m_cPaintGram->GetCharType(nNewType));
nEncryptCode = nOldIndex;
nDecryptCode = m_nCryptMap[ENCRYPT_MAP][nEncryptCode];
nReplaceCode = NOT_USED;
/************************************************************************
* Need to know if nNewType letter was used in the cryptogram *
* before. This can occur in two different instances: another letter *
* was encrypted into nNewType, or when nNewType just appears as a *
* straight representation of itself. If either was case, then another *
* letter needs to be used in it's place. *
************************************************************************/
if (m_nCryptMap[ENCRYPT_MAP][nNewIndex] != NOT_USED) { // New type used in encryption ma?
m_nCryptMap[DECRYPT_MAP][m_nCryptMap[ENCRYPT_MAP][nNewIndex]] = nEncryptCode; // Swap around encrypted chars
m_nCryptMap[ENCRYPT_MAP][nEncryptCode] = m_nCryptMap[ENCRYPT_MAP][nNewIndex];
nReplaceCode = m_cPaintGram->IndexToChar(nEncryptCode);
} else {
m_nCryptMap[ENCRYPT_MAP][nEncryptCode] = NOT_USED;
}
m_nCryptMap[DECRYPT_MAP][nDecryptCode] = nNewIndex; // Match Decrypt map
m_nCryptMap[ENCRYPT_MAP][nNewIndex] = nDecryptCode; // ...with Encrypt map
Encrypt(); // Update internal rep
return nReplaceCode; // return temporary value....
}
/*****************************************************************
*
* IsSolved
*
* FUNCTIONAL DESCRIPTION:
*
* Figures out if the cryptogram is solved, based on
* state of "m_nCryptMap" -- the En-Cryption Map Key.
*
* FORMAL PARAMETERS:
*
* void
*
* IMPLICIT INPUT PARAMETERS:
*
* m_nCryptMap - En-Cryption Map Key
*
* IMPLICIT OUTPUT PARAMETERS:
*
* None
*
* RETURN VALUE:
*
* nTotalSolved - number of correctly decrypted letters
*
****************************************************************/
bool CCryptogram::IsSolved() {
int i;
for (i = 0; i < ALPHABET; i++) { // flip thru Crypt Map
if ((m_nCryptMap[DECRYPT_MAP][i] != i) && // Any chars rep another char?
(m_nCryptMap[DECRYPT_MAP][i] != NOT_USED))
return false; // Yes - cryptogram not solved
}
bIsGameOver = true; // Mark cryptogram as solved
return true;
}
/*****************************************************************
*
* LettersSolved
*
* FUNCTIONAL DESCRIPTION:
*
* Figures out how many letters are properly decrypted, based on
* state of "m_nCryptMap" -- the En-Cryption Map Key.
*
* FORMAL PARAMETERS:
*
* void
*
* IMPLICIT INPUT PARAMETERS:
*
* m_nCryptMap - En-Cryption Map Key
*
* IMPLICIT OUTPUT PARAMETERS:
*
* None
*
* RETURN VALUE:
*
* nTotalSolved - number of correctly decrypted letters
*
****************************************************************/
int CCryptogram::LettersSolved() {
int i;
int nTotalSolved = 0;
for (i = 0; i < ALPHABET; i++) { // flip thru Crypt Map
if (m_nCryptMap[DECRYPT_MAP][i] == i) // Does letter rep itself?
nTotalSolved++; // Yes - it is a solved letter
}
return nTotalSolved;
}
} // namespace Crypt
} // namespace HodjNPodj
} // namespace Bagel

View File

@@ -0,0 +1,74 @@
/* 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_CRYPT_CRYPT_H
#define HODJNPODJ_CRYPT_CRYPT_H
#include "bagel/hodjnpodj/crypt/rec.h"
#include "bagel/hodjnpodj/crypt/pnt_gram.h"
#include "bagel/hodjnpodj/crypt/stats.h"
namespace Bagel {
namespace HodjNPodj {
namespace Crypt {
#define SPLASHSPEC ".\\art\\crypt.BMP" // bitmap file for the splash screen
#define NOT_USED -1
#define MAP 2
#define DECRYPT_MAP 0
#define ENCRYPT_MAP 1
class CCryptogram {
private:
CCryptRecord *m_cRecordGram = nullptr;
int m_nCryptMap[MAP][ALPHABET] = {};
public:
CCryptogram(CDC *pDC);
~CCryptogram();
bool DrawGram(CDC *pDC);
bool HandleUserUpdate(CDC *pDC, CPoint cpointClicked);
bool HandleUserUpdate(CDC *pDC, unsigned int nChar);
void Encrypt();
void CreateCryptMap(int nLettersSolved);
int UpdateCryptMap(int nOldType, int nNewType);
bool IsSolved();
int LettersSolved();
void MarkSolvedLetters(CDC *pDC);
void SolveCryptogram(CDC *pDC);
void DrawSource(CDC *pDC);
char m_chEncryptGram[MAX_GRAM_LEN];
CPaintGram *m_cPaintGram = nullptr;
CStats *m_cStats = nullptr;
bool bIsGameOver = false;
};
// Globals!
extern CPalette *pGamePalette;
} // namespace Crypt
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,51 @@
/* 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_CRYPT_GLOBALS_H
#define HODJNPODJ_CRYPT_GLOBALS_H
namespace Bagel {
namespace HodjNPodj {
namespace Crypt {
// Main Window positioning constants
#define GAME_WIDTH 640
#define GAME_HEIGHT 480
// Cryptogram info
#define ALPHABET 26 // chars in English alphabet
#define SYMBOLS 45 // chars + 9 symbols + 10 digits
#define USED_SYMBOLS 26
#define REVEAL_SYMBOLS 26
// Scroll button
#define IDC_SCROLL 800
#define SCROLL_BUTTON_X 250
#define SCROLL_BUTTON_Y 0
#define SCROLL_BUTTON_DX 140
#define SCROLL_BUTTON_DY 23
} // namespace Crypt
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,98 @@
/* 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/dibdoc.h"
#include "bagel/hodjnpodj/hnplibs/sprite.h"
#include "bagel/hodjnpodj/hnplibs/button.h"
#include "bagel/hodjnpodj/hnplibs/rules.h"
#include "bagel/hodjnpodj/hnplibs/bitmaps.h"
#include "bagel/hodjnpodj/crypt/main.h"
#include "bagel/hodjnpodj/crypt/optn.h"
#include "bagel/hodjnpodj/crypt/globals.h"
#include "bagel/hodjnpodj/crypt/resource.h"
namespace Bagel {
namespace HodjNPodj {
namespace Crypt {
HINSTANCE hDLLInst;
HINSTANCE hExeInst;
CMainWindow *pMainGameWnd = nullptr; // pointer to the poker's main window
CPalette *pTestPalette = nullptr;
HCURSOR hGameCursor;
/////////////////////////////////////////////////////////////////////////////
// Public C interface
/*****************************************************************
*
* RunCrypt
*
* 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 RunCrypt(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 CMainWindow(hParentWnd, lpGameInfo);
pMainGameWnd->ShowWindow(SW_SHOWNORMAL);
pMainGameWnd->SplashScreen(); // Force immediate display to minimize repaint delay
pMainGameWnd->UpdateWindow();
pMainGameWnd->SetActiveWindow();
// return the handle to this window
hDLLInst = (HINSTANCE)GetWindowWord(pMainGameWnd->m_hWnd, GWW_HINSTANCE);
hExeInst = (HINSTANCE)GetWindowWord(hParentWnd, GWW_HINSTANCE);
return pMainGameWnd->m_hWnd;
}
} // namespace Crypt
} // 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_CRYPT_DLLINIT_H
#define HODJNPODJ_CRYPT_DLLINIT_H
#include "bagel/afxwin.h"
namespace Bagel {
namespace HodjNPodj {
namespace Crypt {
extern HWND FAR PASCAL RunCrypt(HWND hParentWnd, LPGAMESTRUCT lpGameInfo);
} // namespace Crypt
} // namespace HodjNPodj
} // namespace Bagel
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,216 @@
/* 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_CRYPT_MAIN_H
#define HODJNPODJ_CRYPT_MAIN_H
#include "bagel/boflib/sound.h"
#include "bagel/hodjnpodj/hnplibs/gamedll.h"
#include "bagel/hodjnpodj/crypt/crypt.h"
namespace Bagel {
namespace HodjNPodj {
namespace Crypt {
#define NEW_GAME_LEFT 15
#define NEW_GAME_TOP 2
#define NEW_GAME_RIGHT 233
#define NEW_GAME_BOTTOM 21
#define PAUSE_TIME 15000 // Pause for 15 seconds -- allows user to read quote
// Game theme song
#define GAME_THEME ".\\sound\\crypt.mid"
// Rules files
#define RULES_TEXT "CRYPTRUL.TXT"
#define RULES_WAV ".\\SOUND\\CRYPT.WAV"
///////////////////////////////////////////
// EASTER EGG AND SOUND HOTSPOT DATA:
//
#define WAV_TIMEOUT ".\\SOUND\\BUZZER.WAV"
#define WAV_WON ".\\SOUND\\SOUNDWON.WAV"
#define WAV_URN1 ".\\SOUND\\OUTTHERE.WAV"
#define WAV_URN2 ".\\SOUND\\SPOOKMUS.WAV"
#define WAV_URN3 ".\\SOUND\\BUTFLIES.WAV"
#define WAV_JOKE1 ".\\SOUND\\JOKE1.WAV"
#define WAV_JOKE2 ".\\SOUND\\JOKE2.WAV"
#define WAV_JOKE3 ".\\SOUND\\JOKE3.WAV"
#define WAV_JOKE4 ".\\SOUND\\JOKE4.WAV"
#define WAV_JOKE5 ".\\SOUND\\JOKE5.WAV"
#define WAV_JOKE6 ".\\SOUND\\JOKE6.WAV"
#define WAV_TORCH ".\\SOUND\\FIREENG.WAV"
#define WAV_GRYPH ".\\SOUND\\GRYPHON.WAV"
#define WAV_STEPS ".\\SOUND\\STAIRS.WAV"
#define WAV_HOUR ".\\SOUND\\SANDTIME.WAV"
#define NUM_SKULL_SOUNDS 6
// Skull anim offsets
#define SKULL_X 21 //15
#define SKULL_Y 257 //245
#define SKULL_DX 97
#define SKULL_DY 135
// URN1 anim offsets
#define URN1_X 98 //95
#define URN1_Y 28 //22
#define URN1_DX 42 //54
#define URN1_DY 133 //48
// URN2 anim offsets
#define URN2_X 204 //186
#define URN2_Y 25 //24
#define URN2_DX 94 //120
#define URN2_DY 104 //106
// URN3 anim offsets
#define URN3_X 361 //357
#define URN3_Y 26 //23
#define URN3_DX 72 //84
#define URN3_DY 103 //108
// Anim cel count
#define NUM_SKULL_CELS 20
#define NUM_URN1_CELS 25
#define NUM_URN2_CELS 22
#define NUM_URN3_CELS 20
// Anim sleep times in millisecs
#define SKULL_SLEEP 100
#define JOKE1_SLEEP 130 // funny thing
#define JOKE2_SLEEP 130 // pj's part A
#define JOKE2B_SLEEP 120 // pj's part B
#define JOKE3_SLEEP 120 // audience
#define JOKE4_SLEEP 130 // brooklyn
#define JOKE5_SLEEP 150 // philly
#define JOKE6_SLEEP 40 // sock it to me
#define URN1_SLEEP 150
#define URN2_SLEEP 200
#define URN3_SLEEP 125
// TORCH audio hotspot offsets
#define TORCH1_X 45
#define TORCH1_Y 25
#define TORCH2_X 170
#define TORCH2_Y 40
#define TORCH3_X 307
#define TORCH3_Y 35
#define TORCH4_X 450
#define TORCH4_Y 40
#define TORCH_DX 50
#define TORCH_DY 80
// GRYPH audio hotspot offsets
#define GRYPH_X 208
#define GRYPH_Y 130
#define GRYPH_DX 240
#define GRYPH_DY 45
// STEPS audio hotspot offsets
#define STEPS_X 568
#define STEPS_Y 198
#define STEPS_DX 42
#define STEPS_DY 183
// HOUR audio hotspot offsets
#define HOUR_X 473
#define HOUR_Y 123
#define HOUR_DX 40
#define HOUR_DY 61
#define MAX_HOURS 10
class CMainWindow : public CFrameWnd {
public:
CMainWindow(HWND, LPGAMESTRUCT);
~CMainWindow();
void SplashScreen();
static void FlushInputEvents();
void DisplayStats(CDC*);
void RefreshStats();
void GameWin();
void GameLose();
private:
HWND m_hCallAppWnd = nullptr;
LPGAMESTRUCT m_lpGameStruct = nullptr;
CRect MainRect; // screen area spanned by the game window
CRect m_cNewGame; // area spanned by new game rect
CBmpButton *m_pScrollButton = nullptr; // scroll button
bool m_bIgnoreScrollClick = false; // scroll button
bool m_bIsFirstTimeHack = false;
CSprite *m_pHourGlass = nullptr;
private:
void OnSoundNotify(CSound *pSound);
protected:
virtual bool OnCommand(WPARAM wParam, LPARAM lParam) override;
//{{AFX_MSG( CMainWindow )
afx_msg void OnPaint();
afx_msg void OnLButtonDown(unsigned int, CPoint);
afx_msg void OnLButtonUp(unsigned int, CPoint);
afx_msg void OnLButtonDblClk(unsigned int, CPoint);
afx_msg void OnMButtonDown(unsigned int, CPoint);
afx_msg void OnMButtonUp(unsigned int, CPoint);
afx_msg void OnMButtonDblClk(unsigned int, CPoint);
afx_msg void OnRButtonDown(unsigned int, CPoint);
afx_msg void OnRButtonUp(unsigned int, CPoint);
afx_msg void OnRButtonDblClk(unsigned int, CPoint);
afx_msg void OnMouseMove(unsigned int nFlags, CPoint point);
afx_msg void OnChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
afx_msg void OnSysChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
afx_msg void OnSysKeyDown(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 OnTimer(uintptr nIDEvent);
afx_msg void OnClose();
afx_msg void OnDestroy();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg LRESULT OnMCINotify(WPARAM, LPARAM);
afx_msg LRESULT OnMMIONotify(WPARAM, LPARAM);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CTheApp:
// See game.cpp for the code to the InitInstance member function.
//
class CTheApp : public CWinApp {
public:
bool InitInstance();
int ExitInstance();
};
} // namespace Crypt
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,362 @@
/* 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/crypt/optn.h"
#include "bagel/hodjnpodj/crypt/resource.h"
namespace Bagel {
namespace HodjNPodj {
namespace Crypt {
static CColorButton *pOKButton = nullptr; // OKAY button on scroll
static CColorButton *pCancelButton = nullptr; // Cancel button on scroll
/////////////////////////////////////////////////////////////////////////////
// COptn dialog
COptn::COptn(
CWnd* pParent /*=nullptr*/,
CPalette *pPalette /*=nullptr*/,
int nLttrsSlvd /*LSLVD_DEFAULT*/,
int nTime /*TIME_DEFAULT*/
)
: CBmpDialog(pParent, pPalette, IDD_USER_OPTIONS, ".\\ART\\SSCROLL.BMP")
{
//{{AFX_DATA_INIT(COptn)
m_nTimeIndex[0] = 15;
m_nTimeIndex[1] = 20;
m_nTimeIndex[2] = 25;
m_nTimeIndex[3] = 30;
m_nTimeIndex[4] = 35;
m_nTimeIndex[5] = 40;
m_nTimeIndex[6] = 45;
m_nTimeIndex[7] = 50;
m_nTimeIndex[8] = 60;
m_nTimeIndex[9] = 70;
m_nTimeIndex[10] = 80;
m_nTimeIndex[11] = 90;
m_nTimeIndex[12] = 120;
m_nTimeIndex[13] = 150;
m_nTimeIndex[14] = 180;
m_nTimeIndex[15] = 240;
m_nTimeIndex[16] = 300;
m_nTimeIndex[17] = 589;
m_nTimeIndex[18] = 601;
pGamePalette = pPalette;
m_nTime = TimeToIndex(nTime);
m_nLttrsSlvd = nLttrsSlvd;
m_pLttrsSlvd = nullptr;
m_pTime = nullptr;
//}}AFX_DATA_INIT
}
COptn::~COptn() {
if (m_pLttrsSlvd != nullptr) {
delete m_pLttrsSlvd;
m_pLttrsSlvd = nullptr;
}
if (m_pTime != nullptr) {
delete m_pTime;
m_pLttrsSlvd = nullptr;
}
CBmpDialog::OnDestroy();
}
int COptn::TimeToIndex(int nTime) {
int nLow;
/***********************************
* Seaches ordered array in n time. *
***********************************/
for (nLow = 0; nLow < TIME_TABLE ; nLow++) {
if (m_nTimeIndex[nLow] == nTime)
return (int)nLow;
}
return false;
}
void COptn::DoDataExchange(CDataExchange* pDX) {
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COptn)
DDX_Control(pDX, IDC_LTTRSSLVD, m_LttrsSlvd);
DDX_Control(pDX, IDC_TIME, m_Time);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COptn, CDialog)
//{{AFX_MSG_MAP(COptn)
ON_WM_PAINT()
ON_WM_ERASEBKGND()
ON_WM_HSCROLL()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COptn message handlers
bool COptn::OnInitDialog() {
CRect statsRect; // game stats displays
int nStat_col_offset; // game stats placement
int nStat_row_offset;
int nStatWidth, nStatHeight;
bool bAssertCheck;
CDC *pDC;
CBmpDialog::OnInitDialog();
// TODO: Add extra initialization here
m_chTime[0] = "15 Seconds";
m_chTime[1] = "20 Seconds";
m_chTime[2] = "25 Seconds";
m_chTime[3] = "30 Seconds";
m_chTime[4] = "35 Seconds";
m_chTime[5] = "40 Seconds";
m_chTime[6] = "45 Seconds";
m_chTime[7] = "50 Seconds";
m_chTime[8] = "60 Seconds";
m_chTime[9] = "70 Seconds";
m_chTime[10] = "80 Seconds";
m_chTime[11] = "90 Seconds";
m_chTime[12] = "120 Seconds";
m_chTime[13] = "150 Seconds";
m_chTime[14] = "3 Minutes";
m_chTime[15] = "4 Minutes";
m_chTime[16] = "5 Minutes";
m_chTime[17] = "10 Minutes";
m_chTime[18] = "None";
pDC = GetDC();
nStat_col_offset = STAT_BOX_COL; // setup the Letters Solved
nStat_row_offset = STAT_BOX_ROW; // stat display box
nStatWidth = STAT_BOX_WIDTH;
nStatHeight = STAT_BOX_HEIGHT;
statsRect.SetRect(
nStat_col_offset,
nStat_row_offset,
nStat_col_offset + nStatWidth,
nStat_row_offset + nStatHeight
);
if ((m_pLttrsSlvd = new CText()) != nullptr) {
bAssertCheck = (*m_pLttrsSlvd).SetupText(pDC, pGamePalette, &statsRect, JUSTIFY_LEFT);
ASSERT(bAssertCheck); // initialize the text objext
}
m_LttrsSlvd.SetScrollRange(MIN_LTTRSSLVD, MAX_LTTRSSLVD, false); // setup Letters Solved defaults
m_LttrsSlvd.SetScrollPos(m_nLttrsSlvd, true);
nStat_row_offset += BOX_ROW_OFFSET; // Time stat display box
statsRect.SetRect(
nStat_col_offset,
nStat_row_offset,
nStat_col_offset + nStatWidth,
nStat_row_offset + nStatHeight
);
if ((m_pTime = new CText()) != nullptr) {
bAssertCheck = (*m_pTime).SetupText(pDC, pGamePalette, &statsRect, JUSTIFY_LEFT);
ASSERT(bAssertCheck); // initialize the text objext
}
m_Time.SetScrollRange(MIN_INDEX_TIME, MAX_INDEX_TIME, false); // Time scroll bar defaults
m_Time.SetScrollPos(m_nTime, true);
if ((pOKButton = new CColorButton) != nullptr) { // build a color QUIT button to let us exit
(*pOKButton).SetPalette(pGamePalette); // 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(pGamePalette); // set the palette to use
(*pCancelButton).SetControl(IDCANCEL, this); // tie to the dialog control
}
ReleaseDC(pDC);
return true; // return true unless you set the focus to a control
}
void COptn::OnDestroy() {
CBmpDialog::OnDestroy();
}
void COptn::OnHScroll(unsigned int nSBCode, unsigned int nPos, CScrollBar* pScrollBar) {
// TODO: Add your message handler code here and/or call default
CDC *pDC;
bool bAssertCheck;
char msg[64];
pDC = GetDC();
if (pScrollBar->GetDlgCtrlID() == IDC_LTTRSSLVD) {
switch (nSBCode) {
case SB_LINERIGHT:
m_nLttrsSlvd++;
break;
case SB_PAGERIGHT:
m_nLttrsSlvd += (int) MAX_LTTRSSLVD / 5; // magic # 5 = five divisions
break;
case SB_RIGHT:
m_nLttrsSlvd = MAX_LTTRSSLVD;
break;
case SB_LINELEFT:
m_nLttrsSlvd--;
break;
case SB_PAGELEFT:
m_nLttrsSlvd -= (int) MAX_LTTRSSLVD / 5; // magic # 5 = five divisions
break;
case SB_LEFT:
m_nLttrsSlvd = MIN_LTTRSSLVD;
break;
case SB_THUMBPOSITION:
case SB_THUMBTRACK:
m_nLttrsSlvd = (int) nPos;
break;
} // end switch
if (m_nLttrsSlvd < MIN_LTTRSSLVD)
m_nLttrsSlvd = MIN_LTTRSSLVD;
if (m_nLttrsSlvd > MAX_LTTRSSLVD)
m_nLttrsSlvd = MAX_LTTRSSLVD;
Common::sprintf_s(msg, "Letters Solved: %d", m_nLttrsSlvd);
bAssertCheck = (*m_pLttrsSlvd).DisplayString(pDC, msg, FONT_SIZE, FW_BOLD, OPTIONS_COLOR);
ASSERT(bAssertCheck);
pScrollBar->SetScrollPos(m_nLttrsSlvd, true);
} else if (pScrollBar->GetDlgCtrlID() == IDC_TIME) {
switch (nSBCode) {
case SB_LINERIGHT:
m_nTime++;
break;
case SB_PAGERIGHT:
m_nTime += MAX_INDEX_TIME / 5; // want 5 pagerights end to end
break;
case SB_RIGHT:
m_nTime = MAX_INDEX_TIME;
break;
case SB_LINELEFT:
m_nTime--;
break;
case SB_PAGELEFT:
m_nTime -= MAX_INDEX_TIME / 5; // want 5 pagerights end to end
break;
case SB_LEFT:
m_nTime = 0;
break;
case SB_THUMBPOSITION:
case SB_THUMBTRACK:
m_nTime = (int) nPos;
break;
} // end switch
if (m_nTime < MIN_INDEX_TIME)
m_nTime = MIN_INDEX_TIME;
if (m_nTime > MAX_INDEX_TIME)
m_nTime = MAX_INDEX_TIME;
Common::sprintf_s(msg, "Time Limit: %s", m_chTime[m_nTime].c_str());
bAssertCheck = (*m_pTime).DisplayString(pDC, msg, FONT_SIZE, FW_BOLD, OPTIONS_COLOR);
ASSERT(bAssertCheck); // paint the text
pScrollBar->SetScrollPos(m_nTime, true);
} // end if
ReleaseDC(pDC);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
void COptn::OnPaint() {
CDC *pDC;
bool bAssertCheck;
char msg[64];
CBmpDialog::OnPaint();
// Do not call CDialog::OnPaint() for painting messages
pDC = GetDC();
Common::sprintf_s(msg, "Letters Solved: %d", m_nLttrsSlvd); // Display Letters Solved stats
bAssertCheck = (*m_pLttrsSlvd).DisplayString(pDC, msg, FONT_SIZE, FW_BOLD, OPTIONS_COLOR);
ASSERT(bAssertCheck);
Common::sprintf_s(msg, "Time: %s", m_chTime[m_nTime].c_str()); // Display Time stats
bAssertCheck = (*m_pTime).DisplayString(pDC, msg, FONT_SIZE, FW_BOLD, OPTIONS_COLOR);
ASSERT(bAssertCheck);
ReleaseDC(pDC);
}
bool COptn::OnEraseBkgnd(CDC *pDC) {
return true;
}
void COptn::OnOK() {
m_nTime = m_nTimeIndex[m_nTime];
ClearDialogImage();
EndDialog(IDOK);
// CDialog::OnOK();
}
void COptn::OnCancel() {
ClearDialogImage();
EndDialog(0);
}
void COptn::ClearDialogImage() {
if (pOKButton != nullptr) { // release the button
delete pOKButton;
pOKButton = nullptr;
}
if (pCancelButton != nullptr) { // release the button
delete pCancelButton;
pCancelButton = nullptr;
}
ValidateRect(nullptr);
}
} // namespace Crypt
} // namespace HodjNPodj
} // namespace Bagel

View 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/>.
*
*/
#ifndef HODJNPODJ_CRYPT_OPTN_H
#define HODJNPODJ_CRYPT_OPTN_H
#include "bagel/hodjnpodj/crypt/resource.h"
#include "bagel/hodjnpodj/hnplibs/cbofdlg.h"
#include "bagel/hodjnpodj/hnplibs/text.h"
namespace Bagel {
namespace HodjNPodj {
namespace Crypt {
#define MIN_LTTRSSLVD 0 // Preferences
#define MAX_LTTRSSLVD 15
#define TIME_TABLE 19
#define MIN_INDEX_TIME 0
#define MAX_INDEX_TIME 18
#define OPTIONS_COLOR RGB(0, 0, 0) // Color of the stats info CText
#define FONT_SIZE 16
#define STAT_BOX_COL 20
#define STAT_BOX_ROW 20
#define STAT_BOX_WIDTH 200
#define STAT_BOX_HEIGHT 20
#define BOX_ROW_OFFSET 48
/////////////////////////////////////////////////////////////////////////////
// COptn dialog
class COptn : public CBmpDialog {
private:
CString m_chTime[TIME_TABLE];
int m_nTimeIndex[TIME_TABLE] = {};
CText *m_pLttrsSlvd = nullptr, *m_pTime = nullptr;
CPalette *pGamePalette = nullptr;
int TimeToIndex(int nTime);
public:
COptn(CWnd* pParent = nullptr, CPalette *pPalette = nullptr, int nLttrsSolvd = false, int nTime = false); // standard constructor
~COptn();
void ClearDialogImage();
int m_nLttrsSlvd = 0, m_nTime = 0;
// Dialog Data
//{{AFX_DATA(COptn)
enum { IDD = IDD_USER_OPTIONS };
CScrollBar m_LttrsSlvd;
CScrollBar m_Time;
//}}AFX_DATA
// Implementation
protected:
virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
// Generated message map functions
//{{AFX_MSG(COptn)
virtual bool OnInitDialog() override;
afx_msg void OnPaint();
afx_msg bool OnEraseBkgnd(CDC *pDC);
afx_msg void OnHScroll(unsigned int nSBCode, unsigned int nPos, CScrollBar* pScrollBar);
virtual void OnOK() override;
virtual void OnCancel() override;
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
} // namespace Crypt
} // namespace HodjNPodj
} // namespace Bagel
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,171 @@
/* 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_CRYPT_PNT_GRAM_H
#define HODJNPODJ_CRYPT_PNT_GRAM_H
#include "bagel/afxwin.h"
#include "bagel/hodjnpodj/hnplibs/sprite.h"
#include "bagel/hodjnpodj/crypt/globals.h"
namespace Bagel {
namespace HodjNPodj {
namespace Crypt {
#define A 65 // ascii value of 'A'
#define Z 90 // ascii value of 'Z'
#define ALPHABET_BASE 0 // first index to char 'A' of bitmap array
#define ASCII_OFFSET 65 // ascii value of 'A'
//#define ALPHA_RESOURCE_ID 100 // corresp to crypt.rc alphabet id's
//#define USED_RESOURCE_ID 200 // corresp to crypt.rc alphabet id's
#define ALPHA_ROW 0
#define USED_ROW 1
#define REVEAL_ROW 2
#define ALPHA_RESOURCE_ID 100 // corresp to crypt.rc celtest.bmp id
#define HILITE_RESOURCE_ID 300 // corresp to crypt.rc alphabet id's
#define STANDARD_SPACE_LENGTH 10 // lenth of ' ' space char
#define STANDARD_CHAR_WIDTH 11 // width of larges char art bitmap
#define STANDARD_CHAR_HEIGHT 9 // height of typical char art bitmap
#define PUNCTUATION 9 // Number of punctuation symbols of non-standard width
#define ALPHA_TOP_COL 185 // alphabet pos coord
#define ALPHA_TOP_ROW 225
#define ALPHA_BOT_COL 472
#define ALPHA_BOT_ROW 237
#define GRAM_TOP_COL 143 // cryptogram pos coord
#define GRAM_TOP_ROW 253
#define GRAM_BOT_COL 505
#define GRAM_BOT_ROW 462
#define GRAM_LINE_SPACING 2 // space betw each line
#define GRAM_LETTER_SPACING 0 // betw each letter
#define GRAM_LEFT_MARGIN 15 // pixels indention
#define GRAM_RIGHT_MARGIN 0
#define CHAR_TYPE 0x00FF // selects character
#define GRAM_TYPE 0x0000 // part of cryptogram screen section
#define ALPHA_TYPE 0x0100 // alphabet section
#define HILITE_TYPE 0x0200 // high-light section
#define USED_TYPE 0x0400 // indicates alphabet letter was used
#define LIMBO_TYPE 0x0800 // indicates char is in purgatory
#define REVEAL_TYPE 0x1000 // indicates an originally revealed letter
class CCryptRecord;
class CPaintGram {
private: // functions
inline int SetHiLiteTypeOn(int nTypeCode) {
return nTypeCode | HILITE_TYPE;
}
inline int SetHiLiteTypeOff(int nTypeCode) {
return nTypeCode & ~HILITE_TYPE;
}
inline int SetAlphaType(int nTypeCode) {
return nTypeCode | ALPHA_TYPE;
}
inline int SetGramType(int nTypeCode) {
return nTypeCode | GRAM_TYPE;
}
inline int SetUsedTypeOn(int nTypeCode) {
return nTypeCode | USED_TYPE;
}
inline int SetUsedTypeOff(int nTypeCode) {
return nTypeCode & ~USED_TYPE;
}
inline int SetRevealTypeOn(int nTypeCode) {
return nTypeCode | REVEAL_TYPE;
}
inline int SetRevealTypeOff(int nTypeCode) {
return nTypeCode & ~REVEAL_TYPE;
}
private: // vars
CSprite *m_cAlphabet[SYMBOLS] = {}; // Crypt construct objects
CSprite *m_cUsedAlphabet[USED_SYMBOLS] = {};
CSprite *m_cRevealAlphabet[REVEAL_SYMBOLS] = {};
CSprite *m_cHiLite = nullptr;
CSize m_cPos;
CRect m_cGramRegion; // Cryptogram formatting params
CRect m_cAlphaRegion;
const int m_nGramLineSpacing;
const int m_nGramLetterSpacing;
const int m_nGramLeftMargin;
const int m_nGramRightMargin;
const int m_nStandardSpaceLength;
const int m_nStandardCharHeight;
const int m_nStandardCharWidth;
public:
CPaintGram(CDC *pDC);
~CPaintGram();
void InitGramPosition(CCryptRecord *pRec);
int CenterGramVert(CCryptRecord *pRec);
void PaintAlphabet(CDC *pDC);
void PaintGram(CDC *pDC, const char *lpszCryptedGram);
void PaintLine(CDC *pDC, const char *lpszCryptedGram, CSize cPos, int i);
void ReplaceLetter(CDC *pDC, int nOldType, int nNewType);
bool IsHiLiteOn();
int GetHiLiteType(CDC *pDC);
void HiLiteOff(CDC *pDC);
void HiLiteOn(CDC *pDC, int nTypeCode);
void UsedOff(CDC *pDC, int nTypeCode);
void UsedOn(CDC *pDC, int nTypeCode);
void RevealOn(CDC *pDC, int nTypeCode);
void ClearGram(CDC *pDC);
bool IsHiLiteType(int nTypeCode);
bool IsAlphabetType(int nTypeCode);
bool IsGramType(int nTypeCode);
bool IsUsedType(int nTypeCode);
bool IsRevealType(int nTypeCode);
bool IsAlphaChar(char chChar);
bool IsSymbolChar(char chChar);
char IndexToSymb(int nIndex);
int SymbToIndex(char chChar);
char IndexToChar(int nIndex);
int CharToIndex(char chChar);
inline char GetCharType(int nTypeCode) {
return (char)(nTypeCode & CHAR_TYPE);
}
inline int SetLimboTypeOn(int nTypeCode) {
return nTypeCode | LIMBO_TYPE;
}
inline int SetLimboTypeOff(int nTypeCode) {
return nTypeCode & ~LIMBO_TYPE;
}
CSprite *m_cDisplayLetters = nullptr;
};
} // namespace Crypt
} // namespace HodjNPodj
} // namespace Bagel
#endif

View 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/>.
*
*/
#include "bagel/hodjnpodj/hnplibs/stdafx.h"
#include "bagel/hodjnpodj/hnplibs/lzss.h"
#include "bagel/hodjnpodj/crypt/rec.h"
namespace Bagel {
namespace HodjNPodj {
namespace Crypt {
bool CCryptRecord::GetRecord(int nID) {
Common::SeekableReadStream *cryptFile;
char chBuf;
int i;
if ((cryptFile = makeLzssStream(CRYPT_TXT_FILE)) == nullptr)
return false;
cryptFile->seek(nID * RECORD_LEN + 1);
for (i = 0; ; i++) { // Grab cryptogram
if (i >= MAX_GRAM_LEN) {
delete cryptFile;
return false;
}
chBuf = (char)cryptFile->readByte();
if (chBuf == '\\') {
chBuf = (char)cryptFile->readByte();
} else if (chBuf == '\"') {
m_lpszGram[i] = '\0';
break;
}
m_lpszGram[i] = toupper(chBuf);
}
// Advance past dilimiting comma and initial quote mark
cryptFile->skip(2);
for (i = 0; ; i++) {
// Grab source
if (i >= MAX_SOURCE_LEN)
return false;
chBuf = (char)cryptFile->readByte();
if (chBuf == '\\') {
chBuf = (char)cryptFile->readByte();
} else if (chBuf == '\"') {
m_lpszSource[i] = '\0';
break;
}
m_lpszSource[i] = toupper(chBuf);
}
delete cryptFile;
return true;
}
} // namespace Crypt
} // namespace HodjNPodj
} // namespace Bagel

View File

@@ -0,0 +1,64 @@
/* 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_CRYPT_REC_H
#define HODJNPODJ_CRYPT_REC_H
#include "common/file.h"
//#include <lzexpand.h>
namespace Bagel {
namespace HodjNPodj {
namespace Crypt {
#define CRYPT_TXT_FILE "Crypt.lz"
#define CRYPT_RECS (g_engine->isDemo() ? 8 : 200)
#define MAX_GRAM_LEN 512
#define MAX_SOURCE_LEN 128
#define RECORD_LEN 392
class CCryptRecord {
private:
int m_nID = 0;
char m_lpszGram[MAX_GRAM_LEN] = { 0 };
char m_lpszSource[MAX_SOURCE_LEN] = { 0 };
public:
bool GetRecord(int nID);
int GetID() const {
return m_nID;
};
const char *GetGram() const {
return m_lpszGram;
};
const char *GetSource() const {
return m_lpszSource;
};
};
} // namespace Crypt
} // 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_CRYPT_RESOURCE_H
#define HODJNPODJ_CRYPT_RESOURCE_H
namespace Bagel {
namespace HodjNPodj {
namespace Crypt {
//{{NO_DEPENDENCIES}}
// App Studio generated include file.
// Used by CRYPT.RC
//
#define IDI_ICON 143
#define IDD_USER_OPTIONS 865
#define IDC_LTTRSSLVD 870
#define IDC_TIME 875
} // namespace Crypt
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,132 @@
/* 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/crypt/globals.h"
#include "bagel/hodjnpodj/crypt/stats.h"
#include "bagel/hodjnpodj/hodjnpodj.h"
namespace Bagel {
namespace HodjNPodj {
namespace Crypt {
CStats::CStats() {
m_pTime = nullptr;
m_pScore = nullptr;
m_nLettersSolved = GetPrivateProfileInt(
INI_SECTION,
INI_LETTERSSOLVED,
LSLVD_DEFAULT,
INI_FNAME
);
if (m_nLettersSolved < MIN_LSLVD || m_nLettersSolved > MAX_LSLVD)
m_nLettersSolved = LSLVD_DEFAULT;
m_nScore = 0;
m_nTime = GetPrivateProfileInt(
INI_SECTION,
INI_TIME,
TIME_DEFAULT,
INI_FNAME
);
if (m_nTime < MIN_TIME || m_nTime > MAX_TIME)
m_nTime = TIME_DEFAULT;
m_nCountDown = m_nTime;
m_nIsUsedGram = GetPrivateProfileInt(
INI_SECTION,
INI_REC,
REC_DEFAULT,
INI_FNAME
);
}
CStats::~CStats() {
if (m_pScore != nullptr) {
delete m_pScore;
m_pScore = nullptr;
}
if (m_pTime != nullptr) {
delete m_pTime;
m_pTime = nullptr;
}
}
int CStats::ResetGame() {
//char chResetUsedGram;
//char tmpBuf[5];
int nID;
//int i;
/*************************
* Reset crytogram stats. *
*************************/
m_nCountDown = m_nTime;
m_nScore = 0;
do { // Get random unused cryptogram
nID = brand() % CRYPT_RECS;
} while (m_nIsUsedGram == nID);
m_nIsUsedGram = nID; // Mark as used
WritePrivateProfileString(
INI_SECTION,
INI_REC,
Common::String::format("%d", m_nIsUsedGram).c_str(),
INI_FNAME
); // Save used list back
return nID;
}
void CStats::SaveStats(int nLttrsSlvd, int nTime) {
m_nLettersSolved = nLttrsSlvd;
m_nTime = nTime;
WritePrivateProfileString(
INI_SECTION,
INI_LETTERSSOLVED,
Common::String::format("%d", m_nLettersSolved).c_str(),
INI_FNAME
);
WritePrivateProfileString(
INI_SECTION,
INI_TIME,
Common::String::format("%d", m_nTime).c_str(),
INI_FNAME
);
}
} // namespace Crypt
} // namespace HodjNPodj
} // namespace Bagel

View File

@@ -0,0 +1,91 @@
/* 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_CRYPT_STATS_H
#define HODJNPODJ_CRYPT_STATS_H
#include "bagel/hodjnpodj/hnplibs/text.h"
#include "bagel/hodjnpodj/crypt/rec.h"
namespace Bagel {
namespace HodjNPodj {
namespace Crypt {
#define DECIMAL_BASE 10 // used in atoi() c function
#define TIME_LEFT_COL 44 // time left box
#define TIME_LEFT_ROW 30
#define TIME_RIGHT_COL 220
#define TIME_RIGHT_ROW 52
#define SCORE_LEFT_COL 459 // score pos
#define SCORE_LEFT_ROW 30
#define SCORE_RIGHT_COL 574
#define SCORE_RIGHT_ROW 52
#define MINUTE 60
#define STATS_COLOR RGB(255,255,255)
#define INI_FNAME "boffo.ini"
#define INI_SECTION "Cryptograms"
#define INI_LETTERSSOLVED "LettersSolved"
#define LSLVD_DEFAULT 6
#define MIN_LSLVD 0
#define MAX_LSLVD 20
#define INI_TIME "Time"
#define TIME_DEFAULT 180
#define MIN_TIME 15
#define MAX_TIME 601
#define INI_REC "Record"
#define REC_DEFAULT 0
#define STAT_TIMER_ID 987 // wm_timer messages
#define INTERVAL 1000 // one second intervals
#define SCORE_FACTOR 2
#define SCORE_JACKPOT 100
class CStats {
public:
CStats();
~CStats();
void SaveStats(int nLttrsSlvd, int nTime);
int ResetGame();
CText *m_pScore;
CText *m_pTime;
int m_nLettersSolved;
int m_nScore;
int m_nTime;
int m_nCountDown;
char m_nIsUsedGram;
};
} // namespace Crypt
} // namespace HodjNPodj
} // namespace Bagel
#endif

View File

@@ -0,0 +1,22 @@
/* 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"