Commit aceb4015 authored by anotherguest's avatar anotherguest

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

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