2005-05-23 02:23:34 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2005 The ScummVM project
|
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SAGA_PUZZLE_H_
|
|
|
|
#define SAGA_PUZZLE_H_
|
|
|
|
|
|
|
|
namespace Saga {
|
|
|
|
|
2005-05-26 09:45:15 +00:00
|
|
|
#define PUZZLE_PIECES 15
|
|
|
|
|
2005-07-15 15:23:19 +00:00
|
|
|
#define PUZZLE_SOUNDS 3622
|
|
|
|
#define PUZZLE_TOOL_SOUNDS (PUZZLE_SOUNDS + 0)
|
|
|
|
#define PUZZLE_HINT_SOUNDS (PUZZLE_SOUNDS + 45)
|
|
|
|
#define PUZZLE_SOLICIT_SOUNDS (PUZZLE_SOUNDS + 57)
|
|
|
|
#define PUZZLE_WHINE_SOUNDS (PUZZLE_SOUNDS + 72)
|
|
|
|
#define PUZZLE_SAKKA_SOUNDS (PUZZLE_SOUNDS + 87)
|
|
|
|
|
2005-05-23 02:23:34 +00:00
|
|
|
class Puzzle {
|
|
|
|
private:
|
2005-05-26 09:45:15 +00:00
|
|
|
enum kRQStates {
|
|
|
|
kRQNoHint = 0,
|
|
|
|
kRQHintRequested = 1,
|
|
|
|
kRQHintRequestedStage2 = 2,
|
|
|
|
kRQSakkaDenies = 3,
|
|
|
|
kRQSkipEverything = 4
|
|
|
|
};
|
|
|
|
|
2005-05-23 02:23:34 +00:00
|
|
|
SagaEngine *_vm;
|
|
|
|
|
|
|
|
bool _solved;
|
|
|
|
bool _active;
|
2005-05-31 01:03:13 +00:00
|
|
|
bool _newPuzzle;
|
|
|
|
bool _sliding;
|
2005-05-23 02:23:34 +00:00
|
|
|
|
2005-05-26 09:45:15 +00:00
|
|
|
kRQStates _hintRqState;
|
|
|
|
int _hintGiver;
|
2005-07-15 15:23:19 +00:00
|
|
|
int _hintSpeaker;
|
2005-05-26 09:45:15 +00:00
|
|
|
int _hintOffer;
|
|
|
|
int _hintCount;
|
|
|
|
int _helpCount;
|
|
|
|
|
|
|
|
int _puzzlePiece;
|
|
|
|
int _piecePriority[PUZZLE_PIECES];
|
|
|
|
|
|
|
|
int _lang;
|
|
|
|
|
2005-05-23 02:23:34 +00:00
|
|
|
public:
|
|
|
|
Puzzle(SagaEngine *vm);
|
|
|
|
|
|
|
|
void execute(void);
|
|
|
|
void exitPuzzle(void);
|
|
|
|
|
|
|
|
bool isSolved(void) { return _solved; }
|
|
|
|
bool isActive(void) { return _active; }
|
|
|
|
|
|
|
|
void handleReply(int reply);
|
2005-05-31 01:03:13 +00:00
|
|
|
void handleClick(Point mousePt);
|
2005-05-23 02:23:34 +00:00
|
|
|
|
|
|
|
void movePiece(Point mousePt);
|
|
|
|
|
|
|
|
private:
|
2005-05-31 01:03:13 +00:00
|
|
|
void initPieceInfo(int i, int16 curX, int16 curY, byte offX, byte offY, int16 trgX,
|
|
|
|
int16 trgY, uint8 flag, uint8 count, Point point0, Point point1,
|
|
|
|
Point point2, Point point3, Point point4, Point point5);
|
|
|
|
|
2005-05-23 02:23:34 +00:00
|
|
|
static void hintTimerCallback(void *refCon);
|
|
|
|
|
2005-05-26 09:45:15 +00:00
|
|
|
void solicitHint(void);
|
|
|
|
|
|
|
|
void initPieces(void);
|
2005-05-31 01:03:13 +00:00
|
|
|
void showPieces(void);
|
|
|
|
void slidePiece(int x1, int y1, int x2, int y2);
|
|
|
|
void dropPiece(Point mousePt);
|
|
|
|
void alterPiecePriority(void);
|
|
|
|
void drawCurrentPiece(void);
|
2005-05-26 09:45:15 +00:00
|
|
|
|
|
|
|
void giveHint(void);
|
|
|
|
void clearHint(void);
|
|
|
|
|
2005-05-31 01:03:13 +00:00
|
|
|
private:
|
2005-05-26 09:45:15 +00:00
|
|
|
struct PieceInfo {
|
|
|
|
int16 curX;
|
|
|
|
int16 curY;
|
|
|
|
byte offX;
|
|
|
|
byte offY;
|
|
|
|
int16 trgX;
|
|
|
|
int16 trgY;
|
|
|
|
uint8 flag;
|
|
|
|
uint8 count;
|
|
|
|
Point point[6];
|
|
|
|
};
|
|
|
|
|
2005-05-31 01:03:13 +00:00
|
|
|
PieceInfo _pieceInfo[PUZZLE_PIECES];
|
|
|
|
int _slidePointX, _slidePointY;
|
2005-07-14 17:46:21 +00:00
|
|
|
Rect _hintBox;
|
2005-05-23 02:23:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Saga
|
|
|
|
|
|
|
|
#endif
|