FOV slider + add other sliders into TTLocalizer

This commit is contained in:
John 2015-06-18 16:53:50 +03:00
parent 1a823356c4
commit 6c94355d39
20 changed files with 51 additions and 37 deletions

View file

@ -71,7 +71,7 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
self.sleepCallback = None
self.accept('wakeup', self.wakeUp)
self.jumpLandAnimFixTask = None
self.fov = OTPGlobals.DefaultCameraFov
self.fov = settings['fov']
self.accept('avatarMoving', self.clearPageUpDown)
self.showNametag2d()
self.setPickable(0)

View file

@ -10,8 +10,8 @@ SafetyGateBitmask = BitMask32(1024)
GhostBitmask = BitMask32(2048)
PathFindingBitmask = BitMask32.bit(29)
PickerBitmask = BitMask32(4096)
OriginalCameraFov = 52.0
DefaultCameraFov = 52.0
MaxCameraFov = 120.0
DefaultCameraFar = 800.0
DefaultCameraNear = 1.0
AICollisionPriority = 10

View file

@ -144,7 +144,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
self.fsm.requestFinalState()
if self.hasLocalToon():
self.removeLocalToon()
base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
base.camLens.setMinFov(settings['fov']/(4./3.))
self.localToonFsm.request('WaitForServer')
self.ignoreAll()
for suit in self.suits:
@ -1263,7 +1263,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
else:
camera.wrtReparentTo(base.localAvatar)
messenger.send('localToonLeftBattle')
base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
base.camLens.setMinFov(settings['fov']/(4./3.))
return
def enterNoLocalToon(self):

View file

@ -134,7 +134,7 @@ class DistributedBattleBldg(DistributedBattleBase.DistributedBattleBase):
camPos = Point3(0, -6, 4)
camHpr = Vec3(0, 0, 0)
camTrack.append(Func(camera.reparentTo, base.localAvatar))
camTrack.append(Func(setCamFov, ToontownGlobals.DefaultCameraFov))
camTrack.append(Func(setCamFov, settings['fov']))
camTrack.append(Func(camera.setPosHpr, camPos, camHpr))
mtrack = Parallel(suitTrack, toonTrack, camTrack)
done = Func(callback)

View file

@ -85,7 +85,7 @@ class CogdoBarrelRoom:
base.localAvatar.b_setAnimState('neutral')
self.defaultFar = base.camLens.getFar()
base.camLens.setFar(CogdoBarrelRoomConsts.BarrelRoomCameraFar)
base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
base.camLens.setMinFov(settings['fov']/(4./3.))
self.showBattleAreaLight(True)
render.setFog(self.fog)
self.model.unstash()

View file

@ -827,6 +827,6 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
def __outroPenthouseChatDone(self, elapsed = None):
self.shopOwnerNpc.setChatAbsolute(TTLocalizer.CogdoExecutiveSuiteToonBye, CFSpeech)
self.ignore('doneChatPage')
track = Parallel(Sequence(ActorInterval(self.shopOwnerNpc, 'wave'), Func(self.shopOwnerNpc.loop, 'neutral')), Sequence(Wait(2.0), Func(self.exitCogdoBuilding), Func(base.camLens.setFov, ToontownGlobals.DefaultCameraFov)))
track = Parallel(Sequence(ActorInterval(self.shopOwnerNpc, 'wave'), Func(self.shopOwnerNpc.loop, 'neutral')), Sequence(Wait(2.0), Func(self.exitCogdoBuilding), Func(base.camLens.setFov, settings['fov'])))
track.start()
self.penthouseOutroChatDoneTrack = track

View file

@ -63,5 +63,5 @@ class DistributedLawOffice(DistributedObject, LawOfficeBase.LawOfficeBase):
def startSignal(self):
base.camera.setScale(base.localAvatar.getScale())
localAvatar.setCameraFov(DefaultCameraFov)
localAvatar.setCameraFov(settings['fov'])
base.camera.clearMat()

View file

@ -92,7 +92,7 @@ class CogHood(Hood):
messenger.send(self.doneEvent)
def exit(self):
base.localAvatar.setCameraFov(ToontownGlobals.DefaultCameraFov)
base.localAvatar.setCameraFov(settings['fov'])
base.camLens.setNearFar(ToontownGlobals.DefaultCameraNear, ToontownGlobals.DefaultCameraFar)
Hood.exit(self)

View file

@ -119,7 +119,7 @@ class MakeAToon(StateData.StateData):
self.fsm.request('GenderShop')
def exit(self):
base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
base.camLens.setMinFov(settings['fov']/(4./3.))
self.guiTopBar.hide()
self.guiBottomBar.hide()
self.music.stop()

View file

@ -295,7 +295,7 @@ class DistributedDivingGame(DistributedMinigame):
self.toonSDs[avId].exit()
base.camLens.setFar(ToontownGlobals.DefaultCameraFar)
base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
base.camLens.setMinFov(settings['fov']/(4./3.))
base.setBackgroundColor(ToontownGlobals.DefaultBackgroundColor)
self.arrowKeys.destroy()
del self.arrowKeys

View file

@ -261,7 +261,7 @@ class DistributedPatternGame(DistributedMinigame):
self.notify.debug('offstage')
DistributedMinigame.offstage(self)
self.music.stop()
base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
base.camLens.setMinFov(settings['fov']/(4./3.))
base.setBackgroundColor(ToontownGlobals.DefaultBackgroundColor)
self.arrowKeys.destroy()
del self.arrowKeys

View file

@ -190,7 +190,7 @@ class DistributedRingGame(DistributedMinigame):
self.__removeAllToonDropShadows()
render.clearFog()
base.camLens.setFar(ToontownGlobals.DefaultCameraFar)
base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
base.camLens.setMinFov(settings['fov']/(4./3.))
base.setBackgroundColor(ToontownGlobals.DefaultBackgroundColor)
self.arrowKeys.destroy()
del self.arrowKeys

View file

@ -708,7 +708,7 @@ class DistributedTargetGame(DistributedMinigame):
self.__removeAllToonDropShadows()
render.clearFog()
base.camLens.setFar(ToontownGlobals.DefaultCameraFar)
base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
base.camLens.setMinFov(settings['fov']/(4./3.))
camera.setHpr(0, 90, 0)
base.setBackgroundColor(ToontownGlobals.DefaultBackgroundColor)
self.arrowKeys.destroy()

View file

@ -293,7 +293,7 @@ class DistributedTugOfWarGame(DistributedMinigame):
self.setupTrack.finish()
del self.setupTrack
self.setupTrack = None
base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
base.camLens.setMinFov(settings['fov']/(4./3.))
base.camLens.setNearFar(ToontownGlobals.DefaultCameraNear, ToontownGlobals.DefaultCameraFar)
if self.arrowKeys:
self.arrowKeys.setPressHandlers(self.arrowKeys.NULL_HANDLERS)

View file

@ -510,7 +510,7 @@ class Purchase(PurchaseBase):
self.door.reparentTo(hidden)
self.title.reparentTo(self.frame)
self.rewardDoubledJellybeanLabel.hide()
base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
base.camLens.setMinFov(settings['fov']/(4./3.))
NametagGlobals.setForceOnscreenChat(False)
def _handleClientCleanup(self):

View file

@ -539,8 +539,7 @@ class DistributedVehicle(DistributedSmoothNode.DistributedSmoothNode, Kart.Kart,
self.toon.loop('neutral')
self.toon.startSmooth()
NametagGlobals.setForceOnscreenChat(False)
base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
return
base.camLens.setMinFov(settings['fov']/(4./3.))
def doHeadScale(self, model, scale):
if scale == None:
@ -685,7 +684,7 @@ class DistributedVehicle(DistributedSmoothNode.DistributedSmoothNode, Kart.Kart,
newCameraPos = Point3(0, -25, 16)
newCameraFov = 70
turboDuration = 3
startFov = ToontownGlobals.DefaultCameraFov/(4./3.)
startFov = settings['fov']/(4./3.)
if self.cameraTrack:
self.cameraTrack.pause()
cameraZoomIn = Parallel(LerpPosInterval(camera, 2, newCameraPos), LerpFunc(base.camLens.setMinFov, fromData=startFov, toData=newCameraFov, duration=2))

View file

@ -296,8 +296,8 @@ class OptionsTabPage(DirectFrame):
options_text_scale = 0.052
disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0)
self.speed_chat_scale = 0.055
self.Music_Label = DirectLabel(parent=self, relief=None, text='Music Volume:', text_align=TextNode.ALeft, text_scale=options_text_scale, pos=(leftMargin, 0, textStartHeight))
self.SoundFX_Label = DirectLabel(parent=self, relief=None, text='SFX Volume:', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - textRowHeight))
self.Music_Label = DirectLabel(parent=self, relief=None, text=TTLocalizer.OptionsPageMusic, text_align=TextNode.ALeft, text_scale=options_text_scale, pos=(leftMargin, 0, textStartHeight))
self.SoundFX_Label = DirectLabel(parent=self, relief=None, text=TTLocalizer.OptionsPageSFX, text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - textRowHeight))
self.Friends_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 3 * textRowHeight))
self.Whispers_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 4 * textRowHeight))
self.DisplaySettings_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=10, pos=(leftMargin, 0, textStartHeight - 5 * textRowHeight))
@ -717,6 +717,7 @@ class ExtraOptionsTabPage(DirectFrame):
def load(self):
guiButton = loader.loadModel('phase_3/models/gui/quit_button')
circleModel = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_nameShop')
titleHeight = 0.61
textStartHeight = 0.45
textRowHeight = 0.145
@ -729,15 +730,21 @@ class ExtraOptionsTabPage(DirectFrame):
disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0)
button_image = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR'))
self.speed_chat_scale = 0.055
self.speedchatPlus_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight))
self.trueFriends_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - textRowHeight))
self.cogInterface_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 2 * textRowHeight))
self.speedchatPlus_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord), command=self.__doToggleSpeedchatPlus)
self.trueFriends_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight), command=self.__doToggleTrueFriends)
self.cogInterface_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 2 * textRowHeight), command=self.__doToggleCogInterface)
self.fov_label = DirectLabel(parent=self, relief=None, text=TTLocalizer.FieldOfViewLabel, text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight))
self.speedchatPlus_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - textRowHeight))
self.trueFriends_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 2 * textRowHeight))
self.cogInterface_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 3 * textRowHeight))
self.fov_slider = DirectSlider(parent=self, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord),
value=settings['fov'], pageSize=5, range=(ToontownGlobals.DefaultCameraFov, ToontownGlobals.MaxCameraFov), command=self.__doFov,
thumb_geom=(circleModel.find('**/tt_t_gui_mat_namePanelCircle')), thumb_relief=None, thumb_geom_scale=2)
self.fov_slider.setScale(0.25)
self.speedchatPlus_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight), command=self.__doToggleSpeedchatPlus)
self.trueFriends_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 2 * textRowHeight), command=self.__doToggleTrueFriends)
self.cogInterface_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 3 * textRowHeight), command=self.__doToggleCogInterface)
self.bugReportButton = DirectButton(parent=self, relief=None, text=TTLocalizer.BugReportButton, image=button_image, image_scale=button_image_scale, text_pos=(0, -0.01), text_fg=(0, 0, 0, 1),
command=self.showReportNotice, pos=(0.0, 0.0, -0.6), text_scale=(0.045))
guiButton.removeNode()
circleModel.removeNode()
def enter(self):
self.show()
@ -752,6 +759,10 @@ class ExtraOptionsTabPage(DirectFrame):
self.hide()
def unload(self):
self.fov_label.destroy()
del self.fov_label
self.fov_slider.destroy()
del self.fov_slider
self.speedchatPlus_label.destroy()
del self.speedchatPlus_label
self.trueFriends_label.destroy()
@ -761,6 +772,11 @@ class ExtraOptionsTabPage(DirectFrame):
self.cogInterface_toggleButton.destroy()
del self.cogInterface_toggleButton
def __doFov(self):
fov = self.fov_slider['value']
settings['fov'] = fov
base.camLens.setMinFov(fov/(4./3.))
def __doToggleCogInterface(self):
messenger.send('wakeup')
settings['cogInterface'] = not settings['cogInterface']

View file

@ -58,13 +58,11 @@ if __debug__:
from direct.directnotify.DirectNotifyGlobal import directNotify
notify = directNotify.newCategory('ClientStart')
notify.setInfo(True)
from otp.settings.Settings import Settings
from otp.otpbase import OTPGlobals
preferencesFilename = ConfigVariableString(
'preferences-filename',
@ -98,6 +96,9 @@ if 'speedchatPlus' not in settings:
settings['speedchatPlus'] = True
if 'trueFriends' not in settings:
settings['trueFriends'] = True
if 'fov' not in settings:
settings['fov'] = OTPGlobals.DefaultCameraFov
loadPrcFileData('Settings: res', 'win-size %d %d' % tuple(settings['res']))
loadPrcFileData('Settings: fullscreen', 'fullscreen %s' % settings['fullscreen'])
loadPrcFileData('Settings: music', 'audio-music-active %s' % settings['music'])
@ -146,7 +147,6 @@ DirectGuiGlobals.setDefaultRolloverSound(base.loadSfx('phase_3/audio/sfx/GUI_rol
DirectGuiGlobals.setDefaultClickSound(base.loadSfx('phase_3/audio/sfx/GUI_create_toon_fwd.ogg'))
DirectGuiGlobals.setDefaultDialogGeom(loader.loadModel('phase_3/models/gui/dialog_box_gui'))
import TTLocalizer
from otp.otpbase import OTPGlobals
if base.musicManagerIsValid:
music = base.loadMusic('phase_3/audio/bgm/tt_theme.ogg')
if music:

View file

@ -3797,8 +3797,8 @@ OptionsPageTitle = 'Options'
ExtraOptionsPageTitle = 'Extra'
OptionsTabTitle = 'Options\n& Codes'
OptionsPageExitToontown = 'Exit Toontown'
OptionsPageMusicOnLabel = 'Music is on.'
OptionsPageMusicOffLabel = 'Music is off.'
OptionsPageMusic = 'Music Volume:'
OptionsPageSFX = 'SFX Volume:'
OptionsPageSFXOnLabel = 'Sound Effects are on.'
OptionsPageSFXOffLabel = 'Sound Effects are off.'
OptionsPageToonChatSoundsOnLabel = ' Type Chat Sounds are on.'
@ -8477,7 +8477,6 @@ def convertSecondsToDate(seconds):
m, s = divmod(seconds, 60)
h, m = divmod(m, 60)
print '%d:%02d:%02d' % (h, m, s)
return '%d:%02d:%02d' % (h, m, s)
ToonDefeatedMessage = '%s was defeated!'
@ -8490,4 +8489,4 @@ SpeedchatPlusLabelOn = 'Speedchat Plus is on.'
SpeedchatPlusLabelOff = 'Speedchat Plus is off.'
TrueFriendsLabelOn = 'True Friends is on.'
TrueFriendsLabelOff = 'True Friends is off.'
FieldOfViewLabel = 'Field of View:'

View file

@ -43,7 +43,7 @@ class ToonBase(OTPBase.OTPBase):
self.wantDynamicShadows = 0
self.exitErrorCode = 0
camera.setPosHpr(0, 0, 0, 0, 0, 0)
self.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
self.camLens.setMinFov(settings['fov']/(4./3.))
self.camLens.setNearFar(ToontownGlobals.DefaultCameraNear, ToontownGlobals.DefaultCameraFar)
self.musicManager.setVolume(0.65)
self.setBackgroundColor(ToontownGlobals.DefaultBackgroundColor)
@ -74,6 +74,7 @@ class ToonBase(OTPBase.OTPBase):
self.accept(ToontownGlobals.MinimizeGameHotKeyRepeatOSX, self.minimizeGame)
self.accept('f3', self.toggleGui)
self.accept('f4', self.oobe)
self.accept('panda3d-render-error', self.panda3dRenderError)
oldLoader = self.loader
self.loader = ToontownLoader.ToontownLoader(self)
@ -84,7 +85,6 @@ class ToonBase(OTPBase.OTPBase):
self.wantPets = self.config.GetBool('want-pets', 1)
self.wantBingo = self.config.GetBool('want-fish-bingo', 1)
self.wantKarts = self.config.GetBool('want-karts', 1)
self.wantNewSpecies = self.config.GetBool('want-new-species', 0)
self.inactivityTimeout = self.config.GetFloat('inactivity-timeout', ToontownGlobals.KeyboardTimeout)
if self.inactivityTimeout:
self.notify.debug('Enabling Panda timeout: %s' % self.inactivityTimeout)