aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress/game/logic.h
blob: 8b7dcef942b8d5ee3e766e8306b86d9c162c686a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#ifndef LASTEXPRESS_LOGIC_H
#define LASTEXPRESS_LOGIC_H

#include "lastexpress/shared.h"

#include "lastexpress/game/entities.h"

#include "lastexpress/eventhandler.h"

#include "common/events.h"

namespace LastExpress {

class LastExpressEngine;

class Action;
class Beetle;
class Debugger;
class Entities;
class Fight;
class SaveLoad;
class State;

class Logic : public EventHandler {
public:
	Logic(LastExpressEngine *engine);
	~Logic();

	void eventMouse(const Common::Event &ev);
	void eventTick(const Common::Event &ev);

	void resetState();
	void gameOver(SavegameType type, uint32 value, SceneIndex sceneIndex, bool showScene) const;
	void playFinalSequence() const;
	void updateCursor(bool redraw = true) const;

	Action 	   *getGameAction()   { return _action; }
	Beetle     *getGameBeetle()   { return _beetle; }
	Entities   *getGameEntities() { return _entities; }
	Fight      *getGameFight()    { return _fight; }
	SaveLoad   *getGameSaveLoad() { return _saveload; }
	State      *getGameState()    { return _state; }

private:
	LastExpressEngine *_engine;

	Action   *_action;          ///< Actions
	Beetle   *_beetle;          ///< Beetle catching
	Entities *_entities;        ///< Entities
	Fight    *_fight;           ///< Fight handling
	SaveLoad *_saveload;        ///< Save & loading
	State    *_state;           ///< Game state

	void switchChapter() const;
	void showCredits() const;

	// Flags & Members
	bool _flagActionPerformed;
	bool _ignoreFrameInterval;
	int _ticksSinceLastSavegame;

	friend class Debugger;
};

} // End of namespace LastExpress

#endif // LASTEXPRESS_LOGIC_H