diff --git a/sound/278142__ricemaster__effect-notify.ogg b/sound/278142__ricemaster__effect-notify.ogg new file mode 100644 index 0000000..08def97 Binary files /dev/null and b/sound/278142__ricemaster__effect-notify.ogg differ diff --git a/src/game/trophies.c b/src/game/trophies.c index ed23d6b..e438afe 100644 --- a/src/game/trophies.c +++ b/src/game/trophies.c @@ -41,16 +41,19 @@ void initTrophies(void) { memset(&trophyHead, 0, sizeof(Trophy)); trophyTail = &trophyHead; + + alertRect.h = 90; + alertRect.y = 10; numTrophies = 0; awarded = 0; - - alertTimer = 0; sparkleAngle = 0; loadTrophyData(); + + resetAlert(); } void awardTrophy(char *id) @@ -171,11 +174,9 @@ void drawTrophyAlert(void) if (alertTrophy) { - SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, SDL_ALPHA_OPAQUE); - SDL_RenderFillRect(app.renderer, &alertRect); - - SDL_SetRenderDrawColor(app.renderer, 64, 64, 64, SDL_ALPHA_OPAQUE); - SDL_RenderDrawRect(app.renderer, &alertRect); + drawRect(alertRect.x, alertRect.y, alertRect.w, alertRect.h, 0, 0, 0, 255); + + drawOutlineRect(alertRect.x, alertRect.y, alertRect.w, alertRect.h, 64, 64, 64, 255); drawText(alertRect.x + 15, alertRect.y + 5, 30, TA_LEFT, colors.white, alertTrophy->title); drawText(alertRect.x + 15, alertRect.y + 45, 20, TA_LEFT, colors.white, alertTrophy->description); diff --git a/src/game/trophies.h b/src/game/trophies.h index 05789a9..ecab245 100644 --- a/src/game/trophies.h +++ b/src/game/trophies.h @@ -27,6 +27,8 @@ extern long lookup(const char *name); extern void textSize(char *text, int size, int *w, int *h); extern void playSound(int snd, int ch); extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...); +extern void drawRect(int x, int y, int w, int h, int r, int g, int b, int a); +extern void drawOutlineRect(int x, int y, int w, int h, int r, int g, int b, int a); extern float mod(float n, float x); extern App app; diff --git a/src/main.c b/src/main.c index 7d82bba..0b8d053 100644 --- a/src/main.c +++ b/src/main.c @@ -57,10 +57,14 @@ int main(int argc, char *argv[]) app.delegate.logic(); + doTrophyAlerts(); + prepareScene(); app.delegate.draw(); + drawTrophyAlert(); + presentScene(); then = capFrameRate(then); diff --git a/src/main.h b/src/main.h index 27d8a40..83fe5e6 100644 --- a/src/main.h +++ b/src/main.h @@ -31,6 +31,8 @@ extern void initAtlasTest(void); extern void init18N(int argc, char *argv[]); extern void initLookups(void); extern void awardTrophies(void); +extern void doTrophyAlerts(void); +extern void drawTrophyAlert(void); App app; Camera camera; diff --git a/src/system/sound.c b/src/system/sound.c index 1f51670..8cca88a 100644 --- a/src/system/sound.c +++ b/src/system/sound.c @@ -128,6 +128,7 @@ static void loadSounds(void) sounds[SND_CONFIRMED] = loadSound("sound/39028__wildweasel__cardlock-open.ogg"); sounds[SND_HEART_CELL] = loadSound("sound/162467__kastenfrosch__gotitem.ogg"); sounds[SND_MISSION_COMPLETE] = loadSound("sound/113989__kastenfrosch__gewonnen.ogg"); + sounds[SND_TROPHY] = loadSound("sound/278142__ricemaster__effect-notify.ogg"); } void destroySounds(void)