ScummVM API documentation
utilities.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 IMMORTAL_UTIL_H
23 #define IMMORTAL_UTIL_H
24 
25 #include "common/system.h"
26 
27 namespace Immortal {
28 
29 // The source uses nK many times throughout, which seems to be a compiler macro for n * 1024, ie. Kb
30 enum Kilobyte {
31  k1K = 0x400, // 1024
32  k2K = 0x800, // 2048
33  k3K = 0xC00, // 3072
34  k4K = 0x1000, // 4096
35  k6K = 0x1800, // 6144
36  k8K = 0x2000, // 8192
37  k10K = 0x2800, // 10240
38  k16K = 0x4000 // 16384
39 };
40 
41 enum BitMask16 : uint16 {
42  kMaskLow = 0x00FF,
43  kMaskHigh = 0xFF00,
44  kMaskLast = 0xF000,
45  kMaskFirst = 0x000F,
46  kMaskHLow = 0x0F00,
47  kMaskLHigh = 0x00F0,
48  kMaskNeg = 0x8000,
49 };
50 
51 enum BitMask8 : uint8 {
52  kMaskASCII = 0x7F, // The non-extended ASCII table uses 7 bits, this makes a couple of things easier
53  kMask8High = 0xF0,
54  kMask8Low = 0x0F
55 };
56 
57 enum ColourBitMask : uint16 {
58  kMaskRed = 0x0F00,
59  kMaskGreen = 0x00F0,
60  kMaskBlue = 0x000F
61 };
62 
63 enum ChrMask : uint16 {
64  kChr0 = 0x0000,
65  kChrL = 0x0001,
66  kChrR = 0xFFFF,
67  kChrLD = 0x0002,
68  kChrRD = 0xFFFE
69 };
70 
71 enum Screen { // These are constants that are used for defining screen related arrays
72  kResH = 320,
73  kResV = 200,
74  kMaxSprites = 32, // Number of sprites allowed at once
75  kViewPortCW = 256 / 64,
76  kViewPortCH = 128 / kMaxSprites,
77  kMaxDrawItems = kViewPortCH + 1 + kMaxSprites,
78  kMaxSpriteAbove = 48, // Maximum sprite extents from center
79  kMaxSpriteBelow = 16,
80  kMaxSpriteLeft = 16,
81  kMaxSpriteRight = 16
82 };
83 
84 namespace Utilities {
85 
86 // Other
87 void delay(int j); // Delay engine by j jiffies (from driver originally, but makes more sense grouped with misc)
88 void delay4(int j); // || /4
89 void delay8(int j); // || /8
90 bool inside(uint8 dist, uint8 centX, uint8 centY, uint8 pointX, uint8 pointY);
91 bool insideRect(uint8 rectX, uint8 rectY, uint8 w, uint8 h, uint8 pointX, uint8 pointY);
92 
93 } // namespace Utilities
94 
95 } // namespace Immortal
96 
97 #endif
Definition: definitions.h:25
Definition: atari-screen.h:60