1 /* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23 #include "ultima/ultima1/u1dialogs/combat.h"
24 #include "ultima/ultima1/game.h"
25 #include "ultima/ultima1/core/resources.h"
26 #include "ultima/ultima1/maps/map.h"
27 #include "ultima/shared/gfx/text_cursor.h"
28 #include "ultima/shared/engine/messages.h"
29
30 namespace Ultima {
31 namespace Ultima1 {
32 namespace U1Dialogs {
33
BEGIN_MESSAGE_MAP(Combat,Dialog)34 BEGIN_MESSAGE_MAP(Combat, Dialog)
35 ON_MESSAGE(KeypressMsg)
36 END_MESSAGE_MAP()
37
38 Combat::Combat(Ultima1Game *game, Shared::Maps::Direction direction, int weaponType,
39 const Common::String weaponName) : FullScreenDialog(game), _direction(direction) {
40 }
41
KeypressMsg(CKeypressMsg * msg)42 bool Combat::KeypressMsg(CKeypressMsg *msg) {
43 if (_direction == Shared::Maps::DIR_NONE) {
44 switch (msg->_keyState.keycode) {
45 case Common::KEYCODE_LEFT:
46 case Common::KEYCODE_KP4:
47 _direction = Shared::Maps::DIR_LEFT;
48 break;
49 case Common::KEYCODE_RIGHT:
50 case Common::KEYCODE_KP6:
51 _direction = Shared::Maps::DIR_RIGHT;
52 break;
53 case Common::KEYCODE_UP:
54 case Common::KEYCODE_KP8:
55 _direction = Shared::Maps::DIR_UP;
56 break;
57 case Common::KEYCODE_DOWN:
58 case Common::KEYCODE_KP2:
59 _direction = Shared::Maps::DIR_DOWN;
60 break;
61 default:
62 nothing();
63 return true;
64 }
65 }
66
67 setDirty(true);
68 return true;
69 }
70
71
draw()72 void Combat::draw() {
73 if (_direction == Shared::Maps::DIR_NONE)
74 drawSelection();
75 }
76
drawSelection()77 void Combat::drawSelection() {
78
79 }
80
nothing()81 void Combat::nothing() {
82 addInfoMsg(Common::String::format(" %s", _game->_res->NOTHING));
83 hide();
84 }
85
86 } // End of namespace U1Dialogs
87 } // End of namespace Ultima1
88 } // End of namespace Ultima
89