Skip to content

Commit

Permalink
FITD: Make the project compile with g++ instead of gcc.
Browse files Browse the repository at this point in the history
Allows for starting the transition to C++, but breaks the current
automake-setup, also requires manual linking as last step at the moment.

BUT, the code atleast still runs and renders properly.
  • Loading branch information
somaen committed Feb 3, 2012
1 parent 2a09317 commit 3804056
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 63 deletions.
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ osystem.h osystemSDL.c osystemSDL_GL.c pak.c pak.h polys.c \
renderer.c renderer.h room.c room.h sequence.c save.c save.h screen.c screen.h \
startupMenu.c startupMenu.h systemMenu.c systemMenu.h tatou.c tatou.h \
threadCode.c threadCode.h \
time.c time.h track.c track.h unpack.c unpack.h vars.c vars.h \
time.c ourtime.h track.c track.h unpack.c unpack.h vars.c vars.h \
version.c version.h videoMode.c videoMode.h zv.c zv.h


41 changes: 21 additions & 20 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,22 @@ typedef signed long int s32;

enum enumCVars
{
SAMPLE_PAGE,
BODY_FLAMME,
MAX_WEIGHT_LOADABLE,
TEXTE_CREDITS,
SAMPLE_TONNERRE,
INTRO_DETECTIVE,
INTRO_HERITIERE,
WORLD_NUM_PERSO,
CHOOSE_PERSO,
SAMPLE_CHOC,
SAMPLE_PLOUF,
REVERSE_OBJECT,
KILLED_SORCERER,
LIGHT_OBJECT,
FOG_FLAG,
DEAD_PERSO,
SAMPLE_PAGE = 0,
BODY_FLAMME = 1,
MAX_WEIGHT_LOADABLE = 2,
TEXTE_CREDITS = 3,
SAMPLE_TONNERRE = 4,
INTRO_DETECTIVE = 5,
INTRO_HERITIERE = 6,
WORLD_NUM_PERSO = 7,
CHOOSE_PERSO = 8,
SAMPLE_CHOC = 9,
SAMPLE_PLOUF = 10,
REVERSE_OBJECT = 11,
KILLED_SORCERER = 12,
LIGHT_OBJECT = 13,
FOG_FLAG = 14,
DEAD_PERSO = 15,
JET_SARBACANE,
TIR_CANON,
JET_SCALPEL,
Expand All @@ -105,7 +105,7 @@ enum enumCVars
MATRICE_FORME,
MATRICE_COULEUR,

UNKNOWN_CVAR // for table padding, shouldn't be called !
UNKNOWN_CVAR = -1 // for table padding, shouldn't be called !
};

typedef enum enumCVars enumCVars;
Expand All @@ -118,7 +118,7 @@ extern enumCVars* currentCVarTable;
int getCVarsIdx(enumCVars);

//////////////////////

/*
#define SAMPLE_PAGE 0
#define BODY_FLAMME 1
#define MAX_WEIGHT_LOADABLE 2
Expand All @@ -134,7 +134,7 @@ int getCVarsIdx(enumCVars);
#define KILLED_SORCERER 12
#define LIGHT_OBJECT 13
#define FOG_FLAG 14
#define DEAD_PERSO 15
#define DEAD_PERSO 15*/


//////////////////
Expand Down Expand Up @@ -182,7 +182,7 @@ int triangulate_polygon(int ncontours,int cntr[],double (*vertices)[2],int (*tri
#include "version.h"
#include "cosTable.h"
#include "hqr.h"
#include "time.h"
#include "ourtime.h"
#include "font.h"
#include "aitdBox.h"
#include "save.h"
Expand Down Expand Up @@ -227,6 +227,7 @@ int triangulate_polygon(int ncontours,int cntr[],double (*vertices)[2],int (*tri
#endif
#endif

#include "common/endian.h"
// Disable byte-swapping for now.
#ifdef BIG_ENDIAN
#undef BIG_ENDIAN
Expand Down
2 changes: 1 addition & 1 deletion src/evalVar.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ int getPosRelTable[] = {4,1,8,2,4,1,8,0};
int getMatrix(int param1, int actorIdx, int param2)
{
int matrixWidth;
unsigned char* matrixPtr = HQR_Get(listMatrix,param1);
char* matrixPtr = HQR_Get(listMatrix,param1);

matrixWidth = *matrixPtr;
matrixPtr++;
Expand Down
12 changes: 6 additions & 6 deletions src/floor.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ void loadFloor(int floorNumber)
for(i=0;i<expectedNumberOfRoom;i++)
{
u32 j;
u8* roomData;
u8* hardColData;
u8* sceZoneData;
char* roomData;
char* hardColData;
char* sceZoneData;
roomDataStruct* currentRoomDataPtr;

if(roomDataTable)
Expand Down Expand Up @@ -201,7 +201,7 @@ void loadFloor(int floorNumber)
{
int k;
unsigned int offset;
unsigned char* currentCameraData;
char* currentCameraData;

if(gameId >= AITD3)
{
Expand All @@ -228,7 +228,7 @@ void loadFloor(int floorNumber)
// load cameras
if(offset<cameraDataSize)
{
unsigned char* backupDataPtr;
char* backupDataPtr;

if(gameId<AITD3)
{
Expand Down Expand Up @@ -278,7 +278,7 @@ void loadFloor(int floorNumber)

// load camera zone
{
unsigned char* pZoneData;
char* pZoneData;
int numZones;
int j;

Expand Down
2 changes: 1 addition & 1 deletion src/fmopl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1854,7 +1854,7 @@ static FM_OPL *OPLCreate(int type, int clock, int rate)
#endif

/* allocate memory block */
ptr = malloc(state_size);
ptr = (char*)malloc(state_size);

if (ptr==NULL)
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/hqr.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ char* HQR_Get(hqrEntryStruct* hqrPtr, int index)
foundEntry->lastTimeUsed = timer;
//foundEntry[hqrPtr->numUsedEntry].offset = hqrPtr->maxFreeData - hqrPtr->sizeFreeData;
foundEntry->size = size;
foundEntry->ptr = malloc(size);
foundEntry->ptr = (char*)malloc(size);

ptr = foundEntry->ptr;

Expand Down
13 changes: 8 additions & 5 deletions src/life.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ short int currentInHand = 0;

int numSequenceParam = 0;

//QUICK-fix, prototype this:
void playSequence(int sequenceIdx, int fadeStart, int fadeOutVar);

sequenceParamStruct sequenceParams[NUM_MAX_SEQUENCE_PARAM];

void resetRotateParam(void)
Expand Down Expand Up @@ -1880,16 +1883,16 @@ void processLife(int lifeNum)

loadPakToPtr("ITD_RESS",ressourceIdx,aux);

copyPalette(aux+64000,lpalette);
copyPalette(aux+64000,(char*)lpalette);

if(gameId < AITD3)
convertPaletteIfRequired(lpalette);
convertPaletteIfRequired((unsigned char*)lpalette);

fadeOut(0x10,0);
fadeIn(lpalette);

osystem_setPalette(lpalette);
copyPalette(lpalette,palette);
osystem_setPalette((char*)lpalette);
copyPalette((char*)lpalette,palette);

copyToScreen(aux,screen);

Expand All @@ -1901,7 +1904,7 @@ void processLife(int lifeNum)
process_events();
readKeyboard();

osystem_CopyBlockPhys(screen,0,0,320,200);
osystem_CopyBlockPhys((unsigned char*)screen,0,0,320,200);
osystem_startFrame();
flipScreen();

Expand Down
24 changes: 14 additions & 10 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@

#include "common.h"


char scaledScreen[640*400];

int input5;

// Quickfix:
int fileExists(char* name);

enumCVars AITD1KnownCVars[]=
{
SAMPLE_PAGE,
Expand All @@ -30,7 +34,7 @@ enumCVars AITD1KnownCVars[]=
LIGHT_OBJECT,
FOG_FLAG,
DEAD_PERSO,
-1
UNKNOWN_CVAR
};

enumCVars AITD2KnownCVars[]=
Expand All @@ -52,7 +56,7 @@ enumCVars AITD2KnownCVars[]=
TYPE_INVENTAIRE,
PROLOGUE,
POIGNARD,
-1
UNKNOWN_CVAR
};

enumCVars* currentCVarTable = NULL;
Expand Down Expand Up @@ -393,9 +397,9 @@ void sysInit(void)
int i;

#ifndef PCLIKE
unsigned long int ltime;
// unsigned long int ltime;
#else
time_t ltime;
// time_t ltime;
#endif
FILE* fHandle;

Expand All @@ -406,9 +410,9 @@ void sysInit(void)

//setupVideoMode();

time( &ltime );
// time( &ltime );

srand(ltime);
srand(time(NULL));

if(!initMusicDriver())
{
Expand Down Expand Up @@ -1537,7 +1541,7 @@ void loadCamera(int cameraIdx)
else
{
memcpy(palette,defaultPalette,0x30);
convertPaletteIfRequired(palette);
convertPaletteIfRequired((unsigned char*)palette);
}

osystem_setPalette(palette);
Expand Down Expand Up @@ -5165,9 +5169,9 @@ void throwStoppedAt(int x, int z)
ZVStruct zvLocal;
u8* bodyPtr;

bodyPtr = HQR_Get(listBody,currentProcessedActorPtr->bodyNum);
bodyPtr = (u8*)HQR_Get(listBody,currentProcessedActorPtr->bodyNum);

getZvNormal(bodyPtr,&zvLocal);
getZvNormal((char*)bodyPtr,&zvLocal);

x2 = x;
y2 = (currentProcessedActorPtr->roomY/2000)*2000;
Expand Down Expand Up @@ -5237,7 +5241,7 @@ void throwStoppedAt(int x, int z)
currentProcessedActorPtr->speed = 0;
currentProcessedActorPtr->gamma = 0;

getZvNormal(bodyPtr,&currentProcessedActorPtr->zv);
getZvNormal((char*)bodyPtr,&currentProcessedActorPtr->zv);

currentProcessedActorPtr->zv.ZVX1 += x2;
currentProcessedActorPtr->zv.ZVX2 += x2;
Expand Down
12 changes: 6 additions & 6 deletions src/osystemSDL_GL.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,15 @@ void osystem_init() // that's the constructor of the system dependent
tobj = gluNewTess();

// Set callback functions
gluTessCallback(tobj, GLU_TESS_VERTEX, vertexCallback);
gluTessCallback(tobj, GLU_TESS_BEGIN, glBegin);
gluTessCallback(tobj, GLU_TESS_VERTEX, (GLvoid (*)())vertexCallback);
gluTessCallback(tobj, GLU_TESS_BEGIN, (GLvoid (*)())glBegin);
gluTessCallback(tobj, GLU_TESS_END, glEnd);
gluTessCallback(tobj, GLU_TESS_COMBINE, combineCallback);
gluTessCallback(tobj, GLU_TESS_COMBINE, (GLvoid (*)())combineCallback);

gluTessCallback(tobj, GLU_TESS_VERTEX, vertexCallback);
gluTessCallback(tobj, GLU_TESS_BEGIN, glBegin);
gluTessCallback(tobj, GLU_TESS_VERTEX, (GLvoid (*)())vertexCallback);
gluTessCallback(tobj, GLU_TESS_BEGIN, (GLvoid (*)())glBegin);
gluTessCallback(tobj, GLU_TESS_END, glEnd);
gluTessCallback(tobj, GLU_TESS_COMBINE, combineCallback);
gluTessCallback(tobj, GLU_TESS_COMBINE, (GLvoid (*)())combineCallback);

// init debug font
#if 0
Expand Down
5 changes: 5 additions & 0 deletions src/ourtime.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifndef _OURTIME_H_
#define _OURTIME_H_
void freezeTime(void);
void unfreezeTime(void);
#endif
4 changes: 2 additions & 2 deletions src/pak.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ char* loadPak(char* name, int index)
fread(compressedDataPtr, pakInfo.discSize, 1, fileHandle);
ptr = (char *) malloc(pakInfo.uncompressedSize);

PAK_explode(compressedDataPtr, ptr, pakInfo.discSize, pakInfo.uncompressedSize, pakInfo.info5);
PAK_explode((unsigned char*)compressedDataPtr, (unsigned char*)ptr, pakInfo.discSize, pakInfo.uncompressedSize, pakInfo.info5);

free(compressedDataPtr);
break;
Expand All @@ -262,7 +262,7 @@ char* loadPak(char* name, int index)
fread(compressedDataPtr, pakInfo.discSize, 1, fileHandle);
ptr = (char *) malloc(pakInfo.uncompressedSize);

PAK_deflate(compressedDataPtr, ptr, pakInfo.discSize, pakInfo.uncompressedSize);
PAK_deflate((unsigned char*)compressedDataPtr, (unsigned char*)ptr, pakInfo.discSize, pakInfo.uncompressedSize);

free(compressedDataPtr);
break;
Expand Down
8 changes: 4 additions & 4 deletions src/sequence.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ s32 q=0;
flipOtherPalette(palette);
} */

osystem_setPalette(localPalette);
copyPalette(localPalette,palette);
osystem_setPalette((char*)localPalette);
copyPalette((char*)localPalette,palette);
}
}
else // not first frame
Expand All @@ -227,7 +227,7 @@ s32 q=0;

if(frameSize < 64000) // key frame
{
unapckSequenceFrame(screen+4,aux);
unapckSequenceFrame((unsigned char*)screen+4,(unsigned char*)aux);
}
else // delta frame
{
Expand All @@ -246,7 +246,7 @@ s32 q=0;
// TODO: here, timming management
// TODO: fade management

osystem_CopyBlockPhys(aux,0,0,320,200);
osystem_CopyBlockPhys((unsigned char*)aux,0,0,320,200);
osystem_startFrame();
flipScreen();

Expand Down
2 changes: 1 addition & 1 deletion src/systemMenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void processSystemMenu(void)
flushScreen();

drawSystemMenuLayout(currentSelectedEntry);
osystem_CopyBlockPhys(screen,0,0,320,200);
osystem_CopyBlockPhys((unsigned char*)screen,0,0,320,200);
osystem_startFrame();

if(lightVar1)
Expand Down
5 changes: 0 additions & 5 deletions src/time.h

This file was deleted.

0 comments on commit 3804056

Please sign in to comment.