ScummVM API documentation
coord_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#ifndef ULTIMA8_WORLD_COORDUTILS_H
23#define ULTIMA8_WORLD_COORDUTILS_H
24
25#include "ultima/ultima8/ultima8.h"
26
27namespace Ultima {
28namespace Ultima8 {
29
33template<typename T>
34static inline void World_ToUsecodeXY(T &x, T &y) {
35 if (GAME_IS_CRUSADER) {
36 x /= 2;
37 y /= 2;
38 }
39}
40
44template<typename T>
45static inline void World_FromUsecodeXY(T &x, T &y) {
46 if (GAME_IS_CRUSADER) {
47 x *= 2;
48 y *= 2;
49 }
50}
51
55template<typename T>
56static inline T World_ToUsecodeCoord(T v) {
57 if (GAME_IS_CRUSADER)
58 return v / 2;
59 else
60 return v;
61}
62
66template<typename T>
67static inline T World_FromUsecodeCoord(T v) {
68 if (GAME_IS_CRUSADER)
69 return v * 2;
70 else
71 return v;
72}
73
74}
75}
76
77#endif // ULTIMA8_WORLD_COORDUTILS_H