ScummVM API documentation
m4_types.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 M4_M4_TYPES_H
23 #define M4_M4_TYPES_H
24 
25 #include "common/scummsys.h"
26 
27 namespace M4 {
28 
29 #define MAX_STRING_LEN 144
30 #define MAX_FILENAME_SIZE 144
31 #define MIN_VIDEO_X 0
32 #define MIN_VIDEO_Y 0
33 #define MAX_VIDEO_X 639
34 #define MAX_VIDEO_Y 479
35 #define VIDEO_W 640
36 #define VIDEO_H 480
37 
38 typedef void *Ptr;
39 typedef void *Handle;
40 
45 typedef intptr frac16;
46 
47 typedef uint32 ulong;
48 
49 enum {
50  TRIG_INV_CLICK = 32000,
51  TRIG_RESTORE_GAME
52 };
53 
54 struct Buffer {
55  int32 w = 0;
56  int32 h = 0;
57  uint8 *data = nullptr;
58  uint8 encoding = 0;
59  int32 stride = 0;
60 
61  constexpr Buffer() = default;
62  constexpr Buffer(int32 _w, int32 _h, uint8 *_data, uint8 _encoding, int32 _stride) : w(_w), h(_h), data(_data), encoding(_encoding), stride(_stride) {}
63 
64  uint8 *getBasePtr(int x, int y) {
65  return data + y * w + x;
66  }
67  const uint8 *getBasePtr(int x, int y) const {
68  return data + y * w + x;
69  }
70 };
71 
72 struct token {
73  char *sym_name = nullptr;
74  int32 tag = 0;
75 };
76 
77 #include "common/pack-start.h" // START STRUCT PACKING
78 struct RGB8 {
79  byte r = 0, g = 0, b = 0;
80 
81  constexpr RGB8() = default;
82  constexpr RGB8(const byte red, const byte green, const byte blue) : r(red), g(green), b(blue) {}
83 } PACKED_STRUCT;
84 #include "common/pack-end.h" // END STRUCT PACKING
85 
86 typedef void (*FuncPtr_v_vv)(void *, void *);
87 
88 typedef FuncPtr_v_vv M4CALLBACK;
89 
90 } // namespace M4
91 
92 #endif
intptr frac16
Definition: m4_types.h:45
Definition: m4_types.h:78
Definition: m4_types.h:54
Definition: database.h:28
Definition: m4_types.h:72