1 /* ResidualVM - A 3D game interpreter
2  *
3  * ResidualVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the AUTHORS
5  * file distributed with this source distribution.
6  *
7  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25  *
26  */
27 
28 #include "engines/icb/p4.h"
29 #include "engines/icb/common/px_common.h"
30 #include "engines/icb/debug.h"
31 #include "engines/icb/protocol.h"
32 #include "engines/icb/res_man.h"
33 #include "engines/icb/global_objects.h"
34 
35 namespace ICB {
36 
FetchAnimHeader(uint8 * animFile)37 _animHeader *FetchAnimHeader(uint8 *animFile) {
38 	return (_animHeader *)(animFile + sizeof(_standardHeader));
39 }
40 
FetchCdtEntry(uint8 * animFile,uint16 frameNo)41 _cdtEntry *FetchCdtEntry(uint8 *animFile, uint16 frameNo) {
42 	_animHeader *animHead;
43 
44 	animHead = FetchAnimHeader(animFile);
45 
46 	return (_cdtEntry *)((uint8 *)animHead + sizeof(_animHeader) + frameNo * sizeof(_cdtEntry));
47 }
48 
FetchFrameHeader(uint8 * animFile,uint16 frameNo)49 _frameHeader *FetchFrameHeader(uint8 *animFile, uint16 frameNo) {
50 	// required address = (address of the start of the anim header) + frameOffset
51 	return (_frameHeader *)(animFile + sizeof(_standardHeader) + (FetchCdtEntry(animFile, frameNo)->frameOffset));
52 }
53 
54 } // End of namespace ICB
55