Commit 993bd449 authored by anotherguest's avatar anotherguest

Added support for continue yes/no scene. added to extra controls yes_no (for...

Added support for continue yes/no scene. added to extra controls yes_no (for extended config for ports), defaults to y, n keys.
parent 2bb81bfd
...@@ -52,7 +52,8 @@ Controls::Controls () { ...@@ -52,7 +52,8 @@ Controls::Controls () {
keys[C_ESCAPE].key = SDLK_ESCAPE; keys[C_ESCAPE].key = SDLK_ESCAPE;
keys[C_STATS].key = SDLK_F9; keys[C_STATS].key = SDLK_F9;
keys[C_PAUSE].key = SDLK_p; keys[C_PAUSE].key = SDLK_p;
keys[C_YES].key = SDLK_y;
keys[C_NO].key = SDLK_n;
#if defined(WIZ) || defined(GP2X) #if defined(WIZ) || defined(GP2X)
buttons[C_UP].button = GP2X_BUTTON_UP; buttons[C_UP].button = GP2X_BUTTON_UP;
buttons[C_DOWN].button = GP2X_BUTTON_DOWN; buttons[C_DOWN].button = GP2X_BUTTON_DOWN;
...@@ -77,6 +78,8 @@ Controls::Controls () { ...@@ -77,6 +78,8 @@ Controls::Controls () {
buttons[C_ESCAPE].button = -1; buttons[C_ESCAPE].button = -1;
buttons[C_STATS].button = -1; buttons[C_STATS].button = -1;
buttons[C_PAUSE].button = -1; buttons[C_PAUSE].button = -1;
buttons[C_YES].button = -1;
buttons[C_NO].button = -1;
#endif #endif
buttons[C_SWIM].button = buttons[C_JUMP].button; buttons[C_SWIM].button = buttons[C_JUMP].button;
...@@ -96,6 +99,8 @@ Controls::Controls () { ...@@ -96,6 +99,8 @@ Controls::Controls () {
axes[C_ESCAPE].axis = -1; axes[C_ESCAPE].axis = -1;
axes[C_STATS].axis = -1; axes[C_STATS].axis = -1;
axes[C_PAUSE].axis = -1; axes[C_PAUSE].axis = -1;
axes[C_YES].axis = -1;
axes[C_NO].axis = -1;
for (count = 0; count < CONTROLS; count++) { for (count = 0; count < CONTROLS; count++) {
......
...@@ -43,8 +43,10 @@ ...@@ -43,8 +43,10 @@
#define C_ESCAPE 9 #define C_ESCAPE 9
#define C_STATS 10 #define C_STATS 10
#define C_PAUSE 11 #define C_PAUSE 11
#define C_YES 12
#define C_NO 13
// Size of those arrays // Size of those arrays
#define CONTROLS 12 #define CONTROLS 14
// Time interval // Time interval
#define T_KEY 200 #define T_KEY 200
......
...@@ -88,7 +88,7 @@ SceneText::SceneText() { ...@@ -88,7 +88,7 @@ SceneText::SceneText() {
textRect.y = -1; textRect.y = -1;
extraLineHeight = -1; extraLineHeight = -1;
text = NULL; text = NULL;
shadowColour = 0;
} }
SceneText::~SceneText() { SceneText::~SceneText() {
...@@ -104,7 +104,8 @@ ScenePage::ScenePage() { ...@@ -104,7 +104,8 @@ ScenePage::ScenePage() {
backgrounds = 0; backgrounds = 0;
musicFile = NULL; musicFile = NULL;
paletteIndex = 0; paletteIndex = 0;
askForYesNo = 0;
stopMusic = 0;
} }
ScenePage::~ScenePage() { ScenePage::~ScenePage() {
...@@ -136,7 +137,7 @@ Scene::Scene (const char * fileName) { ...@@ -136,7 +137,7 @@ Scene::Scene (const char * fileName) {
images = NULL; images = NULL;
palettes = NULL; palettes = NULL;
file->seek(0x13, true); // Skip Digital Dimensions header file->seek(ESignatureLength, true); // Skip Digital Dimensions header
signed long int dataOffset = file->loadInt(); //get offset pointer to first data block signed long int dataOffset = file->loadInt(); //get offset pointer to first data block
scriptItems = file->loadShort(); // Get number of script items scriptItems = file->loadShort(); // Get number of script items
...@@ -205,14 +206,23 @@ int Scene::play () { ...@@ -205,14 +206,23 @@ int Scene::play () {
if (loop(NORMAL_LOOP) == E_QUIT) return E_QUIT; if (loop(NORMAL_LOOP) == E_QUIT) return E_QUIT;
if (controls.release(C_ESCAPE)) return E_NONE; if (controls.release(C_ESCAPE) || (controls.release(C_NO) && pages[sceneIndex].askForYesNo)) return E_NONE;
SDL_Delay(T_FRAME); SDL_Delay(T_FRAME);
int upOrLeft = (controls.release(C_UP) || controls.release(C_LEFT)); int upOrLeft = 0;
int downOrRight = 0;
if(pages[sceneIndex].askForYesNo) {
// Should check for Y also
downOrRight = controls.release(C_ENTER) || controls.release(C_YES);;
} else {
upOrLeft = (controls.release(C_UP) || controls.release(C_LEFT));
downOrRight = (controls.release(C_RIGHT) || controls.release(C_DOWN) || controls.release(C_ENTER));
}
if ((sceneIndex > 0 && upOrLeft) || if ((sceneIndex > 0 && upOrLeft) ||
controls.release(C_RIGHT) || controls.release(C_DOWN) || controls.release(C_ENTER) || downOrRight ||
((globalTicks-lastTicks) >= pageTime * 1000 && pageTime != 256 && pageTime != 0)) { ((globalTicks-lastTicks) >= pageTime * 1000 && pageTime != 256 && pageTime != 0)) {
if (upOrLeft) sceneIndex--; if (upOrLeft) sceneIndex--;
......
...@@ -30,11 +30,20 @@ ...@@ -30,11 +30,20 @@
// Enums // Enums
enum
{
ESignatureLength = 0x13,
EScriptStartTag = 0x50,
EAnimationSoundList = 0x4C53,
EAnimationPlayList = 0x4C50
};
// These are the known script types // These are the known script types
enum { enum {
ESceneYesNo = 0x23,
ESceneMusic = 0x2A, ESceneMusic = 0x2A,
ESceneStopMusic = 0x2D,
ESceneFadeType = 0x3F, ESceneFadeType = 0x3F,
ESceneTextBlock = 0x40, ESceneTextBlock = 0x40,
ESceneTextColour = 0x41, ESceneTextColour = 0x41,
...@@ -74,7 +83,7 @@ class SceneText { ...@@ -74,7 +83,7 @@ class SceneText {
int y; int y;
SDL_Rect textRect; SDL_Rect textRect;
int extraLineHeight; int extraLineHeight;
int shadowColour;
SceneText (); SceneText ();
~SceneText (); ~SceneText ();
...@@ -94,7 +103,8 @@ class ScenePage { ...@@ -94,7 +103,8 @@ class ScenePage {
int nTexts; int nTexts;
char* musicFile; char* musicFile;
int paletteIndex; int paletteIndex;
int askForYesNo;
int stopMusic;
ScenePage(); ScenePage();
~ScenePage(); ~ScenePage();
......
...@@ -389,6 +389,7 @@ void Scene::loadScripts (File *f) { ...@@ -389,6 +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;
for(loop = 0; loop < scriptItems; loop++) { for(loop = 0; loop < scriptItems; loop++) {
...@@ -401,7 +402,7 @@ void Scene::loadScripts (File *f) { ...@@ -401,7 +402,7 @@ void Scene::loadScripts (File *f) {
bool textRectValid = false; bool textRectValid = false;
f->seek(scriptStarts[loop], true); // Seek to data start f->seek(scriptStarts[loop], true); // Seek to data start
if (f->loadChar() == 0x50) { // Script tag if (f->loadChar() == EScriptStartTag) { // Script tag
unsigned short int scriptid = f->loadShort(); unsigned short int scriptid = f->loadShort();
LOG("Script id", scriptid); LOG("Script id", scriptid);
...@@ -419,6 +420,14 @@ void Scene::loadScripts (File *f) { ...@@ -419,6 +420,14 @@ void Scene::loadScripts (File *f) {
switch(type) { switch(type) {
case ESceneYesNo:
{
pages[loop].askForYesNo = 1;
}break;
case ESceneStopMusic:
{
pages[loop].stopMusic = 1;
}break;
case ESceneAnimationSetting: case ESceneAnimationSetting:
{ {
...@@ -595,10 +604,8 @@ void Scene::loadScripts (File *f) { ...@@ -595,10 +604,8 @@ void Scene::loadScripts (File *f) {
case ESceneTextShadow: case ESceneTextShadow:
{ {
textShadow = f->loadShort();
unsigned short value = f->loadShort(); LOG("ESceneTextShadow", textShadow);
LOG("ESceneTextVAdjust", value);
} }
break; break;
...@@ -640,7 +647,6 @@ void Scene::loadScripts (File *f) { ...@@ -640,7 +647,6 @@ void Scene::loadScripts (File *f) {
case ESceneTextBlock: case ESceneTextBlock:
{ {
unsigned char datalen = f->loadChar(); unsigned char datalen = f->loadChar();
LOG("Text len", datalen); LOG("Text len", datalen);
...@@ -683,6 +689,7 @@ void Scene::loadScripts (File *f) { ...@@ -683,6 +689,7 @@ void Scene::loadScripts (File *f) {
text->alignment = textAlignment; text->alignment = textAlignment;
text->fontId = textFont; text->fontId = textFont;
text->shadowColour = textShadow;
if(textPosX != -1) { if(textPosX != -1) {
......
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