diff --git a/toontown/building/ToonInterior.py b/toontown/building/ToonInterior.py index c39acd4..69229ae 100644 --- a/toontown/building/ToonInterior.py +++ b/toontown/building/ToonInterior.py @@ -1,31 +1,33 @@ -from panda3d.core import * -from toontown.toonbase.ToonBaseGlobal import * -from direct.directnotify import DirectNotifyGlobal -from toontown.hood import Place -from toontown.hood import ZoneUtil -from direct.showbase import DirectObject -from direct.fsm import StateData -from direct.fsm import ClassicFSM, State -from direct.fsm import State -from direct.task import Task -from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs -from toontown.toonbase import ToontownGlobals -from toontown.toonbase import TTLocalizer -from toontown.toon import NPCForceAcknowledge -from toontown.toon import HealthForceAcknowledge +from panda3d.core import ModelPool, TexturePool +from panda3d.otp import NametagGlobals -class ToonInterior(Place.Place): - notify = DirectNotifyGlobal.directNotify.newCategory('ToonInterior') +from direct.directnotify.DirectNotifyGlobal import directNotify +from direct.fsm.ClassicFSM import ClassicFSM +from direct.fsm.State import State +from direct.showbase.MessengerGlobal import messenger + +from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs + +from toontown.hood import ZoneUtil +from toontown.hood.Place import Place +from toontown.toon.HealthForceAcknowledge import HealthForceAcknowledge +from toontown.toon.NPCForceAcknowledge import NPCForceAcknowledge +from toontown.toonbase import ToontownGlobals +from toontown.toonbase.ToonBaseGlobal import base + + +class ToonInterior(Place): + notify = directNotify.newCategory('ToonInterior') def __init__(self, loader, parentFSMState, doneEvent): - Place.Place.__init__(self, loader, doneEvent) + Place.__init__(self, loader, doneEvent) self.dnaFile = 'phase_7/models/modules/toon_interior' self.isInterior = 1 self.tfaDoneEvent = 'tfaDoneEvent' self.hfaDoneEvent = 'hfaDoneEvent' self.npcfaDoneEvent = 'npcfaDoneEvent' - self.fsm = ClassicFSM.ClassicFSM('ToonInterior', [State.State('start', self.enterStart, self.exitStart, ['doorIn', 'teleportIn', 'tutorial']), - State.State('walk', self.enterWalk, self.exitWalk, ['sit', + self.fsm = ClassicFSM('ToonInterior', [State('start', self.enterStart, self.exitStart, ['doorIn', 'teleportIn', 'tutorial']), + State('walk', self.enterWalk, self.exitWalk, ['sit', 'stickerBook', 'doorOut', 'DFA', @@ -36,8 +38,8 @@ class ToonInterior(Place.Place): 'phone', 'stopped', 'pet']), - State.State('sit', self.enterSit, self.exitSit, ['walk']), - State.State('stickerBook', self.enterStickerBook, self.exitStickerBook, ['walk', + State('sit', self.enterSit, self.exitSit, ['walk']), + State('stickerBook', self.enterStickerBook, self.exitStickerBook, ['walk', 'DFA', 'trialerFA', 'sit', @@ -48,37 +50,37 @@ class ToonInterior(Place.Place): 'phone', 'stopped', 'pet']), - State.State('trialerFA', self.enterTrialerFA, self.exitTrialerFA, ['trialerFAReject', 'DFA']), - State.State('trialerFAReject', self.enterTrialerFAReject, self.exitTrialerFAReject, ['walk']), - State.State('DFA', self.enterDFA, self.exitDFA, ['DFAReject', + State('trialerFA', self.enterTrialerFA, self.exitTrialerFA, ['trialerFAReject', 'DFA']), + State('trialerFAReject', self.enterTrialerFAReject, self.exitTrialerFAReject, ['walk']), + State('DFA', self.enterDFA, self.exitDFA, ['DFAReject', 'HFA', 'NPCFA', 'teleportOut', 'doorOut']), - State.State('DFAReject', self.enterDFAReject, self.exitDFAReject, ['walk']), - State.State('NPCFA', self.enterNPCFA, self.exitNPCFA, ['NPCFAReject', 'HFA', 'teleportOut']), - State.State('NPCFAReject', self.enterNPCFAReject, self.exitNPCFAReject, ['walk']), - State.State('HFA', self.enterHFA, self.exitHFA, ['HFAReject', 'teleportOut', 'tunnelOut']), - State.State('HFAReject', self.enterHFAReject, self.exitHFAReject, ['walk']), - State.State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk']), - State.State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk', 'stopped']), - State.State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk']), - State.State('teleportOut', self.enterTeleportOut, self.exitTeleportOut, ['teleportIn']), - State.State('quest', self.enterQuest, self.exitQuest, ['walk', 'doorOut']), - State.State('tutorial', self.enterTutorial, self.exitTutorial, ['walk', 'quest']), - State.State('purchase', self.enterPurchase, self.exitPurchase, ['walk', 'doorOut']), - State.State('pet', self.enterPet, self.exitPet, ['walk']), - State.State('phone', self.enterPhone, self.exitPhone, ['walk', 'doorOut']), - State.State('stopped', self.enterStopped, self.exitStopped, ['walk', 'doorOut']), - State.State('final', self.enterFinal, self.exitFinal, ['start'])], 'start', 'final') + State('DFAReject', self.enterDFAReject, self.exitDFAReject, ['walk']), + State('NPCFA', self.enterNPCFA, self.exitNPCFA, ['NPCFAReject', 'HFA', 'teleportOut']), + State('NPCFAReject', self.enterNPCFAReject, self.exitNPCFAReject, ['walk']), + State('HFA', self.enterHFA, self.exitHFA, ['HFAReject', 'teleportOut', 'tunnelOut']), + State('HFAReject', self.enterHFAReject, self.exitHFAReject, ['walk']), + State('doorIn', self.enterDoorIn, self.exitDoorIn, ['walk']), + State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk', 'stopped']), + State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk']), + State('teleportOut', self.enterTeleportOut, self.exitTeleportOut, ['teleportIn']), + State('quest', self.enterQuest, self.exitQuest, ['walk', 'doorOut']), + State('tutorial', self.enterTutorial, self.exitTutorial, ['walk', 'quest']), + State('purchase', self.enterPurchase, self.exitPurchase, ['walk', 'doorOut']), + State('pet', self.enterPet, self.exitPet, ['walk']), + State('phone', self.enterPhone, self.exitPhone, ['walk', 'doorOut']), + State('stopped', self.enterStopped, self.exitStopped, ['walk', 'doorOut']), + State('final', self.enterFinal, self.exitFinal, ['start'])], 'start', 'final') self.parentFSMState = parentFSMState def load(self): - Place.Place.load(self) + Place.load(self) self.parentFSMState.addChild(self.fsm) def unload(self): - Place.Place.unload(self) + Place.unload(self) self.parentFSMState.removeChild(self.fsm) del self.parentFSMState del self.fsm @@ -111,7 +113,7 @@ class ToonInterior(Place.Place): def enterTutorial(self, requestStatus): self.fsm.request('walk') base.localAvatar.b_setParent(ToontownGlobals.SPRender) - globalClock.tick() + base.clock.tick() base.transitions.irisIn() messenger.send('enterTutorialInterior') @@ -134,7 +136,7 @@ class ToonInterior(Place.Place): def enterNPCFA(self, requestStatus): self.acceptOnce(self.npcfaDoneEvent, self.enterNPCFACallback, [requestStatus]) - self.npcfa = NPCForceAcknowledge.NPCForceAcknowledge(self.npcfaDoneEvent) + self.npcfa = NPCForceAcknowledge(self.npcfaDoneEvent) self.npcfa.enter() def exitNPCFA(self): @@ -161,7 +163,7 @@ class ToonInterior(Place.Place): def enterHFA(self, requestStatus): self.acceptOnce(self.hfaDoneEvent, self.enterHFACallback, [requestStatus]) - self.hfa = HealthForceAcknowledge.HealthForceAcknowledge(self.hfaDoneEvent) + self.hfa = HealthForceAcknowledge(self.hfaDoneEvent) self.hfa.enter(1) def exitHFA(self): @@ -191,10 +193,11 @@ class ToonInterior(Place.Place): base.localAvatar.setPosHpr(0, 0, ToontownGlobals.FloorOffset, 45.0, 0.0, 0.0) else: base.localAvatar.setPosHpr(2.5, 11.5, ToontownGlobals.FloorOffset, 45.0, 0.0, 0.0) - Place.Place.enterTeleportIn(self, requestStatus) + + Place.enterTeleportIn(self, requestStatus) def enterTeleportOut(self, requestStatus): - Place.Place.enterTeleportOut(self, requestStatus, self.__teleportOutDone) + Place.enterTeleportOut(self, requestStatus, self.__teleportOutDone) def __teleportOutDone(self, requestStatus): hoodId = requestStatus['hoodId'] @@ -207,7 +210,6 @@ class ToonInterior(Place.Place): else: self.doneStatus = requestStatus messenger.send(self.doneEvent) - return def goHomeFailed(self, task): self.notifyUserGoHomeFailed() @@ -215,7 +217,7 @@ class ToonInterior(Place.Place): self.doneStatus['avId'] = -1 self.doneStatus['zoneId'] = self.getZoneId() self.fsm.request('teleportIn', [self.doneStatus]) - return Task.done + return task.done def exitTeleportOut(self): - Place.Place.exitTeleportOut(self) + Place.exitTeleportOut(self) diff --git a/toontown/hood/Hood.py b/toontown/hood/Hood.py index 6872c50..3bd164c 100644 --- a/toontown/hood/Hood.py +++ b/toontown/hood/Hood.py @@ -1,24 +1,33 @@ -from panda3d.core import * -from toontown.toonbase.ToonBaseGlobal import * -from toontown.toonbase.ToontownGlobals import * -from toontown.distributed.ToontownMsgTypes import * -from direct.directnotify import DirectNotifyGlobal -from direct.fsm import StateData -from direct.task.Task import Task -from toontown.minigame import Purchase -from direct.gui import OnscreenText -from toontown.building import SuitInterior -from . import QuietZoneState -from . import ZoneUtil -from toontown.toonbase import TTLocalizer -from toontown.toon.Toon import teleportDebug -from direct.interval.IntervalGlobal import * +from panda3d.core import ( + CompassEffect, + ModelPool, + NodePath, + TexturePool, + TransparencyAttrib, + Vec4 +) -class Hood(StateData.StateData): - notify = DirectNotifyGlobal.directNotify.newCategory('Hood') +from direct.directnotify.DirectNotifyGlobal import directNotify +from direct.fsm.StateData import StateData +from direct.gui.OnscreenText import OnscreenText +from direct.interval.IntervalGlobal import Sequence, Wait, Func +from direct.showbase.MessengerGlobal import messenger +from direct.showbase.PythonUtil import uniqueName +from direct.task.TaskManagerGlobal import taskMgr + +from toontown.hood import ZoneUtil +from toontown.hood.QuietZoneState import QuietZoneState +from toontown.toon.Toon import teleportDebug +from toontown.toonbase import ToontownGlobals +from toontown.toonbase import TTLocalizer +from toontown.toonbase.ToonBaseGlobal import base + + +class Hood(StateData): + notify = directNotify.newCategory('Hood') def __init__(self, parentFSM, doneEvent, dnaStore, hoodId): - StateData.StateData.__init__(self, doneEvent) + StateData.__init__(self, doneEvent) self.loader = 'not initialized' self.parentFSM = parentFSM self.dnaStore = dnaStore @@ -31,21 +40,20 @@ class Hood(StateData.StateData): self.holidayStorageDNADict = {} self.spookySkyFile = None self.halloweenLights = [] - return def enter(self, requestStatus): - hoodId = requestStatus['hoodId'] zoneId = requestStatus['zoneId'] hoodText = self.getHoodText(zoneId) - self.titleText = OnscreenText.OnscreenText(hoodText, fg=self.titleColor, font=getSignFont(), pos=(0, -0.5), scale=TTLocalizer.HtitleText, drawOrder=0, mayChange=1) + self.titleText = OnscreenText(hoodText, fg=self.titleColor, font=ToontownGlobals.getSignFont(), pos=(0, -0.5), scale=TTLocalizer.HtitleText, drawOrder=0, mayChange=1) self.fsm.request(requestStatus['loader'], [requestStatus]) def getHoodText(self, zoneId): hoodText = base.cr.hoodMgr.getFullnameFromId(self.id) - if self.id != Tutorial: - streetName = StreetNames.get(ZoneUtil.getCanonicalBranchZone(zoneId)) + if self.id != ToontownGlobals.Tutorial: + streetName = ToontownGlobals.StreetNames.get(ZoneUtil.getCanonicalBranchZone(zoneId)) if streetName: hoodText = hoodText + '\n' + streetName[-1] + return hoodText def spawnTitleText(self, zoneId): @@ -69,32 +77,35 @@ class Hood(StateData.StateData): if self.titleTextSeq: self.titleTextSeq.finish() self.titleTextSeq = None + if self.titleText: self.titleText.cleanup() self.titleText = None + base.localAvatar.stopChat() - return def load(self): if self.storageDNAFile: - loader.loadDNAFile(self.dnaStore, self.storageDNAFile) + base.loader.loadDNAFile(self.dnaStore, self.storageDNAFile) + newsManager = base.cr.newsManager if newsManager: holidayIds = base.cr.newsManager.getDecorationHolidayId() for holiday in holidayIds: for storageFile in self.holidayStorageDNADict.get(holiday, []): - loader.loadDNAFile(self.dnaStore, storageFile) + base.loader.loadDNAFile(self.dnaStore, storageFile) if ToontownGlobals.HALLOWEEN_COSTUMES not in holidayIds and ToontownGlobals.SPOOKY_COSTUMES not in holidayIds or not self.spookySkyFile: - self.sky = loader.loadModel(self.skyFile) + self.sky = base.loader.loadModel(self.skyFile) self.sky.setTag('sky', 'Regular') self.sky.setScale(1.0) self.sky.setFogOff() else: - self.sky = loader.loadModel(self.spookySkyFile) + self.sky = base.loader.loadModel(self.spookySkyFile) self.sky.setTag('sky', 'Halloween') + if not newsManager: - self.sky = loader.loadModel(self.skyFile) + self.sky = base.loader.loadModel(self.skyFile) self.sky.setTag('sky', 'Regular') self.sky.setScale(1.0) self.sky.setFogOff() @@ -105,6 +116,7 @@ class Hood(StateData.StateData): self.loader.exit() self.loader.unload() del self.loader + del self.fsm del self.parentFSM self.dnaStore.resetHood() @@ -134,12 +146,13 @@ class Hood(StateData.StateData): teleportDebug(requestStatus, 'Hood.enterQuietZone: status=%s' % requestStatus) self._quietZoneDoneEvent = uniqueName('quietZoneDone') self.acceptOnce(self._quietZoneDoneEvent, self.handleQuietZoneDone) - self.quietZoneStateData = QuietZoneState.QuietZoneState(self._quietZoneDoneEvent) + self.quietZoneStateData = QuietZoneState(self._quietZoneDoneEvent) self._enterWaitForSetZoneResponseMsg = self.quietZoneStateData.getEnterWaitForSetZoneResponseMsg() self.acceptOnce(self._enterWaitForSetZoneResponseMsg, self.handleWaitForSetZoneResponse) self._quietZoneLeftEvent = self.quietZoneStateData.getQuietZoneLeftEvent() if base.placeBeforeObjects: self.acceptOnce(self._quietZoneLeftEvent, self.handleLeftQuietZone) + self.quietZoneStateData.load() self.quietZoneStateData.enter(requestStatus) @@ -151,7 +164,6 @@ class Hood(StateData.StateData): self.quietZoneStateData.exit() self.quietZoneStateData.unload() self.quietZoneStateData = None - return def loadLoader(self, requestStatus): pass @@ -159,19 +171,21 @@ class Hood(StateData.StateData): def handleWaitForSetZoneResponse(self, requestStatus): loaderName = requestStatus['loader'] if loaderName == 'safeZoneLoader': - if not loader.inBulkBlock: - loader.beginBulkLoad('hood', TTLocalizer.HeadingToPlayground, safeZoneCountMap[self.id], 1, TTLocalizer.TIP_GENERAL) + if not base.loader.inBulkBlock: + base.loader.beginBulkLoad('hood', TTLocalizer.HeadingToPlayground, ToontownGlobals.safeZoneCountMap[self.id], 1, TTLocalizer.TIP_GENERAL) + self.loadLoader(requestStatus) - loader.endBulkLoad('hood') + base.loader.endBulkLoad('hood') elif loaderName == 'townLoader': - if not loader.inBulkBlock: + if not base.loader.inBulkBlock: zoneId = requestStatus['zoneId'] - toPhrase = StreetNames[ZoneUtil.getCanonicalBranchZone(zoneId)][0] - streetName = StreetNames[ZoneUtil.getCanonicalBranchZone(zoneId)][-1] - loader.beginBulkLoad('hood', TTLocalizer.HeadingToStreet % {'to': toPhrase, - 'street': streetName}, townCountMap[self.id], 1, TTLocalizer.TIP_STREET) + toPhrase = ToontownGlobals.StreetNames[ZoneUtil.getCanonicalBranchZone(zoneId)][0] + streetName = ToontownGlobals.StreetNames[ZoneUtil.getCanonicalBranchZone(zoneId)][-1] + base.loader.beginBulkLoad('hood', TTLocalizer.HeadingToStreet % {'to': toPhrase, + 'street': streetName}, ToontownGlobals.townCountMap[self.id], 1, TTLocalizer.TIP_STREET) + self.loadLoader(requestStatus) - loader.endBulkLoad('hood') + base.loader.endBulkLoad('hood') elif loaderName == 'minigame': pass elif loaderName == 'cogHQLoader': @@ -197,6 +211,7 @@ class Hood(StateData.StateData): if self.titleTextSeq: self.titleTextSeq.finish() self.titleTextSeq = None + self.hideTitleText() self.ignore(self.loaderDoneEvent) self.loader.exit() @@ -215,7 +230,7 @@ class Hood(StateData.StateData): messenger.send(self.doneEvent) def startSky(self): - self.sky.reparentTo(camera) + self.sky.reparentTo(base.camera) self.sky.setZ(0.0) self.sky.setHpr(0.0, 0.0, 0.0) ce = CompassEffect.make(NodePath(), CompassEffect.PRot | CompassEffect.PZ) @@ -223,17 +238,19 @@ class Hood(StateData.StateData): def stopSky(self): taskMgr.remove('skyTrack') - self.sky.reparentTo(hidden) + self.sky.reparentTo(base.hidden) def startSpookySky(self): if not self.spookySkyFile: return + if hasattr(self, 'sky') and self.sky: self.stopSky() - self.sky = loader.loadModel(self.spookySkyFile) + + self.sky = base.loader.loadModel(self.spookySkyFile) self.sky.setTag('sky', 'Halloween') self.sky.setColor(0.5, 0.5, 0.5, 1) - self.sky.reparentTo(camera) + self.sky.reparentTo(base.camera) self.sky.setTransparency(TransparencyAttrib.MDual, 1) fadeIn = self.sky.colorScaleInterval(1.5, Vec4(1, 1, 1, 1), startColorScale=Vec4(1, 1, 1, 0.25), blendType='easeInOut') fadeIn.start() @@ -244,9 +261,10 @@ class Hood(StateData.StateData): def endSpookySky(self): if hasattr(self, 'sky') and self.sky: - self.sky.reparentTo(hidden) + self.sky.reparentTo(base.hidden) + if hasattr(self, 'sky'): - self.sky = loader.loadModel(self.skyFile) + self.sky = base.loader.loadModel(self.skyFile) self.sky.setTag('sky', 'Regular') self.sky.setScale(1.0) self.startSky() diff --git a/toontown/minigame/OrthoDrive.py b/toontown/minigame/OrthoDrive.py index 742906f..e341905 100644 --- a/toontown/minigame/OrthoDrive.py +++ b/toontown/minigame/OrthoDrive.py @@ -38,18 +38,17 @@ class OrthoDrive: self.__placeToonHOG(self.lt.getPos()) taskMgr.add(self.__update, OrthoDrive.TASK_NAME, priority=self.priority) self.lastAction = None - return def __placeToonHOG(self, pos, h = None): if h == None: h = self.lt.getH() + self.lt.setPos(pos) self.lt.setH(h) self.lastPos = pos self.atRestHeading = h self.lastXVel = 0 self.lastYVel = 0 - return def stop(self): self.notify.debug('stop') @@ -59,7 +58,9 @@ class OrthoDrive: if hasattr(self, 'turnLocalToonIval'): if self.turnLocalToonIval.isPlaying(): self.turnLocalToonIval.pause() + del self.turnLocalToonIval + base.localAvatar.setSpeed(0, 0) def __update(self, task): @@ -68,12 +69,16 @@ class OrthoDrive: yVel = 0 if self.arrowKeys.upPressed(): yVel += 1 + if self.arrowKeys.downPressed(): yVel -= 1 + if self.arrowKeys.leftPressed(): xVel -= 1 + if self.arrowKeys.rightPressed(): xVel += 1 + vel.setX(xVel) vel.setY(yVel) vel.normalize() @@ -89,8 +94,10 @@ class OrthoDrive: self.lt.runSound() else: self.lt.stopSound() + if self.setHeading: self.__handleHeading(xVel, yVel) + toonPos = self.lt.getPos() dt = base.clock.getDt() posOffset = vel * dt @@ -101,10 +108,12 @@ class OrthoDrive: if posOffsetLen > self.maxFrameMove: posOffset *= self.maxFrameMove posOffset /= posOffsetLen + if self.customCollisionCallback: toonPos = self.customCollisionCallback(toonPos, toonPos + posOffset) else: toonPos = toonPos + posOffset + self.lt.setPos(toonPos) self.lastPos = toonPos return task.cont @@ -138,6 +147,8 @@ class OrthoDrive: taskMgr.doMethodLater(0.05, setAtRestHeading, OrthoDrive.SET_ATREST_HEADING_TASK) else: self.atRestHeading = curHeading + orientToon(curHeading) + self.lastXVel = xVel self.lastYVel = yVel diff --git a/toontown/minigame/TwoDDrive.py b/toontown/minigame/TwoDDrive.py index 16284a3..1111f66 100644 --- a/toontown/minigame/TwoDDrive.py +++ b/toontown/minigame/TwoDDrive.py @@ -33,7 +33,6 @@ class TwoDDrive: self.ONE_JUMP_PER_UP_PRESSED = True self.lastAction = None self.isMovingX = False - return def destroy(self): self.game = None @@ -43,7 +42,6 @@ class TwoDDrive: del self.arrowKeys del self.customCollisionCallback self.lastAction = None - return def start(self): self.notify.debug('start') @@ -55,6 +53,7 @@ class TwoDDrive: def __placeToonHOG(self, pos, h = None): if h == None: h = self.lt.getH() + self.lt.setPos(pos) self.lt.setH(h) self.lastPos = pos @@ -62,7 +61,6 @@ class TwoDDrive: self.oldAtRestHeading = h self.lastXVel = 0 self.lastYVel = 0 - return def stop(self): self.notify.debug('stop') @@ -72,7 +70,9 @@ class TwoDDrive: if hasattr(self, 'turnLocalToonIval'): if self.turnLocalToonIval.isPlaying(): self.turnLocalToonIval.pause() + del self.turnLocalToonIval + base.localAvatar.setSpeed(0, 0) base.localAvatar.stopSound() @@ -92,10 +92,13 @@ class TwoDDrive: if not self.game.isHeadInFloor: if base.localAvatar.controlManager.currentControls == base.localAvatar.controlManager.get('twoD'): base.localAvatar.controlManager.currentControls.jumpPressed() + if self.arrowKeys.leftPressed(): xVel -= 1 + if self.arrowKeys.rightPressed(): xVel += 1 + vel.setX(xVel) vel.setY(yVel) vel.normalize() @@ -107,6 +110,7 @@ class TwoDDrive: elif self.isMovingX: self.isMovingX = False messenger.send('avatarStoppedX') + speed = vel.length() action = self.lt.setSpeed(speed, 0) if action != self.lastAction: @@ -115,8 +119,10 @@ class TwoDDrive: base.localAvatar.runSound() else: base.localAvatar.stopSound() + if self.setHeading: self.__handleHeading(xVel, yVel) + toonPos = self.lt.getPos() dt = base.clock.getDt() posOffset = vel * dt @@ -124,6 +130,7 @@ class TwoDDrive: toonPos = self.customCollisionCallback(toonPos, toonPos + posOffset) else: toonPos += posOffset + self.lt.setPos(toonPos) self.lastPos = toonPos return task.cont @@ -157,6 +164,8 @@ class TwoDDrive: taskMgr.doMethodLater(0.05, setAtRestHeading, TwoDDrive.SET_ATREST_HEADING_TASK) else: self.atRestHeading = curHeading + orientToon(curHeading) + self.lastXVel = xVel self.lastYVel = yVel diff --git a/toontown/toonbase/ToontownStart.py b/toontown/toonbase/ToontownStart.py index f331542..de6d608 100644 --- a/toontown/toonbase/ToontownStart.py +++ b/toontown/toonbase/ToontownStart.py @@ -44,6 +44,7 @@ if launcher.isDummy(): http = HTTPClient() else: http = launcher.http + tempLoader = Loader() backgroundNode = tempLoader.loadSync(Filename('phase_3/models/gui/loading-background')) from direct.gui import DirectGuiGlobals @@ -55,6 +56,7 @@ from .ToonBaseGlobal import base if base.win == None: print('Unable to open window; aborting.') sys.exit() + launcher.setPandaErrorCode(0) launcher.setPandaWindowOpen() ConfigVariableDouble('decompressor-step-time').setValue(0.01) @@ -77,11 +79,13 @@ if base.musicManagerIsValid: music.setLoop(1) music.setVolume(0.9) music.play() + print('ToontownStart: Loading default gui sounds') DirectGuiGlobals.setDefaultRolloverSound(base.loader.loadSfx('phase_3/audio/sfx/GUI_rollover.ogg')) DirectGuiGlobals.setDefaultClickSound(base.loader.loadSfx('phase_3/audio/sfx/GUI_create_toon_fwd.ogg')) else: music = None + from direct.gui.DirectGui import OnscreenText serverVersion = ConfigVariableString('server-version', 'no_version_set').value print('ToontownStart: serverVersion: ', serverVersion) @@ -100,6 +104,7 @@ if not launcher.isDummy(): base.startShow(cr, launcher.getGameServer()) else: base.startShow(cr) + backgroundNodePath.reparentTo(hidden) backgroundNodePath.removeNode() del backgroundNodePath