Skip to content

Commit

Permalink
Make draining of coop rockmeter independent of frame rate
Browse files Browse the repository at this point in the history
  • Loading branch information
erodozer committed Dec 26, 2011
1 parent 036e89a commit 2ee49a9
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Scorekeeper.py
Expand Up @@ -33,6 +33,7 @@
import Song
import Log
import Config
from datetime import datetime

HANDICAPS = [.75, 1.0, .8, .9, .75, .8, 1.05, 1.1, 1.03, 1.02, 1.01, .95, .9, .85, .7, .95, 0.0, .5, .7, .7]
HANDICAP_NAMES = [_("Auto Kick Bass"), _("Medium Assist Mode"), _("Easy Assist Mode"), _("Jurgen Played!"), \
Expand Down Expand Up @@ -396,6 +397,9 @@ def run(self):
if self.instrument.starPowerActive:
self.mult *= 2


_drainRate = 500000 #amount of microseconds that need to pass before it drains rock again

#Different rockmeter for keeping track of coOp modes
class CoOpRockmeterScoring(RockmeterScoring):
def __init__(self, players, coOp = None):
Expand All @@ -411,6 +415,8 @@ def __init__(self, players, coOp = None):
self.minusRock = _minBase #amount of rock to subtract when decreasing
self.plusRock = _pluBase #amount of rock to add when increasing
self.players = players
self.drainTime = 0 #time in microseconds recorded to know when to
# drain from the rockmeter again

#starts the process
def start(self):
Expand Down Expand Up @@ -461,8 +467,11 @@ def run(self):
self.failing = self.rock <= _rockLo

if self.numDead > 0:
self.drain()
else:
dt = datetime.now().microsecond % _drainRate
if dt < self.drainTime:
self.drain()
self.drainTime = dt
elif not self.coOp == "RB":
self.rock = 0
for player in self.players:
self.rock += player.rockCard.rock
Expand Down

0 comments on commit 2ee49a9

Please sign in to comment.