level bar behaviour at loading saved game

Talk about Severance Blade of Darkness modifications and maps here. No tips or tech support questions please, use the forum above. Note that the game is rated 18 so some content may be unsuitable for younger readers.

Moderators: prospero, Ade

Post Reply
User avatar
cieply
Dragon
Posts: 337
Joined: Wed Jun 26, 2013 3:43 pm

level bar behaviour at loading saved game

Post by cieply »

when loading saved game level bar behaves quite strangely - it starts to update its position from zero or from max position

Image

it looks horrible
and is unprofessional... L)

in my attempt to sort it I wanted to change it just before SaveGame loading finishes so I could change it to for example 0.01 [s] (default==1.5[s]) and then after let's say 2 seconds back to normal

I implemented delay factor in widget responsible for this but now I don't know when exactly SavGame loading is finished it would be obvious workaround, I know but I don't have better idea

maybe it's possible to do it better

@ Lib/Widgets/ScorerWidgets.py

### original Lib/Widgets/ScorerWidgets.py

Code: Select all

  def SetPosition(self,pos,smooth=1):
    currpos=self.GetPosition()
    if currpos==pos:
      return

    if smooth:
      if self.Updating==1:
        if self.CurrentTarget!=pos:
          #Si ya estß actualizando y recibe una nueva petici¾n para otra posici¾n
          # Trata de atenderla mßs tarde
          Bladex.AddScheduledFunc(Bladex.GetTime()+1.5,self.SetPosition,(pos,1))
          print "Posponed SetPosition",pos,smooth
          return
      else:
        self.Updating=1
        self.CurrentTarget=pos
        now=Bladex.GetTime()
        #print "Updating level bar: now:",now,"pos:",pos,"currpos:",currpos
        m_interp=BarIncClass(currpos,pos,self)
        self.interpolator.AddAction(now,now+1.5,m_interp)
    else:
      BUIx.B_BarWidget.SetPosition(self,pos)
### new

Code: Select all

  def SetPosition(self,pos,smooth=1):
    currpos=self.GetPosition()
    if currpos==pos:
      return
    ## delay factor:
    delay = Reference.SMOOTHBARWIDGET_DELAY

    if smooth:
      if self.Updating==1:
        if self.CurrentTarget!=pos:
          #Si ya estß actualizando y recibe una nueva petici¾n para otra posici¾n
          # Trata de atenderla mßs tarde
          Bladex.AddScheduledFunc(Bladex.GetTime()+delay, self.SetPosition, (pos,1))
          print "Posponed SetPosition",pos,smooth
          return
      else:
        self.Updating=1
        self.CurrentTarget=pos
        now=Bladex.GetTime()
        print "Updating level bar: now:",now,"pos:",pos,"currpos:",currpos
        m_interp=BarIncClass(currpos,pos,self)
        self.interpolator.AddAction(now, now+delay, m_interp)
    else:
      BUIx.B_BarWidget.SetPosition(self,pos)

and in Lib/Reference.py

Code: Select all

# @ Lib/Widgets/ScorerWidgets::B_SmoothBarWidget
SMOOTHBARWIDGET_DELAY=1.5
someone has idea how to sort it
l'aria fresca,
vino puro, ...

User avatar
cieply
Dragon
Posts: 337
Joined: Wed Jun 26, 2013 3:43 pm

why it doesn't work?

Post by cieply »

there is a function to change delay

Code: Select all

# @ Lib/Widgets/ScorerWidgets::B_SmoothBarWidget
SMOOTHBARWIDGET_DELAY=1.5
##
def SmoothBarWidget_delay(delay=None):
	global SMOOTHBARWIDGET_DELAY
	if (delay==None):
		return SMOOTHBARWIDGET_DELAY
	SMOOTHBARWIDGET_DELAY = delay
##
and in theory it should work like that:

Code: Select all

Bladex.AddScheduledFunc(Bladex.GetTime()+5.0, Reference.SmoothBarWidget_delay, (1.5))
but it doesn't
what's wrong?
l'aria fresca,
vino puro, ...

User avatar
cieply
Dragon
Posts: 337
Joined: Wed Jun 26, 2013 3:43 pm

Re: level bar behaviour at loading saved game

Post by cieply »

your wild guess is right but I know that, question is how to improve it

actually I solved it but without scheduling change of parameter it's useless at the moment
so question is why this:
Bladex.AddScheduledFunc(Bladex.GetTime()+5.0, Reference.SmoothBarWidget_delay, (1.5))
doesn't work?
l'aria fresca,
vino puro, ...

Post Reply