Skip to content

Commit

Permalink
Attempted fix of the message gui background behaviour. It should now …
Browse files Browse the repository at this point in the history
…behave similarly to the comms log gui. It is displayed at all times if the permanent key has been set to YES in hud.plist, otherwise it fades out together with the messages displayed. Should hopefully address #236.
  • Loading branch information
AnotherCommander committed Jul 3, 2017
1 parent 4b32237 commit 4fd9403
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
20 changes: 12 additions & 8 deletions src/Core/GuiDisplayGen.m
Original file line number Diff line number Diff line change
Expand Up @@ -1407,16 +1407,20 @@ - (void) drawGLDisplay:(GLfloat)x :(GLfloat)y :(GLfloat)z :(GLfloat) alpha
NSSize titleCharacterSize = pixel_title_size;

// do backdrop
//
// don't draw it if docked, unless message_gui is permanent
// don't draw it on the intro screens
if (backgroundColor)
{
OOGL(glColor4f([backgroundColor redComponent], [backgroundColor greenComponent], [backgroundColor blueComponent], alpha * [backgroundColor alphaComponent]));
OOGLBEGIN(GL_QUADS);
glVertex3f(x + 0.0f, y + 0.0f, z);
glVertex3f(x + size_in_pixels.width, y + 0.0f, z);
glVertex3f(x + size_in_pixels.width, y + size_in_pixels.height, z);
glVertex3f(x + 0.0f, y + size_in_pixels.height, z);
OOGLEND();
if ([PLAYER status] != STATUS_START_GAME)
{
OOGL(glColor4f([backgroundColor redComponent], [backgroundColor greenComponent], [backgroundColor blueComponent], alpha * [backgroundColor alphaComponent]));
OOGLBEGIN(GL_QUADS);
glVertex3f(x + 0.0f, y + 0.0f, z);
glVertex3f(x + size_in_pixels.width, y + 0.0f, z);
glVertex3f(x + size_in_pixels.width, y + size_in_pixels.height, z);
glVertex3f(x + 0.0f, y + size_in_pixels.height, z);
OOGLEND();
}
}

// show the 'foreground', aka overlay!
Expand Down
10 changes: 9 additions & 1 deletion src/Core/HeadUpDisplay.m
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,15 @@ - (void) resetGuis:(NSDictionary *)info
[UNIVERSE setPermanentMessageLog:NO];
}

[gui setAlpha: 1.0]; // message_gui is always visible.
if ([UNIVERSE permanentMessageLog])
{
[gui stopFadeOuts];
[gui setAlpha:1.0];
}
else
{
[gui setAlpha:0.0];
}

// And now set up the comms log

Expand Down
1 change: 1 addition & 0 deletions src/Core/Universe.h
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +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) update:(OOTimeDelta)delta_t;

Expand Down
9 changes: 9 additions & 0 deletions src/Core/Universe.m
Original file line number Diff line number Diff line change
Expand Up @@ -6418,6 +6418,7 @@ - (void) addMessage:(NSString *) text forCount:(OOTimeDelta) count forceDisplay:
}

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

[currentMessage release];
currentMessage = [text retain];
Expand Down Expand Up @@ -6450,6 +6451,7 @@ - (void) addCommsMessage:(NSString *)text forCount:(OOTimeDelta)count andShowCom
}

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

[currentMessage release];
currentMessage = [text retain];
Expand All @@ -6470,6 +6472,13 @@ - (void) showCommsLog:(OOTimeDelta)how_long
}


- (void) fadeOutMessageGuiBackground:(OOTimeDelta)how_long
{
[message_gui setAlpha:1.0];
if (![self permanentMessageLog]) [message_gui fadeOutFromTime:[self getTime] overDuration:how_long];
}


- (void) repopulateSystem
{
if (EXPECT_NOT([PLAYER status] == STATUS_START_GAME))
Expand Down

0 comments on commit 4fd9403

Please sign in to comment.