Skip to content

Commit

Permalink
Deobfuscate UI code about track score multipliers
Browse files Browse the repository at this point in the history
Looks like the server never sends track score multipliers currently.
Nevertheless, this is code is nice to deobfuscate to better understand
surrounding code.
  • Loading branch information
StenAL committed May 18, 2024
1 parent c42c613 commit 6eadcf2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
14 changes: 7 additions & 7 deletions client/src/main/java/agolf/game/GamePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ public void handlePacket(String[] args) {

} else if (args[1].equals("scoringmulti")) {
int len = args.length - 2;
int[] var3 = new int[len];
int[] trackScoresMultipliers = new int[len];

for (int trackCount = 0; trackCount < len; ++trackCount) {
var3[trackCount] = Integer.parseInt(args[2 + trackCount]);
for (int track = 0; track < len; ++track) {
trackScoresMultipliers[track] = Integer.parseInt(args[2 + track]);
}

this.gamePlayerInfoPanel.method356(var3);
this.gamePlayerInfoPanel.setTrackScoresMultipliers(trackScoresMultipliers);
} else if (args[1].equals("players")) {
int len = (args.length - 2) / 3;
int playerCountIndex = 2;
Expand Down Expand Up @@ -307,9 +307,9 @@ else if (args[1].equals("starttrack")) {

this.gameTrackInfoPanel.parseTrackInfoStats(trackInformation[0], trackInformation[1], trackStats[0], trackStats[1], trackInformation[2], trackInformation[3], trackTestMode1, trackTestMode2, this.gameCanvas.method134());

int numberOfPlayers = this.gamePlayerInfoPanel.startNextTrack();
if (numberOfPlayers > 1) {
this.gameChatPanel.addMessage(gameContainer.textManager.getGame("GameChat_ScoreMultiNotify", numberOfPlayers));
int trackScoreMultiplier = this.gamePlayerInfoPanel.startNextTrack();
if (trackScoreMultiplier > 1) {
this.gameChatPanel.addMessage(gameContainer.textManager.getGame("GameChat_ScoreMultiNotify", trackScoreMultiplier));
}

this.gameControlPanel.displaySkipButton(); // checks if you can skip on first shot
Expand Down
22 changes: 11 additions & 11 deletions client/src/main/java/agolf/game/GamePlayerInfoPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class GamePlayerInfoPanel extends Panel implements ItemListener, MouseListener {
private int[] anIntArray394;
private boolean[] playerVotedToSkip;
private boolean[] playerReadyForNewGame;
private int[] anIntArray397;
private int[] trackScoresMultipliers;
private int[][] anIntArrayArray398;
private Choicer aChoicer399;
private Image image;
Expand All @@ -67,7 +67,7 @@ protected GamePlayerInfoPanel(GameContainer gameContainer, int width, int height
this.setLayout(null);
this.currentTimeForShot = -1;
this.initialized = false;
this.anIntArray397 = null;
this.trackScoresMultipliers = null;
this.anIntArrayArray398 = null;
}

Expand Down Expand Up @@ -145,12 +145,12 @@ public void update(Graphics g) {

this.graphics.drawString(var9 >= 0 ? String.valueOf(var9) : this.gameContainer.textManager.getGame("GamePlayerInfo_Skipped"), 130 + track * 20, offsetY);
this.graphics.setColor(color);
} else if (this.anIntArray397[track] == 1) {
} else if (this.trackScoresMultipliers[track] == 1) {
this.graphics.drawString("-", 130 + track * 20 + 5, offsetY);
} else {
this.graphics.setFont(fontDialog10);
this.graphics.setColor(playerColors[player][1]);
this.graphics.drawString("(*" + this.anIntArray397[track] + ")", 130 + track * 20, offsetY - 1);
this.graphics.drawString("(*" + this.trackScoresMultipliers[track] + ")", 130 + track * 20, offsetY - 1);
this.graphics.setFont(font);
this.graphics.setColor(color);
}
Expand Down Expand Up @@ -292,10 +292,10 @@ protected void init(int playerCount, int trackCount, int maxStrokes, int strokeT
this.anIntArray394[player] = 0;
}

this.anIntArray397 = new int[trackCount];
this.trackScoresMultipliers = new int[trackCount];

for (int track = 0; track < trackCount; ++track) {
this.anIntArray397[track] = 1;
this.trackScoresMultipliers[track] = 1;
}

this.playerId = -1;
Expand All @@ -304,8 +304,8 @@ protected void init(int playerCount, int trackCount, int maxStrokes, int strokeT
this.repaint();
}

protected void method356(int[] var1) {
this.anIntArray397 = var1;
protected void setTrackScoresMultipliers(int[] trackScoresMultipliers) {
this.trackScoresMultipliers = trackScoresMultipliers;
this.repaint();
}

Expand Down Expand Up @@ -360,7 +360,7 @@ protected int startNextTrack() {

++this.currentTrackIndex;
this.repaint();
return this.anIntArray397[this.currentTrackIndex];
return this.trackScoresMultipliers[this.currentTrackIndex];
}

protected boolean method361(int var1) {
Expand All @@ -369,7 +369,7 @@ protected boolean method361(int var1) {
} else {
int var2 = this.trackStrokes[var1][this.currentTrackIndex].get();
if (this.trackScoring == 0) {
var2 /= this.anIntArray397[this.currentTrackIndex];
var2 /= this.trackScoresMultipliers[this.currentTrackIndex];
}

return var2 >= this.maxStrokes;
Expand All @@ -392,7 +392,7 @@ protected boolean startTurn(int playerId) {

protected void method363(int playerId, boolean isStrokeEnd) {
if (this.trackScoring == 0) {
int var3 = !isStrokeEnd ? this.anIntArray397[this.currentTrackIndex] : 1;
int var3 = !isStrokeEnd ? this.trackScoresMultipliers[this.currentTrackIndex] : 1;
this.trackStrokes[playerId][this.currentTrackIndex].get_upd(var3);
this.playersId[playerId].get_upd(var3);
} else {
Expand Down

0 comments on commit 6eadcf2

Please sign in to comment.