From 5cc0d8f27a1e3e3a1fee18f9a43b11e8334126a8 Mon Sep 17 00:00:00 2001 From: John Cote Date: Thu, 25 Jun 2015 22:59:13 -0400 Subject: [PATCH] More nametag translation --- otp/nametag/NametagGlobals.py | 4 ++-- toontown/estate/DistributedCannon.py | 13 ++++++------- toontown/estate/DistributedHouse.py | 17 +++++++---------- toontown/estate/ToonStatueSelectionGUI.py | 14 +++++++++----- toontown/minigame/DistributedCannonGame.py | 11 +++++------ toontown/minigame/DistributedPatternGame.py | 7 ++++--- toontown/minigame/DistributedTugOfWarGame.py | 8 +++++--- toontown/parties/Cannon.py | 11 +++++------ toontown/racing/DistributedVehicle.py | 6 +++--- 9 files changed, 46 insertions(+), 45 deletions(-) diff --git a/otp/nametag/NametagGlobals.py b/otp/nametag/NametagGlobals.py index d6c972b6..7f74d09a 100644 --- a/otp/nametag/NametagGlobals.py +++ b/otp/nametag/NametagGlobals.py @@ -95,6 +95,6 @@ onscreenChatForced = 0 def setOnscreenChatForced(ocf): global onscreenChatForced onscreenChatForced = ocf - + def setGlobalNametagScale(s): - pass \ No newline at end of file + pass diff --git a/toontown/estate/DistributedCannon.py b/toontown/estate/DistributedCannon.py index b5db83fc..861a249d 100755 --- a/toontown/estate/DistributedCannon.py +++ b/toontown/estate/DistributedCannon.py @@ -21,8 +21,8 @@ from direct.distributed import DistributedObject from toontown.effects import Wake from direct.controls.ControlManager import CollisionHandlerRayStart -from toontown.nametag.NametagFloat3d import NametagFloat3d -from toontown.nametag.Nametag import Nametag +from otp.nametag.NametagFloat3d import NametagFloat3d +from otp.nametag.Nametag import Nametag LAND_TIME = 2 WORLD_SCALE = 2.0 @@ -1239,19 +1239,19 @@ class DistributedCannon(DistributedObject.DistributedObject): def __calcHitTreasures(self, trajectory): estate = self.cr.doId2do.get(self.estateId) self.hitTreasures = [] - if estate: + '''if estate: doIds = estate.flyingTreasureId for id in doIds: t = self.cr.doId2do.get(id) if t: - pos = t.nodePath.getPos() + pos = t.pos rad = 10.5 height = 10.0 t_impact = trajectory.checkCollisionWithCylinderSides(pos, rad, height) if t_impact > 0: self.hitTreasures.append([t_impact, t]) - del estate + del estate''' return None def __shootTask(self, task): @@ -1579,5 +1579,4 @@ class DistributedCannon(DistributedObject.DistributedObject): def turnOnBumperCollision(self, whatever = 0): if self.bumperCol: - self.bumperCol.setCollideMask(ToontownGlobals.WallBitmask) - + self.bumperCol.setCollideMask(ToontownGlobals.WallBitmask)# decompiled 0 files: 0 okay, 1 failed, 0 verify failed diff --git a/toontown/estate/DistributedHouse.py b/toontown/estate/DistributedHouse.py index 29f8a562..37bb1218 100755 --- a/toontown/estate/DistributedHouse.py +++ b/toontown/estate/DistributedHouse.py @@ -19,8 +19,8 @@ import HouseGlobals from toontown.building import ToonInteriorColors from direct.showbase.MessengerGlobal import messenger from toontown.dna.DNAParser import * -from toontown.nametag.NametagGroup import NametagGroup -from toontown.nametag.Nametag import Nametag +from otp.nametag.NametagGroup import NametagGroup +from otp.nametag.Nametag import Nametag class DistributedHouse(DistributedObject.DistributedObject): notify = directNotify.newCategory('DistributedHouse') @@ -231,19 +231,16 @@ class DistributedHouse(DistributedObject.DistributedObject): else: houseName = TTLocalizer.AvatarsHouse % TTLocalizer.GetPossesive(self.name) self.nametag = NametagGroup() - self.nametag.setNametag3d(None) self.nametag.setFont(ToontownGlobals.getBuildingNametagFont()) if TTLocalizer.BuildingNametagShadow: self.nametag.setShadow(*TTLocalizer.BuildingNametagShadow) - self.nametag.hideChat() - self.nametag.hideThought() - nametagColor = NametagGlobals.NametagColors[NametagGlobals.CCToonBuilding] - self.nametag.setNametagColor(nametagColor) - self.nametag.setActive(False) + self.nametag.setContents(Nametag.CName) + self.nametag.setColorCode(NametagGroup.CCHouseBuilding) + self.nametag.setActive(0) self.nametag.setAvatar(self.house) - self.nametag.setText(houseName) + self.nametag.setObjectCode(self.doId) + self.nametag.setName(houseName) self.nametag.manage(base.marginManager) - self.nametag.updateAll() def unload(self): self.notify.debug('unload') diff --git a/toontown/estate/ToonStatueSelectionGUI.py b/toontown/estate/ToonStatueSelectionGUI.py index f50f2c19..7fd5dcc1 100755 --- a/toontown/estate/ToonStatueSelectionGUI.py +++ b/toontown/estate/ToonStatueSelectionGUI.py @@ -9,7 +9,8 @@ from panda3d.core import * from toontown.estate import DistributedToonStatuary from toontown.estate import GardenGlobals from toontown.estate import PlantingGUI -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals +from otp.nametag.NametagGroup import * from toontown.toon import DistributedToon from toontown.toon import Toon from toontown.toonbase import TTLocalizer @@ -96,20 +97,23 @@ class ToonStatueSelectionGUI(DirectFrame): return test def __makeFFlist(self): - playerAvatar = (base.localAvatar.doId, base.localAvatar.name, NametagGlobals.CCNonPlayer) + playerAvatar = (base.localAvatar.doId, base.localAvatar.name, CCNonPlayer) self.ffList.append(playerAvatar) self.dnaSelected = base.localAvatar.style self.createPreviewToon(self.dnaSelected) for familyMember in base.cr.avList: if familyMember.id != base.localAvatar.doId: - newFF = (familyMember.id, familyMember.name, NametagGlobals.CCNonPlayer) + newFF = (familyMember.id, familyMember.name, CCNonPlayer) self.ffList.append(newFF) for friendId in base.localAvatar.friendsList: handle = base.cr.identifyFriend(friendId) if handle and not self.checkFamily(friendId): if hasattr(handle, 'getName'): - newFF = (friendId, handle.getName(), NametagGlobals.getFriendColor(handle)) + colorCode = CCSpeedChat + if flags & ToontownGlobals.FriendChat: + colorCode = CCFreeChat + newFF = (friendId, handle.getName(), colorCode) self.ffList.append(newFF) else: self.notify.warning('Bad Handle for getName in makeFFlist') @@ -124,7 +128,7 @@ class ToonStatueSelectionGUI(DirectFrame): self.scrollList.refresh() def makeFamilyButton(self, familyId, familyName, colorCode): - fg = NametagGlobals.NametagColors[colorCode][3][0] + fg = NametagGlobals.getNameFg(colorCode, PGButton.SInactive) return DirectButton(relief=None, text=familyName, text_scale=0.04, text_align=TextNode.ALeft, text_fg=fg, text1_bg=self.textDownColor, text2_bg=self.textRolloverColor, text3_fg=self.textDisabledColor, textMayChange=0, command=self.__chooseFriend, extraArgs=[familyId, familyName]) def __chooseFriend(self, friendId, friendName): diff --git a/toontown/minigame/DistributedCannonGame.py b/toontown/minigame/DistributedCannonGame.py index e2bf4fd8..52b3a451 100755 --- a/toontown/minigame/DistributedCannonGame.py +++ b/toontown/minigame/DistributedCannonGame.py @@ -1,7 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from panda3d.core import * -from toontown.nametag.NametagFloat3d import NametagFloat3d -from toontown.nametag.Nametag import Nametag +from otp.nametag.NametagFloat3d import NametagFloat3d +from otp.nametag.Nametag import Nametag from toontown.toonbase.ToonBaseGlobal import * from DistributedMinigame import * from direct.distributed.ClockDelta import * @@ -198,7 +198,7 @@ class DistributedCannonGame(DistributedMinigame): if av: av.loop('neutral') av.setPlayRate(1.0, 'run') - av.nametag.remove(head.tag) + av.nametag.removeNametag(head.tag) head.delete() del self.toonHeadDict @@ -345,11 +345,10 @@ class DistributedCannonGame(DistributedMinigame): self.toonHeadDict[avId] = head toon = self.getAvatar(avId) tag = NametagFloat3d() - tag.hideNametag() - tag.update() + tag.setContents(Nametag.CSpeech | Nametag.CThought) tag.setBillboardOffset(0) tag.setAvatar(head) - toon.nametag.add(tag) + toon.nametag.addNametag(tag) tagPath = head.attachNewNode(tag) tagPath.setPos(0, 0, 1) head.tag = tag diff --git a/toontown/minigame/DistributedPatternGame.py b/toontown/minigame/DistributedPatternGame.py index 29d04747..ceb52ef4 100755 --- a/toontown/minigame/DistributedPatternGame.py +++ b/toontown/minigame/DistributedPatternGame.py @@ -9,8 +9,7 @@ import string import ArrowKeys from DistributedMinigame import * import PatternGameGlobals -from toontown.chat.ChatGlobals import * -from toontown.nametag.NametagGlobals import * +from otp.nametag.NametagConstants import * from toontown.toon import NPCToons from toontown.toon import ToonHead from toontown.toonbase import TTLocalizer @@ -200,6 +199,7 @@ class DistributedPatternGame(DistributedMinigame): camera.setPosHpr(0.0, -14.59, 10.56, 0.0, -16.39, 0.0) base.camLens.setMinFov(24.66/(4./3.)) base.setBackgroundColor(Vec4(0.984, 0.984, 0.584, 1)) + NametagGlobals.setGlobalNametagScale(0.6) self.arrowKeys = ArrowKeys.ArrowKeys() self.room.reparentTo(render) self.room.setPosHpr(0.0, 18.39, -ToontownGlobals.FloorOffset, 0.0, 0.0, 0.0) @@ -244,7 +244,7 @@ class DistributedPatternGame(DistributedMinigame): self.makeToonLookatCamera(self.blinky) self.blinky.loop('neutral') self.blinky.nametag.manage(base.marginManager) - self.blinky.nametag.getNametag3d().setChatWordWrap(8) + self.blinky.nametag.getNametag3d().setChatWordwrap(8) self.arrowDict['m'] = [self.arrows.pop(), self.xs.pop()] for k in xrange(0, 2): self.arrowDict['m'][k].setBillboardAxis() @@ -262,6 +262,7 @@ class DistributedPatternGame(DistributedMinigame): self.music.stop() base.camLens.setMinFov(settings['fov']/(4./3.)) base.setBackgroundColor(ToontownGlobals.DefaultBackgroundColor) + NametagGlobals.setGlobalNametagScale(1.0) self.arrowKeys.destroy() del self.arrowKeys self.room.reparentTo(hidden) diff --git a/toontown/minigame/DistributedTugOfWarGame.py b/toontown/minigame/DistributedTugOfWarGame.py index 81d791a6..4f755987 100755 --- a/toontown/minigame/DistributedTugOfWarGame.py +++ b/toontown/minigame/DistributedTugOfWarGame.py @@ -21,7 +21,7 @@ from toontown.effects import Ripples from toontown.toonbase import TTLocalizer import MinigamePowerMeter from direct.task.Task import Task -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals class DistributedTugOfWarGame(DistributedMinigame): bgm = 'phase_4/audio/bgm/MG_tug_o_war.ogg' @@ -251,6 +251,7 @@ class DistributedTugOfWarGame(DistributedMinigame): self.notify.debug('onstage') DistributedMinigame.onstage(self) self.lt = base.localAvatar + NametagGlobals.setGlobalNametagScale(1) self.arrowKeys = ArrowKeys.ArrowKeys() self.room.reparentTo(render) self.room.setPosHpr(0.0, 18.39, -ToontownGlobals.FloorOffset, 0.0, 0.0, 0.0) @@ -294,6 +295,7 @@ class DistributedTugOfWarGame(DistributedMinigame): self.setupTrack = None base.camLens.setMinFov(settings['fov']/(4./3.)) base.camLens.setNearFar(ToontownGlobals.DefaultCameraNear, ToontownGlobals.DefaultCameraFar) + NametagGlobals.setGlobalNametagScale(1.0) if self.arrowKeys: self.arrowKeys.setPressHandlers(self.arrowKeys.NULL_HANDLERS) self.arrowKeys.setReleaseHandlers(self.arrowKeys.NULL_HANDLERS) @@ -1020,8 +1022,8 @@ class DistributedTugOfWarGame(DistributedMinigame): d = SuitDNA.SuitDNA() d.newSuit(self.suitType) self.suit.setDNA(d) - self.suit.nametag.setNametag2d(None) - self.suit.nametag.setNametag3d(None) + self.suit.nametag3d.stash() + self.suit.nametag.destroy() self.suit.reparentTo(render) self.suit.setPos(self.origSuitPosHpr[0]) self.suit.setHpr(self.origSuitPosHpr[1]) diff --git a/toontown/parties/Cannon.py b/toontown/parties/Cannon.py index 74510d13..2b66b1c8 100755 --- a/toontown/parties/Cannon.py +++ b/toontown/parties/Cannon.py @@ -9,8 +9,8 @@ from toontown.minigame.CannonGameGlobals import * from toontown.toonbase import ToontownGlobals from toontown.parties.PartyUtils import toRadians, calcVelocity from direct.showbase.PythonUtil import StackTrace -from toontown.nametag.NametagFloat3d import NametagFloat3d -from toontown.nametag.Nametag import Nametag +from otp.nametag.NametagFloat3d import NametagFloat3d +from otp.nametag.Nametag import Nametag CANNON_ROTATION_MIN = -70 CANNON_ROTATION_MAX = 70 INITIAL_VELOCITY = 80.0 @@ -134,11 +134,10 @@ class Cannon: self.toonHead.setupHead(toon.style) self.toonHead.reparentTo(hidden) tag = NametagFloat3d() - tag.hideNametag() - tag.update() + tag.setContents(Nametag.CSpeech | Nametag.CThought) tag.setBillboardOffset(0) tag.setAvatar(self.toonHead) - toon.nametag.add(tag) + toon.nametag.addNametag(tag) tagPath = self.toonHead.attachNewNode(tag) tagPath.setPos(0, 0, 1) self.toonHead.tag = tag @@ -192,7 +191,7 @@ class Cannon: if self.toonHead != None: self.hideToonHead() if hasattr(self.toonInside, 'nametag'): - self.toonInside.nametag.remove(self.toonHead.tag) + self.toonInside.nametag.removeNametag(self.toonHead.tag) self.toonHead.delete() self.toonHead = None self.toonInside = None diff --git a/toontown/racing/DistributedVehicle.py b/toontown/racing/DistributedVehicle.py index c3330b50..8d630378 100755 --- a/toontown/racing/DistributedVehicle.py +++ b/toontown/racing/DistributedVehicle.py @@ -19,7 +19,7 @@ from toontown.battle.BattleProps import * import random from direct.showbase.PythonUtil import randFloat from direct.task.Task import Task -from toontown.nametag import NametagGlobals +from otp.nametag import NametagGlobals import math iceTurnFactor = 0.25 iceAccelFactor = 0.4 @@ -497,7 +497,7 @@ class DistributedVehicle(DistributedSmoothNode.DistributedSmoothNode, Kart.Kart, self.toon.sendCurrentPosition() self.doHeadScale(self.toon, 1.75) self.toon.setShear(0, 0, 0) - NametagGlobals.setForceOnscreenChat(True) + NametagGlobals.setOnscreenChatForced(1) if self.localVehicle: camera.reparentTo(self.cameraNode) camera.setPosHpr(0, -33, 16, 0, -10, 0) @@ -537,7 +537,7 @@ class DistributedVehicle(DistributedSmoothNode.DistributedSmoothNode, Kart.Kart, self.toon.reparentTo(render) self.toon.loop('neutral') self.toon.startSmooth() - NametagGlobals.setForceOnscreenChat(False) + NametagGlobals.setOnscreenChatForced(0) base.camLens.setMinFov(settings['fov']/(4./3.)) def doHeadScale(self, model, scale):