aboutsummaryrefslogtreecommitdiff
path: root/engines/glk
diff options
context:
space:
mode:
Diffstat (limited to 'engines/glk')
-rw-r--r--engines/glk/adrift/scare.h4
-rw-r--r--engines/glk/level9/detection.cpp10
-rw-r--r--engines/glk/level9/os_glk.h4
-rw-r--r--engines/glk/magnetic/glk.cpp10
-rw-r--r--engines/glk/magnetic/magnetic.cpp2
-rw-r--r--engines/glk/magnetic/magnetic_defs.h16
-rw-r--r--engines/glk/tads/tads2/line_source_file.cpp2
7 files changed, 20 insertions, 28 deletions
diff --git a/engines/glk/adrift/scare.h b/engines/glk/adrift/scare.h
index 04a287229e..f3bdc5a5ec 100644
--- a/engines/glk/adrift/scare.h
+++ b/engines/glk/adrift/scare.h
@@ -47,8 +47,8 @@ typedef long sc_int;
typedef unsigned long sc_uint;
typedef int sc_bool;
-#define BYTE_MAX 0xff
-#define INTEGER_MAX 0x7fff
+enum { BYTE_MAX = 0xff };
+enum { INTEGER_MAX = 0x7fff };
/* Enumerated confirmation types, passed to os_confirm(). */
enum {
diff --git a/engines/glk/level9/detection.cpp b/engines/glk/level9/detection.cpp
index a366bc0f9b..fef1baec46 100644
--- a/engines/glk/level9/detection.cpp
+++ b/engines/glk/level9/detection.cpp
@@ -542,8 +542,8 @@ gln_game_tableref_t GameDetection::gln_gameid_identify_game() {
&& _startData[21] == _startData[23];
length = is_version2
- ? _startData[28] | _startData[29] << BITS_PER_CHAR
- : _startData[0] | _startData[1] << BITS_PER_CHAR;
+ ? _startData[28] | _startData[29] << BITS_PER_BYTE
+ : _startData[0] | _startData[1] << BITS_PER_BYTE;
if (length >= _fileSize)
return nullptr;
@@ -596,7 +596,7 @@ uint16 GameDetection::gln_get_buffer_crc(const void *void_buffer, size_t length,
int bit;
crc = (uint16)index;
- for (bit = 0; bit < BITS_PER_CHAR; bit++)
+ for (bit = 0; bit < BITS_PER_BYTE; bit++)
crc = crc & 1 ? GLN_CRC_POLYNOMIAL ^ (crc >> 1) : crc >> 1;
_crcTable[index] = crc;
@@ -611,11 +611,11 @@ uint16 GameDetection::gln_get_buffer_crc(const void *void_buffer, size_t length,
/* Start with zero in the crc, then update using table entries. */
crc = 0;
for (index = 0; index < length; index++)
- crc = _crcTable[(crc ^ buffer[index]) & BYTE_MAX] ^ (crc >> BITS_PER_CHAR);
+ crc = _crcTable[(crc ^ buffer[index]) & BYTE_MAX] ^ (crc >> BITS_PER_BYTE);
/* Add in any requested NUL padding bytes. */
for (index = 0; index < padding; index++)
- crc = _crcTable[crc & BYTE_MAX] ^ (crc >> BITS_PER_CHAR);
+ crc = _crcTable[crc & BYTE_MAX] ^ (crc >> BITS_PER_BYTE);
return crc;
}
diff --git a/engines/glk/level9/os_glk.h b/engines/glk/level9/os_glk.h
index d617fb37c3..a4880b9a2d 100644
--- a/engines/glk/level9/os_glk.h
+++ b/engines/glk/level9/os_glk.h
@@ -26,8 +26,8 @@
namespace Glk {
namespace Level9 {
-#define BYTE_MAX 0xff
-#define BITS_PER_CHAR 8
+enum { BYTE_MAX = 0xff };
+enum { BITS_PER_BYTE = 8 };
extern bool gln_graphics_enabled;
extern bool gln_graphics_possible;
diff --git a/engines/glk/magnetic/glk.cpp b/engines/glk/magnetic/glk.cpp
index ee4faebdd9..67fed7632b 100644
--- a/engines/glk/magnetic/glk.cpp
+++ b/engines/glk/magnetic/glk.cpp
@@ -289,7 +289,7 @@ glui32 Magnetic::gms_get_buffer_crc(const void *void_buffer, size_t length) {
*/
crc = 0xffffffff;
for (index = 0; index < length; index++)
- crc = crc_table[(crc ^ buf[index]) & BYTE_MAX] ^ (crc >> CHAR_BIT);
+ crc = crc_table[(crc ^ buf[index]) & BYTE_MAX] ^ (crc >> BITS_PER_BYTE);
return crc ^ 0xffffffff;
}
@@ -767,8 +767,8 @@ void Magnetic::gms_graphics_apply_animation_frame(type8 bitmap[],
* even. Here we'll calculate the real width of a mask, and also set a high
* bit for later on.
*/
- mask_width = (((frame_width - 1) / CHAR_BIT) + 2) & (~1);
- mask_hibit = 1 << (CHAR_BIT - 1);
+ mask_width = (((frame_width - 1) / BITS_PER_BYTE) + 2) & (~1);
+ mask_hibit = 1 << (BITS_PER_BYTE - 1);
/*
* Initialize row index components; these are optimizations to avoid the
@@ -808,8 +808,8 @@ void Magnetic::gms_graphics_apply_animation_frame(type8 bitmap[],
type8 mask_byte;
/* Isolate the mask byte, and test the transparency bit. */
- mask_byte = mask[mask_row + (x / CHAR_BIT)];
- if ((mask_byte & (mask_hibit >> (x % CHAR_BIT))) != 0)
+ mask_byte = mask[mask_row + (x / BITS_PER_BYTE)];
+ if ((mask_byte & (mask_hibit >> (x % BITS_PER_BYTE))) != 0)
continue;
}
diff --git a/engines/glk/magnetic/magnetic.cpp b/engines/glk/magnetic/magnetic.cpp
index 00aa540c5f..e768deed41 100644
--- a/engines/glk/magnetic/magnetic.cpp
+++ b/engines/glk/magnetic/magnetic.cpp
@@ -135,7 +135,7 @@ void Magnetic::initializeCRC() {
int bit;
crc = index;
- for (bit = 0; bit < CHAR_BIT; bit++)
+ for (bit = 0; bit < BITS_PER_BYTE; bit++)
crc = crc & 1 ? GMS_CRC_POLYNOMIAL ^ (crc >> 1) : crc >> 1;
crc_table[index] = crc;
diff --git a/engines/glk/magnetic/magnetic_defs.h b/engines/glk/magnetic/magnetic_defs.h
index f2b18c0539..6760569c01 100644
--- a/engines/glk/magnetic/magnetic_defs.h
+++ b/engines/glk/magnetic/magnetic_defs.h
@@ -42,18 +42,10 @@ typedef int16 type16s;
typedef uint32 type32;
typedef int32 type32s;
-#ifndef BYTE_MAX
-#define BYTE_MAX 255
-#endif
-#ifndef CHAR_BIT
-#define CHAR_BIT 8
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX 0xffff
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX 0x7fffffff
-#endif
+enum { BYTE_MAX = 255 };
+enum { BITS_PER_BYTE = 8 };
+enum { UINT16_MAX = 0xffff };
+enum { INT32_MAX = 0x7fffffff };
#define MAX_HINTS 260
#define MAX_HCONTENTS 30000
diff --git a/engines/glk/tads/tads2/line_source_file.cpp b/engines/glk/tads/tads2/line_source_file.cpp
index 1cf90b2fcb..24a7d67643 100644
--- a/engines/glk/tads/tads2/line_source_file.cpp
+++ b/engines/glk/tads/tads2/line_source_file.cpp
@@ -31,7 +31,7 @@ namespace Glk {
namespace TADS {
namespace TADS2 {
-#define BYTE_MAX 0xff
+enum { BYTE_MAX = 0xff };
/* initialize a pre-allocated linfdef, skipping debugger page setup */
void linfini2(mcmcxdef *mctx, linfdef *linf,