Randomly scale planet.
This commit is contained in:
parent
862d73dbc2
commit
dcef433d4d
|
@ -197,7 +197,7 @@ static void draw(void)
|
||||||
|
|
||||||
drawBackground(battle.background);
|
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();
|
drawStars();
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ extern void drawHud(void);
|
||||||
extern void drawEffects(void);
|
extern void drawEffects(void);
|
||||||
extern void doEffects(void);
|
extern void doEffects(void);
|
||||||
extern void doObjectives(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 initHud(void);
|
||||||
extern void initRadar(void);
|
extern void initRadar(void);
|
||||||
extern void initGalacticMap(void);
|
extern void initGalacticMap(void);
|
||||||
|
|
|
@ -35,6 +35,7 @@ void loadMission(char *filename)
|
||||||
{
|
{
|
||||||
cJSON *root;
|
cJSON *root;
|
||||||
char *text, music[MAX_DESCRIPTION_LENGTH];
|
char *text, music[MAX_DESCRIPTION_LENGTH];
|
||||||
|
float planetScale;
|
||||||
|
|
||||||
startSectionTransition();
|
startSectionTransition();
|
||||||
|
|
||||||
|
@ -47,9 +48,15 @@ void loadMission(char *filename)
|
||||||
root = cJSON_Parse(text);
|
root = cJSON_Parse(text);
|
||||||
|
|
||||||
battle.background = getTexture(cJSON_GetObjectItem(root, "background")->valuestring);
|
battle.background = getTexture(cJSON_GetObjectItem(root, "background")->valuestring);
|
||||||
|
|
||||||
|
planetScale = 75 + (rand() % 125);
|
||||||
|
planetScale *= 0.01;
|
||||||
battle.planetTexture = getTexture(cJSON_GetObjectItem(root, "planet")->valuestring);
|
battle.planetTexture = getTexture(cJSON_GetObjectItem(root, "planet")->valuestring);
|
||||||
battle.planet.x = (SCREEN_WIDTH / 2) - (rand() % SCREEN_WIDTH) + (rand() % SCREEN_WIDTH);
|
battle.planet.x = (SCREEN_WIDTH / 2) - (rand() % SCREEN_WIDTH) + (rand() % SCREEN_WIDTH);
|
||||||
battle.planet.y = (SCREEN_HEIGHT / 2) - (rand() % SCREEN_HEIGHT) + (rand() % SCREEN_HEIGHT);
|
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"));
|
loadObjectives(cJSON_GetObjectItem(root, "objectives"));
|
||||||
|
|
||||||
|
|
|
@ -295,6 +295,7 @@ typedef struct {
|
||||||
Entity *extractionPoint;
|
Entity *extractionPoint;
|
||||||
SDL_Texture *background, *planetTexture;
|
SDL_Texture *background, *planetTexture;
|
||||||
PointF planet;
|
PointF planet;
|
||||||
|
int planetWidth, planetHeight;
|
||||||
Entity entityHead, *entityTail;
|
Entity entityHead, *entityTail;
|
||||||
Bullet bulletHead, *bulletTail;
|
Bullet bulletHead, *bulletTail;
|
||||||
Debris debrisHead, *debrisTail;
|
Debris debrisHead, *debrisTail;
|
||||||
|
|
Loading…
Reference in New Issue