25 SOUNDPREFIX = "quake-" |
25 SOUNDPREFIX = "quake-" |
26 |
26 |
27 SOUNDS = { |
27 SOUNDS = { |
28 "countdown_start": os.path.abspath(SOUNDPREFIX + "sound/countdown.mp3"), |
28 "countdown_start": os.path.abspath(SOUNDPREFIX + "sound/countdown.mp3"), |
29 "race_start": os.path.abspath(SOUNDPREFIX + "sound/racestart.mp3"), |
29 "race_start": os.path.abspath(SOUNDPREFIX + "sound/racestart.mp3"), |
30 "race_prepare": os.path.abspath(SOUNDPREFIX + "sound/siren.mp3"), |
30 "race_prepare": os.path.abspath(SOUNDPREFIX + "sound/prepare.mp3"), |
31 "lap_record": os.path.abspath(SOUNDPREFIX + "sound/laprecord.mp3"), |
31 "lap_record": os.path.abspath(SOUNDPREFIX + "sound/laprecord.mp3"), |
32 "fuel_warning1": os.path.abspath(SOUNDPREFIX + "sound/fuel1.mp3"), |
32 "fuel_warning1": os.path.abspath(SOUNDPREFIX + "sound/fuel1.mp3"), |
33 "fuel_warning2": os.path.abspath(SOUNDPREFIX + "sound/fuel2.mp3"), |
33 "fuel_warning2": os.path.abspath(SOUNDPREFIX + "sound/fuel2.mp3"), |
34 "fuel_full": os.path.abspath(SOUNDPREFIX + "sound/fuel_full.mp3"), |
34 "fuel_full": os.path.abspath(SOUNDPREFIX + "sound/fuel_full.mp3"), |
35 "pitlane_enter": os.path.abspath(SOUNDPREFIX + "sound/pitlane_enter.mp3"), |
35 "pitlane_enter": os.path.abspath(SOUNDPREFIX + "sound/pitlane_enter.mp3"), |
74 copy(self.slot_dummy), copy(self.slot_dummy), |
74 copy(self.slot_dummy), copy(self.slot_dummy), |
75 copy(self.slot_dummy), copy(self.slot_dummy), |
75 copy(self.slot_dummy), copy(self.slot_dummy), |
76 ] |
76 ] |
77 self.reset_slots() |
77 self.reset_slots() |
78 self.sysclk = 0.00 |
78 self.sysclk = 0.00 |
|
79 self.sysclk_last = 0.00 |
79 self.bestlap = 9999999.00 |
80 self.bestlap = 9999999.00 |
80 self.test = test |
81 self.test = test |
81 self.laplimit = 999; |
82 self.laplimit = 999; |
82 self.timelimit = 0; |
83 self.timelimit = 0; |
83 |
84 |
397 if rx == "!RESUME": |
398 if rx == "!RESUME": |
398 # panic mode |
399 # panic mode |
399 trigger_sound("resume") |
400 trigger_sound("resume") |
400 |
401 |
401 |
402 |
402 if (self.sysclk_last != self.sysclk) and ((self.sysclk / 60) >= self.timelimit): |
403 if (self.sysclk_last > 0) and (self.sysclk_last != self.sysclk) and ((self.sysclk / 60) >= self.timelimit): |
403 # we have time limit reached! |
404 self.sysclk_last = self.sysclk |
404 trigger_sound("win") |
405 # we have time limit reached! |
405 # get the one with position 1 |
406 trigger_sound("win") |
406 for slot in self.slots: |
407 # get the one with position 1 |
407 if slot["position"] == 1: |
408 for slot in self.slots: |
408 slot["status"] = "WINNER!" |
409 if slot["position"] == 1: |
409 self.box.query("+") # stop race |
410 slot["status"] = "WINNER!" |
410 |
411 self.box.query("+") # stop race |
|
412 self.sysclk_last = self.sysclk |
|
413 |
411 |
414 |
412 |
415 |
413 self.scr.addstr(17,31, |
416 self.scr.addstr(17,31, |
414 "Race Timer: %7.3f min" % (self.sysclk / 60), |
417 "Race Timer: %7.3f min" % (self.sysclk / 60), |
415 curses.color_pair(2)) |
418 curses.color_pair(2)) |