diff --git a/otp/avatar/Avatar.py b/otp/avatar/Avatar.py index 99a5f363..23c4cd75 100644 --- a/otp/avatar/Avatar.py +++ b/otp/avatar/Avatar.py @@ -39,6 +39,7 @@ class Avatar(Actor, ShadowCaster): Actor.__init__(self, None, None, other, flattenable=0, setFinal=0) ShadowCaster.__init__(self) self.__font = OTPGlobals.getInterfaceFont() + self.__speechFont = OTPGlobals.getInterfaceFont() self.soundChatBubble = None self.avatarType = '' self.nametagNodePath = None @@ -46,6 +47,7 @@ class Avatar(Actor, ShadowCaster): self.nametag = NametagGroup() self.nametag.setAvatar(self) self.nametag.setFont(OTPGlobals.getInterfaceFont()) + self.nametag.setSpeechFont(OTPGlobals.getInterfaceFont()) self.nametag2dContents = Nametag.CName | Nametag.CSpeech self.nametag2dDist = Nametag.CName | Nametag.CSpeech self.nametag2dNormalContents = Nametag.CName | Nametag.CSpeech @@ -91,6 +93,7 @@ class Avatar(Actor, ShadowCaster): self.ignoreNametagAmbientLightChange() self.Avatar_deleted = 1 del self.__font + del self.__speechFont del self.style del self.soundChatBubble self.nametag.destroy() @@ -252,6 +255,13 @@ class Avatar(Actor, ShadowCaster): self.__font = font self.nametag.setFont(font) + def getSpeechFont(self): + return self.__speechFont + + def setSpeechFont(self, font): + self.__speechFont = font + self.nametag.setSpeechFont(font) + def getStyle(self): return self.style diff --git a/otp/nametag/Nametag.py b/otp/nametag/Nametag.py index de40c1a4..ac1bf1e6 100644 --- a/otp/nametag/Nametag.py +++ b/otp/nametag/Nametag.py @@ -30,7 +30,7 @@ class Nametag(ClickablePopup): self.chatWordWrap = None self.font = None - self.speechFont = OTPGlobals.getInterfaceFont() + self.speechFont = None self.name = '' self.displayName = '' self.qtColor = VBase4(1,1,1,1) @@ -93,6 +93,9 @@ class Nametag(ClickablePopup): self.showName() def showBalloon(self, balloon, text): + if not self.speechFont: + # If no font is set, we can't display anything yet... + return color = self.qtColor if (self.chatFlags&CFQuicktalker) else self.chatBg if color[3] > self.CHAT_ALPHA: color = (color[0], color[1], color[2], self.CHAT_ALPHA) diff --git a/otp/nametag/NametagGroup.py b/otp/nametag/NametagGroup.py index d2d99c57..ea7af978 100644 --- a/otp/nametag/NametagGroup.py +++ b/otp/nametag/NametagGroup.py @@ -26,6 +26,7 @@ class NametagGroup: self.chatTimeoutTask = None self.font = None + self.speechFont = None self.name = '' self.displayName = '' self.wordWrap = None @@ -141,6 +142,10 @@ class NametagGroup: self.font = font self.updateTags() + def setSpeechFont(self, font): + self.speechFont = font + self.updateTags() + def setWordwrap(self, wrap): self.wordWrap = wrap self.updateTags() @@ -227,6 +232,7 @@ class NametagGroup: def updateNametag(self, tag): tag.font = self.font + tag.speechFont = self.speechFont tag.name = self.name tag.wordWrap = self.wordWrap or DEFAULT_WORDWRAPS[self.colorCode] tag.displayName = self.displayName or self.name diff --git a/toontown/suit/Suit.py b/toontown/suit/Suit.py index afa8ecf9..bad93bba 100644 --- a/toontown/suit/Suit.py +++ b/toontown/suit/Suit.py @@ -344,6 +344,7 @@ class Suit(Avatar.Avatar): Avatar.Avatar.__init__(self) self.setFont(ToontownGlobals.getSuitFont()) + self.setSpeechFont(ToontownGlobals.getSuitFont()) self.setPlayerType(NametagGroup.CCSuit) self.setPickable(1) self.leftHand = None diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 1f220982..c3b07555 100644 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -2623,7 +2623,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute else: self.gmToonLockStyle = False self.removeGMIcon() - self.setNametagStyle(0) + self.setNametagStyle(100) def setGMIcon(self, gmType = None): if hasattr(self, 'gmIcon') and self.gmIcon: diff --git a/toontown/toon/Toon.py b/toontown/toon/Toon.py index 65e06436..c19e3368 100644 --- a/toontown/toon/Toon.py +++ b/toontown/toon/Toon.py @@ -504,6 +504,7 @@ class Toon(Avatar.Avatar, ToonHead): self.jar = None self.setTag('pieCode', str(ToontownGlobals.PieCodeToon)) self.setFont(ToontownGlobals.getToonFont()) + self.setSpeechFont(ToontownGlobals.getToonFont()) self.soundChatBubble = base.loadSfx('phase_3/audio/sfx/GUI_balloon_popup.ogg') self.animFSM = ClassicFSM('Toon', [State('off', self.enterOff, self.exitOff), State('neutral', self.enterNeutral, self.exitNeutral), @@ -2971,6 +2972,7 @@ class Toon(Avatar.Avatar, ToonHead): self.suit.loop('neutral') self.isDisguised = 1 self.setFont(ToontownGlobals.getSuitFont()) + self.setSpeechFont(ToontownGlobals.getSuitFont()) if setDisplayName: if hasattr(base, 'idTags') and base.idTags: name = self.getAvIdName() @@ -3004,6 +3006,7 @@ class Toon(Avatar.Avatar, ToonHead): Emote.globalEmote.releaseAll(self) self.isDisguised = 0 self.setFont(ToontownGlobals.getToonFont()) + self.setSpeechFont(ToontownGlobals.getToonFont()) self.nametag.setWordwrap(None) if hasattr(base, 'idTags') and base.idTags: name = self.getAvIdName()