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 "common/scummsys.h"
24 #include "access/access.h"
25 #include "access/room.h"
26 #include "access/amazon/amazon_game.h"
27 #include "access/amazon/amazon_player.h"
28 #include "access/amazon/amazon_resources.h"
29 
30 namespace Access {
31 
32 namespace Amazon {
33 
AmazonPlayer(AccessEngine * vm)34 AmazonPlayer::AmazonPlayer(AccessEngine *vm) : Player(vm) {
35 	_game = (AmazonEngine *)vm;
36 }
37 
load()38 void AmazonPlayer::load() {
39 	Player::load();
40 
41 	// Special scene setup for the top-down view when on the Slaver ship
42 	if (_vm->_room->_roomFlag == 3) {
43 		_playerOffset.x = _vm->_screen->_scaleTable1[8];
44 		_playerOffset.y = _vm->_screen->_scaleTable1[11];
45 		_leftDelta = 0;
46 		_rightDelta = 8;
47 		_upDelta = 2;
48 		_downDelta = -2;
49 		_scrollConst = 2;
50 
51 		for (int i = 0; i < _vm->_playerDataCount; ++i) {
52 			_walkOffRight[i] = OVEROFFR[i];
53 			_walkOffLeft[i] = OVEROFFL[i];
54 			_walkOffUp[i] = OVEROFFU[i];
55 			_walkOffDown[i] = OVEROFFD[i];
56 			_walkOffUR[i].x = OVEROFFURX[i];
57 			_walkOffUR[i].y = OVEROFFURY[i];
58 			_walkOffDR[i].x = OVEROFFDRX[i];
59 			_walkOffDR[i].y = OVEROFFDRY[i];
60 			_walkOffUL[i].x = OVEROFFULX[i];
61 			_walkOffUL[i].y = OVEROFFULY[i];
62 			_walkOffDL[i].x = OVEROFFDLX[i];
63 			_walkOffDL[i].y = OVEROFFDLY[i];
64 		}
65 
66 		_vm->_timers[8]._initTm = 7;
67 		_vm->_timers[8]._timer = 7;
68 		++_vm->_timers[8]._flag;
69 
70 		_sideWalkMin = 0;
71 		_sideWalkMax = 5;
72 		_upWalkMin = 12;
73 		_upWalkMax = 17;
74 		_downWalkMin = 6;
75 		_downWalkMax = 11;
76 		_diagUpWalkMin = 0;
77 		_diagUpWalkMax = 5;
78 		_diagDownWalkMin = 0;
79 		_diagDownWalkMax = 5;
80 		_game->_guard->setPosition(Common::Point(56, 190));
81 	} else {
82 		for (int i = 0; i < _vm->_playerDataCount; ++i) {
83 			_walkOffRight[i] = SIDEOFFR[i];
84 			_walkOffLeft[i] = SIDEOFFL[i];
85 			_walkOffUp[i] = SIDEOFFU[i];
86 			_walkOffDown[i] = SIDEOFFD[i];
87 
88 			_walkOffUR[i].x = DIAGOFFURX[i];
89 			_walkOffUR[i].y = DIAGOFFURY[i];
90 			_walkOffDR[i].x = DIAGOFFDRX[i];
91 			_walkOffDR[i].y = DIAGOFFDRY[i];
92 			_walkOffUL[i].x = DIAGOFFULX[i];
93 			_walkOffUL[i].y = DIAGOFFULY[i];
94 			_walkOffDL[i].x = DIAGOFFDLX[i];
95 			_walkOffDL[i].y = DIAGOFFDLY[i];
96 		}
97 	}
98 }
99 
100 } // End of namespace Amazon
101 
102 } // End of namespace Access
103