ICB: Fixed compilation for non SDL target. Fixed unsigned char type compilation.

This commit is contained in:
Pawel Kolodziejski 2020-06-28 21:35:04 +02:00
parent 7895fd4c88
commit 3f7a5d447e
9 changed files with 46 additions and 19 deletions

View File

@ -28,6 +28,8 @@
#ifndef _PX_INC_PROJECT_X_COMMON_H
#define _PX_INC_PROJECT_X_COMMON_H
#include "common/scummsys.h"
#include "px_rccommon.h"
#include "px_rcutypes.h"

View File

@ -39,7 +39,8 @@ typedef const char *cstr;
typedef unsigned int uint; // Short hand for unsigned int
#if CHAR_MAX == 255
#error Char type must be signed - (WATCOM compile with /j option)
typedef signed char int8;
typedef unsigned char uint8;
#else
typedef char int8;
typedef unsigned char uint8;

View File

@ -28,7 +28,9 @@
#include "engines/icb/common/px_rccommon.h"
#include "engines/icb/common/px_windows.h"
#if defined (SDL_BACKEND)
#include <SDL/SDL_joystick.h>
#endif
#include "p4_generic.h"
#include "debug.h"
#include "p4.h"
@ -111,7 +113,9 @@ typedef struct {
class NTJoystickHandler {
private:
int joyThere[16]; // 1 if joystick is plugged in, 0 otherwise
#if defined (SDL_BACKEND)
SDL_Joystick *joy[16];
#endif
JoyInfo cached_joyinfo[16];
public:
@ -147,19 +151,26 @@ NTJoystickHandler::~NTJoystickHandler(void) {
void NTJoystickHandler::Init() {
for (int x = 0; x < QueryJoystick(); x++) {
#if defined (SDL_BACKEND)
SDL_Joystick *j = SDL_JoystickOpen(x);
if (j) {
// there *is* a joystick 'x' installed!
++joyThere[x];
joy[x] = j;
}
#endif
}
UpdateJoystick();
}
int NTJoystickHandler::QueryJoystick(void) {
// if no joystick(s), returns 0 else number of joysticks attached.
return (SDL_NumJoysticks());
return
#if defined (SDL_BACKEND)
(SDL_NumJoysticks());
#else
0;
#endif
}
int normalize(int val, int minval, int maxval) {

View File

@ -25,7 +25,7 @@
*
*/
#ifdef ENABLE_OPENGL
#if defined (SDL_BACKEND) && defined (ENABLE_OPENGL)
#include <stdlib.h>
#include <stdio.h>

View File

@ -30,7 +30,7 @@
#include "gfxstub_dutch.h"
#ifdef ENABLE_OPENGL
#if defined (SDL_BACKEND) && defined (ENABLE_OPENGL)
#include <SDL/SDL_opengl.h>
#endif
@ -43,7 +43,7 @@ public:
int w;
int h;
int bpp;
#ifdef ENABLE_OPENGL
#if defined (SDL_BACKEND) && defined (ENABLE_OPENGL)
GLuint textureId;
#endif
};

View File

@ -31,6 +31,11 @@
#define FORBIDDEN_SYMBOL_EXCEPTION_fread
#define FORBIDDEN_SYMBOL_EXCEPTION_ftell
#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
#define FORBIDDEN_SYMBOL_EXCEPTION_stderr
#define FORBIDDEN_SYMBOL_EXCEPTION_getwd
#define FORBIDDEN_SYMBOL_EXCEPTION_getcwd
#define FORBIDDEN_SYMBOL_EXCEPTION_chdir
#define FORBIDDEN_SYMBOL_EXCEPTION_unlink
#include "engines/icb/common/px_common.h"
@ -134,18 +139,18 @@ int async_loadThread(void *v) {
{
if (rm->async_loading == 1) {
z = rm->async_data.zipped;
fn = new char[1 + strlen(rm->async_data.fn)];
strcpy(fn, rm->async_data.fn);
fn = new int8[1 + strlen(rm->async_data.fn)];
strcpy((char *)fn, rm->async_data.fn);
p = rm->async_data.p;
size = rm->async_data.size;
g_system->unlockMutex(rm->hResManMutex); // ReleaseMutex(rm->hResManMutex);
if (z)
memUncompress(p, fn); // TODO: Use wrapCompressedStream to solve?
memUncompress(p, (const char *)fn); // TODO: Use wrapCompressedStream to solve?
else {
uint32 timer = g_system->getMillis();
in = openDiskFileForBinaryRead(fn);
in = openDiskFileForBinaryRead((char *)fn);
newSize = size;
while (newSize != 0) {
if (newSize > 1024) {
@ -259,7 +264,7 @@ async_PacketType res_man::async_shiftArray() {
// Add item to list
void res_man::async_addFile(const int8 *fn, uint8 *p, int32 size, int32 zipped, int32 memListNo) {
async_PacketType a;
a.fn = fn;
a.fn = (char *)fn;
a.p = p;
a.size = size;
a.zipped = zipped;

View File

@ -25,7 +25,9 @@
*
*/
#if defined (SDL_BACKEND)
#include <SDL/SDL.h>
#endif
#include "engines/icb/sound/direct_sound.h"
#include "engines/icb/sound/music_manager.h"
@ -41,6 +43,7 @@ SpeechManager *g_theSpeechManager = NULL;
FxManager *g_theFxManager = NULL;
bool8 g_TimerOn = TRUE8;
#if defined (SDL_BACKEND)
SDL_TimerID g_timer_id = 0;
Uint32 SoundEngineTimer(Uint32 interval, void *) {
@ -59,11 +62,14 @@ Uint32 SoundEngineTimer(Uint32 interval, void *) {
return interval;
}
#endif
bool8 Init_Sound_Engine() {
// DO THIS FIRST INCASE REST OF INIT FAILS
// Create a timer to poll the sound engine at 100 millisecond intervals
#if defined (SDL_BACKEND)
g_timer_id = SDL_AddTimer(100, SoundEngineTimer, NULL);
#endif
// Initalize the other sections (ie music, fx and speech)
g_theMusicManager = new MusicManager();
@ -74,8 +80,10 @@ bool8 Init_Sound_Engine() {
}
bool8 Close_Sound_Engine() {
#if defined (SDL_BACKEND)
// Kill the sound engine timer
SDL_RemoveTimer(g_timer_id);
#endif
// Destroy the fx manager
if (g_theFxManager) {

View File

@ -38,6 +38,7 @@
namespace ICB {
#if defined (SDL_BACKEND) && defined (ENABLE_OPENGL)
PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffers;
PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffers;
PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebuffer;
@ -51,6 +52,8 @@ PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorage;
GLuint g_RGBFrameBuffer;
#endif
#define FIRST_CLIENT_SURFACE 2
uint32 working_buffer_id;
@ -58,8 +61,6 @@ uint32 bg_buffer_id;
uint32 effect_time; // Time spent doing postprocessing effects (fades ect)
uint32 flipTime;
HWND g_mainHWnd = NULL;
_surface::~_surface() {
// Is the surface there
if (m_dds) {
@ -81,9 +82,6 @@ _surface::_surface() {
}
void _surface_manager::PrintDebugLabel(const char *mess, uint32 c) {
#if 0
HDC dc;
#endif
static int y = 100;
if (mess == NULL) {
@ -106,9 +104,6 @@ void _surface_manager::PrintTimer(char label, uint32 time, uint32 limit) {
0x00ff0000, // 4x - 5x
0x00ffffff }; // 5x +
*/
#if 0
HDC dc;
#endif
static int x = 20;
if (limit == 0) {

View File

@ -32,7 +32,9 @@
#include "engines/icb/common/px_array.h"
#include "engines/icb/common/px_assert.h"
#ifdef ENABLE_OPENGL
#include <SDL/SDL_opengl.h>
#endif
#include "graphics/surface.h"
#include "graphics/pixelbuffer.h"
@ -60,8 +62,10 @@ extern uint32 bg_buffer_id;
// Define this here so we can get rid of the <ddraw.h> include
#define DDBLT_KEYSRC 0x00008000l
#if defined (SDL_BACKEND) && defined (ENABLE_OPENGL)
extern PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebuffer;
extern GLuint g_RGBFrameBuffer;
#endif
class _surface {
public:
@ -80,11 +84,12 @@ class _surface_manager {
private:
Graphics::Surface *sdl_screen;
TinyGL::FrameBuffer *_zb;
#if defined (SDL_BACKEND) && defined (ENABLE_OPENGL)
GLuint RGBFrameBufferTexture;
GLuint RGBFrameBuffer;
GLuint renderBuffer;
GLuint sdlTextureId;
#endif
RECT m_screen_rect; // The screen rectangle
public:
rcAutoPtrArray<_surface> m_Surfaces; // List of client surface