Resolution update work.
This commit is contained in:
parent
ff40191eab
commit
2430f866e0
|
@ -276,6 +276,8 @@ static void drawMenu(void)
|
||||||
|
|
||||||
if (app.modalDialog.type == MD_NONE)
|
if (app.modalDialog.type == MD_NONE)
|
||||||
{
|
{
|
||||||
|
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
|
||||||
|
|
||||||
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
|
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
|
||||||
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
|
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
|
||||||
SDL_RenderFillRect(app.renderer, NULL);
|
SDL_RenderFillRect(app.renderer, NULL);
|
||||||
|
@ -283,8 +285,8 @@ static void drawMenu(void)
|
||||||
|
|
||||||
r.w = 400;
|
r.w = 400;
|
||||||
r.h = 400;
|
r.h = 400;
|
||||||
r.x = (SCREEN_WIDTH / 2) - r.w / 2;
|
r.x = (UI_WIDTH / 2) - r.w / 2;
|
||||||
r.y = (SCREEN_HEIGHT / 2) - r.h / 2;
|
r.y = (UI_HEIGHT / 2) - r.h / 2;
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
|
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
|
||||||
SDL_RenderFillRect(app.renderer, &r);
|
SDL_RenderFillRect(app.renderer, &r);
|
||||||
|
@ -292,6 +294,8 @@ static void drawMenu(void)
|
||||||
SDL_RenderDrawRect(app.renderer, &r);
|
SDL_RenderDrawRect(app.renderer, &r);
|
||||||
|
|
||||||
drawWidgets("inBattle");
|
drawWidgets("inBattle");
|
||||||
|
|
||||||
|
SDL_SetRenderTarget(app.renderer, app.backBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -452,13 +452,13 @@ static void drawNumFighters(void)
|
||||||
{
|
{
|
||||||
/* Allies */
|
/* Allies */
|
||||||
setAtlasColor(150, 200, 255, 255);
|
setAtlasColor(150, 200, 255, 255);
|
||||||
blit(smallFighter, 400, 15, 0);
|
blit(smallFighter, (app.winWidth / 2) - 200, 15, 0);
|
||||||
drawText(425, 11, 14, TA_LEFT, colors.white, battle.numAllies < 1000 ? "(%d)" : "(999+)", battle.numAllies);
|
drawText((app.winWidth / 2) - 175, 11, 14, TA_LEFT, colors.white, battle.numAllies < 1000 ? "(%d)" : "(999+)", battle.numAllies);
|
||||||
|
|
||||||
/* Enemies */
|
/* Enemies */
|
||||||
setAtlasColor(255, 100, 100, 255);
|
setAtlasColor(255, 100, 100, 255);
|
||||||
blit(smallFighter, SCREEN_WIDTH - 410, 15, 0);
|
blit(smallFighter, (app.winWidth / 2) + 195, 15, 0);
|
||||||
drawText(SCREEN_WIDTH - 420, 11, 14, TA_RIGHT, colors.white, !battle.unlimitedEnemies ? "(%d)" : "(999+)", battle.numEnemies);
|
drawText((app.winWidth / 2) + 185, 11, 14, TA_RIGHT, colors.white, !battle.unlimitedEnemies ? "(%d)" : "(999+)", battle.numEnemies);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawObjectives(void)
|
static void drawObjectives(void)
|
||||||
|
@ -469,12 +469,12 @@ static void drawObjectives(void)
|
||||||
|
|
||||||
if (!game.currentMission->challengeData.isChallenge)
|
if (!game.currentMission->challengeData.isChallenge)
|
||||||
{
|
{
|
||||||
blit(objectives, (SCREEN_WIDTH / 2) - 50, 14, 0);
|
blit(objectives, (app.winWidth / 2) - 50, 14, 0);
|
||||||
drawText(SCREEN_WIDTH / 2, 10, 16, TA_CENTER, colors.white, "%d / %d", battle.numObjectivesComplete, (battle.numObjectivesTotal + battle.numConditions));
|
drawText(app.winWidth / 2, 10, 16, TA_CENTER, colors.white, "%d / %d", battle.numObjectivesComplete, (battle.numObjectivesTotal + battle.numConditions));
|
||||||
|
|
||||||
if (battle.isEpic && battle.epicLives > 0)
|
if (battle.isEpic && battle.epicLives > 0)
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, REMAINING_PILOTS_TEXT, battle.epicLives - 1);
|
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, REMAINING_PILOTS_TEXT, battle.epicLives - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -483,46 +483,46 @@ static void drawObjectives(void)
|
||||||
{
|
{
|
||||||
timeRemaining = game.currentMission->challengeData.timeLimit - battle.stats[STAT_TIME];
|
timeRemaining = game.currentMission->challengeData.timeLimit - battle.stats[STAT_TIME];
|
||||||
|
|
||||||
blit(clockIcon, (SCREEN_WIDTH / 2) - 50, 14, 0);
|
blit(clockIcon, (app.winWidth / 2) - 50, 14, 0);
|
||||||
drawText(SCREEN_WIDTH / 2, 10, 16, TA_CENTER, (timeRemaining < 11 * FPS) ? colors.red : colors.white, timeToString(timeRemaining, 0));
|
drawText(app.winWidth / 2, 10, 16, TA_CENTER, (timeRemaining < 11 * FPS) ? colors.red : colors.white, timeToString(timeRemaining, 0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH / 2, 10, 16, TA_CENTER, colors.white, timeToString(battle.stats[STAT_TIME], 0));
|
drawText(app.winWidth / 2, 10, 16, TA_CENTER, colors.white, timeToString(battle.stats[STAT_TIME], 0));
|
||||||
blit(clockIcon, (SCREEN_WIDTH / 2) - 50, 14, 0);
|
blit(clockIcon, (app.winWidth / 2) - 50, 14, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game.currentMission->challengeData.killLimit)
|
if (game.currentMission->challengeData.killLimit)
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ENEMIES_KILLED_PLAYER] + battle.stats[STAT_ENEMIES_DISABLED], game.currentMission->challengeData.killLimit);
|
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ENEMIES_KILLED_PLAYER] + battle.stats[STAT_ENEMIES_DISABLED], game.currentMission->challengeData.killLimit);
|
||||||
}
|
}
|
||||||
else if (game.currentMission->challengeData.itemLimit)
|
else if (game.currentMission->challengeData.itemLimit)
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ITEMS_COLLECTED] + battle.stats[STAT_ITEMS_COLLECTED_PLAYER], game.currentMission->challengeData.itemLimit);
|
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ITEMS_COLLECTED] + battle.stats[STAT_ITEMS_COLLECTED_PLAYER], game.currentMission->challengeData.itemLimit);
|
||||||
}
|
}
|
||||||
else if (game.currentMission->challengeData.playerItemLimit)
|
else if (game.currentMission->challengeData.playerItemLimit)
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ITEMS_COLLECTED_PLAYER], game.currentMission->challengeData.playerItemLimit);
|
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ITEMS_COLLECTED_PLAYER], game.currentMission->challengeData.playerItemLimit);
|
||||||
}
|
}
|
||||||
else if (game.currentMission->challengeData.rescueLimit)
|
else if (game.currentMission->challengeData.rescueLimit)
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_CIVILIANS_RESCUED], game.currentMission->challengeData.rescueLimit);
|
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_CIVILIANS_RESCUED], game.currentMission->challengeData.rescueLimit);
|
||||||
}
|
}
|
||||||
else if (game.currentMission->challengeData.disableLimit)
|
else if (game.currentMission->challengeData.disableLimit)
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ENEMIES_DISABLED], game.currentMission->challengeData.disableLimit);
|
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ENEMIES_DISABLED], game.currentMission->challengeData.disableLimit);
|
||||||
}
|
}
|
||||||
else if (game.currentMission->challengeData.surrenderLimit)
|
else if (game.currentMission->challengeData.surrenderLimit)
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ENEMIES_SURRENDERED], game.currentMission->challengeData.surrenderLimit);
|
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ENEMIES_SURRENDERED], game.currentMission->challengeData.surrenderLimit);
|
||||||
}
|
}
|
||||||
else if (game.currentMission->challengeData.waypointLimit)
|
else if (game.currentMission->challengeData.waypointLimit)
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_WAYPOINTS_VISITED], game.currentMission->challengeData.waypointLimit);
|
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_WAYPOINTS_VISITED], game.currentMission->challengeData.waypointLimit);
|
||||||
}
|
}
|
||||||
else if (player->flags & EF_MUST_DISABLE)
|
else if (player->flags & EF_MUST_DISABLE)
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, SYSTEM_POWER_TEXT, player->systemPower);
|
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, SYSTEM_POWER_TEXT, player->systemPower);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -552,18 +552,18 @@ static void drawDistancesInfo(void)
|
||||||
{
|
{
|
||||||
if (player->target->flags & EF_AI_LEADER && player->target->speed > 0)
|
if (player->target->flags & EF_AI_LEADER && player->target->speed > 0)
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH - 15, y, 18, TA_RIGHT, colors.red, LEADER_DIST_TEXT, player->target->name);
|
drawText(app.winWidth - 15, y, 18, TA_RIGHT, colors.red, LEADER_DIST_TEXT, player->target->name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH - 15, y, 18, TA_RIGHT, colors.red, player->target->name);
|
drawText(app.winWidth - 15, y, 18, TA_RIGHT, colors.red, player->target->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
y += 30;
|
y += 30;
|
||||||
|
|
||||||
distance = distanceToKM(player->x, player->y, player->target->x, player->target->y);
|
distance = distanceToKM(player->x, player->y, player->target->x, player->target->y);
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH - 15, y, 14, TA_RIGHT, colors.red, TARGET_DIST_TEXT, distance);
|
drawText(app.winWidth - 15, y, 14, TA_RIGHT, colors.red, TARGET_DIST_TEXT, distance);
|
||||||
|
|
||||||
y += 25;
|
y += 25;
|
||||||
}
|
}
|
||||||
|
@ -572,7 +572,7 @@ static void drawDistancesInfo(void)
|
||||||
{
|
{
|
||||||
distance = distanceToKM(player->x, player->y, battle.missionTarget->x, battle.missionTarget->y);
|
distance = distanceToKM(player->x, player->y, battle.missionTarget->x, battle.missionTarget->y);
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH - 15, y, 14, TA_RIGHT, colors.green, OBJECTIVE_DIST_TEXT, distance);
|
drawText(app.winWidth - 15, y, 14, TA_RIGHT, colors.green, OBJECTIVE_DIST_TEXT, distance);
|
||||||
|
|
||||||
y += 25;
|
y += 25;
|
||||||
}
|
}
|
||||||
|
@ -581,7 +581,7 @@ static void drawDistancesInfo(void)
|
||||||
{
|
{
|
||||||
distance = distanceToKM(player->x, player->y, battle.jumpgate->x, battle.jumpgate->y);
|
distance = distanceToKM(player->x, player->y, battle.jumpgate->x, battle.jumpgate->y);
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH - 15, y, 14, TA_RIGHT, colors.yellow, JUMPGATE_DIST_TEXT, distance);
|
drawText(app.winWidth - 15, y, 14, TA_RIGHT, colors.yellow, JUMPGATE_DIST_TEXT, distance);
|
||||||
|
|
||||||
y += 25;
|
y += 25;
|
||||||
}
|
}
|
||||||
|
@ -590,7 +590,7 @@ static void drawDistancesInfo(void)
|
||||||
{
|
{
|
||||||
distance = distanceToKM(player->x, player->y, battle.messageSpeaker->x, battle.messageSpeaker->y);
|
distance = distanceToKM(player->x, player->y, battle.messageSpeaker->x, battle.messageSpeaker->y);
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH - 15, y, 14, TA_RIGHT, colors.white, "%s: %.2fkm", battle.messageSpeaker->name, distance);
|
drawText(app.winWidth - 15, y, 14, TA_RIGHT, colors.white, "%s: %.2fkm", battle.messageSpeaker->name, distance);
|
||||||
|
|
||||||
y += 25;
|
y += 25;
|
||||||
}
|
}
|
||||||
|
@ -599,7 +599,7 @@ static void drawDistancesInfo(void)
|
||||||
static void drawHudMessages(void)
|
static void drawHudMessages(void)
|
||||||
{
|
{
|
||||||
HudMessage *hudMessage;
|
HudMessage *hudMessage;
|
||||||
int y = SCREEN_HEIGHT - 25;
|
int y = app.winHeight - 25;
|
||||||
|
|
||||||
for (hudMessage = hudMessageHead.next ; hudMessage != NULL ; hudMessage = hudMessage->next)
|
for (hudMessage = hudMessageHead.next ; hudMessage != NULL ; hudMessage = hudMessage->next)
|
||||||
{
|
{
|
||||||
|
@ -620,17 +620,17 @@ static void drawPlayerSelect(void)
|
||||||
|
|
||||||
blit(targetCircle, player->x - battle.camera.x, player->y - battle.camera.y, 1);
|
blit(targetCircle, player->x - battle.camera.x, player->y - battle.camera.y, 1);
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH / 2, 500, 28, TA_CENTER, colors.white, NEW_FIGHTER_TEXT);
|
drawText(app.winWidth / 2, 500, 28, TA_CENTER, colors.white, NEW_FIGHTER_TEXT);
|
||||||
|
|
||||||
if (player->health > 0)
|
if (player->health > 0)
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH / 2, 540, 20, TA_CENTER, colors.white, "%s (%d%% / %d%%)", player->defName, getPercent(player->health, player->maxHealth), getPercent(player->shield, player->maxShield));
|
drawText(app.winWidth / 2, 540, 20, TA_CENTER, colors.white, "%s (%d%% / %d%%)", player->defName, getPercent(player->health, player->maxHealth), getPercent(player->shield, player->maxShield));
|
||||||
}
|
}
|
||||||
|
|
||||||
setAtlasColor(255, 255, 255, 255);
|
setAtlasColor(255, 255, 255, 255);
|
||||||
|
|
||||||
blit(arrowLeft, (SCREEN_WIDTH / 2) - 200, 520, 1);
|
blit(arrowLeft, (app.winWidth / 2) - 200, 520, 1);
|
||||||
blit(arrowRight, (SCREEN_WIDTH / 2) + 200, 520, 1);
|
blit(arrowRight, (app.winWidth / 2) + 200, 520, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawSuspicionLevel(void)
|
static void drawSuspicionLevel(void)
|
||||||
|
@ -641,10 +641,10 @@ static void drawSuspicionLevel(void)
|
||||||
{
|
{
|
||||||
battle.suspicionLevel = MIN(battle.suspicionLevel, MAX_SUSPICION_LEVEL);
|
battle.suspicionLevel = MIN(battle.suspicionLevel, MAX_SUSPICION_LEVEL);
|
||||||
|
|
||||||
drawText((SCREEN_WIDTH / 2) - 150, SCREEN_HEIGHT - 60, 18, TA_RIGHT, colors.white, SUSPICION_TEXT);
|
drawText((app.winWidth / 2) - 150, app.winHeight - 60, 18, TA_RIGHT, colors.white, SUSPICION_TEXT);
|
||||||
|
|
||||||
r.x = (SCREEN_WIDTH / 2) - 140;
|
r.x = (app.winWidth / 2) - 140;
|
||||||
r.y = SCREEN_HEIGHT - 58;
|
r.y = app.winHeight - 58;
|
||||||
r.w = 400;
|
r.w = 400;
|
||||||
r.h = 20;
|
r.h = 20;
|
||||||
|
|
||||||
|
@ -678,7 +678,7 @@ static void drawSuspicionLevel(void)
|
||||||
|
|
||||||
SDL_RenderFillRect(app.renderer, &r);
|
SDL_RenderFillRect(app.renderer, &r);
|
||||||
|
|
||||||
drawText(r.x + r.w + 7, SCREEN_HEIGHT - 57, 12, TA_LEFT, colors.white, "%d%%", (battle.suspicionLevel > 0) ? getPercent(battle.suspicionLevel, MAX_SUSPICION_LEVEL) : 0);
|
drawText(r.x + r.w + 7, app.winHeight - 57, 12, TA_LEFT, colors.white, "%d%%", (battle.suspicionLevel > 0) ? getPercent(battle.suspicionLevel, MAX_SUSPICION_LEVEL) : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -686,7 +686,7 @@ static void drawMissileWarning(void)
|
||||||
{
|
{
|
||||||
if (battle.incomingMissile && battle.stats[STAT_TIME] % FPS < 40)
|
if (battle.incomingMissile && battle.stats[STAT_TIME] % FPS < 40)
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 60, 18, TA_CENTER, colors.red, WARNING_TEXT);
|
drawText(app.winWidth / 2, app.winHeight - 60, 18, TA_CENTER, colors.red, WARNING_TEXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ void drawMessageBox(void)
|
||||||
r.y = 50;
|
r.y = 50;
|
||||||
r.w = 650;
|
r.w = 650;
|
||||||
r.h = msg->height + 40;
|
r.h = msg->height + 40;
|
||||||
r.x = (SCREEN_WIDTH - r.w) / 2;
|
r.x = (app.winWidth - r.w) / 2;
|
||||||
|
|
||||||
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
|
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,8 @@ void initMissionInfo(void)
|
||||||
|
|
||||||
void drawMissionInfo(void)
|
void drawMissionInfo(void)
|
||||||
{
|
{
|
||||||
|
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
|
||||||
|
|
||||||
switch (battle.status)
|
switch (battle.status)
|
||||||
{
|
{
|
||||||
case MS_START:
|
case MS_START:
|
||||||
|
@ -96,6 +98,8 @@ void drawMissionInfo(void)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_SetRenderTarget(app.renderer, app.backBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawMissionSummary(AtlasImage *header)
|
static void drawMissionSummary(AtlasImage *header)
|
||||||
|
|
|
@ -42,9 +42,9 @@ void drawRadar(void)
|
||||||
Entity *e;
|
Entity *e;
|
||||||
int dist, inRange, blink;
|
int dist, inRange, blink;
|
||||||
|
|
||||||
blit(radarTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 1);
|
blit(radarTexture, app.winWidth - 85, app.winHeight - 85, 1);
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH - 160, SCREEN_HEIGHT - 30, 14, TA_RIGHT, colors.white, "%dx", battle.radarRange + 1);
|
drawText(app.winWidth - 160, app.winHeight - 30, 14, TA_RIGHT, colors.white, "%dx", battle.radarRange + 1);
|
||||||
|
|
||||||
r.w = r.h = 3;
|
r.w = r.h = 3;
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ void drawRadar(void)
|
||||||
|
|
||||||
if (inRange)
|
if (inRange)
|
||||||
{
|
{
|
||||||
r.x = SCREEN_WIDTH - 85;
|
r.x = app.winWidth - 85;
|
||||||
r.y = SCREEN_HEIGHT - 85;
|
r.y = app.winHeight - 85;
|
||||||
|
|
||||||
r.x -= (player->x - e->x) / radarRanges[battle.radarRange];
|
r.x -= (player->x - e->x) / radarRanges[battle.radarRange];
|
||||||
r.y -= (player->y - e->y) / radarRanges[battle.radarRange];
|
r.y -= (player->y - e->y) / radarRanges[battle.radarRange];
|
||||||
|
@ -110,40 +110,40 @@ void drawRadarRangeWarning(void)
|
||||||
{
|
{
|
||||||
int x, y, leaving;
|
int x, y, leaving;
|
||||||
|
|
||||||
x = (int)player->x / (SCREEN_WIDTH / 2);
|
x = (int)player->x / (app.winWidth / 2);
|
||||||
y = (int)player->y / (SCREEN_HEIGHT / 2);
|
y = (int)player->y / (app.winHeight / 2);
|
||||||
leaving = 0;
|
leaving = 0;
|
||||||
|
|
||||||
if (x <= 2 && player->dx < 0)
|
if (x <= 2 && player->dx < 0)
|
||||||
{
|
{
|
||||||
blitRotated(radarWarningTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 270);
|
blitRotated(radarWarningTexture, app.winWidth - 85, app.winHeight - 85, 270);
|
||||||
|
|
||||||
leaving = 1;
|
leaving = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y <= 3 && player->dy < 0)
|
if (y <= 3 && player->dy < 0)
|
||||||
{
|
{
|
||||||
blitRotated(radarWarningTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 0);
|
blitRotated(radarWarningTexture, app.winWidth - 85, app.winHeight - 85, 0);
|
||||||
|
|
||||||
leaving = 1;
|
leaving = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x >= BATTLE_AREA_CELLS - 2 && player->dx > 0)
|
if (x >= BATTLE_AREA_CELLS - 2 && player->dx > 0)
|
||||||
{
|
{
|
||||||
blitRotated(radarWarningTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 90);
|
blitRotated(radarWarningTexture, app.winWidth - 85, app.winHeight - 85, 90);
|
||||||
|
|
||||||
leaving = 1;
|
leaving = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y >= BATTLE_AREA_CELLS - 3 && player->dy > 0)
|
if (y >= BATTLE_AREA_CELLS - 3 && player->dy > 0)
|
||||||
{
|
{
|
||||||
blitRotated(radarWarningTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 180);
|
blitRotated(radarWarningTexture, app.winWidth - 85, app.winHeight - 85, 180);
|
||||||
|
|
||||||
leaving = 1;
|
leaving = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leaving && battle.stats[STAT_TIME] % FPS < 40)
|
if (leaving && battle.stats[STAT_TIME] % FPS < 40)
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 30, 14, TA_CENTER, colors.white, CAUTION_TEXT);
|
drawText(app.winWidth / 2, app.winHeight - 30, 14, TA_CENTER, colors.white, CAUTION_TEXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,8 @@ void initStars(void)
|
||||||
|
|
||||||
for (i = 0 ; i < MAX_STARS ; i++)
|
for (i = 0 ; i < MAX_STARS ; i++)
|
||||||
{
|
{
|
||||||
stars[i].x = rand() % SCREEN_WIDTH;
|
stars[i].x = rand() % app.winWidth;
|
||||||
stars[i].y = rand() % SCREEN_HEIGHT;
|
stars[i].y = rand() % app.winHeight;
|
||||||
stars[i].speed = 5 + rand() % 35;
|
stars[i].speed = 5 + rand() % 35;
|
||||||
|
|
||||||
stars[i].speed *= 0.1;
|
stars[i].speed *= 0.1;
|
||||||
|
@ -47,8 +47,8 @@ void doStars(float dx, float dy)
|
||||||
stars[i].x -= (dx * stars[i].speed);
|
stars[i].x -= (dx * stars[i].speed);
|
||||||
stars[i].y -= (dy * stars[i].speed);
|
stars[i].y -= (dy * stars[i].speed);
|
||||||
|
|
||||||
stars[i].x = mod(stars[i].x, SCREEN_WIDTH - 1);
|
stars[i].x = mod(stars[i].x, app.winWidth - 1);
|
||||||
stars[i].y = mod(stars[i].y, SCREEN_HEIGHT - 1);
|
stars[i].y = mod(stars[i].y, app.winHeight - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,7 @@ static void doChallenges(void)
|
||||||
|
|
||||||
for (c = game.challengeMissionHead.next ; c != NULL ; c = c->next)
|
for (c = game.challengeMissionHead.next ; c != NULL ; c = c->next)
|
||||||
{
|
{
|
||||||
if (i >= startIndex && i < end && app.mouse.button[SDL_BUTTON_LEFT] && collision(app.mouse.x, app.mouse.y, 3, 3, c->rect.x, c->rect.y, c->rect.w, c->rect.h))
|
if (i >= startIndex && i < end && app.mouse.button[SDL_BUTTON_LEFT] && collision(app.uiMouse.x, app.uiMouse.y, 3, 3, c->rect.x, c->rect.y, c->rect.w, c->rect.h))
|
||||||
{
|
{
|
||||||
if (c->available)
|
if (c->available)
|
||||||
{
|
{
|
||||||
|
@ -308,6 +308,8 @@ static void draw(void)
|
||||||
|
|
||||||
drawStars();
|
drawStars();
|
||||||
|
|
||||||
|
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH / 2, 40, 28, TA_CENTER, colors.white, CHALLENGES_TEXT);
|
drawText(SCREEN_WIDTH / 2, 40, 28, TA_CENTER, colors.white, CHALLENGES_TEXT);
|
||||||
drawText(SCREEN_WIDTH / 2, 83, 16, TA_CENTER, colors.lightGrey, COMPLETED_TEXT, game.completedChallenges, game.totalChallenges);
|
drawText(SCREEN_WIDTH / 2, 83, 16, TA_CENTER, colors.lightGrey, COMPLETED_TEXT, game.completedChallenges, game.totalChallenges);
|
||||||
drawText(SCREEN_WIDTH / 2, 110, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages);
|
drawText(SCREEN_WIDTH / 2, 110, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages);
|
||||||
|
@ -340,6 +342,8 @@ static void draw(void)
|
||||||
drawFighterDatabase();
|
drawFighterDatabase();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_SetRenderTarget(app.renderer, app.backBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawChallenges(void)
|
static void drawChallenges(void)
|
||||||
|
|
|
@ -640,8 +640,8 @@ static void drawStarSystemDetail(void)
|
||||||
|
|
||||||
r.w = 900;
|
r.w = 900;
|
||||||
r.h = 600;
|
r.h = 600;
|
||||||
r.x = (SCREEN_WIDTH / 2) - (r.w / 2);
|
r.x = (UI_WIDTH / 2) - (r.w / 2);
|
||||||
r.y = (SCREEN_HEIGHT / 2) - (r.h / 2);
|
r.y = (UI_HEIGHT / 2) - (r.h / 2);
|
||||||
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
|
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 225);
|
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 225);
|
||||||
|
@ -654,7 +654,7 @@ static void drawStarSystemDetail(void)
|
||||||
|
|
||||||
y = 70;
|
y = 70;
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH / 2, y, 28, TA_CENTER, colors.cyan, selectedStarSystem->name);
|
drawText(UI_WIDTH / 2, y, 28, TA_CENTER, colors.cyan, selectedStarSystem->name);
|
||||||
|
|
||||||
SDL_RenderDrawLine(app.renderer, r.x, 120, r.x + r.w - 1, 120);
|
SDL_RenderDrawLine(app.renderer, r.x, 120, r.x + r.w - 1, 120);
|
||||||
|
|
||||||
|
@ -710,15 +710,15 @@ static void drawStarSystemDetail(void)
|
||||||
|
|
||||||
if (game.currentMission->completed)
|
if (game.currentMission->completed)
|
||||||
{
|
{
|
||||||
drawText(525, SCREEN_HEIGHT - 95, 18, TA_LEFT, colors.green, COMPLETED_TEXT);
|
drawText(525, UI_HEIGHT - 95, 18, TA_LEFT, colors.green, COMPLETED_TEXT);
|
||||||
}
|
}
|
||||||
else if (game.currentMission->epic)
|
else if (game.currentMission->epic)
|
||||||
{
|
{
|
||||||
drawText(525, SCREEN_HEIGHT - 95, 18, TA_LEFT, colors.yellow, EPIC_TEXT);
|
drawText(525, UI_HEIGHT - 95, 18, TA_LEFT, colors.yellow, EPIC_TEXT);
|
||||||
}
|
}
|
||||||
else if (game.currentMission->isOptional)
|
else if (game.currentMission->isOptional)
|
||||||
{
|
{
|
||||||
drawText(525, SCREEN_HEIGHT - 95, 18, TA_LEFT, colors.cyan, OPTIONAL_TEXT);
|
drawText(525, UI_HEIGHT - 95, 18, TA_LEFT, colors.cyan, OPTIONAL_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
startMissionButton->enabled = (!game.currentMission->completed || selectedStarSystem->type == SS_SOL || campaignComplete);
|
startMissionButton->enabled = (!game.currentMission->completed || selectedStarSystem->type == SS_SOL || campaignComplete);
|
||||||
|
@ -805,6 +805,8 @@ static void startMission(void)
|
||||||
static void drawMenu(void)
|
static void drawMenu(void)
|
||||||
{
|
{
|
||||||
SDL_Rect r;
|
SDL_Rect r;
|
||||||
|
|
||||||
|
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
|
||||||
|
|
||||||
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
|
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
|
||||||
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
|
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
|
||||||
|
@ -813,8 +815,8 @@ static void drawMenu(void)
|
||||||
|
|
||||||
r.w = 400;
|
r.w = 400;
|
||||||
r.h = 500;
|
r.h = 500;
|
||||||
r.x = (SCREEN_WIDTH / 2) - r.w / 2;
|
r.x = (UI_WIDTH / 2) - r.w / 2;
|
||||||
r.y = (SCREEN_HEIGHT / 2) - r.h / 2;
|
r.y = (UI_HEIGHT / 2) - r.h / 2;
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
|
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
|
||||||
SDL_RenderFillRect(app.renderer, &r);
|
SDL_RenderFillRect(app.renderer, &r);
|
||||||
|
@ -822,6 +824,8 @@ static void drawMenu(void)
|
||||||
SDL_RenderDrawRect(app.renderer, &r);
|
SDL_RenderDrawRect(app.renderer, &r);
|
||||||
|
|
||||||
drawWidgets("galacticMap");
|
drawWidgets("galacticMap");
|
||||||
|
|
||||||
|
SDL_SetRenderTarget(app.renderer, app.backBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resume(void)
|
static void resume(void)
|
||||||
|
|
|
@ -109,27 +109,27 @@ void drawFighterDatabase(void)
|
||||||
|
|
||||||
r.w = 700;
|
r.w = 700;
|
||||||
r.h = 650;
|
r.h = 650;
|
||||||
r.x = (SCREEN_WIDTH / 2) - r.w / 2;
|
r.x = (UI_WIDTH / 2) - r.w / 2;
|
||||||
r.y = (SCREEN_HEIGHT / 2) - r.h / 2;
|
r.y = (UI_HEIGHT / 2) - r.h / 2;
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
|
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
|
||||||
SDL_RenderFillRect(app.renderer, &r);
|
SDL_RenderFillRect(app.renderer, &r);
|
||||||
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
|
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
|
||||||
SDL_RenderDrawRect(app.renderer, &r);
|
SDL_RenderDrawRect(app.renderer, &r);
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH / 2, 50, 28, TA_CENTER, colors.white, DB_TEXT);
|
drawText(UI_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);
|
drawText(UI_WIDTH / 2, 90, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages);
|
||||||
|
|
||||||
fighter = dbFighters[page];
|
fighter = dbFighters[page];
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH / 2, 130, 28, TA_CENTER, colors.white, fighter->name);
|
drawText(UI_WIDTH / 2, 130, 28, TA_CENTER, colors.white, fighter->name);
|
||||||
|
|
||||||
blitRotated(fighter->texture, r.x + (r.w / 2), 250, rotation);
|
blitRotated(fighter->texture, r.x + (r.w / 2), 250, rotation);
|
||||||
|
|
||||||
if (fighter->flags & EF_COMMON_FIGHTER)
|
if (fighter->flags & EF_COMMON_FIGHTER)
|
||||||
{
|
{
|
||||||
drawText(SCREEN_WIDTH / 2, 170, 18, TA_CENTER, colors.darkGrey, COMMON_TEXT);
|
drawText(UI_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 + (r.w / 2), 290, 18, TA_CENTER, colors.lightGrey, "%s: %d", DESTROYED_TEXT, numDestroyed);
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,17 +140,17 @@ void drawStats(void)
|
||||||
|
|
||||||
r.w = 500;
|
r.w = 500;
|
||||||
r.h = 600;
|
r.h = 600;
|
||||||
r.x = (SCREEN_WIDTH / 2) - r.w / 2;
|
r.x = (UI_WIDTH / 2) - r.w / 2;
|
||||||
r.y = (SCREEN_HEIGHT / 2) - r.h / 2;
|
r.y = (UI_HEIGHT / 2) - r.h / 2;
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
|
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
|
||||||
SDL_RenderFillRect(app.renderer, &r);
|
SDL_RenderFillRect(app.renderer, &r);
|
||||||
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
|
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
|
||||||
SDL_RenderDrawRect(app.renderer, &r);
|
SDL_RenderDrawRect(app.renderer, &r);
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH / 2, 70, 28, TA_CENTER, colors.white, STATS_TEXT);
|
drawText(UI_WIDTH / 2, 70, 28, TA_CENTER, colors.white, STATS_TEXT);
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH / 2, 110, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages);
|
drawText(UI_WIDTH / 2, 110, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages);
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 128, 128, 128, 255);
|
SDL_SetRenderDrawColor(app.renderer, 128, 128, 128, 255);
|
||||||
SDL_RenderDrawLine(app.renderer, r.x, 150, r.x + r.w, 150);
|
SDL_RenderDrawLine(app.renderer, r.x, 150, r.x + r.w, 150);
|
||||||
|
|
|
@ -142,17 +142,17 @@ void drawTrophies(void)
|
||||||
|
|
||||||
r.w = boxWidth;
|
r.w = boxWidth;
|
||||||
r.h = 650;
|
r.h = 650;
|
||||||
r.x = (SCREEN_WIDTH / 2) - r.w / 2;
|
r.x = (UI_WIDTH / 2) - r.w / 2;
|
||||||
r.y = (SCREEN_HEIGHT / 2) - r.h / 2;
|
r.y = (UI_HEIGHT / 2) - r.h / 2;
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
|
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
|
||||||
SDL_RenderFillRect(app.renderer, &r);
|
SDL_RenderFillRect(app.renderer, &r);
|
||||||
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
|
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
|
||||||
SDL_RenderDrawRect(app.renderer, &r);
|
SDL_RenderDrawRect(app.renderer, &r);
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH / 2, 40, 28, TA_CENTER, colors.white, TROPHIES_TEXT);
|
drawText(UI_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(UI_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);
|
drawText(UI_WIDTH / 2, 110, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages);
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 128, 128, 128, 255);
|
SDL_SetRenderDrawColor(app.renderer, 128, 128, 128, 255);
|
||||||
SDL_RenderDrawLine(app.renderer, r.x, 150, r.x + r.w, 150);
|
SDL_RenderDrawLine(app.renderer, r.x, 150, r.x + r.w, 150);
|
||||||
|
|
|
@ -151,6 +151,8 @@ void drawControls(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SDL_Rect r;
|
SDL_Rect r;
|
||||||
|
|
||||||
|
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
|
||||||
|
|
||||||
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
|
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
|
||||||
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
|
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
|
||||||
|
@ -201,6 +203,8 @@ void drawControls(void)
|
||||||
app.textWidth = 0;
|
app.textWidth = 0;
|
||||||
|
|
||||||
drawWidgets("controls");
|
drawWidgets("controls");
|
||||||
|
|
||||||
|
SDL_SetRenderTarget(app.renderer, app.backBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void restoreDefaults(void)
|
static void restoreDefaults(void)
|
||||||
|
|
|
@ -100,6 +100,8 @@ void doModalDialog(void)
|
||||||
void drawModalDialog(void)
|
void drawModalDialog(void)
|
||||||
{
|
{
|
||||||
SDL_Rect r;
|
SDL_Rect r;
|
||||||
|
|
||||||
|
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
|
||||||
|
|
||||||
app.textWidth = 700;
|
app.textWidth = 700;
|
||||||
|
|
||||||
|
@ -109,8 +111,8 @@ void drawModalDialog(void)
|
||||||
|
|
||||||
r.w = 800;
|
r.w = 800;
|
||||||
r.h = getWrappedTextHeight(app.modalDialog.message, 24) + 100;
|
r.h = getWrappedTextHeight(app.modalDialog.message, 24) + 100;
|
||||||
r.x = (SCREEN_WIDTH / 2) - (r.w / 2);
|
r.x = (UI_WIDTH / 2) - (r.w / 2);
|
||||||
r.y = (SCREEN_HEIGHT / 2) - (r.h / 2);
|
r.y = (UI_HEIGHT / 2) - (r.h / 2);
|
||||||
|
|
||||||
ok->rect.y = okCancelOK->rect.y = okCancelCancel->rect.y = r.y + r.h - 50;
|
ok->rect.y = okCancelOK->rect.y = okCancelCancel->rect.y = r.y + r.h - 50;
|
||||||
|
|
||||||
|
@ -122,7 +124,7 @@ void drawModalDialog(void)
|
||||||
|
|
||||||
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE);
|
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE);
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH / 2, r.y + 10, 24, TA_CENTER, colors.white, app.modalDialog.message);
|
drawText(UI_WIDTH / 2, r.y + 10, 24, TA_CENTER, colors.white, app.modalDialog.message);
|
||||||
|
|
||||||
switch (app.modalDialog.type)
|
switch (app.modalDialog.type)
|
||||||
{
|
{
|
||||||
|
@ -136,4 +138,6 @@ void drawModalDialog(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
app.textWidth = 0;
|
app.textWidth = 0;
|
||||||
|
|
||||||
|
SDL_SetRenderTarget(app.renderer, app.backBuffer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue