Skip to content

Commit

Permalink
improve includes and fix demo crash
Browse files Browse the repository at this point in the history
  • Loading branch information
jmimu committed Aug 18, 2017
1 parent d8f29cb commit fb5f44d
Show file tree
Hide file tree
Showing 54 changed files with 329 additions and 92 deletions.
6 changes: 4 additions & 2 deletions TODO.org
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

*** High priority
- change all unsigned to uXX?
- minimize includes (not everything in common.h)
- make types.h instead of redefining u8 in each h of PakEdit

*** Low priority
Expand All @@ -19,6 +18,7 @@

** Crashs


*** Demo AITD1 64 bits
Thread 1 "fitd" received signal SIGSEGV, Segmentation fault.
processAnimRotation (bodyPtr=bodyPtr@entry=0x7fffffffd948, bp=bp@entry=1, bx=bx@entry=15) at anim.c:261
Expand All @@ -31,8 +31,10 @@

When is bodyPtr filled with 32 pointers? How is it working in 64 bits?

*** Demo AITD1 32 bit
*** Demo AITD1 64/32 bits : Fixed
Unsupported ZV type in copyObjectToActor
if was a problem in initEngine when fixing maxObjects = 300 for AITD1.
only 291 objects where read in file, I initialized 300 objects before reading

*** selectHero
Crash in
Expand Down
1 change: 0 additions & 1 deletion fitd.pro
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ HEADERS += \
src/evalVar.h \
src/debugger.h \
src/debugFont.h \
src/cosTable.h \
src/common.h \
src/bmp.h \
src/animAction.h \
Expand Down
3 changes: 3 additions & 0 deletions src/actorList.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#include "actorList.h"
#include "common.h"
#include "vars.h"
#include "main.h"

int sortCompareFunction(const void* param1, const void* param2)
{
Expand Down
3 changes: 3 additions & 0 deletions src/aitdBox.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#include "aitdBox.h"
#include "common.h"
#include "vars.h"
#include "main.h"

void drawPartOfAITDBox(int left, int top, int index, u8* gfxData)
{
Expand Down
4 changes: 4 additions & 0 deletions src/anim.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#include "anim.h"
#include "common.h"
#include "vars.h"
#include "main.h"
#include "hqr.h"

int initAnimInBody(int frame, u8* anim, u8* body)
{
Expand Down
7 changes: 7 additions & 0 deletions src/anim.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#ifndef _ANIM_
#define _ANIM_

#include "types.h"

int anim(int animNum,int arg_2, int arg_4);
int initAnimInBody(int frame, u8 *anim, u8 *body);
short int setInterAnimObjet(int frame, u8* animPtr, u8* bodyPtr);
short int getAnimParam(u8* animPtr);
void initBufferAnim(u8 *buffer, u8 *bodyPtr);


#endif
7 changes: 7 additions & 0 deletions src/animAction.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#include "animAction.h"
#include "common.h"
#include "vars.h"
#include "main.h"
#include "life.h"
#include "hqr.h"
#include "tatou.h"
#include "zv.h"

void processAnimAction(void)
{
Expand Down
10 changes: 5 additions & 5 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,18 @@
#define ASSERT_PTR(exp)
#endif

/*
#ifdef USE_GL
#include <GL/gl.h> // Header File For The OpenGL32 Library
#include <GL/glu.h> // Header File For The GLu32 Library
//#include <gl\glaux.h> // Header File For The Glaux Library
#endif
#include <SDL.h>

*/
//////////////// GAME SPECIFIC DEFINES

//#define NUM_MAX_OBJ 300
#define NUM_MAX_OBJ 300
#define NUM_MAX_ACTOR 50
#define NUM_MAX_TEXT 40
#define NUM_MAX_MESSAGE 5
Expand Down Expand Up @@ -122,7 +123,7 @@ int getCVarsIdx(enumCVars);
// temp triangulation stuff
//#include <bool.h>
//#include <geometry.h>
int triangulate_polygon(int ncontours,int cntr[],double (*vertices)[2],int (*triangles)[3]);
/*int triangulate_polygon(int ncontours,int cntr[],double (*vertices)[2],int (*triangles)[3]);
#include "room.h"
#include "vars.h"
#include "main.h"
Expand All @@ -136,7 +137,6 @@ int triangulate_polygon(int ncontours,int cntr[],double (*vertices)[2],int (*tri
#include "renderer.h"
#include "input.h"
#include "version.h"
#include "cosTable.h"
#include "hqr.h"
#include "freezetime.h"
#include "freezetime.h"
Expand Down Expand Up @@ -168,7 +168,7 @@ int triangulate_polygon(int ncontours,int cntr[],double (*vertices)[2],int (*tri
#include "evalVar.h"
#include "osystem.h"

*/

////

Expand Down
2 changes: 1 addition & 1 deletion src/cosTable.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "common.h"

short int cosTable[]={
s16 cosTable[]={
4,
201,
402,
Expand Down
2 changes: 0 additions & 2 deletions src/cosTable.h

This file was deleted.

1 change: 1 addition & 0 deletions src/debugger.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "common.h"
#include "osystem.h"

#ifdef INTERNAL_DEBUGGER

Expand Down
6 changes: 6 additions & 0 deletions src/evalVar.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#include "evalVar.h"

#include "common.h"
#include "vars.h"
#include "hqr.h"
#include "main.h"
#include "tatou.h"

int getPosRelTable[] = {4,1,8,2,4,1,8,0};

Expand Down
4 changes: 4 additions & 0 deletions src/fileAccess.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#include "common.h"
#include "vars.h"
#include "main.h"
#include "pak.h"

// seg 20
void theEnd(int type, char* name)
{
Expand Down
5 changes: 5 additions & 0 deletions src/floor.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#include "floor.h"
#include "common.h"
#include "vars.h"
#include "hqr.h"
#include "pak.h"
#include "fileAccess.h"

u32 etageVar0Size = 0;
u32 numGlobalCamera = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/floor.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _FLOOR_H_
#define _FLOOR_H_

#include "room.h"

extern cameraDataStruct* globalCameraDataTable;
extern u32 etageVar0Size;
extern u32 numGlobalCamera;
Expand Down
3 changes: 3 additions & 0 deletions src/font.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#include "font.h"
#include "common.h"
#include "vars.h"
#include "main.h"

u8* fontVar1 = NULL;
short int fontSm1 = 0;
Expand Down
7 changes: 7 additions & 0 deletions src/font.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#ifndef _FONT_
#define _FONT_

#include "types.h"

void initFont(u8 *fontData, int color);
void initFont2(int var1, int var2);
int computeStringWidth(char* string);
void renderText(int x, int y, u8 *surface, char* string);
void drawSlectedText(int x, int y, int index, int color1, int color2);
void drawText(int x, int y, int index, int color);

#endif
1 change: 1 addition & 0 deletions src/freezetime.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "common.h"
#include "vars.h"

bool timerSaved = false;
unsigned int timerSavedValue = 0;
Expand Down
4 changes: 4 additions & 0 deletions src/hqr.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#include "hqr.h"
#include "common.h"
#include "freezetime.h"
#include "fileAccess.h"
#include "pak.h"

hqrSubEntryStruct* quickFindEntry(int index, int numMax, hqrSubEntryStruct* ptr) // no RE. Original was probably faster
{
Expand Down
4 changes: 4 additions & 0 deletions src/hqr.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#ifndef _HQR_
#define _HQR_

#include "vars.h"
#include "types.h"

u8 *HQR_Get(hqrEntryStruct* hqrPtr, int index);
int printTextSub1(hqrEntryStruct* hqrPtr,int size);
u8 *printTextSub2(hqrEntryStruct* hqrPtr, int index);
Expand Down
6 changes: 5 additions & 1 deletion src/input.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include "common.h"
#include "input.h"
#include <SDL.h>
#include "vars.h"
#include "common.h"
#include "debugger.h"
#include "main.h"

extern float nearVal;
extern float farVal;
Expand Down
10 changes: 10 additions & 0 deletions src/inventory.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
#include "common.h"
#include "vars.h"
#include "aitdBox.h"
#include "font.h"
#include "main.h"
#include "renderer.h"
#include "main.h"
#include "freezetime.h"
#include "tatou.h"
#include "hqr.h"
#include "input.h"

int statusLeft;
int statusTop;
Expand Down
14 changes: 14 additions & 0 deletions src/life.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#include "common.h"
#include "sequence.h"
#include "life.h"
#include "life_2.h"
#include "room.h"
#include "main.h"
#include "renderer.h"
#include "hqr.h"
#include "track.h"
#include "music.h"
#include "evalVar.h"
#include "tatou.h"
#include "pak.h"
#include "input.h"
#include "freezetime.h"
#include "zv.h"

int groundLevel;
short int specialTable[4] = {144, 192, 48, 112};
Expand Down
2 changes: 2 additions & 0 deletions src/life.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _LIFE_
#define _LIFE_

#include "vars.h"

enum enumLifeMacro
{
LM_DO_MOVE = 0,
Expand Down
3 changes: 2 additions & 1 deletion src/lifeMacroTable.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "common.h"
#include "life.h"

enumLifeMacro AITD2LifeMacroTable[] =
{
Expand Down Expand Up @@ -193,4 +194,4 @@ enumLifeMacro AITD1LifeMacroTable[] =
LM_END_SEQUENCE,
LM_SAMPLE_THEN_REPEAT,
LM_WAIT_GAME_OVER,
};
};
Loading

0 comments on commit fb5f44d

Please sign in to comment.