"How to play" added

This commit is contained in:
2021-04-05 19:07:33 +02:00
parent 36bb6b8fe8
commit 2330820a15
4 changed files with 95 additions and 36 deletions
+65 -29
View File
@@ -183,7 +183,7 @@ void GameDirector::initProg()
mMenu.title->addItem("OPTIONS");
mMenu.title->addItem("HOW TO PLAY", 0, 5);
mMenu.title->addItem("QUIT");
mMenu.title->setDefaultActionWhenCancel(2);
mMenu.title->setDefaultActionWhenCancel(3);
mMenu.title->setBackgroundColor(0x30, 0x30, 0x40, 192);
mMenu.title->setSelectorColor(0xe5, 0x1c, 0x23, 255);
mMenu.title->setSelectorTextColor(0xFF, 0xF1, 0x76);
@@ -684,6 +684,7 @@ void GameDirector::resetTitle(Uint8 subsection)
mTitle.menuVisible = false;
mTitle.nextProgSection = PROG_SECTION_GAME;
mTitle.instructionsCounter = INSTRUCTIONS_COUNTER;
mTitle.instructionsMode = MODE_AUTO;
// Inicializa el bitmap de Coffee
mTitle.coffeeBitmap->init(mTexture[TEXTURE_TITLE].texture, mRenderer);
@@ -4064,7 +4065,7 @@ void GameDirector::renderFade(Uint8 index)
void GameDirector::renderMessages()
{
// GetReady
if (mGame.counter < STAGE_COUNTER)
if ((mGame.counter < STAGE_COUNTER) && (!mDemo.enabled))
{
mGame.getReadyBitmap->setPosX((int)mGame.getReadyBitmapPath[mGame.counter]);
mGame.getReadyBitmap->render();
@@ -4096,8 +4097,8 @@ void GameDirector::renderMessages()
{
if (mDemo.counter % 30 > 14)
{
mText.black->writeCentered(PLAY_AREA_CENTER_X + 1, PLAY_AREA_FIRST_QUARTER_Y + 1, "D E M O");
mText.white->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_FIRST_QUARTER_Y, "D E M O");
mText.blackX2->writeCentered(PLAY_AREA_CENTER_X + 2, PLAY_AREA_FIRST_QUARTER_Y + 2, "D E M O");
mText.whiteX2->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_FIRST_QUARTER_Y, "D E M O");
}
}
@@ -4752,8 +4753,7 @@ void GameDirector::runTitle(Uint8 subsection)
mMenu.active->reset();
mMenu.keyPressed = false;
mTitle.section = TITLE_SECTION_INSTRUCTIONS;
//runInstructions(MODE_MANUAL);
//setProgSection(PROG_SECTION_TITLE,TITLE_SECTION_INSTRUCTIONS);
mTitle.instructionsMode = MODE_MANUAL;
break;
case 3: // QUIT
JA_PlaySound(mSound[SOUND_MENU_CANCEL].sound);
@@ -4827,7 +4827,7 @@ void GameDirector::runTitle(Uint8 subsection)
// Sección Instrucciones
if (mTitle.section == TITLE_SECTION_INSTRUCTIONS)
runInstructions(MODE_AUTO);
runInstructions(mTitle.instructionsMode);
}
quitTitle();
@@ -5039,6 +5039,10 @@ void GameDirector::runInstructions(Uint8 mode)
Sprite *sprite = new Sprite();
SDL_Rect srcRect = {0, 0, 16, 16};
bool wannaExit = false;
if (mode == MODE_MANUAL)
mTitle.instructionsCounter = 0;
const SDL_Rect destRect1 = {60, 88 + (16 * 0), 16, 16}; // Disquito
const SDL_Rect destRect2 = {60, 88 + (16 * 1), 16, 16}; // Gavineixon
const SDL_Rect destRect3 = {60, 88 + (16 * 2), 16, 16}; // Pacmar
@@ -5061,8 +5065,13 @@ void GameDirector::runInstructions(Uint8 mode)
if ((mEventHandler->type == SDL_KEYDOWN) || (mEventHandler->type == SDL_JOYBUTTONDOWN))
{
JA_StopMusic();
setProgSection(PROG_SECTION_TITLE);
if (mode == MODE_AUTO)
{
JA_StopMusic();
setProgSection(PROG_SECTION_TITLE);
}
else
wannaExit = true;
}
}
@@ -5070,17 +5079,19 @@ void GameDirector::runInstructions(Uint8 mode)
SDL_SetRenderTarget(mRenderer, mInstructionsSurface);
SDL_SetRenderDrawColor(mRenderer, 0x27, 0x27, 0x36, 255);
SDL_RenderClear(mRenderer);
mText.white->writeCentered(SCREEN_CENTER_X, 8, "OBJECTIVE", 0);
mText.white->writeCentered(SCREEN_CENTER_X, 24, "YOU HAVE TO POP AS MANY", 0);
mText.white->writeCentered(SCREEN_CENTER_X, 34, "BALLOONS AS YOU CAN", 0);
mText.white->writeCentered(SCREEN_CENTER_X, 48, "DIFFICULTY WILL BE INCREASED", 0);
mText.white->writeCentered(SCREEN_CENTER_X, 58, "AS YOU SCORE POINTS", 0);
mText.white->writeCentered(SCREEN_CENTER_X, 75, "ITEMS", 0);
mText.white->writeCenteredAndColored(SCREEN_CENTER_X, 8, "OBJECTIVE", 0, 0xFF, 0x7A, 0x00);
mText.white->writeCentered(SCREEN_CENTER_X, 24, "YOU HAVE TO POP AS MANY");
mText.white->writeCentered(SCREEN_CENTER_X, 34, "BALLOONS AS YOU CAN");
mText.white->writeCentered(SCREEN_CENTER_X, 48, "DIFFICULTY WILL BE INCREASED");
mText.white->writeCentered(SCREEN_CENTER_X, 58, "AS YOU SCORE POINTS");
mText.white->writeCenteredAndColored(SCREEN_CENTER_X, 75, "ITEMS", 0, 0xFF, 0x7A, 0x00);
mText.white->write(84, 92, "1.000 POINTS", 0);
mText.white->write(84, 108, "2.500 POINTS", 0);
mText.white->write(84, 124, "5.000 POINTS", 0);
mText.white->write(84, 140, "TIME STOPPER", 0);
mText.white->write(84, 156, "EXTRA HIT", 0);
if ((mode == MODE_MANUAL) && (mTitle.instructionsCounter % 50 > 14))
mText.white->writeCenteredAndColored(SCREEN_CENTER_X, SCREEN_HEIGHT - 12, "PRESS ANY KEY TO RETURN", 0, 0xFF, 0x7A, 0x00);
// Disquito
sprite->init(destRect1, mTexture[TEXTURE_ITEMS].texture, mRenderer);
@@ -5125,27 +5136,52 @@ void GameDirector::runInstructions(Uint8 mode)
SDL_RenderClear(mRenderer);
// Dibuja los objetos
window.y = std::max(0, SCREEN_HEIGHT - (INSTRUCTIONS_COUNTER - mTitle.instructionsCounter) + 100);
if (mode == MODE_AUTO)
window.y = std::max(0, SCREEN_HEIGHT - (INSTRUCTIONS_COUNTER - mTitle.instructionsCounter) + 100);
else
window.y = 0;
SDL_RenderCopy(mRenderer, mInstructionsSurface, NULL, &window);
// Muestra la pantalla
SDL_RenderPresent(mRenderer);
mTitle.instructionsCounter--;
if (mTitle.instructionsCounter == 0)
// Lógica
if (SDL_GetTicks() - mProg.ticks > mProg.ticksSpeed)
{
resetTitle(TITLE_SECTION_1);
mTitle.section = TITLE_SECTION_3;
mTitle.nextProgSection = PROG_SECTION_LOGO;
// Actualiza el contador de ticks
mProg.ticks = SDL_GetTicks();
// Prepara las variables para la sección 3 del titulo
mTitle.dustBitmapL->setEnabled(false);
mTitle.dustBitmapR->setEnabled(false);
mTitle.menuVisible = true;
mTitle.coffeeBitmap->setPosY(11);
mTitle.crisisBitmap->setPosY(57);
mMenu.title->setSelectorPos(2);
// Modo automático
if (mode == MODE_AUTO)
{
mTitle.instructionsCounter--;
if (mTitle.instructionsCounter == 0)
{
resetTitle(TITLE_SECTION_1);
mTitle.nextProgSection = PROG_SECTION_LOGO;
}
}
// Modo manual
else
{
++mTitle.instructionsCounter %= 60000;
if (wannaExit)
{
resetTitle(TITLE_SECTION_1);
mTitle.section = TITLE_SECTION_3;
mTitle.nextProgSection = PROG_SECTION_LOGO;
// Prepara las variables para la sección 3 del titulo
mTitle.dustBitmapL->setEnabled(false);
mTitle.dustBitmapR->setEnabled(false);
mTitle.menuVisible = true;
mTitle.coffeeBitmap->setPosY(11);
mTitle.crisisBitmap->setPosY(57);
mMenu.title->setSelectorPos(2);
}
}
}
}
delete sprite;