Commit aceb4015 authored by anotherguest's avatar anotherguest

Updated constants. Updated animation setting reading from game wiki info. Looks correct.

parent 993bd449
/*
*
* scene.h
*
* 3rd February 2009: Created scene.h from parts of scene.c
*
* Part of the OpenJazz project
*
*
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
* the GNU General Public License, version 2.0
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef _SCENE_H
#define _SCENE_H
#include "io/file.h"
#include <SDL/SDL.h>
// Enums
enum
{
ESignatureLength = 0x13,
EScriptStartTag = 0x50,
EAnimationSoundList = 0x4C53,
EAnimationPlayList = 0x4C50
};
/*
*
* scene.h
*
* 3rd February 2009: Created scene.h from parts of scene.c
*
* Part of the OpenJazz project
*
*
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
* the GNU General Public License, version 2.0
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef _SCENE_H
#define _SCENE_H
#include "io/file.h"
#include <SDL/SDL.h>
// Enums
enum
{
ESignatureLength = 0x13,
EScriptStartTag = 0x50,
EAnimationSoundList = 0x4C53,
EAnimationPlayList = 0x4C50,
EAnimationData = 0x4e41
};
// These are the known script types
enum {
ESceneYesNo = 0x23,
ESceneMusic = 0x2A,
ESceneMusic = 0x2A,
ESceneStopMusic = 0x2D,
ESceneFadeType = 0x3F,
ESceneTextBlock = 0x40,
......@@ -73,9 +73,9 @@ enum {
class Font;
class SceneText {
class SceneText {
public:
public:
unsigned char* text;
int alignment;
int fontId;
......@@ -84,14 +84,14 @@ class SceneText {
SDL_Rect textRect;
int extraLineHeight;
int shadowColour;
SceneText ();
~SceneText ();
SceneText ();
~SceneText ();
};
};
class ScenePage {
class ScenePage {
public:
public:
int backgrounds;
int bgIndex[30];
unsigned short int bgX[30];
......@@ -103,37 +103,37 @@ class ScenePage {
int nTexts;
char* musicFile;
int paletteIndex;
int askForYesNo;
int askForYesNo;
int stopMusic;
ScenePage();
~ScenePage();
ScenePage();
~ScenePage();
};
};
class SceneImage {
class SceneImage {
public:
public:
SceneImage* next;
SDL_Surface* image;
int id;
SceneImage (SceneImage* newNext);
~SceneImage ();
SceneImage (SceneImage* newNext);
~SceneImage ();
};
class ScenePalette {
};
class ScenePalette {
public:
ScenePalette *next;
SDL_Color palette[256];
int id;
ScenePalette *next;
SDL_Color palette[256];
int id;
ScenePalette (ScenePalette* newNext);
~ScenePalette ();
};
};
class SceneFont {
public:
......@@ -142,33 +142,33 @@ class SceneFont {
};
class Scene {
class Scene {
private:
SDL_Surface* background;
SceneImage* images;
ScenePalette* palettes;
SDL_Surface* background;
SceneImage* images;
ScenePalette* palettes;
SceneFont fonts[5];
int nFonts;
unsigned short int scriptItems;
unsigned short int dataItems;
signed long int* scriptStarts;
signed long int* dataOffsets;
unsigned short int scriptItems;
unsigned short int dataItems;
signed long int* scriptStarts;
signed long int* dataOffsets;
// Scripts all information needed to render script pages, text etc
ScenePage* pages;
// Scripts all information needed to render script pages, text etc
ScenePage* pages;
void loadScripts (File* f);
void loadData (File* f);
void loadAni (File* f, int dataIndex);
void loadScripts (File* f);
void loadData (File* f);
void loadAni (File* f, int dataIndex);
public:
Scene (const char* fileName);
~Scene ();
int play ();
};
#endif
Scene (const char* fileName);
~Scene ();
int play ();
};
#endif
......@@ -47,7 +47,7 @@ void Scene::loadAni (File *f, int dataIndex) {
type = f->loadShort();
if (type == 0x4C53) { // SL
if (type == EAnimationSoundList) { // SL
/*unsigned short int offset =*/ f->loadShort();
unsigned char noSounds = f->loadChar();
......@@ -60,7 +60,7 @@ void Scene::loadAni (File *f, int dataIndex) {
}
} else if (type == 0x4C50) {// PL
} else if (type == EAnimationPlayList) {// PL
int pos = f->tell();
int nextPos = f->tell();
......@@ -326,7 +326,7 @@ void Scene::loadData (File *f) {
LOG("Data dataLen", dataLen);
// AN
if (dataLen == 0x4e41) {
if (dataLen == EAnimationData) {
LOG("Data Type", "ANI");
loadAni(f, loop);
......@@ -389,7 +389,7 @@ void Scene::loadScripts (File *f) {
/*int bgIndex = 0;*/
int textAlignment = 0;
int textFont = 0;
int textShadow = 0;
int textShadow = -1;
for(loop = 0; loop < scriptItems; loop++) {
......@@ -423,30 +423,30 @@ void Scene::loadScripts (File *f) {
case ESceneYesNo:
{
pages[loop].askForYesNo = 1;
LOG("ESceneYesNo", 1);
}break;
case ESceneStopMusic:
{
pages[loop].stopMusic = 1;
LOG("ESceneStopMusic", 1);
}break;
case ESceneAnimationSetting:
{
signed long int something = f->loadInt();
signed long int something2 = f->loadInt();
LOG("ESceneAnimationSetting1", something);
LOG("ESceneAnimationSetting2", something2);
signed long int loop = f->loadInt();
signed short int speed = f->loadShort();
signed short int graphnum = f->loadShort();
LOG("ESceneAnimationSetting loop", loop);
LOG("ESceneAnimationSetting speed", speed);
LOG("ESceneAnimationSetting graphnum", graphnum);
}
break;
case ESceneAnimationIndex:
{
unsigned char aniIndex = f->loadChar();
LOG("ESceneAnimationIndex", aniIndex);
}
break;
......@@ -604,7 +604,16 @@ void Scene::loadScripts (File *f) {
case ESceneTextShadow:
{
textShadow = f->loadShort();
char enableShadow = f->loadChar();
if(enableShadow) {
textShadow = f->loadChar();
}
else
{
f->loadChar(); // Skip this value since shadows are turned off
textShadow = -1; // Turn off shadow , -1 means no shadow colour
}
LOG("ESceneTextShadow", textShadow);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment