Light bitmaps and more sound fixes

* Adding the loading of bitmaps for the lights
* Moved done sounds to start playing after the end scene has drawn
This commit is contained in:
Jon Thysell 2021-11-12 10:25:28 -08:00
parent efaf627495
commit 56f52ad87c
10 changed files with 33 additions and 9 deletions

Binary file not shown.

BIN
assets/light0.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

BIN
assets/light1.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

View File

@ -13,6 +13,8 @@
#define RetryButtonPictResID (NextButtonPictResID + 1)
#define SoundOffPictResID (RetryButtonPictResID + 1)
#define SoundOnPictResID (SoundOffPictResID + 1)
#define LightOffPictResID (SoundOnPictResID + 1)
#define LightOnPictResID (LightOffPictResID + 1)
#define StarRectPadding 2
@ -102,6 +104,20 @@ void Bitmaps_Init(Bitmaps *pBitmaps)
{
ShowError("\pSound on PICT resource missing!", true);
}
// Load light off
pBitmaps->LightOffPict = GetPicture(LightOffPictResID);
if (pBitmaps->LightOffPict == nil)
{
ShowError("\pLight off PICT resource missing!", true);
}
// Load light on
pBitmaps->LightOnPict = GetPicture(LightOnPictResID);
if (pBitmaps->LightOnPict == nil)
{
ShowError("\pLight on PICT resource missing!", true);
}
}
void Bitmaps_GetNumberRect(const Bitmaps *pBitmaps, const uint32_t number, const uint8_t scale, Rect *pDestRect)

View File

@ -21,6 +21,8 @@ typedef struct sBitmaps
PicHandle RetryButtonPict;
PicHandle SoundOffPict;
PicHandle SoundOnPict;
PicHandle LightOffPict;
PicHandle LightOnPict;
} Bitmaps;
void Bitmaps_Init(Bitmaps *pBitmaps);

View File

@ -32,9 +32,6 @@ void GameEndScene_Init(GameWindow *pGameWindow)
GetBoxRect(pContentRect, Bottom, &r);
GetBoxRect(&r, Top, &r);
CenterRect(&r, &(pGameWindow->GameEndScene.ScoreRect));
// Play done sound
Sounds_PlayDoneSnd(&(pGameWindow->Sounds));
}
void GameEndScene_Draw(const GameWindow *pGameWindow, bool fullRefresh)

View File

@ -48,9 +48,6 @@ void LevelEndScene_Init(GameWindow *pGameWindow)
GetBoxRect(pContentRect, BottomRight, &r);
CenterRect(&r, &(pGameWindow->LevelEndScene.NextButtonRect));
// Play done sound
Sounds_PlayDoneSnd(&(pGameWindow->Sounds));
}
void LevelEndScene_Draw(const GameWindow *pGameWindow, bool fullRefresh)
@ -96,6 +93,15 @@ void LevelEndScene_Click(GameWindow *pGameWindow, const Point *pPosition)
{
Sounds_PlayClickSnd(&(pGameWindow->Sounds));
GameEngine_NextLevel(&(pGameWindow->Engine));
GameWindow_SetScene(pGameWindow, GameEngine_IsGameOver(&(pGameWindow->Engine)) ? GameEnd : Play);
if (GameEngine_IsGameOver(&(pGameWindow->Engine)))
{
GameWindow_SetScene(pGameWindow, GameEnd);
Sounds_PlayDoneSnd(&(pGameWindow->Sounds));
}
else
{
GameWindow_SetScene(pGameWindow, Play);
}
}
}

Binary file not shown.

Binary file not shown.

View File

@ -104,12 +104,14 @@ void PlayScene_Draw(const GameWindow *pGameWindow, bool fullRefresh)
if (GameEngine_GetLight(&(pGameWindow->Engine), c, r))
{
// Draw ON light
FillRoundRect(&lightRect, LightCornerSize, LightCornerSize, white);
DrawPicture(pGameWindow->Bitmaps.LightOnPict, &lightRect);
//FillRoundRect(&lightRect, LightCornerSize, LightCornerSize, white);
}
else
{
// Draw OFF light
FillRoundRect(&lightRect, LightCornerSize, LightCornerSize, dkGray);
DrawPicture(pGameWindow->Bitmaps.LightOffPict, &lightRect);
//FillRoundRect(&lightRect, LightCornerSize, LightCornerSize, dkGray);
}
}
}
@ -176,6 +178,7 @@ void PlayScene_Click(GameWindow *pGameWindow, const Point *pPosition)
// Level was completed in the last click
GameWindow_Draw(pGameWindow, false);
GameWindow_SetScene(pGameWindow, LevelEnd);
Sounds_PlayDoneSnd(&(pGameWindow->Sounds));
}
}
else if (PtInRect(*pPosition, &(pGameWindow->PlayScene.HUDRect)))