Skip to content

Commit 72fb427

Browse files
authored
Merge pull request #4 from RCMgames/dq-dev
add DQ feature
2 parents 0b8745b + e215156 commit 72fb427

File tree

2 files changed

+39
-8
lines changed

2 files changed

+39
-8
lines changed

ScoreWindow/RefPWindow.pde

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@ class refPWindow extends PApplet {
3131
fill(0);
3232
text("CONNECTION LOST", width*.56, 40);
3333
}
34-
35-
String[] bmsg={"score", "ownership score", "penalty score", "ownership %", "switch own time", "scale own time", "climbs"};
36-
String[] bval={str(int(blueScore)), str(int(blueOwnershipScore)), str(int(bluePenaltyScore)), nf(blueOwnershipPercent, 3, 1)+(blueOwnershipPercent>=ownershipRPPercent?" (RP)":""), str(int(blueSwitchOwnershipTime)), str(int(blueScaleOwnershipTime)), blueClimbs==maxClimbs?str(blueClimbs)+" (RP)":str(blueClimbs)};
37-
String[] rmsg={"score", "ownership score", "penalty score", "ownership %", "switch own time", "scale own time", "climbs"};
38-
String[] rval={str(int(redScore)), str(int(redOwnershipScore)), str(int(redPenaltyScore)), nf(redOwnershipPercent, 3, 1)+(redOwnershipPercent>=ownershipRPPercent?" (RP)":""), str(int(redSwitchOwnershipTime)), str(int(redScaleOwnershipTime)), redClimbs==maxClimbs?str(redClimbs)+" (RP)":str(redClimbs)};
34+
String[] bmsg={"score", "ownership score", "penalty score", "ownership %", "switch own time", "scale own time", "climbs", (blueSide==Left?"(v) ":"(n) ")+"DQ"};
35+
String[] bval={str(int(blueScore)), str(int(blueOwnershipScore)), str(int(bluePenaltyScore)), nf(blueOwnershipPercent, 3, 1)+(blueOwnershipPercent>=ownershipRPPercent?" (RP)":""), str(int(blueSwitchOwnershipTime)), str(int(blueScaleOwnershipTime)), blueClimbs==maxClimbs?str(blueClimbs)+" (RP)":str(blueClimbs), DQBlue?"YES :(":"no"};
36+
String[] rmsg={"score", "ownership score", "penalty score", "ownership %", "switch own time", "scale own time", "climbs", (blueSide==Right?"(v) ":"(n) ")+"DQ"};
37+
String[] rval={str(int(redScore)), str(int(redOwnershipScore)), str(int(redPenaltyScore)), nf(redOwnershipPercent, 3, 1)+(redOwnershipPercent>=ownershipRPPercent?" (RP)":""), str(int(redSwitchOwnershipTime)), str(int(redScaleOwnershipTime)), redClimbs==maxClimbs?str(redClimbs)+" (RP)":str(redClimbs), DQRed?"YES :(":"no"};
3938
if (blueSide==Left) {
4039
dispData(color(0, 0, 100), bmsg, bval, 0, 0, width*.25, height, 35);
4140
dispData(color(100, 0, 0), rmsg, rval, width*.75, 0, width*.25, height, 35);
@@ -48,7 +47,7 @@ class refPWindow extends PApplet {
4847
nextState=false;
4948
state++;
5049
if (state==2) {//post match
51-
String strToSave=str(year())+"/"+str(month())+"/"+str(day())+" "+str(hour())+":"+str(minute())+":"+str(second())+","+str(int(blueScore))+","+str(int(redScore))+","+str(blueRP)+","+str(int(redRP))+","+str(bluePenaltyScore)+","+str(redPenaltyScore)+","+str(blueClimbs)+","+str(redClimbs)+","+nf(blueOwnershipPercent, 3, 1)+","+nf(redOwnershipPercent, 3, 1)+","+int(blueSwitchOwnershipTime)+","+int(redSwitchOwnershipTime)+","+int(blueScaleOwnershipTime)+","+int(redScaleOwnershipTime) +","+str(int(totalMatchTime-matchTime));
50+
String strToSave=str(year())+"/"+str(month())+"/"+str(day())+" "+str(hour())+":"+str(minute())+":"+str(second())+","+str(int(blueScore))+","+str(int(redScore))+","+str(blueRP)+","+str(int(redRP))+","+str(bluePenaltyScore)+","+str(redPenaltyScore)+","+str(blueClimbs)+","+str(redClimbs)+","+nf(blueOwnershipPercent, 3, 1)+","+nf(redOwnershipPercent, 3, 1)+","+int(blueSwitchOwnershipTime)+","+int(redSwitchOwnershipTime)+","+int(blueScaleOwnershipTime)+","+int(redScaleOwnershipTime) +","+str(int(totalMatchTime-matchTime))+","+str(int(DQBlue))+","+str(int(DQRed));
5251
try {
5352
String[] stringsToSave=loadStrings(filename);
5453
stringsToSave=append(stringsToSave, strToSave);
@@ -353,6 +352,21 @@ class refPWindow extends PApplet {
353352
blueClimbs++;
354353
}
355354
}
355+
356+
if (key=='v') {
357+
if (blueSide==Right) {
358+
DQRed=!DQRed;
359+
} else {
360+
DQBlue=!DQBlue;
361+
}
362+
}
363+
if (key=='n') {
364+
if (blueSide==Left) {
365+
DQRed=!DQRed;
366+
} else {
367+
DQBlue=!DQBlue;
368+
}
369+
}
356370
if (redClimbs>maxClimbs)
357371
redClimbs=0;
358372
if (blueClimbs>maxClimbs)

ScoreWindow/ScoreWindow.pde

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ int blueClimbs=0;
4747

4848
int state=-1;
4949

50+
boolean DQRed=false;
51+
boolean DQBlue=false;
52+
5053
float matchTime=0;
5154
int totalMatchTime=5*60;/////
5255
int matchStartMillis=0;
@@ -141,6 +144,8 @@ void draw() {
141144
blueOwnershipPercent=0;
142145
redRP=0;
143146
blueRP=0;
147+
DQRed=false;
148+
DQBlue=false;
144149
matchStartMillis=millis();
145150
}
146151
if (state==-1) {
@@ -247,8 +252,20 @@ void draw() {
247252
text("final scores are being reviewed", width/4, height/2);
248253
redScore=redOwnershipScore+redPenaltyScore+climbPoints*redClimbs;
249254
blueScore=blueOwnershipScore+bluePenaltyScore+climbPoints*blueClimbs;
255+
if (DQBlue) {
256+
blueScore=-9999;
257+
}
258+
if (DQRed) {
259+
redScore=-9999;
260+
}
250261
redRP=2*int(int(redScore)>int(blueScore)+int(int(redScore)==int(blueScore)))+int(redOwnershipPercent>=ownershipRPPercent)+int(redClimbs==maxClimbs);
251262
blueRP=2*int(int(blueScore)>int(redScore)+int(int(blueScore)==int(redScore)))+int(blueOwnershipPercent>=ownershipRPPercent)+int(blueClimbs==maxClimbs);
263+
if (DQBlue) {
264+
blueRP=0;
265+
}
266+
if (DQRed) {
267+
redRP=0;
268+
}
252269
}
253270
}
254271

@@ -348,12 +365,12 @@ void drawScores(float y, float h, float w) {
348365

349366
fill(100, 100, 255);
350367
rect(width*.5, y, width*w*blueSide, h);
351-
fill(255);
368+
fill(DQBlue?color(255, 155, 0):color(255));
352369
text(str(int(blueScore)), width/2-w/2*width+w*blueSide*width/2, y, width*w, h);
353370

354371
fill(100, 0, 0);
355372
rect(width*.5, y, width*-w*blueSide, h);
356-
fill(255);
373+
fill(DQRed?color(255, 155, 0):color(255));
357374
text(str(int(redScore)), width/2-w/2*width-w*blueSide*width/2, y, width*w, h);
358375

359376
popStyle();

0 commit comments

Comments
 (0)