aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/goblin_v3.cpp
blob: 6c250ef3964e4897c9cf63fb66997a59f2300d94 (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2004 Ivan Dubrov
 * Copyright (C) 2004-2006 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * $URL$
 * $Id$
 *
 */

#include "gob/gob.h"
#include "gob/goblin.h"
#include "gob/mult.h"

namespace Gob {

Goblin_v3::Goblin_v3(GobEngine *vm) : Goblin_v2(vm) {
}

bool Goblin_v3::isMovement(int8 state) {
	if ((state >= 0) && (state < 8))
		return true;
	if ((state >= 40) && (state < 44))
		return true;
	if ((state == 26) || (state == 27))
		return true;
	if ((state == 38) || (state == 39))
		return true;

	return false;
}

void Goblin_v3::advMovement(Mult::Mult_Object *obj, int8 state) {
	switch (state) {
	case 0:
		obj->goblinX--;
		break;

	case 1:
		obj->goblinX--;
		obj->goblinY--;
		break;

	case 2:
	case 26:
	case 38:
		obj->goblinY--;
		break;

	case 3:
		obj->goblinX++;
		obj->goblinY--;
		break;

	case 4:
		obj->goblinX++;
		break;

	case 5:
		obj->goblinX++;
		obj->goblinY++;
		break;

	case 6:
	case 27:
	case 39:
		obj->goblinY++;
		break;

	case 7:
		obj->goblinX--;
		obj->goblinY++;
		break;

	case 40:
		obj->goblinX--;
		obj->goblinY -= 2;
		break;

	case 41:
		obj->goblinX--;
		obj->goblinY += 2;
		break;

	case 42:
		obj->goblinX++;
		obj->goblinY -= 2;
		break;

	case 43:
		obj->goblinX++;
		obj->goblinY += 2;
		break;
	}
}

} // End of namespace Gob