Randomize planet and background in Challenge Home.
This commit is contained in:
parent
25d68b27fb
commit
9d846fd137
|
@ -60,13 +60,13 @@ void initChallengeHome(void)
|
|||
app.delegate.draw = &draw;
|
||||
memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);
|
||||
|
||||
background = getTexture("gfx/backgrounds/background06.jpg");
|
||||
planetTexture = getTexture("gfx/planets/bluePlanet.png");
|
||||
background = getTexture(getBackgroundTextureName(rand()));
|
||||
planetTexture = getTexture(getPlanetTextureName(rand()));
|
||||
|
||||
battle.camera.x = battle.camera.y = 0;
|
||||
|
||||
planet.x = SCREEN_WIDTH;
|
||||
planet.y = (rand() % SCREEN_HEIGHT - 128);
|
||||
planet.x = rand() % SCREEN_WIDTH;
|
||||
planet.y = rand() % SCREEN_HEIGHT;
|
||||
|
||||
game.currentMission = NULL;
|
||||
|
||||
|
@ -174,7 +174,7 @@ static void draw(void)
|
|||
{
|
||||
drawBackground(background);
|
||||
|
||||
blit(planetTexture, planet.x, planet.y, 0);
|
||||
blit(planetTexture, planet.x, planet.y, 1);
|
||||
|
||||
drawStars();
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@ extern void selectWidget(const char *name, const char *group);
|
|||
extern void updateAllMissions(void);
|
||||
extern char *getTranslatedString(char *string);
|
||||
extern void blit(SDL_Texture *t, int x, int y, int centered);
|
||||
extern char *getBackgroundTextureName(int n);
|
||||
extern char *getPlanetTextureName(int n);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
|
|
|
@ -113,12 +113,12 @@ void drawBackground(SDL_Texture *texture)
|
|||
}
|
||||
}
|
||||
|
||||
char *getBackgroundTexture(int i)
|
||||
char *getBackgroundTextureName(int i)
|
||||
{
|
||||
return backgrounds[i % numBackgrounds];
|
||||
}
|
||||
|
||||
char *getPlanetTexture(int i)
|
||||
char *getPlanetTextureName(int i)
|
||||
{
|
||||
return planets[i % numPlanets];
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ static char *getAutoBackground(char *filename)
|
|||
hash = hashcode(filename);
|
||||
}
|
||||
|
||||
return getBackgroundTexture(hash);
|
||||
return getBackgroundTextureName(hash);
|
||||
}
|
||||
|
||||
static char *getAutoPlanet(char *filename)
|
||||
|
@ -244,7 +244,7 @@ static char *getAutoPlanet(char *filename)
|
|||
hash = hashcode(filename);
|
||||
}
|
||||
|
||||
return getPlanetTexture(hash);
|
||||
return getPlanetTextureName(hash);
|
||||
}
|
||||
|
||||
void completeMission(void)
|
||||
|
|
|
@ -51,8 +51,8 @@ extern void initMissionInfo(void);
|
|||
extern char *getTranslatedString(char *string);
|
||||
extern void updateStarSystemMissions(void);
|
||||
extern void updateChallengeMissions(void);
|
||||
extern char *getBackgroundTexture(int n);
|
||||
extern char *getPlanetTexture(int n);
|
||||
extern char *getBackgroundTextureName(int n);
|
||||
extern char *getPlanetTextureName(int n);
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *player;
|
||||
|
|
Loading…
Reference in New Issue