SLUDGE: use scummvm int type instead of uint16/32_t

This commit is contained in:
yinsimei 2017-06-05 19:35:03 +02:00 committed by Eugene Sandulenko
parent a8ccd05315
commit 7430ebe883
16 changed files with 31 additions and 47 deletions

View file

@ -38,10 +38,10 @@ int fontHeight = 0, numFontColours, loadedFontNum;
char *fontOrderString = NULL; char *fontOrderString = NULL;
short fontSpace = -1; short fontSpace = -1;
uint32_t *fontTable = NULL; uint32 *fontTable = NULL;
unsigned int fontTableSize = 0; unsigned int fontTableSize = 0;
#define fontInTable(x) ((x<fontTableSize) ? fontTable[(uint32_t) x] : 0) #define fontInTable(x) ((x<fontTableSize) ? fontTable[(uint32) x] : 0)
extern float cameraZoom; extern float cameraZoom;
@ -56,7 +56,7 @@ bool isInFont(char *theText) {
return false; return false;
int i = 0; int i = 0;
uint32_t c = u8_nextchar(theText, &i); uint32 c = u8_nextchar(theText, &i);
return u8_strchr(fontOrderString, c, &i); return u8_strchr(fontOrderString, c, &i);
} }
@ -67,7 +67,7 @@ int stringLength(char *theText) {
int stringWidth(char *theText) { int stringWidth(char *theText) {
int a = 0; int a = 0;
uint32_t c; uint32 c;
int xOff = 0; int xOff = 0;
if (!fontTableSize) if (!fontTableSize)
@ -84,7 +84,7 @@ int stringWidth(char *theText) {
void pasteString(char *theText, int xOff, int y, spritePalette &thePal) { void pasteString(char *theText, int xOff, int y, spritePalette &thePal) {
sprite *mySprite; sprite *mySprite;
int a = 0; int a = 0;
uint32_t c; uint32 c;
if (!fontTableSize) if (!fontTableSize)
return; return;
@ -101,7 +101,7 @@ void pasteString(char *theText, int xOff, int y, spritePalette &thePal) {
void pasteStringToBackdrop(char *theText, int xOff, int y, spritePalette &thePal) { void pasteStringToBackdrop(char *theText, int xOff, int y, spritePalette &thePal) {
sprite *mySprite; sprite *mySprite;
int a = 0; int a = 0;
uint32_t c; uint32 c;
if (!fontTableSize) if (!fontTableSize)
return; return;
@ -118,7 +118,7 @@ void pasteStringToBackdrop(char *theText, int xOff, int y, spritePalette &thePal
void burnStringToBackdrop(char *theText, int xOff, int y, spritePalette &thePal) { void burnStringToBackdrop(char *theText, int xOff, int y, spritePalette &thePal) {
sprite *mySprite; sprite *mySprite;
int a = 0; int a = 0;
uint32_t c; uint32 c;
if (!fontTableSize) if (!fontTableSize)
return; return;
@ -167,7 +167,7 @@ void setFontColour(spritePalette &sP, byte r, byte g, byte b) {
bool loadFont(int filenum, const char *charOrder, int h) { bool loadFont(int filenum, const char *charOrder, int h) {
int a = 0; int a = 0;
uint32_t c; uint32 c;
delete[] fontOrderString; delete[] fontOrderString;
fontOrderString = copyString(charOrder); fontOrderString = copyString(charOrder);
@ -185,7 +185,7 @@ bool loadFont(int filenum, const char *charOrder, int h) {
fontTableSize++; fontTableSize++;
delete[] fontTable; delete[] fontTable;
fontTable = new uint32_t[fontTableSize]; fontTable = new uint32[fontTableSize];
if (!checkNew(fontTable)) if (!checkNew(fontTable))
return false; return false;

View file

@ -185,7 +185,7 @@ void changeToUserDir() {
} }
} }
uint32_t launch(char *filename) { uint32 launch(char *filename) {
debugOut("Trying to launch: %s\n", filename); debugOut("Trying to launch: %s\n", filename);
if (!fileExists("/usr/bin/xdg-open")) { if (!fileExists("/usr/bin/xdg-open")) {

View file

@ -22,8 +22,6 @@
#ifndef SLUDGE_MOREIO_H #ifndef SLUDGE_MOREIO_H
#define SLUDGE_MOREIO_H #define SLUDGE_MOREIO_H
#include <stdint.h>
namespace Sludge { namespace Sludge {
// Read // Read

View file

@ -20,8 +20,6 @@
* *
*/ */
#include <stdlib.h>
#include "sludge/allfiles.h" #include "sludge/allfiles.h"
#include "sludge/sprites.h" #include "sludge/sprites.h"
#include "sludge/sprbanks.h" #include "sludge/sprbanks.h"

View file

@ -24,7 +24,6 @@
/* These are the functions which have different versions for /* These are the functions which have different versions for
* the different operating systems. * the different operating systems.
*/ */
#include <stdint.h>
namespace Sludge { namespace Sludge {
@ -35,7 +34,7 @@ void msgBox(const char *head, const char *msg);
int msgBoxQuestion(const char *head, const char *msg); int msgBoxQuestion(const char *head, const char *msg);
void changeToUserDir(); void changeToUserDir();
uint32_t launch(char *filename); uint32 launch(char *filename);
bool defaultUserFullScreen(); bool defaultUserFullScreen();

View file

@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
*/ */
#include <stdint.h>
#include <unistd.h>
#include "common/file.h" #include "common/file.h"

View file

@ -22,8 +22,6 @@
#ifndef SLUDGER_H #ifndef SLUDGER_H
#define SLUDGER_H #define SLUDGER_H
#include <stdint.h>
#include "common/file.h" #include "common/file.h"
#include "sludge/allfiles.h" #include "sludge/allfiles.h"
@ -35,8 +33,8 @@ namespace Sludge {
#ifndef _WIN32 #ifndef _WIN32
typedef struct _FILETIME { typedef struct _FILETIME {
uint32_t dwLowDateTime; uint32 dwLowDateTime;
uint32_t dwHighDateTime; uint32 dwHighDateTime;
} FILETIME; } FILETIME;
#endif #endif

View file

@ -49,7 +49,7 @@ soundThing soundCache[MAX_SAMPLES];
int defVol = 128; int defVol = 128;
int defSoundVol = 255; int defSoundVol = 255;
char *loadEntireFileToMemory(Common::SeekableReadStream *inputFile, uint32_t size) { char *loadEntireFileToMemory(Common::SeekableReadStream *inputFile, uint32 size) {
char *allData = new char[size]; char *allData = new char[size];
if (!allData) if (!allData)
return NULL; return NULL;
@ -137,7 +137,7 @@ bool playMOD(int f, int a, int fromTrack) {
stopMOD(a); stopMOD(a);
setResourceForFatal(f); setResourceForFatal(f);
uint32_t length = openFileFromNum(f); uint32 length = openFileFromNum(f);
if (length == 0) if (length == 0)
return NULL; return NULL;
@ -287,7 +287,7 @@ int cacheSound(int f) {
a = findEmptySoundSlot(); a = findEmptySoundSlot();
freeSound(a); freeSound(a);
uint32_t length = openFileFromNum(f); uint32 length = openFileFromNum(f);
if (!length) if (!length)
return -1; return -1;

View file

@ -34,7 +34,7 @@ int defVol = 128;
int defSoundVol = 255; int defSoundVol = 255;
#if 0 #if 0
char *loadEntireFileToMemory(FILE *inputFile, uint32_t size) { char *loadEntireFileToMemory(FILE *inputFile, uint32 size) {
char *allData = new char[size]; char *allData = new char[size];
if (! allData) return NULL; if (! allData) return NULL;
fread(allData, size, 1, inputFile); fread(allData, size, 1, inputFile);

View file

@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
*/ */
#include <stdint.h>
#include <stdio.h>
#if 0 #if 0
#include "AL/alure.h" #include "AL/alure.h"
@ -369,7 +367,7 @@ void playStream(int a, bool isMOD, bool loopy) {
} }
char *loadEntireFileToMemory(Common::SeekableReadStream *inputFile, char *loadEntireFileToMemory(Common::SeekableReadStream *inputFile,
uint32_t size) { uint32 size) {
char *allData = new char[size]; char *allData = new char[size];
if (!allData) if (!allData)
return NULL; return NULL;
@ -390,7 +388,7 @@ bool playMOD(int f, int a, int fromTrack) {
stopMOD(a); stopMOD(a);
setResourceForFatal(f); setResourceForFatal(f);
uint32_t length = openFileFromNum(f); uint32 length = openFileFromNum(f);
if (length == 0) { if (length == 0) {
finishAccess(); finishAccess();
setResourceForFatal(-1); setResourceForFatal(-1);
@ -532,7 +530,7 @@ int cacheSound(int f) {
a = findEmptySoundSlot(); a = findEmptySoundSlot();
freeSound(a); freeSound(a);
uint32_t length = openFileFromNum(f); uint32 length = openFileFromNum(f);
if (! length) return -1; if (! length) return -1;
unsigned char *memImage; unsigned char *memImage;

View file

@ -255,7 +255,7 @@ void showThumbnail(char *filename, int atX, int atY) {
bool skipThumbnail(Common::SeekableReadStream *stream) { bool skipThumbnail(Common::SeekableReadStream *stream) {
thumbWidth = stream->readUint32LE(); thumbWidth = stream->readUint32LE();
thumbHeight = stream->readUint32LE(); thumbHeight = stream->readUint32LE();
uint32_t skippy = thumbWidth; uint32 skippy = thumbWidth;
skippy *= thumbHeight << 1; skippy *= thumbHeight << 1;
stream->seek(skippy, 1); stream->seek(skippy, 1);
return (stream->readByte() == '!'); return (stream->readByte() == '!');

View file

@ -20,8 +20,6 @@
* *
*/ */
#include <stdint.h>
#include "sludge/allfiles.h" #include "sludge/allfiles.h"
#include "sludge/colours.h" #include "sludge/colours.h"
#include "sludge/backdrop.h" #include "sludge/backdrop.h"
@ -147,7 +145,7 @@ void transitionSnapshotBox() {
//---------------------------------------------------- //----------------------------------------------------
#define KK 17 #define KK 17
uint32_t randbuffer[KK][2]; // history buffer uint32 randbuffer[KK][2]; // history buffer
int p1, p2; int p1, p2;
void resetRandW() { void resetRandW() {
@ -199,8 +197,8 @@ void transitionDisolve() {
return; return;
} }
uint32_t n; uint32 n;
uint32_t y; uint32 y;
GLubyte *toScreen = transitionTexture; GLubyte *toScreen = transitionTexture;
GLubyte *end = transitionTexture + (256 * 256 * 4); GLubyte *end = transitionTexture + (256 * 256 * 4);
@ -267,8 +265,8 @@ void transitionTV() {
#if 0 #if 0
if (! transitionTextureName) reserveTransitionTexture(); if (! transitionTextureName) reserveTransitionTexture();
uint32_t n; uint32 n;
uint32_t y; uint32 y;
GLubyte *toScreen = transitionTexture; GLubyte *toScreen = transitionTexture;
GLubyte *end = transitionTexture + (256 * 256 * 4); GLubyte *end = transitionTexture + (256 * 256 * 4);

View file

@ -20,8 +20,6 @@
* *
*/ */
#include <dirent.h>
#include "common/debug.h" #include "common/debug.h"
#include "sludge/debug.h" #include "sludge/debug.h"
@ -164,7 +162,7 @@ bool getSavedGamesStack(stackHandler *sH, char *ext) {
variable newName; variable newName;
newName.varType = SVT_NULL; newName.varType = SVT_NULL;
#if 0
#ifdef _WIN32 #ifdef _WIN32
WCHAR *w_pattern = ConvertToUTF16(pattern); WCHAR *w_pattern = ConvertToUTF16(pattern);
@ -215,7 +213,7 @@ bool getSavedGamesStack(stackHandler *sH, char *ext) {
closedir(dir); closedir(dir);
#endif #endif
#endif
delete[] pattern; delete[] pattern;
pattern = NULL; pattern = NULL;
return true; return true;

View file

@ -21,7 +21,6 @@
*/ */
#ifndef _MSC_VER // Microsoft compiler? #ifndef _MSC_VER // Microsoft compiler?
#include <unistd.h> // For unlink
#else #else
#include <io.h> #include <io.h>
#include <stdio.h> #include <stdio.h>

View file

@ -215,9 +215,9 @@ namespace Sludge {
_wchdir(szAppData); _wchdir(szAppData);
} }
uint32_t launch(char *f) { uint32 launch(char *f) {
WCHAR *w_f = ConvertToUTF16(f); WCHAR *w_f = ConvertToUTF16(f);
uint32_t r = (uint32_t) ShellExecute(hMainWindow, TEXT("open"), w_f, NULL, TEXT("C:\\"), SW_SHOWNORMAL); uint32 r = (uint32) ShellExecute(hMainWindow, TEXT("open"), w_f, NULL, TEXT("C:\\"), SW_SHOWNORMAL);
delete w_f; delete w_f;
return r; return r;
} }

View file

@ -68,7 +68,7 @@ void sortZPal(int *oldpal, int *newpal, int size) {
bool setZBuffer(int y) { bool setZBuffer(int y) {
#if 0 #if 0
int x, n; int x, n;
uint32_t stillToGo = 0; uint32 stillToGo = 0;
int yPalette[16], sorted[16], sortback[16]; int yPalette[16], sorted[16], sortback[16];
killZBuffer(); killZBuffer();