void drawTrophyAlert(void) { int x, y; 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); 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); setSparkleColor(alertTrophy); x = alertRect.x + alertRect.w - 72; y = alertRect.y + 20; blit(alertSphere, x + 24, y + 24, 1); blitRotated(sparkle, x + 24, y + 24, sparkleAngle); blitRotated(sparkle, x + 24, y + 24, -sparkleAngle); blitScaled(trophyIcons[alertTrophy->value], x, y, 48, 48, 0); } }
static void drawEntity(Entity *e) { SDL_SetTextureColorMod(e->texture, 255, 255, 255); if (e->armourHit > 0) { SDL_SetTextureColorMod(e->texture, 255, 255 - e->armourHit, 255 - e->armourHit); } if (e->systemHit > 0) { SDL_SetTextureColorMod(e->texture, 255 - e->systemHit, 255, 255); } if (e->flags & EF_DISABLED) { SDL_SetTextureColorMod(e->texture, disabledGlow, disabledGlow, 255); } blitRotated(e->texture, e->x - battle.camera.x, e->y - battle.camera.y, e->angle); if (e->shieldHit > 0) { drawShieldHitEffect(e); } SDL_SetTextureColorMod(e->texture, 255, 255, 255); }
void drawDebris(void) { int i; Debris *d; for (i = 0, d = debrisToDraw[i] ; d != NULL ; d = debrisToDraw[++i]) { blitRotated(d->texture, d->x - battle.camera.x, d->y - battle.camera.y, d->angle); } }
void drawRadarRangeWarning(void) { int x, y, leaving; x = (int)player->x / GRID_CELL_WIDTH; y = (int)player->y / GRID_CELL_HEIGHT; leaving = 0; if (x <= 4 && player->dx < 0) { blitRotated(radarWarningTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 270); leaving = 1; } if (y <= 4 && player->dy < 0) { blitRotated(radarWarningTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 0); leaving = 1; } if (x >= GRID_SIZE - 4 && player->dx > 0) { blitRotated(radarWarningTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 90); leaving = 1; } if (y >= GRID_SIZE - 4 && player->dy > 0) { blitRotated(radarWarningTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 180); leaving = 1; } if (leaving && battle.stats[STAT_TIME] % FPS < 40) { drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 30, 14, TA_CENTER, colors.white, "Caution: Leaving battle area - turn around."); } }
void drawTrophies(void) { Trophy *t; SDL_Rect r; int start, end, i, x, y; SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128); SDL_RenderFillRect(app.renderer, NULL); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE); r.w = boxWidth; r.h = 650; r.x = (SCREEN_WIDTH / 2) - r.w / 2; r.y = (SCREEN_HEIGHT / 2) - r.h / 2; SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 0); SDL_RenderFillRect(app.renderer, &r); SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_RenderDrawRect(app.renderer, &r); drawText(SCREEN_WIDTH / 2, 40, 28, TA_CENTER, colors.white, TROPHIES_TEXT); drawText(SCREEN_WIDTH / 2, 83, 16, TA_CENTER, colors.lightGrey, AWARDED_TEXT, awarded, total); drawText(SCREEN_WIDTH / 2, 110, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages); SDL_SetRenderDrawColor(app.renderer, 128, 128, 128, 255); SDL_RenderDrawLine(app.renderer, r.x, 150, r.x + r.w, 150); x = r.x + 15; y = 180; start = page * TROPHIES_PER_PAGE; end = start + TROPHIES_PER_PAGE; i = 0; for (t = game.trophyHead.next ; t != NULL ; t = t->next) { if (i >= start && i < end) { if (t->awarded) { setSparkleColor(t); blitRotated(sparkle, x + 32, y + 32, sparkleAngle); blitRotated(sparkle, x + 32, y + 32, -sparkleAngle); blitScaled(trophyIcons[t->value], x, y, 64, 64, 0); drawText(x + 85, y - 10, 20, TA_LEFT, colors.yellow, t->title); drawText(x + 85, y + 20, 18, TA_LEFT, colors.white, t->description); drawText(x + 85, y + 48, 18, TA_LEFT, colors.white, t->awardDateStr); } else { blitScaled(trophyIcons[TROPHY_UNEARNED], x, y, 64, 64, 0); if (!t->hidden) { drawText(x + 85, y - 10, 20, TA_LEFT, colors.lightGrey, t->title); drawText(x + 85, y + 20, 18, TA_LEFT, colors.darkGrey, t->description); drawText(x + 85, y + 48, 18, TA_LEFT, colors.darkGrey, "-"); } else { drawText(x + 85, y + 20, 20, TA_LEFT, colors.darkGrey, HIDDEN_TEXT); } } y += 120; } i++; } drawWidgets("trophies"); }
void drawFighterDatabase(void) { SDL_Rect r; Entity *fighter; int i, y, numCannons; SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128); SDL_RenderFillRect(app.renderer, NULL); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE); r.w = 700; r.h = 650; r.x = (SCREEN_WIDTH / 2) - r.w / 2; r.y = (SCREEN_HEIGHT / 2) - r.h / 2; SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 0); SDL_RenderFillRect(app.renderer, &r); SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_RenderDrawRect(app.renderer, &r); drawText(SCREEN_WIDTH / 2, 50, 28, TA_CENTER, colors.white, DB_TEXT); drawText(SCREEN_WIDTH / 2, 90, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages); fighter = dbFighters[page]; drawText(SCREEN_WIDTH / 2, 130, 28, TA_CENTER, colors.white, fighter->name); blitRotated(fighter->texture, r.x + (r.w / 2), 250, rotation); if (fighter->flags & EF_COMMON_FIGHTER) { drawText(SCREEN_WIDTH / 2, 170, 18, TA_CENTER, colors.darkGrey, COMMON_TEXT); drawText(r.x + (r.w / 2), 290, 18, TA_CENTER, colors.lightGrey, "%s: %d", DESTROYED_TEXT, numDestroyed); } drawText(r.x + 25, 200, 22, TA_LEFT, colors.white, "%s: %s", AFFILIATION_TEXT, fighter->affiliation); drawText(r.x + 25, 240, 22, TA_LEFT, colors.white, "%s: %d", ARMOUR_TEXT, fighter->health); drawText(r.x + 25, 280, 22, TA_LEFT, colors.white, "%s: %d", SHIELD_TEXT, fighter->shield); drawText(r.x + 25, 320, 22, TA_LEFT, colors.white, "%s: %.0f", SPEED_TEXT, ((fighter->speed * fighter->speed) * FPS)); y = 200; for (i = 1 ; i < BT_MAX ; i++) { numCannons = countFighterGuns(fighter, i); if (numCannons > 0) { drawText(r.x + r.w - 25, y, 22, TA_RIGHT, colors.white, "%s x %d", gunName[i], numCannons); y += 40; } } if (fighter->missiles > 0) { drawText(r.x + r.w - 25, y, 22, TA_RIGHT, colors.white, "Missiles x %d", fighter->missiles); } y = MAX(y, 320) + 75; limitTextWidth(r.w - 100); drawText(r.x + 25, y, 18, TA_LEFT, colors.white, fighter->description); limitTextWidth(0); drawWidgets("fighterDB"); }