diff --git a/src/battle/battle.c b/src/battle/battle.c index 18b5313..8fdc3e9 100644 --- a/src/battle/battle.c +++ b/src/battle/battle.c @@ -197,7 +197,7 @@ static void draw(void) drawBackground(battle.background); - blit(battle.planetTexture, battle.planet.x, battle.planet.y, 1); + blitScaled(battle.planetTexture, battle.planet.x, battle.planet.y, battle.planetWidth, battle.planetHeight); drawStars(); diff --git a/src/battle/battle.h b/src/battle/battle.h index 3aef3c5..4371501 100644 --- a/src/battle/battle.h +++ b/src/battle/battle.h @@ -41,7 +41,7 @@ extern void drawHud(void); extern void drawEffects(void); extern void doEffects(void); extern void doObjectives(void); -extern void blit(SDL_Texture *texture, int x, int y, int centered); +extern void blitScaled(SDL_Texture *texture, int x, int y, int w, int h); extern void initHud(void); extern void initRadar(void); extern void initGalacticMap(void); diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index f8b7453..fc14f74 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -35,6 +35,7 @@ void loadMission(char *filename) { cJSON *root; char *text, music[MAX_DESCRIPTION_LENGTH]; + float planetScale; startSectionTransition(); @@ -47,9 +48,15 @@ void loadMission(char *filename) root = cJSON_Parse(text); battle.background = getTexture(cJSON_GetObjectItem(root, "background")->valuestring); + + planetScale = 75 + (rand() % 125); + planetScale *= 0.01; battle.planetTexture = getTexture(cJSON_GetObjectItem(root, "planet")->valuestring); battle.planet.x = (SCREEN_WIDTH / 2) - (rand() % SCREEN_WIDTH) + (rand() % SCREEN_WIDTH); battle.planet.y = (SCREEN_HEIGHT / 2) - (rand() % SCREEN_HEIGHT) + (rand() % SCREEN_HEIGHT); + SDL_QueryTexture(battle.planetTexture, NULL, NULL, &battle.planetWidth, &battle.planetHeight); + battle.planetWidth *= planetScale; + battle.planetHeight *= planetScale; loadObjectives(cJSON_GetObjectItem(root, "objectives")); diff --git a/src/structs.h b/src/structs.h index 3f63628..f087bda 100644 --- a/src/structs.h +++ b/src/structs.h @@ -295,6 +295,7 @@ typedef struct { Entity *extractionPoint; SDL_Texture *background, *planetTexture; PointF planet; + int planetWidth, planetHeight; Entity entityHead, *entityTail; Bullet bulletHead, *bulletTail; Debris debrisHead, *debrisTail;