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