cleaning up scummsys.h a bit (in preparation of using configure eventually). Most notable, uint32 etc. will be 'unsigned int' not 'unsigned long'. Except for 16 bit systems that should be right, and configure will replace this by a proper check for data type sizes anyway

svn-id: r5290
This commit is contained in:
Max Horn 2002-10-23 14:02:46 +00:00
parent 4585debc18
commit 7a58ae782e
5 changed files with 431 additions and 440 deletions

View file

@ -18,11 +18,14 @@
* $Header$
*
*/
#ifndef __SCUMMSYS_H_
#define __SCUMMSYS_H_
#ifndef SCUMMSYS_H
#define SCUMMSYS_H
#include <stdlib.h>
// TODO - use config.h, generated by configure
//#include "config.h"
#if defined(HAVE_NO_BOOL)
typedef int bool;
const bool true(1), false(0);
@ -93,7 +96,7 @@ typedef signed long int32;
#ifdef X11_BACKEND
/* You need to set those manually */
#define SCUMM_LITTLE_ENDIAN
// #define SCUMM_LITTLE_ENDIAN
/* #define SCUMM_NEED_ALIGNMENT */
#else
@ -113,26 +116,21 @@ typedef signed long int32;
#define FORCEINLINE inline
#define CDECL
#ifndef CONFIG_H
typedef unsigned char byte;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint;
typedef unsigned int uint32;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
#endif
# if defined(__DECCXX) // Assume alpha architecture
# define INVERSE_MKID
# define SCUMM_NEED_ALIGNMENT
typedef unsigned int uint32;
typedef signed int int32;
# else
typedef unsigned long uint32;
typedef signed long int32;
# endif
@ -153,7 +151,7 @@ typedef signed long int32;
#include "macos.h"
#define scumm_stricmp strcmp
#define scumm_stricmp strcmp// FIXME - this is definitly wrong. Try strcasecmp?
#define CHECK_HEAP
#define SCUMM_BIG_ENDIAN
@ -208,6 +206,7 @@ typedef signed long int32;
#define NORETURN
#endif
#define main morphos_main
#elif defined(__DC__)
#define scumm_stricmp strcasecmp
@ -241,11 +240,6 @@ typedef signed long int32;
#if defined(SCUMM_LITTLE_ENDIAN)
//#if defined(SCUMM_NEED_ALIGNMENT)
//#error Little endian processors that need alignment is not implemented
//#endif
#define PROTO_MKID(a) SWAP_BYTES(a)
#define PROTO_MKID_BE(a) (a & 0xffffffff)
@ -351,6 +345,7 @@ uint32 FORCEINLINE READ_BE_UINT32_UNALIGNED(void *ptr) {
#define TO_BE_32(a) (a)
#define TO_BE_16(a) (a)
#else
#error No endianness defined
@ -358,13 +353,9 @@ uint32 FORCEINLINE READ_BE_UINT32_UNALIGNED(void *ptr) {
#endif
#ifdef NEED_STRDUP
char *strdup(const char *s);
#endif
/* Initialized operator new */
void * operator new(size_t size);
void operator delete(void *ptr);
#endif

View file

@ -159,7 +159,7 @@ void Scumm::readRoomsOffsets()
_fileHandle.seek(16, SEEK_SET);
} else {
_fileHandle.seek(12, SEEK_SET); // Directlry searching for the room offset block would be more generic...
_fileHandle.seek(12, SEEK_SET); // Directly searching for the room offset block would be more generic...
}
num = _fileHandle.readByte();
@ -730,7 +730,7 @@ int Scumm::readSoundResource(int type, int idx)
_fileHandle.read(createResource(type, idx, total_size), total_size - 8);
return 1;
} else {
fprintf(stderr, "WARNING: Unrecognized base tag 0x%08lx in sound %d\n", basetag, idx);
fprintf(stderr, "WARNING: Unrecognized base tag 0x%08x in sound %d\n", basetag, idx);
}
res.roomoffs[type][idx] = 0xFFFFFFFF;
return 0;
@ -1483,7 +1483,7 @@ void Scumm::resourceStats()
}
}
printf("Total allocated size=%ld, locked=%ld(%ld)\n", _allocatedSize, lockedSize, lockedNum);
printf("Total allocated size=%d, locked=%d(%d)\n", _allocatedSize, lockedSize, lockedNum);
}
void Scumm::heapClear(int mode)

View file

@ -111,7 +111,7 @@ bool ScummMixer::addChannel(_Channel * c) {
fprintf(stderr, "_nextIndex == %d\n", _nextIndex);
for(i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) {
fprintf(stderr, "channel %d : %p(%ld, %d) %d %d\n", i, _channels[i].chan,
fprintf(stderr, "channel %d : %p(%d, %d) %d %d\n", i, _channels[i].chan,
_channels[i].chan ? _channels[i].chan->getTrackIdentifier() : -1,
_channels[i].chan ? _channels[i].chan->isTerminated() : 1,
_channels[i].first, _channels[i].mixer_index);

View file

@ -253,7 +253,7 @@ void Scumm::CHARSET_1()
if (!(_features & GF_OLD256)) // FIXME
for (i = 0; i < 4; i++)
if (_features & GF_SMALL_HEADER)
charset._colorMap[i] = _charsetData[charset._curId][i - 12];
charset._colorMap[i] = _charsetData[charset._curId][i - 12]; // FIXME - do we really want to access index -12 to -9 ?
else
charset._colorMap[i] = _charsetData[charset._curId][i];
@ -343,7 +343,7 @@ void Scumm::CHARSET_1()
charset._xpos2 -= charset.getStringWidth(0, buffer, 0) >> 1;
}
if (_features & GF_SMALL_HEADER)
charset._ypos2 += getResourceAddress(rtCharset, charset._curId)[18];
charset._ypos2 += getResourceAddress(rtCharset, charset._curId)[30 - 12];
else
charset._ypos2 += getResourceAddress(rtCharset, charset._curId)[30];
charset._disableOffsX = 1;
@ -418,7 +418,7 @@ void Scumm::CHARSET_1()
case 14: {
int oldy;
if (_features & GF_SMALL_HEADER)
oldy = getResourceAddress(rtCharset, charset._curId)[18];
oldy = getResourceAddress(rtCharset, charset._curId)[30 - 12];
else
oldy = getResourceAddress(rtCharset, charset._curId)[30];
@ -426,11 +426,11 @@ void Scumm::CHARSET_1()
buffer += 2;
for (i = 0; i < 4; i++)
if (_features & GF_SMALL_HEADER)
charset._colorMap[i] = _charsetData[charset._curId][i - 12];
charset._colorMap[i] = _charsetData[charset._curId][i - 12]; // FIXME - do we really want to access index -12 to -9 ?
else
charset._colorMap[i] = _charsetData[charset._curId][i];
if (_features & GF_SMALL_HEADER)
charset._ypos2 -= getResourceAddress(rtCharset, charset._curId)[18] - oldy;
charset._ypos2 -= getResourceAddress(rtCharset, charset._curId)[30 - 12] - oldy;
else
charset._ypos2 -= getResourceAddress(rtCharset, charset._curId)[30] - oldy;
break;
@ -596,7 +596,7 @@ void Scumm::drawString(int a)
for (i = 0; i < 4; i++)
if (_features & GF_SMALL_HEADER)
charset._colorMap[i] = _charsetData[charset._curId][i - 12];
charset._colorMap[i] = _charsetData[charset._curId][i - 12]; // FIXME - do we really want to access index -12 to -9 ?
else
charset._colorMap[i] = _charsetData[charset._curId][i];
@ -876,7 +876,7 @@ void Scumm::initCharset(int charsetno)
for (i = 0; i < 0x10; i++)
if (_features & GF_SMALL_HEADER)
charset._colorMap[i] = _charsetData[charset._curId][i - 12];
charset._colorMap[i] = _charsetData[charset._curId][i - 12]; // FIXME - do we really want to access index -12 to -9 ?
else
charset._colorMap[i] = _charsetData[charset._curId][i];
}
@ -1159,7 +1159,7 @@ void Scumm::translateText(char * text, char * trans_buff) {
number[2] = *(text + l + 3);
number[3] = 0;
num = atol(number);
sprintf(num_s, "%ld", num);
sprintf(num_s, "%d", num);
char * buf = _languageBuffer;
pos = 0;

View file

@ -4794,7 +4794,7 @@ void SimonState::playSound(uint sound)
_effects_file->read(&size, 4);
// FIXME - do we really want to read a block of 4 bytes, ignoring endian issues?
printf("FOO %08lx 7 %ld \n", size, size & 0xffffff);
printf("FOO %08x / %d (please report this to Fingolfin)\n", size, size & 0xffffff);
size = size & 0xffffff;
_effects_file->seek(-1, SEEK_CUR);
_effects_file->read(&voc_block_hdr, sizeof(voc_block_hdr));