working on text notifications

This commit is contained in:
2021-08-27 22:40:48 +02:00
parent aac11d05aa
commit 3f53ba333b
15 changed files with 263 additions and 320 deletions

View File

@@ -84,6 +84,9 @@ Game::Game(int numPlayers, SDL_Renderer *renderer, std::string *filelist, std::s
Game::~Game()
{
saveScoreFile();
saveDemoFile();
mRenderer = nullptr;
mFileList = nullptr;
mInput[0] = nullptr;
@@ -286,8 +289,7 @@ void Game::init()
mSection.subsection = GAME_SECTION_PLAY_1P;
mMenaceCurrent = 0;
mMenaceThreshold = 0;
//mScore = 0;
mHiScore = 0;
//mHiScore = 0;
mHiScoreAchieved = false;
mCurrentStage = 0;
mStageBitmapCounter = STAGE_COUNTER;
@@ -350,7 +352,7 @@ void Game::init()
mDemo.counter = 0;
// Iniciualiza el objeto para el fundido
mFade->init();
mFade->init(0x27, 0x27, 0x36);
// Inicializa los objetos de texto
mText->init();
@@ -2131,25 +2133,19 @@ void Game::checkPlayerItemCollision(int index)
JA_PlaySound(mSoundItemPickup);
break;
case ITEM_COFFEE:
mPlayer[index]->giveExtraHit();
JA_PlaySound(mSoundItemPickup);
if (mPlayer[index]->getCoffees() == 2)
{
mPlayer[index]->addScore(5000);
updateHiScore();
createItemScoreSprite(mItem[i]->getPosX() + (mItem[i]->getWidth() / 2) - (m5000Bitmap->getWidth() / 2), mPlayer[index]->getPosY(), m5000Bitmap);
}
mPlayer[index]->giveExtraHit();
JA_PlaySound(mSoundItemPickup);
break;
case ITEM_COFFEE_MACHINE:
mPlayer[index]->setPowerUp(true);
JA_PlaySound(mSoundItemPickup);
mCoffeeMachineEnabled = false;
{
printf("-collision-\n");
printf("x\t%f\n", mItem[i]->getPosX());
printf("y\t%f\n", mItem[i]->getPosY());
printf("---\n");
}
break;
default:
@@ -2419,10 +2415,6 @@ void Game::throwPlayer(int x, int y, int index)
const int sentit = ((rand() % 2) ? 1 : -1);
mDeathIndex = getSmartSpriteFreeIndex();
/*if (index == 1)
mSmartSprite[mDeathIndex]->init(mTexturePlayer1Death, mRenderer);
if (index == 2)
mSmartSprite[mDeathIndex]->init(mTexturePlayer2Death, mRenderer);*/
mSmartSprite[mDeathIndex]->init(mPlayer[index]->getDeadTexture(), mRenderer);
mSmartSprite[mDeathIndex]->setPosX(x);
mSmartSprite[mDeathIndex]->setPosY(y);
@@ -3300,12 +3292,14 @@ void Game::runGameOverScreen()
// Dibuja la informacion de debug en pantalla
void Game::renderDebugInfo()
{
const color_t color = {0xFF, 0x20, 0x20};
//mText->writeShadowed(2, 2 + 0 * BLOCK, "POW: " + std::to_string(mPlayer[0]->mPowerUpCounter), color);
//if (mHelper.needCoffeeMachine)
// mText->writeShadowed(2, 2 + 1 * BLOCK, "NEED COFFEMACHINE", color);
if (mDebug.enabled)
{
const color_t color = {0xFF, 0x20, 0x20};
SDL_RenderSetLogicalSize(mRenderer, SCREEN_WIDTH * 2, SCREEN_HEIGHT * 2);
//SDL_RenderSetLogicalSize(mRenderer, SCREEN_WIDTH * 2, SCREEN_HEIGHT * 2);
mText->writeShadowed(2, 2 + 0 * BLOCK, "menace(umb): " + std::to_string(mMenaceCurrent) + "(" + std::to_string(mMenaceThreshold) + ")", color);
mText->writeShadowed(2, 2 + 1 * BLOCK, "currentPower: " + std::to_string(mStage[mCurrentStage].currentPower), color);
mText->writeShadowed(2, 2 + 2 * BLOCK, "mCurrentStage:" + std::to_string(mCurrentStage), color);