[Add] Messages now fade away all sexy like.
This commit is contained in:
parent
cc9ee5bf1a
commit
95d8eff1c5
20
src/player.c
20
src/player.c
@ -608,9 +608,12 @@ void player_renderGUI(void) {
|
||||
double x, y;
|
||||
char str[10];
|
||||
Pilot* p;
|
||||
glColour* c;
|
||||
glColour* c, c2;
|
||||
glFont* f;
|
||||
StarSystem* sys;
|
||||
unsigned int t;
|
||||
|
||||
t = SDL_GetTicks();
|
||||
|
||||
/* Pilot is dead or being created, just render her and stop. */
|
||||
if(player_isFlag(PLAYER_DESTROYED) || player_isFlag(PLAYER_CREATING) ||
|
||||
@ -618,7 +621,7 @@ void player_renderGUI(void) {
|
||||
|
||||
if(player_isFlag(PLAYER_DESTROYED)) {
|
||||
if(!toolkit && !player_isFlag(PLAYER_CREATING) &&
|
||||
(SDL_GetTicks() > player_timer)) {
|
||||
(t > player_timer)) {
|
||||
menu_death();
|
||||
}
|
||||
}
|
||||
@ -830,18 +833,25 @@ void player_renderGUI(void) {
|
||||
/* Messages. */
|
||||
x = gui.msg.x;
|
||||
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++) {
|
||||
y -= (double)gl_defFont.h*1.2;
|
||||
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';
|
||||
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!!! */
|
||||
if(pilot_isFlag(player, PILOT_HYPERSPACE) && !paused) {
|
||||
i = (int)player->ptimer - HYPERSPACE_FADEOUT;
|
||||
j = (int)SDL_GetTicks();
|
||||
j = (int) t;
|
||||
if(i < j) {
|
||||
x = (double)(j-i) / HYPERSPACE_FADEOUT;
|
||||
glColor4d(1.,1.,1., x); /* We'll | I'll, make this more effiecent later. */
|
||||
|
Loading…
Reference in New Issue
Block a user