2019-11-02 19:14:34 -05:00
|
|
|
from panda3d.core import *
|
|
|
|
|
|
|
|
if __debug__:
|
|
|
|
loadPrcFile('etc/Configrc.prc')
|
|
|
|
|
2019-11-02 17:27:54 -05:00
|
|
|
import __builtin__
|
|
|
|
|
|
|
|
class game:
|
|
|
|
name = 'toontown'
|
|
|
|
process = 'client'
|
|
|
|
|
|
|
|
|
|
|
|
__builtin__.game = game()
|
|
|
|
import time
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import random
|
|
|
|
import __builtin__
|
|
|
|
try:
|
|
|
|
launcher
|
|
|
|
except:
|
|
|
|
from toontown.launcher.ToontownDummyLauncher import ToontownDummyLauncher
|
|
|
|
launcher = ToontownDummyLauncher()
|
|
|
|
__builtin__.launcher = launcher
|
|
|
|
|
|
|
|
launcher.setRegistry('EXIT_PAGE', 'normal')
|
|
|
|
pollingDelay = 0.5
|
|
|
|
print 'ToontownStart: Polling for game2 to finish...'
|
|
|
|
while not launcher.getGame2Done():
|
|
|
|
time.sleep(pollingDelay)
|
|
|
|
|
|
|
|
print 'ToontownStart: Game2 is finished.'
|
|
|
|
print 'ToontownStart: Starting the game.'
|
|
|
|
if launcher.isDummy():
|
|
|
|
http = HTTPClient()
|
|
|
|
else:
|
|
|
|
http = launcher.http
|
2019-11-02 18:49:34 -05:00
|
|
|
tempLoader = Loader()
|
2019-11-02 17:27:54 -05:00
|
|
|
backgroundNode = tempLoader.loadSync(Filename('phase_3/models/gui/loading-background'))
|
|
|
|
from direct.gui import DirectGuiGlobals
|
|
|
|
print 'ToontownStart: setting default font'
|
|
|
|
import ToontownGlobals
|
|
|
|
DirectGuiGlobals.setDefaultFontFunc(ToontownGlobals.getInterfaceFont)
|
|
|
|
launcher.setPandaErrorCode(7)
|
|
|
|
import ToonBase
|
|
|
|
ToonBase.ToonBase()
|
|
|
|
if base.win == None:
|
|
|
|
print 'Unable to open window; aborting.'
|
|
|
|
sys.exit()
|
|
|
|
launcher.setPandaErrorCode(0)
|
|
|
|
launcher.setPandaWindowOpen()
|
|
|
|
ConfigVariableDouble('decompressor-step-time').setValue(0.01)
|
|
|
|
ConfigVariableDouble('extractor-step-time').setValue(0.01)
|
|
|
|
backgroundNodePath = aspect2d.attachNewNode(backgroundNode, 0)
|
|
|
|
backgroundNodePath.setPos(0.0, 0.0, 0.0)
|
|
|
|
backgroundNodePath.setScale(render2d, VBase3(1))
|
|
|
|
backgroundNodePath.find('**/fg').setBin('fixed', 20)
|
|
|
|
backgroundNodePath.find('**/bg').setBin('fixed', 10)
|
|
|
|
base.graphicsEngine.renderFrame()
|
2019-11-08 18:26:51 -06:00
|
|
|
DirectGuiGlobals.setDefaultRolloverSound(base.loader.loadSfx('phase_3/audio/sfx/GUI_rollover.mp3'))
|
|
|
|
DirectGuiGlobals.setDefaultClickSound(base.loader.loadSfx('phase_3/audio/sfx/GUI_create_toon_fwd.mp3'))
|
2019-11-02 17:27:54 -05:00
|
|
|
DirectGuiGlobals.setDefaultDialogGeom(loader.loadModel('phase_3/models/gui/dialog_box_gui'))
|
|
|
|
import TTLocalizer
|
|
|
|
from otp.otpbase import OTPGlobals
|
|
|
|
OTPGlobals.setDefaultProductPrefix(TTLocalizer.ProductPrefix)
|
|
|
|
if base.musicManagerIsValid:
|
|
|
|
music = base.musicManager.getSound('phase_3/audio/bgm/tt_theme.mid')
|
|
|
|
if music:
|
|
|
|
music.setLoop(1)
|
|
|
|
music.setVolume(0.9)
|
|
|
|
music.play()
|
|
|
|
print 'ToontownStart: Loading default gui sounds'
|
2019-11-08 18:26:51 -06:00
|
|
|
DirectGuiGlobals.setDefaultRolloverSound(base.loader.loadSfx('phase_3/audio/sfx/GUI_rollover.mp3'))
|
|
|
|
DirectGuiGlobals.setDefaultClickSound(base.loader.loadSfx('phase_3/audio/sfx/GUI_create_toon_fwd.mp3'))
|
2019-11-02 17:27:54 -05:00
|
|
|
else:
|
|
|
|
music = None
|
|
|
|
import ToontownLoader
|
|
|
|
from direct.gui.DirectGui import *
|
|
|
|
serverVersion = base.config.GetString('server-version', 'no_version_set')
|
|
|
|
print 'ToontownStart: serverVersion: ', serverVersion
|
|
|
|
version = OnscreenText(serverVersion, pos=(-1.3, -0.975), scale=0.06, fg=Vec4(0, 0, 1, 0.6), align=TextNode.ALeft)
|
|
|
|
loader.beginBulkLoad('init', TTLocalizer.LoaderLabel, 138, 0, TTLocalizer.TIP_NONE)
|
|
|
|
from ToonBaseGlobal import *
|
|
|
|
from direct.showbase.MessengerGlobal import *
|
|
|
|
from toontown.distributed import ToontownClientRepository
|
|
|
|
cr = ToontownClientRepository.ToontownClientRepository(serverVersion, launcher)
|
|
|
|
cr.music = music
|
|
|
|
del music
|
|
|
|
base.initNametagGlobals()
|
|
|
|
base.cr = cr
|
|
|
|
loader.endBulkLoad('init')
|
|
|
|
from otp.friends import FriendManager
|
|
|
|
from otp.distributed.OtpDoGlobals import *
|
|
|
|
cr.generateGlobalObject(OTP_DO_ID_FRIEND_MANAGER, 'FriendManager')
|
|
|
|
if not launcher.isDummy():
|
|
|
|
base.startShow(cr, launcher.getGameServer())
|
|
|
|
else:
|
|
|
|
base.startShow(cr)
|
|
|
|
backgroundNodePath.reparentTo(hidden)
|
|
|
|
backgroundNodePath.removeNode()
|
|
|
|
del backgroundNodePath
|
|
|
|
del backgroundNode
|
|
|
|
del tempLoader
|
|
|
|
version.cleanup()
|
|
|
|
del version
|
|
|
|
base.loader = base.loader
|
|
|
|
__builtin__.loader = base.loader
|
|
|
|
autoRun = ConfigVariableBool('toontown-auto-run', 1)
|
|
|
|
if autoRun and launcher.isDummy() and (not Thread.isTrueThreads() or __name__ == '__main__'):
|
|
|
|
try:
|
2019-11-08 18:26:51 -06:00
|
|
|
base.run()
|
2019-11-02 17:27:54 -05:00
|
|
|
except SystemExit:
|
|
|
|
raise
|
|
|
|
except:
|
2019-11-08 19:23:35 -06:00
|
|
|
from otp.otpbase import PythonUtil
|
2019-11-02 17:27:54 -05:00
|
|
|
print PythonUtil.describeException()
|
|
|
|
raise
|