2019-11-02 19:14:34 -05:00
|
|
|
from panda3d.core import *
|
|
|
|
|
|
|
|
if __debug__:
|
|
|
|
loadPrcFile('etc/Configrc.prc')
|
|
|
|
|
2019-12-30 00:07:56 -06:00
|
|
|
import builtins
|
2019-11-02 17:27:54 -05:00
|
|
|
|
|
|
|
class game:
|
|
|
|
name = 'toontown'
|
|
|
|
process = 'client'
|
|
|
|
|
|
|
|
|
2019-12-30 00:07:56 -06:00
|
|
|
builtins.game = game()
|
2019-11-02 17:27:54 -05:00
|
|
|
import time
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import random
|
2019-12-30 00:07:56 -06:00
|
|
|
import builtins
|
2019-11-02 17:27:54 -05:00
|
|
|
try:
|
|
|
|
launcher
|
|
|
|
except:
|
|
|
|
from toontown.launcher.ToontownDummyLauncher import ToontownDummyLauncher
|
|
|
|
launcher = ToontownDummyLauncher()
|
2019-12-30 00:07:56 -06:00
|
|
|
builtins.launcher = launcher
|
2019-11-02 17:27:54 -05:00
|
|
|
|
|
|
|
launcher.setRegistry('EXIT_PAGE', 'normal')
|
|
|
|
pollingDelay = 0.5
|
2019-12-30 00:07:56 -06:00
|
|
|
print('ToontownStart: Polling for game2 to finish...')
|
2019-11-02 17:27:54 -05:00
|
|
|
while not launcher.getGame2Done():
|
|
|
|
time.sleep(pollingDelay)
|
|
|
|
|
2019-12-30 00:07:56 -06:00
|
|
|
print('ToontownStart: Game2 is finished.')
|
|
|
|
print('ToontownStart: Starting the game.')
|
2019-11-02 17:27:54 -05:00
|
|
|
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
|
2019-12-30 00:07:56 -06:00
|
|
|
print('ToontownStart: setting default font')
|
|
|
|
from . import ToontownGlobals
|
2019-11-02 17:27:54 -05:00
|
|
|
DirectGuiGlobals.setDefaultFontFunc(ToontownGlobals.getInterfaceFont)
|
|
|
|
launcher.setPandaErrorCode(7)
|
2019-12-30 00:07:56 -06:00
|
|
|
from . import ToonBase
|
2019-11-02 17:27:54 -05:00
|
|
|
ToonBase.ToonBase()
|
|
|
|
if base.win == None:
|
2019-12-30 00:07:56 -06:00
|
|
|
print('Unable to open window; aborting.')
|
2019-11-02 17:27:54 -05:00
|
|
|
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'))
|
2019-12-30 00:07:56 -06:00
|
|
|
from . import TTLocalizer
|
2019-11-02 17:27:54 -05:00
|
|
|
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()
|
2019-12-30 00:07:56 -06:00
|
|
|
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
|
2019-12-30 00:07:56 -06:00
|
|
|
from . import ToontownLoader
|
2019-11-02 17:27:54 -05:00
|
|
|
from direct.gui.DirectGui import *
|
|
|
|
serverVersion = base.config.GetString('server-version', 'no_version_set')
|
2019-12-30 00:07:56 -06:00
|
|
|
print('ToontownStart: serverVersion: ', serverVersion)
|
2019-11-02 17:27:54 -05:00
|
|
|
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)
|
2019-12-30 00:07:56 -06:00
|
|
|
from .ToonBaseGlobal import *
|
2019-11-02 17:27:54 -05:00
|
|
|
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
|
2019-12-30 00:07:56 -06:00
|
|
|
builtins.loader = base.loader
|
2019-11-02 17:27:54 -05:00
|
|
|
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-12-30 00:07:56 -06:00
|
|
|
print(PythonUtil.describeException())
|
2019-11-02 17:27:54 -05:00
|
|
|
raise
|