forked from fofix/fofix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GuitarScene.py
6802 lines (5909 loc) · 317 KB
/
GuitarScene.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire #
# Copyright (C) 2006 Sami Kyöstil? #
# 2008 Alarian #
# 2008 myfingershurt #
# 2008 Capo #
# 2008 Spikehead777 #
# 2008 Glorandwarf #
# 2008 ShiekOdaSandz #
# 2008 QQStarS #
# 2008 .liquid. #
# 2008 Blazingamer #
# 2008 evilynux <evilynux@gmail.com> #
# #
# This program is free software; you can redistribute it and/or #
# modify it under the terms of the GNU General Public License #
# as published by the Free Software Foundation; either version 2 #
# of the License, or (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, #
# MA 02110-1301, USA. #
#####################################################################
from Scene import Scene, SuppressScene
from Song import Note, Tempo, TextEvent, PictureEvent, loadSong, Bars, VocalNote, VocalPhrase
from Menu import Menu
from Language import _
import Player
from Player import CONTROLLER1KEYS, CONTROLLER2KEYS, CONTROLLER3KEYS, CONTROLLER1ACTIONS, CONTROLLER2ACTIONS, CONTROLLER3ACTIONS, CONTROLLER4KEYS, CONTROLLER4ACTIONS
from Player import CONTROLLER1DRUMS, CONTROLLER2DRUMS, CONTROLLER3DRUMS, CONTROLLER4DRUMS, STAR, KILL, CANCEL, KEY1A
import Dialogs
import Data
import View
import Audio
import Stage
import Settings
import Song
from Scorekeeper import ScoreCard, Rockmeter
from Shader import shaders
import math
import random
import os
try:
set()
except:
from sets import Set as set
import Log
import locale
from OpenGL.GL import *
#blazingamer: Little fix for RB Score font
from pygame import version
class GuitarScene(Scene):
def __init__(self, engine, libraryName, songName):
Scene.__init__(self, engine)
if self.engine.world.sceneName == "GuitarScene": #MFH - dual / triple loading cycle fix
Log.warn("Extra GuitarScene was instantiated, but detected and shut down. Cause unknown.")
raise SuppressScene #stump
else:
self.engine.createdGuitarScene = True
self.engine.world.sceneName = "GuitarScene"
self.playerList = self.players
self.partyMode = False
self.battle = False #QQstarS:new2 Bettle
self.battleGH = False #Qstick
self.coOp = False
self.coOpRB = False #akedrou
self.coOpGH = False
self.coOpType = False
self.practiceMode = False
self.bossBattle = False
self.ready = False
Log.debug("GuitarScene init...")
self.coOpPlayerMeter = 0
#MFH - testing new traceback logging:
#raise TypeError
#myfingershurt: new loading place for "loading" screen for song preparation:
#blazingamer new loading phrases
self.sinfo = Song.loadSongInfo(self.engine, songName, library = libraryName)
phrase = self.sinfo.loadingPhrase
if phrase == "":
phrase = random.choice(self.engine.theme.loadingPhrase)
if phrase == "None":
i = random.randint(0,4)
if i == 0:
phrase = _("Let's get this show on the Road")
elif i == 1:
phrase = _("Impress the Crowd")
elif i == 2:
phrase = _("Don't forget to strum!")
elif i == 3:
phrase = _("Rock the house!")
else:
phrase = _("Jurgen is watching")
splash = Dialogs.showLoadingSplashScreen(self.engine, phrase + " \n " + _("Initializing..."))
Dialogs.changeLoadingSplashScreenText(self.engine, splash, phrase + " \n " + _("Initializing..."))
self.countdownSeconds = 3 #MFH - don't change this initialization value unless you alter the other related variables to match
self.countdown = 100 #MFH - arbitrary value to prevent song from starting right away
self.countdownOK = False
#MFH - retrieve game parameters:
self.gamePlayers = len(self.engine.world.players)
self.gameMode1p = self.engine.world.gameMode
self.gameMode2p = self.engine.world.multiMode
self.lostFocusPause = self.engine.config.get("game", "lost_focus_pause")
if self.sinfo.bossBattle == "True" and self.gameMode1p == 2 and self.gamePlayers == 1:
self.bossBattle = True
self.engine.world.multiMode = 6
self.gameMode2p = 6
self.gamePlayers = 2
if self.gameMode1p == 2:
self.careerMode = True
else:
self.careerMode = False
#MFH - check for party mode
if self.gameMode2p == 2:
self.partyMode = True
self.gamePlayers = 1
self.partySwitch = 0
self.partyTime = self.engine.config.get("game", "party_time")
self.partyPlayer = 0
elif self.gamePlayers > 1:
#MFH - check for battle mode
if self.gameMode2p == 1:
self.battle = True
self.battleGH = False
self.coOp = False
self.coOpRB = False
self.coOpGH = False
self.coOpType = False
elif self.gameMode2p == 3:
self.battle = False
self.battleGH = False
self.coOp = True
self.coOpRB = False
self.coOpGH = False
self.coOpType = True
elif self.gameMode2p == 4:
self.battle = False
self.battleGH = False
self.coOp = False
self.coOpRB = True
self.coOpGH = False
self.coOpType = True
elif self.gameMode2p == 5:
self.battle = False
self.battleGH = False
self.coOp = False
self.coOpRB = False
self.coOpGH = True
self.coOpType = True
elif self.gameMode2p == 6:
self.battle = False
self.battleGH = True
self.coOp = False
self.coOpRB = False
self.coOpGH = False
self.coOpType = False
else:
self.battle = False
self.coOp = False
self.coOpRB = False
self.coOpGH = False
self.coOpType = False
self.splayers = self.gamePlayers #Spikehead777
#myfingershurt: drums :)
self.instruments = [] # akedrou - this combines Guitars, Drums, and Vocalists
self.keysList = []
self.soloKeysList = []
self.soloShifts = []
self.playingVocals = False
self.numberOfGuitars = len(self.playerList)
self.numOfPlayers = len(self.playerList)
self.numOfSingers = 0
self.firstGuitar = None
self.neckrender = []
gNum = 0
for j,player in enumerate(self.playerList):
guitar = True
if player.part.id == Song.VOCAL_PART:
from Vocalist import Vocalist
inst = Vocalist(self.engine, player, False, j)
if self.coOpRB:
inst.coOpRB = True
self.instruments.append(inst)
self.playingVocals = True
self.numOfSingers += 1
self.numberOfGuitars -= 1
guitar = False
elif player.part.id == Song.DRUM_PART:
#myfingershurt: drums :)
from Drum import Drum
inst = Drum(self.engine,player,False,j)
self.instruments.append(inst)
else:
from Guitar import Guitar
bass = False
if player.part.id == Song.BASS_PART:
bass = True
inst = Guitar(self.engine,player,False,j, bass = bass)
self.instruments.append(inst)
if player.part.id == Song.LEAD_PART or player.part.id == Song.GUITAR_PART: #both these selections should get guitar solos
self.instruments[j].canGuitarSolo = True
if player.practiceMode:
self.practiceMode = True
if guitar:
player.guitarNum = gNum
gNum += 1
if self.firstGuitar is None:
self.firstGuitar = j
self.neckrender.append(self.instruments[j].neck)
if self.instruments[j].isDrum:
self.keysList.append(player.drums)
self.soloKeysList.append(player.drumSolo)
self.soloShifts.append(None)
self.instruments[j].keys = player.drums
self.instruments[j].actions = player.drums
else:
self.keysList.append(player.keys)
self.soloKeysList.append(player.soloKeys)
self.soloShifts.append(player.soloShift)
self.instruments[j].keys = player.keys
self.instruments[j].actions = player.actions
else:
self.neckrender.append(None)
self.keysList.append([])
self.soloKeysList.append([])
self.soloShifts.append([])
self.guitars = self.instruments #for compatibility - I'll try to fix this...
#Log.debug("GuitarScene keysList: " + str(self.keysList))
Log.debug("GuitarScene keysList: %s" % str(self.keysList))
#for number formatting with commas for Rock Band:
locale.setlocale(locale.LC_ALL, '') #more compatible
self.visibility = 1.0
self.libraryName = libraryName
self.songName = songName
self.done = False
#try:
# self.sfxChannel = self.engine.audio.getChannel(5)
#except Exception, e:
# Log.warn("GuitarScene.py: Unable to procure sound effect track: %s" % e)
# self.sfxChannel = None
self.lastMultTime = [None for i in self.playerList]
self.cheatCodes = [
#([117, 112, 116, 111, 109, 121, 116, 101, 109, 112, 111], self.toggleAutoPlay), #Jurgen is enabled in the menu -- Spikehead777
([102, 97, 115, 116, 102, 111, 114, 119, 97, 114, 100], self.goToResults)
]
self.enteredCode = []
self.song = None
#self.finishedProcessingSong = False
#Spikehead777
#self.jurg = self.engine.config.get("game", "jurgtype")
#MFH
#self.jurgenLogic = self.engine.config.get("game", "jurglogic") #logic 0 = original, logic 1 = MFH-1
self.numOfPlayers = len(self.playerList)
self.jurgenLogic = [0 for i in self.playerList]
for i in range(len(self.playerList)):
self.jurgenLogic[i] = self.engine.config.get("game", "jurg_logic_p%d" % i)
self.aiSkill = [0 for i in self.playerList]
self.aiHitPercentage = [0 for i in self.playerList]
self.aiPlayNote = [True for i in self.playerList]
self.jurgBattleWhammyTime = [0 for i in self.playerList]
self.jurgBattleUseTime = [0 for i in self.playerList]
self.aiUseSP = [0 for i in self.playerList]
self.battleItemsHolding = [0 for i in self.playerList]
self.battleTarget = [0 for i in self.playerList]
for i, player in enumerate(self.playerList):
self.battleTarget[i] = i-1
if self.battleTarget[i] == -1:
self.battleTarget[i] = self.numOfPlayers - 1
self.aiSkill[i] = self.engine.config.get("game", "jurg_skill_p%d" % i)
if self.aiSkill[i] == 0:
self.aiHitPercentage[i] = 70 + (5*player.getDifficultyInt())
self.jurgBattleWhammyTime[i] = 1000
self.jurgBattleUseTime[i] = 5000
elif self.aiSkill[i] == 1:
self.aiHitPercentage[i] = 80 + (5*player.getDifficultyInt())
self.jurgBattleWhammyTime[i] = 750
self.jurgBattleUseTime[i] = 2000
elif self.aiSkill[i] == 2:
self.aiHitPercentage[i] = 85 + (5*player.getDifficultyInt())
self.jurgBattleWhammyTime[i] = 750
self.jurgBattleUseTime[i] = 2000
elif self.aiSkill[i] == 3:
self.aiHitPercentage[i] = 90 + (5*player.getDifficultyInt())
self.jurgBattleWhammyTime[i] = 500
self.jurgBattleUseTime[i] = 1000
elif self.aiSkill[i] == 4:
self.aiHitPercentage[i] = 95 + (5*player.getDifficultyInt())
self.jurgBattleWhammyTime[i] = 250
self.jurgBattleUseTime[i] = 1000 #this will be replaced by algorithm
elif self.aiSkill[i] == 5:
self.aiHitPercentage[i] = 100
self.jurgBattleWhammyTime[i] = 200
self.jurgBattleUseTime[i] = 1000 #this will be replaced by algorithm
if self.aiHitPercentage[i] > 100:
self.aiHitPercentage[i] = 100
#self.jurgenText = self.engine.config.get("game", "jurgtext")
self.jurgenText = self.engine.theme.jurgTextPos
if float(self.jurgenText[2]) < 0.00035:
self.jurgenText[2] = 0.00035
if float(self.jurgenText[0]) < 0:
self.jurgenText[0] = 0
if float(self.jurgenText[1]) < 0:
self.jurgenText[1] = 0
self.battleJurgMissTime = [0 for i in self.playerList]
self.whammySavesSP = self.engine.config.get("game", "whammy_saves_starpower") #MFH
self.failingEnabled = self.engine.config.get("coffee", "failingEnabled")
self.timeLeft = None
self.processedFirstNoteYet = False
#MFH - MUST be in front of loadSettings call!
#self.autoPlay = self.engine.config.get("game", "jurgmode")
#if self.autoPlay == 0:
# self.autoPlay = True
#else:
# self.autoPlay = False
self.playerAssist = [0 for i in self.playerList]
for i, player in enumerate(self.playerList):
if self.instruments[i].isDrum:
if player.autoKick:
self.playerAssist[i] = 3
elif not self.instruments[i].isVocal:
self.playerAssist[i] = player.assistMode
if self.playerAssist[i] == 2 and player.getDifficultyInt() > 1:
self.playerAssist[i] = 0
elif self.playerAssist[i] == 1 and player.getDifficultyInt() > 2:
self.playerAssist[i] = 0
for assistMode in self.playerAssist:
if assistMode > 0:
self.assisting = True
break
else:
self.assisting = False
self.autoPlay = False
self.jurgPlayer = [False for i in self.playerList]
self.jurg = [False for i in self.playerList]
self.customBot = [None for i in self.playerList]
for i in range(self.numOfPlayers):
if self.instruments[i].isVocal:
continue
if self.engine.config.get("game", "jurg_p%d" % i) == True:
self.jurg[i] = True
self.autoPlay = True
self.lastPickPos = [None for i in self.playerList]
self.lastSongPos = 0.0
self.keyBurstTimeout = [None for i in self.playerList]
self.keyBurstPeriod = 30
self.camera.target = (0.0, 0.0, 4.0)
self.camera.origin = (0.0, 3.0, -3.0)
self.camera.target = (0.0, 1.0, 8.0)
self.camera.origin = (0.0, 2.0, -3.4)
self.targetX = self.engine.theme.povTargetX
self.targetY = self.engine.theme.povTargetY
self.targetZ = self.engine.theme.povTargetZ
self.originX = self.engine.theme.povOriginX
self.originY = self.engine.theme.povOriginY
self.originZ = self.engine.theme.povOriginZ
self.customPOV = False
self.ending = False
povList = [str(self.targetX), str(self.targetY), str(self.targetZ), str(self.originX), str(self.originY), str(self.originZ)]
if "None" not in povList:
self.customPOV = True
Log.debug("All theme POV set. Using custom camera POV.")
self.pause = False
self.failed = False
self.finalFailed = False
self.failEnd = False
self.crowdsCheering = False #akedrou
self.inUnison = [False for i in self.playerList]
self.haveUnison = [False for i in self.playerList]
self.firstUnison = False
self.firstUnisonDone = False
self.unisonActive = False
self.unisonNum = 0
self.unisonEarn = [False for i in self.playerList]
self.starPowersActive = 0
self.playersInGreen = 0
self.crowdFaderVolume = 0.0
self.coOpStarPower = 0
self.coOpStarPowerTimer = 0
self.coOpStarPowerActive = [0 for i in self.playerList]
self.battleSuddenDeath = False
self.failTimer = 0
self.rockTimer = 0 #myfingershurt
self.youRock = False #myfingershurt
self.rockCountdown = 100
self.soloReviewDispDelay = 300
self.baseScore = 50
self.baseSustainScore = .1
self.rockFinished = False
self.spTimes = [[] for i in self.playerList]
self.midiSP = False
self.oBarScale = 0.0 #volshebnyi - overdrive bar scale factor
#self.bossBattle = False
###Capo###
self.firstClap = True
###endCapo###
self.multi = [1 for i in self.playerList]
self.x1 = [0 for i in self.playerList]
self.y1 = [0 for i in self.playerList]
self.x2 = [0 for i in self.playerList]
self.y2 = [0 for i in self.playerList]
self.x3 = [0 for i in self.playerList]
self.y3 = [0 for i in self.playerList]
if self.coOpType:
self.x1.append(0)
self.y1.append(0)
self.x2.append(0)
self.y2.append(0)
self.x3.append(0)
self.y3.append(0)
#MFH - precalculation variable definition
#Get theme
themename = self.engine.data.themeLabel
self.theme = self.engine.data.theme
self.rmtype = self.theme
if self.engine.theme.hopoIndicatorX != None:
self.hopoIndicatorX = self.engine.theme.hopoIndicatorX
else:
self.hopoIndicatorX = .950
if self.engine.theme.hopoIndicatorY != None:
self.hopoIndicatorY = self.engine.theme.hopoIndicatorY
else:
self.hopoIndicatorY = .710
self.hopoIndicatorActiveColor = self.engine.theme.hopoIndicatorActiveColor
self.hopoIndicatorInactiveColor = self.engine.theme.hopoIndicatorInactiveColor
if self.coOpGH:
for instrument in self.instruments:
instrument.starPowerDecreaseDivisor /= self.numOfPlayers
self.rockMax = 30000.0
self.rockMedThreshold = self.rockMax/3.0 #MFH
self.rockHiThreshold = self.rockMax/3.0*2 #MFH
self.rock = [self.rockMax/2 for i in self.playerList]
self.arrowRotation = [.5 for i in self.playerList]
self.starNotesMissed = [False for i in self.playerList] #MFH
self.notesMissed = [False for i in self.playerList]
self.lessMissed = [False for i in self.playerList]
self.notesHit = [False for i in self.playerList]
self.lessHit = False
self.minBase = 400
self.pluBase = 15
self.minGain = 2
self.pluGain = 7
self.battleMax = 300 #QQstarS:new2 the max adding when battle
self.minusRock = [self.minBase for i in self.playerList]
self.plusRock = [self.pluBase for i in self.playerList]
self.coOpMulti = 1
self.coOpFailDone = [False for i in self.playerList]
if self.coOpRB: #akedrou
self.coOpPlayerMeter = len(self.rock)
self.rock.append(self.rockMax/2)
self.minusRock.append(0.0)
self.plusRock.append(0.0)
self.timesFailed = [0 for i in self.playerList]
if self.coOp or self.coOpGH:
self.coOpPlayerMeter = len(self.rock)-1 #make sure it's the last one
#Dialogs.changeLoadingSplashScreenText(self.engine, splash, phrase + " \n " + _("Loading Stage..."))
stage = os.path.join("themes",themename,"stage.ini")
self.stage = Stage.Stage(self, self.engine.resource.fileName(stage))
#Dialogs.changeLoadingSplashScreenText(self.engine, splash, phrase + " \n " + _("Loading Settings..."))
self.loadSettings()
self.tsBotNames = [_("KiD"), _("Stump"), _("AkedRobot"), _("Q"), _("MFH"), _("Jurgen")]
#MFH pre-translate text strings:
self.powerUpName = self.engine.theme.power_up_name
if self.battleGH:
self.tsBattleIcons = [None] * 9
self.tsBattleIcons[1] = _("Death Drain")
self.tsBattleIcons[2] = _("Difficulty Up")
self.tsBattleIcons[3] = _("Broken String")
self.tsBattleIcons[4] = _("Whammy")
self.tsBattleIcons[5] = _("Powerup Steal")
self.tsBattleIcons[6] = _("Switch Controls")
self.tsBattleIcons[7] = _("Double Notes")
self.tsBattleIcons[8] = _("Amp Overload")
self.tsNoteStreak = _("%d Note Streak")
self.tsPhraseStreak = _("%d Phrase Streak")
self.tsStarPowerReady = _("%s Ready") % self.powerUpName
self.tsCoOpStarPower = _("Activate %s!") % self.powerUpName
self.tsYouFailedBattle = _("You Failed")
self.tsJurgenIsHere = _("%s is here")
self.tsJurgenWasHere = _("%s was here")
self.tsPercentComplete = _("% Complete")
self.tsHopoIndicator = _("HOPO")
self.tsCompleted = _("COMPLETED")
self.tsPercentOn = _(" % ON ")
self.tsBassGroove = _("BASS GROOVE")
self.tsBassGrooveLabel = _("Bass Groove:")
self.tsHandicapLabel = _("Handicap")
self.tsAvgLabel = _("Avg")
self.tsAccVeryLate = _("Very Late")
self.tsAccLate = _("Late")
self.tsAccSlightlyLate = _("Slightly Late")
self.tsAccExcellentLate = _("-Excellent!")
self.tsAccPerfect = _("Perfect!!")
self.tsAccExcellentEarly= _("+Excellent!")
self.tsAccSlightlyEarly = _("Slightly Early")
self.tsAccEarly = _("Early")
self.tsAccVeryEarly = _("Very Early")
self.msLabel = _("ms")
self.tsSolo = _("Solo!")
self.tsPerfectSolo = _("Perfect Solo!")
self.tsAwesomeSolo = _("Awesome Solo!")
self.tsGreatSolo = _("Great Solo!")
self.tsGoodSolo = _("Good Solo!")
self.tsSolidSolo = _("Solid Solo!")
self.tsOkaySolo = _("Okay Solo")
self.tsMessySolo = _("Messy Solo")
self.tsPtsLabel = _("pts")
self.tsGetReady = _("Get Ready to Rock")
self.tsAsMadeFamousBy = _("as made famous by")
self.tsBy = _("by ")
self.tsFrettedBy = _(" fretted by ")
for player in self.playerList:
player.currentTheme = self.theme
#MFH - precalculate full and player viewports
self.engine.view.setViewport(1,0)
self.wFull, self.hFull = self.engine.view.geometry[2:4]
#Log.debug("GuitarScene wFull = %d, hFull = %d" % (self.wFull, self.hFull) )
self.wPlayer = []
self.hPlayer = []
self.hOffset = []
self.hFontOffset = []
self.stage.wFull = self.wFull #MFH - needed for new stage background handling
self.stage.hFull = self.hFull
#self.fontScreenBottom = 0.75 #from our current viewport's constant 3:4 aspect ratio (which is always stretched to fill the video resolution)
self.fontScreenBottom = self.engine.data.fontScreenBottom
self.oBarScaleCoef = (0.6 + 0.4 * self.numberOfGuitars) * 1.256 * self.hFull / self.wFull #volshebnyi - depends on resolution and number of players
for i, player in enumerate(self.playerList):
if not self.instruments[i].isVocal:
self.engine.view.setViewportHalf(self.numberOfGuitars,player.guitarNum)
w = self.engine.view.geometryAllHalf[self.numberOfGuitars-1,player.guitarNum,2]
h = self.engine.view.geometryAllHalf[self.numberOfGuitars-1,player.guitarNum,3]
else:
w = self.wFull
h = self.hFull
self.wPlayer.append( w )
self.hPlayer.append( h )
self.hOffset.append( h )
self.hFontOffset.append( h )
if not self.instruments[i].isVocal:
self.wPlayer[i] = self.wPlayer[i]*self.numberOfGuitars #QQstarS: set the width to right one
if self.numberOfGuitars>1:
self.hPlayer[i] = self.hPlayer[i]*self.numberOfGuitars/1.5 #QQstarS: Set the hight to right one
self.hOffset[i] = self.hPlayer[i]*.4*(self.numberOfGuitars-1)
else:
self.hPlayer[i] = self.hPlayer[i]*self.numberOfGuitars #QQstarS: Set the hight to right one
self.hOffset[i] = 0
self.hFontOffset[i] = -self.hOffset[i]/self.hPlayer[i]*0.752 #QQstarS: font Hight Offset when there are 2 players
self.engine.view.setViewport(1,0)
self.drumMisses = self.engine.config.get("game", "T_sound") #Faaa Drum sound
if not self.engine.data.bassDrumSoundFound:
self.bassKickSoundEnabled = False
if not self.engine.data.T1DrumSoundFound:
self.drumMisses == 0
if not self.engine.data.T2DrumSoundFound:
self.drumMisses == 0
if not self.engine.data.T3DrumSoundFound:
self.drumMisses == 0
if not self.engine.data.CDrumSoundFound:
self.drumMisses == 0
#MFH - constant definitions, ini value retrievals
self.pitchBendLowestFactor = .90 #stump: perhaps read this from song.ini and fall back on a specific value?
self.lineByLineLyricMaxLineWidth = 0.5
self.lineByLineStartSlopMs = 750
self.digitalKillswitchStarpowerChunkSize = 0.05 * self.engine.audioSpeedFactor
self.digitalKillswitchActiveStarpowerChunkSize = self.digitalKillswitchStarpowerChunkSize / 3.0
# evilynux: was 0.10, now much closer to actual GH3
self.analogKillswitchStarpowerChunkSize = 0.15 * self.engine.audioSpeedFactor
self.analogKillswitchActiveStarpowerChunkSize = self.analogKillswitchStarpowerChunkSize / 3.0
self.rbOverdriveBarGlowFadeInChunk = .07 #this amount added to visibility every run() cycle when fading in - original .2
self.rbOverdriveBarGlowFadeOutChunk = .03 #this amount subtracted from visibility every run() cycle when fading out - original .07
self.crowdCheerFadeInChunk = .02 #added to crowdVolume every run() when fading in
self.crowdCheerFadeOutChunk = .03 #subtracted from crowdVolume every run() on fade out.
self.maxDisplayTextScale = 0.0024 #orig 0.0024
self.displayTextScaleStep2 = 0.00008 #orig 0.00008
self.displayTextScaleStep1 = 0.0001 #orig 0.0001
self.textTimeToDisplay = 100
self.songInfoDisplayScale = self.engine.theme.songInfoDisplayScale
self.songInfoDisplayX = self.engine.theme.songInfoDisplayX #Worldrave - This controls the X position of song info display during countdown
self.songInfoDisplayY = self.engine.theme.songInfoDisplayY #Worldrave - This controls the Y position of song info display during countdown
self.lyricMode = self.engine.config.get("game", "lyric_mode")
self.scriptLyricPos = self.engine.config.get("game", "script_lyric_pos")
self.starClaps = self.engine.config.get("game", "star_claps")
self.rb_sp_neck_glow = self.engine.config.get("game", "rb_sp_neck_glow")
self.accuracy = [0 for i in self.playerList]
self.resumeCountdownEnabled = self.engine.config.get("game", "resume_countdown")
self.resumeCountdown = 0
self.resumeCountdownSeconds = 0
self.pausePos = 0
self.dispAccuracy = [False for i in self.playerList]
self.showAccuracy = self.engine.config.get("game", "accuracy_mode")
self.hitAccuracyPos = self.engine.config.get("game", "accuracy_pos")
self.showUnusedTextEvents = self.engine.config.get("game", "show_unused_text_events")
self.bassKickSoundEnabled = self.engine.config.get("game", "bass_kick_sound")
self.gameTimeMode = self.engine.config.get("game", "game_time")
self.midiLyricsEnabled = self.engine.config.get("game", "rb_midi_lyrics")
self.midiSectionsEnabled = self.engine.config.get("game", "rb_midi_sections") #MFH
if self.numOfPlayers > 1 and self.midiLyricsEnabled == 1:
self.midiLyricsEnabled = 0
if self.numOfPlayers > 1 and self.midiSectionsEnabled == 1:
self.midiSectionsEnabled = 0
self.hopoDebugDisp = self.engine.config.get("game","hopo_debug_disp")
if self.hopoDebugDisp == 1:
for instrument in self.instruments:
if not instrument.isDrum and not instrument.isVocal:
instrument.debugMode = True
self.numDecimalPlaces = self.engine.config.get("game","decimal_places")
self.roundDecimalForDisplay = lambda n: ('%%.%df' % self.numDecimalPlaces) % float(n) #stump
self.starScoring = self.engine.config.get("game", "star_scoring")#MFH
self.ignoreOpenStrums = self.engine.config.get("game", "ignore_open_strums") #MFH
self.muteSustainReleases = self.engine.config.get("game", "sustain_muting") #MFH
self.hopoIndicatorEnabled = self.engine.config.get("game", "hopo_indicator") #MFH
self.fontShadowing = self.engine.config.get("game", "in_game_font_shadowing") #MFH
self.muteLastSecond = self.engine.config.get("audio", "mute_last_second") #MFH
self.mutedLastSecondYet = False
self.muteDrumFill = self.engine.config.get("game", "mute_drum_fill") #MFH
self.starScoreUpdates = self.engine.config.get("performance", "star_score_updates") #MFH
self.currentlyAnimating = True
self.missPausesAnim = self.engine.config.get("game", "miss_pauses_anim") #MFH
self.displayAllGreyStars = self.engine.theme.displayAllGreyStars
self.starpowerMode = self.engine.config.get("game", "starpower_mode") #MFH
self.useMidiSoloMarkers = False
self.logMarkerNotes = self.engine.config.get("game", "log_marker_notes")
self.logStarpowerMisses = self.engine.config.get("game", "log_starpower_misses")
self.soloFrameMode = self.engine.config.get("game", "solo_frame")
self.whammyEffect = self.engine.config.get("audio", "whammy_effect")
if self.whammyEffect == 1 and not Audio.pitchBendSupported: #pitchbend
Dialogs.showMessage(self.engine, "Pitchbend module not found! Forcing Killswitch effect.")
self.whammyEffect = 0
shaders.var["whammy"] = self.whammyEffect
self.bigRockEndings = self.engine.config.get("game", "big_rock_endings")
self.showFreestyleActive = self.engine.config.get("debug", "show_freestyle_active")
#stump: continuous star fillup
self.starFillupCenterX = self.engine.theme.starFillupCenterX
self.starFillupCenterY = self.engine.theme.starFillupCenterY
self.starFillupInRadius = self.engine.theme.starFillupInRadius
self.starFillupOutRadius = self.engine.theme.starFillupOutRadius
self.starFillupColor = self.engine.theme.colorToHex(self.engine.theme.starFillupColor)
self.starContinuousAvailable = self.engine.config.get("performance", "star_continuous_fillup") and \
None not in (self.starFillupCenterX, self.starFillupCenterY, self.starFillupInRadius, self.starFillupOutRadius, self.starFillupColor)
self.showBpm = self.engine.config.get("debug", "show_bpm") #MFH
self.logLyricEvents = self.engine.config.get("log", "log_lyric_events")
#self.logTempoEvents = self.engine.config.get("log", "log_tempo_events")
self.vbpmLogicType = self.engine.config.get("debug", "use_new_vbpm_beta")
#MFH - switch to midi lyric mode option
self.midiLyricMode = self.engine.config.get("game", "midi_lyric_mode")
#self.midiLyricMode = 0
self.currentSimpleMidiLyricLine = ""
self.noMoreMidiLineLyrics = False
self.screenCenterX = self.engine.video.screen.get_rect().centerx
self.screenCenterY = self.engine.video.screen.get_rect().centery
#racer: practice beat claps:
self.beatClaps = self.engine.config.get("game", "beat_claps")
self.killDebugEnabled = self.engine.config.get("game", "kill_debug")
#myfingershurt: for checking if killswitch key is analog for whammy
self.whammyVolAdjStep = 0.1
self.analogKillMode = [self.engine.input.getAnalogKill(i) for i in range(self.numOfPlayers)]
self.isKillAnalog = [False for i in self.playerList]
self.isSPAnalog = [False for i in self.playerList]
self.isSlideAnalog = [False for i in self.playerList]
self.whichJoyKill = [0 for i in self.playerList]
self.whichAxisKill = [0 for i in self.playerList]
self.whichJoyStar = [0 for i in self.playerList]
self.whichAxisStar = [0 for i in self.playerList]
self.whichJoySlide = [0 for i in self.playerList]
self.whichAxisSlide = [0 for i in self.playerList]
self.whammyVol = [0.0 for i in self.playerList]
self.starAxisVal = [0.0 for i in self.playerList]
self.starDelay = [0.0 for i in self.playerList]
self.starActive = [False for i in self.playerList]
self.slideValue = [-1 for i in self.playerList]
self.targetWhammyVol = [0.0 for i in self.playerList]
self.defaultWhammyVol = [self.analogKillMode[i]-1.0 for i in range(self.numOfPlayers)] #makes xbox defaults 1.0, PS2 defaults 0.0
for i in range(self.numOfPlayers):
if self.analogKillMode[i] == 3: #XBOX inverted mode
self.defaultWhammyVol[i] = -1.0
self.actualWhammyVol = [self.defaultWhammyVol[i] for i in range(self.numOfPlayers)]
self.lastWhammyVol = [self.defaultWhammyVol[i] for i in range(self.numOfPlayers)]
KillKeyCode = [0 for i in self.playerList]
StarKeyCode = [0 for i in self.playerList]
SlideKeyCode = [0 for i in self.playerList]
self.lastTapText = "tapp: -"
#myfingershurt: auto drum starpower activation option
#self.autoDrumStarpowerActivate = self.engine.config.get("game", "auto_drum_sp")
self.autoDrumStarpowerActivate = self.engine.config.get("game", "drum_sp_mode")
self.analogSlideMode = [self.engine.input.getAnalogSlide(i) for i in range(self.numOfPlayers)]
self.analogSPMode = [self.engine.input.getAnalogSP(i) for i in range(self.numOfPlayers)]
self.analogSPThresh = [self.engine.input.getAnalogSPThresh(i) for i in range(self.numOfPlayers)]
self.analogSPSense = [self.engine.input.getAnalogSPSense(i) for i in range(self.numOfPlayers)]
self.numDrumFills = 0 #MFH - count drum fills to see whether or not we should use auto SP
#MFH - TODO - rewrite in an expandable fashion; requires creation of some new Player object constants that will link to the appropriate player's control based on which player the object is set to
for i, player in enumerate(self.playerList):
if self.analogKillMode[i] > 0:
KillKeyCode[i] = self.controls.getReverseMapping(player.keyList[KILL])
self.isKillAnalog[i], self.whichJoyKill[i], self.whichAxisKill[i] = self.engine.input.getWhammyAxis(KillKeyCode[i])
if self.isKillAnalog[i]:
try:
testJoy = self.engine.input.joysticks[self.whichJoyKill[i]].get_axis(self.whichAxisKill[i])
except IndexError:
self.isKillAnalog[i] = False
if self.analogSPMode[i] > 0:
StarKeyCode[i] = self.controls.getReverseMapping(player.keyList[STAR])
self.isSPAnalog[i], self.whichJoyStar[i], self.whichAxisStar[i] = self.engine.input.getWhammyAxis(StarKeyCode[i])
if self.isSPAnalog[i]:
try:
testJoy = self.engine.input.joysticks[self.whichJoyStar[i]].get_axis(self.whichAxisStar[i])
except IndexError:
self.isSPAnalog[i] = False
if player.controlType == 4:
SlideKeyCode[i] = self.controls.getReverseMapping(player.keyList[KEY1A])
self.isSlideAnalog[i], self.whichJoySlide[i], self.whichAxisSlide[i] = self.engine.input.getWhammyAxis(SlideKeyCode[i])
if self.isSlideAnalog[i]:
try:
testJoy = self.engine.input.joysticks[self.whichJoySlide[i]].get_axis(self.whichAxisSlide[i])
except IndexError:
self.isSlideAnalog[i] = False
self.inGameStats = self.engine.config.get("performance","in_game_stats")
self.inGameStars = self.engine.config.get("game","in_game_stars")
self.partialStars = self.engine.config.get("game","partial_stars")
self.guitarSoloAccuracyDisplayMode = self.engine.config.get("game", "gsolo_accuracy_disp")
self.guitarSoloAccuracyDisplayPos = self.engine.config.get("game", "gsolo_acc_pos")
#need a new flag for each player, showing whether or not they've missed a note during a solo section.
#this way we have a backup detection of Perfect Solo in case a note got left out, picks up the other side of the solo slop
self.guitarSoloBroken = [False for i in self.playerList]
self.deadPlayerList = [] #akedrou - keep the order failed.
self.numDeadPlayers = 0
coOpInstruments = []
self.scoring = []
#self.stars = [0,0]
for instrument in self.instruments:
if instrument.isDrum:
this = Song.DRUM_PART
coOpInstruments.append(this)
elif instrument.isBassGuitar:
this = Song.BASS_PART
coOpInstruments.append(this)
elif instrument.isVocal:
this = Song.VOCAL_PART
coOpInstruments.append(this)
else:
this = Song.GUITAR_PART
coOpInstruments.append(this) #while different guitars exist, they don't affect scoring.
self.scoring.append(ScoreCard([this]))
if self.coOpType:
self.coOpScoreCard = ScoreCard(coOpInstruments, coOpType = True)
else:
self.coOpScoreCard = None
self.partialStar = [0 for i in self.playerList]
self.starRatio = [0.0 for i in self.playerList]
self.dispSoloReview = [False for i in self.playerList]
self.soloReviewText = [[] for i in self.playerList]
self.soloReviewCountdown = [0 for i in self.playerList]
self.guitarSoloAccuracy = [0.0 for i in self.playerList]
self.guitarSoloActive = [False for i in self.playerList]
self.currentGuitarSolo = [0 for i in self.playerList]
#guitar solo display initializations
if self.theme == 2:
self.solo_soloFont = self.engine.data.scoreFont
else:
self.solo_soloFont = self.engine.data.font
self.guitarSoloShown = [False for i in self.playerList]
self.currentGuitarSoloLastHitNotes = [1 for i in self.playerList]
self.solo_xOffset = [0.0 for i in self.playerList]
self.solo_yOffset = [0.0 for i in self.playerList]
self.solo_boxXOffset = [0.0 for i in self.playerList]
self.solo_boxYOffset = [0.0 for i in self.playerList]
self.solo_Tw = [0.0 for i in self.playerList]
self.solo_Th = [0.0 for i in self.playerList]
self.solo_soloText = ["solo" for i in self.playerList]
self.soloAcc_Rect = [None for i in self.playerList]
self.solo_txtSize = 0.00250
for i, playa in enumerate(self.playerList):
if self.guitarSoloAccuracyDisplayPos == 0: #right
if self.guitarSoloAccuracyDisplayMode == 1: #percentage only
self.solo_xOffset[i] = 0.890
else:
self.solo_xOffset[i] = 0.950
else:
self.solo_xOffset[i] = 0.150
self.solo_yOffset[i] = 0.320 #last change -.040
#self.totalNotes = [0,0]
#self.totalSingleNotes = [0,0]
self.currentGuitarSoloTotalNotes = [0 for i in self.playerList]
#self.currentGuitarSoloHitNotes = [0,0]
self.guitarSolos = [ [] for i in self.playerList]
guitarSoloStartTime = 0
isGuitarSoloNow = False
guitarSoloNoteCount = 0
lastSoloNoteTime = 0
self.drumStart = False
soloSlop = 100.0
unisonCheck = []
if self.careerMode:
self.failingEnabled = True
self.tut = self.engine.config.get("game", "tut")
#MFH - no Jurgen in Career mode or tutorial mode or practice mode:
if self.careerMode or self.tut or self.playerList[0].practiceMode:
self.autoPlay = False
#force jurgen player 2 (and only player 2) for boss battles
if self.bossBattle:
self.autoPlay = True
self.jurg = [False for i in self.playerList]
self.jurg[1] = True
self.rockFailUp = True #akedrou - fading mech
self.rockFailViz = 0.0
self.failViz = [0.0 for i in self.playerList]
self.phrases = self.engine.config.get("coffee", "game_phrases")#blazingamer
self.starfx = self.engine.config.get("game", "starfx")#blazingamer
smallMult = self.engine.config.get("game","small_rb_mult")
self.rbmfx = False
if smallMult == 2 or (smallMult == 1 and self.engine.theme.smallMult):
self.rbmfx = True
self.boardY = 2
self.rbOverdriveBarGlowVisibility = 0
self.rbOverdriveBarGlowFadeOut = False
self.counting = self.engine.config.get("video", "counting")
Dialogs.changeLoadingSplashScreenText(self.engine, splash, phrase + " \n " + _("Loading Song..."))
#MFH - this is where song loading originally took place, and the loading screen was spawned.
self.engine.resource.load(self, "song", lambda: loadSong(self.engine, songName, library = libraryName, part = [player.part for player in self.playerList], practiceMode = self.playerList[0].practiceMode, practiceSpeed = self.playerList[0].practiceSpeed), synch = True, onLoad = self.songLoaded)
# glorandwarf: show the loading splash screen and load the song synchronously
#Dialogs.hideLoadingSplashScreen(self.engine, splash)
#splash = None
#splash = Dialogs.showLoadingSplashScreen(self.engine, phrase)
Dialogs.changeLoadingSplashScreenText(self.engine, splash, phrase + " \n " + _("Preparing Note Phrases..."))
if self.playerList[0].practiceMode or self.song.info.tutorial or self.tut:
self.failingEnabled = False
self.playerList[0].hopoFreq = self.song.info.hopofreq
bassGrooveEnableSet = self.engine.config.get("game", "bass_groove_enable")
if bassGrooveEnableSet == 1 and self.theme == 2:
self.bassGrooveEnabled = True
elif bassGrooveEnableSet == 2 and self.song.midiStyle == Song.MIDI_TYPE_RB:
self.bassGrooveEnabled = True
elif bassGrooveEnableSet == 3:
self.bassGrooveEnabled = True
else:
self.bassGrooveEnabled = False
for i, drum in enumerate(self.instruments):
if not drum.isDrum:
continue
if drum.drumFlip:
for d in range(len(Song.difficulties)):
self.song.tracks[i][d].flipDrums()
for scoreCard in self.scoring:
scoreCard.bassGrooveEnabled = self.bassGrooveEnabled
#MFH - single audio track song detection
self.isSingleAudioTrack = self.song.isSingleAudioTrack
#myfingershurt: also want to go through song and search for guitar solo parts, and count notes in them in each diff.
#MFH - now, handle MIDI starpower / overdrive / other special marker notes:
#MFH - first, count the markers for each instrument. If a particular instrument does not have at least two starpower phrases
# marked, ignore them and force auto-generation of SP paths.
for i in range(self.numOfPlayers): #MFH - count number of drum fills
if self.instruments[i].isDrum: #MFH - count number of drum fill markers
self.numDrumFills = len([1 for time, event in self.song.midiEventTrack[i].getAllEvents() if (isinstance(event, Song.MarkerNote) and (event.number == Song.freestyleMarkingNote) ) ])
Log.debug("Drum part found, scanning for drum fills.... %d freestyle markings found (the last one may be a Big Rock Ending)." % self.numDrumFills)
#MFH - handle early hit window automatic type determination, and how it compares to the forced handicap if not auto
self.effectiveEarlyHitWindow = Song.EARLY_HIT_WINDOW_HALF
self.automaticEarlyHitWindow = Song.EARLY_HIT_WINDOW_HALF
self.forceEarlyHitWindowSetting = self.engine.config.get("handicap", "early_hit_window")
if self.song.info.early_hit_window_size:
Log.debug("song.ini setting found speficying early_hit_window_size - %s" % self.song.info.early_hit_window_size)
if self.song.info.early_hit_window_size.lower() == "none":
self.automaticEarlyHitWindow = Song.EARLY_HIT_WINDOW_NONE
elif self.song.info.early_hit_window_size.lower() == "half":
self.automaticEarlyHitWindow = Song.EARLY_HIT_WINDOW_HALF
#elif self.song.info.early_hit_window_size.lower() == "full":