Skip to content

Commit

Permalink
Further fixes to the display of gui messages (game over messages are …
Browse files Browse the repository at this point in the history
…now displayed too) plus some refactoring to make the messages displaying code more compact.
  • Loading branch information
AnotherCommander committed Jul 4, 2017
1 parent 93adf46 commit 784dfe7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/Core/GuiDisplayGen.m
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,8 @@ - (void) drawGLDisplay:(GLfloat)x :(GLfloat)y :(GLfloat)z :(GLfloat) alpha
// don't draw it on the intro screens
if (backgroundColor)
{
if ([PLAYER status] != STATUS_START_GAME)
int playerStatus = [PLAYER status];
if (playerStatus != STATUS_START_GAME && playerStatus != STATUS_DEAD)
{
OOGL(glColor4f([backgroundColor redComponent], [backgroundColor greenComponent], [backgroundColor blueComponent], alpha * [backgroundColor alphaComponent]));
OOGLBEGIN(GL_QUADS);
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Universe.h
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ enum
- (void) addCommsMessage:(NSString *) text forCount:(OOTimeDelta) count;
- (void) addCommsMessage:(NSString *) text forCount:(OOTimeDelta) count andShowComms:(BOOL)showComms logOnly:(BOOL)logOnly;
- (void) showCommsLog:(OOTimeDelta) how_long;
- (void) fadeOutMessageGuiBackground:(OOTimeDelta)how_long;
- (void) showGUIMessage:(NSString *)text withScroll:(BOOL)scroll overDuration:(OOTimeDelta)how_long;

- (void) update:(OOTimeDelta)delta_t;

Expand Down
23 changes: 14 additions & 9 deletions src/Core/Universe.m
Original file line number Diff line number Diff line change
Expand Up @@ -6312,7 +6312,7 @@ - (void) displayMessage:(NSString *) text forCount:(OOTimeDelta)count
if (currentMessage) [currentMessage release];
currentMessage = [text retain];
messageRepeatTime=universal_time + 6.0;
[message_gui printLongText:text align:GUI_ALIGN_CENTER color:[OOColor yellowColor] fadeTime:count key:nil addToArray:nil];
[self showGUIMessage:text withScroll:YES overDuration:count];
}
}

Expand All @@ -6324,8 +6324,7 @@ - (void) displayCountdownMessage:(NSString *) text forCount:(OOTimeDelta)count
if (currentMessage) [currentMessage release];
currentMessage = [text retain];
countdown_messageRepeatTime=universal_time + count;
[message_gui printLineNoScroll:text align:GUI_ALIGN_CENTER color:[OOColor yellowColor] fadeTime:count key:nil addToArray:nil];
[message_gui setAlpha:[[PLAYER hud] overallAlpha]];
[self showGUIMessage:text withScroll:NO overDuration:count];
}
}

Expand Down Expand Up @@ -6418,8 +6417,7 @@ - (void) addMessage:(NSString *) text forCount:(OOTimeDelta) count forceDisplay:
[self speakWithSubstitutions:text];
}

[message_gui printLongText:text align:GUI_ALIGN_CENTER color:[OOColor yellowColor] fadeTime:([self permanentMessageLog]?0.0:count) key:nil addToArray:nil];
[self fadeOutMessageGuiBackground:count];
[self showGUIMessage:text withScroll:YES overDuration:count];

[currentMessage release];
currentMessage = [text retain];
Expand Down Expand Up @@ -6451,8 +6449,7 @@ - (void) addCommsMessage:(NSString *)text forCount:(OOTimeDelta)count andShowCom
[self speakWithSubstitutions:[NSString stringWithFormat:format, text]];
}

[message_gui printLongText:text align:GUI_ALIGN_CENTER color:[OOColor greenColor] fadeTime:([self permanentMessageLog]?0.0:count) key:nil addToArray:nil];
[self fadeOutMessageGuiBackground:count];
[self showGUIMessage:text withScroll:YES overDuration:count];

[currentMessage release];
currentMessage = [text retain];
Expand All @@ -6473,9 +6470,17 @@ - (void) showCommsLog:(OOTimeDelta)how_long
}


- (void) fadeOutMessageGuiBackground:(OOTimeDelta)how_long
- (void) showGUIMessage:(NSString *)text withScroll:(BOOL)scroll overDuration:(OOTimeDelta)how_long
{
[message_gui setAlpha:1.0];
if (scroll)
{
[message_gui printLongText:text align:GUI_ALIGN_CENTER color:[OOColor yellowColor] fadeTime:how_long key:nil addToArray:nil];
}
else
{
[message_gui printLineNoScroll:text align:GUI_ALIGN_CENTER color:[OOColor yellowColor] fadeTime:how_long key:nil addToArray:nil];
}
[message_gui setAlpha:1.0f];
if (![self permanentMessageLog]) [message_gui fadeOutFromTime:[self getTime] overDuration:how_long];
}

Expand Down

0 comments on commit 784dfe7

Please sign in to comment.