[Add] Messages now fade away all sexy like.

This commit is contained in:
Allanis 2013-08-09 16:24:48 +01:00
parent cc9ee5bf1a
commit 95d8eff1c5

View File

@ -608,9 +608,12 @@ void player_renderGUI(void) {
double x, y; double x, y;
char str[10]; char str[10];
Pilot* p; Pilot* p;
glColour* c; glColour* c, c2;
glFont* f; glFont* f;
StarSystem* sys; StarSystem* sys;
unsigned int t;
t = SDL_GetTicks();
/* Pilot is dead or being created, just render her and stop. */ /* Pilot is dead or being created, just render her and stop. */
if(player_isFlag(PLAYER_DESTROYED) || player_isFlag(PLAYER_CREATING) || if(player_isFlag(PLAYER_DESTROYED) || player_isFlag(PLAYER_CREATING) ||
@ -618,7 +621,7 @@ void player_renderGUI(void) {
if(player_isFlag(PLAYER_DESTROYED)) { if(player_isFlag(PLAYER_DESTROYED)) {
if(!toolkit && !player_isFlag(PLAYER_CREATING) && if(!toolkit && !player_isFlag(PLAYER_CREATING) &&
(SDL_GetTicks() > player_timer)) { (t > player_timer)) {
menu_death(); menu_death();
} }
} }
@ -830,18 +833,25 @@ void player_renderGUI(void) {
/* Messages. */ /* Messages. */
x = gui.msg.x; x = gui.msg.x;
y = gui.msg.y + (double)(gl_defFont.h * msg_max)*1.2; y = gui.msg.y + (double)(gl_defFont.h * msg_max)*1.2;
c2.r = c2.g = c2.b = 1.;
for(i = 0; i < msg_max; i++) { for(i = 0; i < msg_max; i++) {
y -= (double)gl_defFont.h*1.2; y -= (double)gl_defFont.h*1.2;
if(msg_stack[msg_max-i-1].str[0] != '\0') { if(msg_stack[msg_max-i-1].str[0] != '\0') {
if(msg_stack[msg_max-i-1].t < SDL_GetTicks()) if(msg_stack[msg_max-i-1].t < t)
msg_stack[msg_max-i-1].str[0] = '\0'; msg_stack[msg_max-i-1].str[0] = '\0';
else gl_print(NULL, x, y, NULL, "%s", msg_stack[msg_max-i-1].str); else {
if(msg_stack[msg_max-i-1].t - msg_timeout/2 < t)
c2.a = (double)(msg_stack[msg_max-i-1].t - t) / (double)(msg_timeout/2);
else
c2.a = 1.;
gl_print(NULL, x, y, &c2, "%s", msg_stack[msg_max-i-1].str);
}
} }
} }
/* Hyperspace FLASH BANG!!! */ /* Hyperspace FLASH BANG!!! */
if(pilot_isFlag(player, PILOT_HYPERSPACE) && !paused) { if(pilot_isFlag(player, PILOT_HYPERSPACE) && !paused) {
i = (int)player->ptimer - HYPERSPACE_FADEOUT; i = (int)player->ptimer - HYPERSPACE_FADEOUT;
j = (int)SDL_GetTicks(); j = (int) t;
if(i < j) { if(i < j) {
x = (double)(j-i) / HYPERSPACE_FADEOUT; x = (double)(j-i) / HYPERSPACE_FADEOUT;
glColor4d(1.,1.,1., x); /* We'll | I'll, make this more effiecent later. */ glColor4d(1.,1.,1., x); /* We'll | I'll, make this more effiecent later. */