ScummVM API documentation
utils.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * This code is based on Labyrinth of Time code with assistance of
24  *
25  * Copyright (c) 1993 Terra Nova Development
26  * Copyright (c) 2004 The Wyrmkeep Entertainment Co.
27  *
28  */
29 
30 #ifndef LAB_UTILS_H
31 #define LAB_UTILS_H
32 
33 namespace Lab {
34 
35 class Utils {
36 private:
37  LabEngine *_vm;
38  uint16 _dataBytesPerRow;
39 
43  template<typename T>
44  void unDiff(T *dest, Common::File *sourceFile);
45 
50  template<typename T>
51  void verticalUnDiff(T *dest, Common::File *sourceFile, uint16 bytesPerRow);
52 
53 public:
54  Utils(LabEngine *vm);
55 
57 
62  uint16 scaleX(uint16 x);
63 
68  uint16 scaleY(uint16 y);
69  Common::Rect rectScale(int16 x1, int16 y1, int16 x2, int16 y2);
70 
74  int16 vgaScaleX(int16 x);
75 
79  int16 vgaScaleY(int16 y);
80  Common::Rect vgaRectScale(int16 x1, int16 y1, int16 x2, int16 y2);
81  uint16 svgaCord(uint16 cord);
82  uint16 mapScaleX(uint16 x);
83  uint16 mapScaleY(uint16 y);
84  Common::Rect mapRectScale(int16 x1, int16 y1, int16 x2, int16 y2);
85 
90 
94  void unDiff(byte *newBuf, byte *oldBuf, Common::File *sourceFile, uint16 bytesPerRow, bool isVertical);
95  void runLengthDecode(byte *dest, Common::File *sourceFile);
96  void verticalRunLengthDecode(byte *dest, Common::File *sourceFile, uint16 bytesPerRow);
97  void setBytesPerRow(int num);
98  uint16 getRandom(uint16 max);
99 };
100 
101 
102 } // End of namespace Lab
103 
104 #endif // LAB_UTILS_H
int16 vgaScaleY(int16 y)
int16 vgaScaleX(int16 x)
Definition: random.h:44
Definition: rect.h:144
uint16 scaleX(uint16 x)
Definition: utils.h:35
Definition: anim.h:33
Definition: file.h:47
Definition: rect.h:45
uint16 scaleY(uint16 y)
Definition: lab.h:119
Common::Point vgaUnscale(Common::Point pos)