mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 08:25:35 +00:00
TOON: Implement sparkles on English demo options screen
This adds the random sparkle animation on the options screen of the English demo.
This commit is contained in:
parent
389fe44dda
commit
c786c75695
@ -625,35 +625,52 @@ static const MenuFile mainMenuFiles[] = {
|
||||
};
|
||||
|
||||
#define OPTIONMENU_ENTRYCOUNT 27
|
||||
#define OPTIONMENU_ENTRYCOUNT_ENGLISH_DEMO 11
|
||||
static const MenuFile optionMenuFiles[] = {
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_PLAY, "PLAYBUTN.CAF", 0 }, // "Start" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_QUIT, "QUITBUTN.CAF", 0 }, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VIDEO_MODE, "VIDMODE.CAF", 0 }, // "Start" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_TEXTSPEED, "TXTSPEED.CAF", 0 }, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_TEXT, "TEXTDIAL.CAF", 0}, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMESFX, "SFXBUTN.CAF", 0 }, // "Start" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMESFXSLIDER, "SFXSLDR.CAF", 0 }, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMEVOICE, "VOICEBTN.CAF", 0 }, // "Start" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMEVOICESLIDER, "VOICESLD.CAF", 0 }, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMEMUSIC, "MUSICBTN.CAF", 0 }, // "Start" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMEMUSICSLIDER, "MUSICSLD.CAF", 0 }, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_SPEAKERBUTTON, "XTRABUTN.CAF", 0 }, // "Start" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_SPEAKERLEVER, "XTRALEVR.CAF", 0}, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "ANTENNAL.CAF", 6 }, // "Start" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "ANTENNAR.CAF", 6 }, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "BIGREDL.CAF", 6 }, // "Start" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "BIGREDR.CAF", 6 }, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "GRIDLTEL.CAF", 6 }, // "Start" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "GRIDLTER.CAF", 6 }, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "LSPEAKR.CAF", 0 }, // "Start" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "RSPEAKR.CAF", 0 }, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "STARLITL.CAF", 6 }, // "Start" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "STARLITR.CAF", 6 }, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "CHASE1.CAF", 6 }, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "CHASE2.CAF", 6 }, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "CHASE3.CAF", 6 }, // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "CHASE4.CAF", 6 } // "Intro" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_PLAY, "PLAYBUTN.CAF", 0 }, // "Play" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_QUIT, "QUITBUTN.CAF", 0 }, // "Quit" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VIDEO_MODE, "VIDMODE.CAF", 0 }, // "Video mode" slider
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_TEXTSPEED, "TXTSPEED.CAF", 0 }, // "Text speed" slider
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_TEXT, "TEXTDIAL.CAF", 0}, // "Text" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMESFX, "SFXBUTN.CAF", 0 }, // "SFX" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMESFXSLIDER, "SFXSLDR.CAF", 0 }, // "SFX volume" slider
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMEVOICE, "VOICEBTN.CAF", 0 }, // "Voice" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMEVOICESLIDER, "VOICESLD.CAF", 0 }, // "Voice volume" slider
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMEMUSIC, "MUSICBTN.CAF", 0 }, // "Music" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMEMUSICSLIDER, "MUSICSLD.CAF", 0 }, // "Music volume" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_SPEAKERBUTTON, "XTRABUTN.CAF", 0 }, // Right speaker button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_SPEAKERLEVER, "XTRALEVR.CAF", 0}, // Left speaker switch
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "ANTENNAL.CAF", 6 }, // Decorative animation
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "ANTENNAR.CAF", 6 }, // Decorative animation
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "BIGREDL.CAF", 6 }, // Decorative animation
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "BIGREDR.CAF", 6 }, // Decorative animation
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "GRIDLTEL.CAF", 6 }, // Decorative animation
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "GRIDLTER.CAF", 6 }, // Decorative animation
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "LSPEAKR.CAF", 0 }, // Left speaker animation
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "RSPEAKR.CAF", 0 }, // Right speaker animation
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "STARLITL.CAF", 6 }, // Decorative animation
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "STARLITR.CAF", 6 }, // Decorative animation
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "CHASE1.CAF", 6 }, // Decorative animation
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "CHASE2.CAF", 6 }, // Decorative animation
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "CHASE3.CAF", 6 }, // Decorative animation
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "CHASE4.CAF", 6 } // Decorative animation
|
||||
};
|
||||
|
||||
// English demo does not have most of the animations, but it has a random
|
||||
// sparkle effect instead.
|
||||
#define OPTIONMENU_ENTRYCOUNT_ENGLISH_DEMO 12
|
||||
static const MenuFile optionMenuFilesEnglishDemo[] = {
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_PLAY, "PLAYBUTN.CAF", 0 }, // "Play" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_QUIT, "QUITBUTN.CAF", 0 }, // "Quit" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VIDEO_MODE, "VIDMODE.CAF", 0 }, // "Video mode" slider
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_TEXTSPEED, "TXTSPEED.CAF", 0 }, // "Text speed" slider
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_TEXT, "TEXTDIAL.CAF", 0}, // "Text" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMESFX, "SFXBUTN.CAF", 0 }, // "SFX" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMESFXSLIDER, "SFXSLDR.CAF", 0 }, // "SFX volume" slider
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMEVOICE, "VOICEBTN.CAF", 0 }, // "Voice" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMEVOICESLIDER, "VOICESLD.CAF", 0 }, // "Voice volume" slider
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMEMUSIC, "MUSICBTN.CAF", 0 }, // "Music" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_VOLUMEMUSICSLIDER, "MUSICSLD.CAF", 0 }, // "Music volume" button
|
||||
{ OPTIONMENUMASK_EVERYWHERE, OPTIONMENUHOTSPOT_NONE, "SPRKL.CAF", 6 } // Sparkle animation
|
||||
};
|
||||
|
||||
struct MenuEntry {
|
||||
@ -684,16 +701,17 @@ bool ToonEngine::showOptions() {
|
||||
|
||||
// English demo options menu has less animations and no SFX
|
||||
int optionMenuEntryCount = _isEnglishDemo ? OPTIONMENU_ENTRYCOUNT_ENGLISH_DEMO : OPTIONMENU_ENTRYCOUNT;
|
||||
const MenuFile *optionMenuFilesPtr = _isEnglishDemo ? optionMenuFilesEnglishDemo : optionMenuFiles;
|
||||
MenuEntry *entries = new MenuEntry[optionMenuEntryCount];
|
||||
|
||||
for (int entryNr = 0; entryNr < optionMenuEntryCount; entryNr++) {
|
||||
entries[entryNr].menuMask = optionMenuFiles[entryNr].menuMask;
|
||||
entries[entryNr].id = optionMenuFiles[entryNr].id;
|
||||
entries[entryNr].menuMask = optionMenuFilesPtr[entryNr].menuMask;
|
||||
entries[entryNr].id = optionMenuFilesPtr[entryNr].id;
|
||||
entries[entryNr].animation = new Animation(this);
|
||||
entries[entryNr].animation->loadAnimation(optionMenuFiles[entryNr].animationFile);
|
||||
entries[entryNr].animation->loadAnimation(optionMenuFilesPtr[entryNr].animationFile);
|
||||
if (entries[entryNr].id != OPTIONMENUHOTSPOT_NONE)
|
||||
entries[entryNr].rect = entries[entryNr].animation->getRect();
|
||||
entries[entryNr].animateOnFrame = optionMenuFiles[entryNr].animateOnFrame;
|
||||
entries[entryNr].animateOnFrame = optionMenuFilesPtr[entryNr].animateOnFrame;
|
||||
entries[entryNr].animateCurFrame = 0;
|
||||
entries[entryNr].activeFrame = 0;
|
||||
entries[entryNr].playOnce = false;
|
||||
@ -717,6 +735,11 @@ bool ToonEngine::showOptions() {
|
||||
entries[4].activeFrame = 0;
|
||||
}
|
||||
|
||||
// Variables for the English demo sparkle animation.
|
||||
int sparkleDelay = 100;
|
||||
int sparklePosX = 0;
|
||||
int sparklePosY = 0;
|
||||
|
||||
setCursor(0);
|
||||
|
||||
int menuMask = OPTIONMENUMASK_EVERYWHERE;
|
||||
@ -745,6 +768,24 @@ bool ToonEngine::showOptions() {
|
||||
|
||||
for (int entryNr = 0; entryNr < optionMenuEntryCount; entryNr++) {
|
||||
if (entries[entryNr].menuMask & menuMask) {
|
||||
int animPosX = 0;
|
||||
int animPosY = 0;
|
||||
if (_isEnglishDemo && entryNr == 11) {
|
||||
// Special handling for the sparkles in the English demo.
|
||||
if (sparkleDelay > 0) {
|
||||
// Don't show the next sparkle until the delay has
|
||||
// counted down.
|
||||
sparkleDelay--;
|
||||
continue;
|
||||
} else if (entries[entryNr].animateCurFrame == 0 && entries[entryNr].activeFrame == 0) {
|
||||
// Start of a new sparkle animation. Generate a
|
||||
// random position on the screen.
|
||||
sparklePosX = randRange(0, 639 - entries[entryNr].animation->getWidth());
|
||||
sparklePosY = randRange(0, 399 - entries[entryNr].animation->getHeight());
|
||||
}
|
||||
animPosX = sparklePosX;
|
||||
animPosY = sparklePosY;
|
||||
}
|
||||
if (entries[entryNr].animateOnFrame) {
|
||||
entries[entryNr].animateCurFrame++;
|
||||
if (entries[entryNr].animateOnFrame <= entries[entryNr].animateCurFrame) {
|
||||
@ -758,12 +799,16 @@ bool ToonEngine::showOptions() {
|
||||
if (entryNr == 20 && entries[entryNr].animateOnFrame > 0) {
|
||||
playSFX(-3, 128);
|
||||
}
|
||||
if (_isEnglishDemo && entryNr == 11)
|
||||
// Sparkle animation has finished. Generate
|
||||
// a random delay until the next sparkle.
|
||||
sparkleDelay = randRange(0, 100);
|
||||
}
|
||||
entries[entryNr].animateCurFrame = 0;
|
||||
}
|
||||
}
|
||||
int32 frameNr = entries[entryNr].activeFrame;
|
||||
entries[entryNr].animation->drawFrame(*_mainSurface, frameNr, 0, 0);
|
||||
entries[entryNr].animation->drawFrame(*_mainSurface, frameNr, animPosX, animPosY);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user