Skip to content

Commit

Permalink
Tanks v1.2.2 full release
Browse files Browse the repository at this point in the history
  • Loading branch information
aehmttw committed Sep 12, 2021
1 parent 282314b commit 41d227a
Show file tree
Hide file tree
Showing 17 changed files with 99 additions and 53 deletions.
6 changes: 5 additions & 1 deletion src/main/java/tanks/CrusadePlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import basewindow.BaseFile;
import tanks.bullet.Bullet;
import tanks.gui.screen.ScreenCrashed;
import tanks.gui.screen.ScreenGame;
import tanks.gui.screen.ScreenOutOfMemory;
import tanks.gui.screen.ScreenPartyLobby;
import tanks.hotbar.ItemBar;
import tanks.hotbar.item.Item;
Expand Down Expand Up @@ -153,7 +155,9 @@ public void saveCrusade(boolean win)
{
Crusade.currentCrusade.recordPerformance(ScreenGame.lastTimePassed, win);
this.coins = player.hotbar.coins;
player.remainingLives--;

if (!(Game.screen instanceof ScreenCrashed || Game.screen instanceof ScreenOutOfMemory))
player.remainingLives--;
}

f.println(player.remainingLives + "");
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/tanks/Drawing.java
Original file line number Diff line number Diff line change
Expand Up @@ -1116,13 +1116,6 @@ public double getPlayerOffsetY()
if (!enableMovingCameraY && !Game.followingCam)
return 0;

while (Panel.panel.pastPlayerTime.size() > 1 && Panel.panel.pastPlayerTime.get(1) < Panel.panel.age - track_offset)
{
Panel.panel.pastPlayerX.remove(0);
Panel.panel.pastPlayerY.remove(0);
Panel.panel.pastPlayerTime.remove(0);
}

double y = playerY;

if (Panel.panel.pastPlayerTime.size() == 1)
Expand Down
18 changes: 17 additions & 1 deletion src/main/java/tanks/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public enum Framework {lwjgl, libgdx}
public static double[][] tilesDepth = new double[28][18];

//Remember to change the version in android's build.gradle and ios's robovm.properties
public static final String version = "Tanks v1.2.2d";
public static final String version = "Tanks v1.2.2";
public static final int network_protocol = 36;
public static boolean debug = false;
public static boolean traceAllRays = false;
Expand Down Expand Up @@ -232,6 +232,7 @@ private Game()

public static void registerEvents()
{
System.out.println(Integer.MIN_VALUE + (Integer.MAX_VALUE - 2));
NetworkEventMap.register(EventSendClientDetails.class);
NetworkEventMap.register(EventPing.class);
NetworkEventMap.register(EventConnectionSuccess.class);
Expand Down Expand Up @@ -807,6 +808,8 @@ public static void exitToCrash(Throwable e)
if (ScreenPartyLobby.isClient || Game.connectedToOnline)
Client.handler.ctx.close();

ScreenPartyLobby.connections.clear();

ScreenPartyHost.isServer = false;
ScreenPartyLobby.isClient = false;

Expand Down Expand Up @@ -869,6 +872,19 @@ public static void exitToCrash(Throwable e)
else
screen = new ScreenCrashed();

try
{
if (Crusade.currentCrusade != null && !ScreenPartyHost.isServer && !ScreenPartyLobby.isClient)
{
Crusade.currentCrusade.crusadePlayers.get(Game.player).saveCrusade();
}
}
catch (Exception e1)
{
e1.printStackTrace(Game.logger);
e1.printStackTrace();
}

recycleEffects.clear();
removeEffects.clear();
removeTracks.clear();
Expand Down
21 changes: 19 additions & 2 deletions src/main/java/tanks/Panel.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,13 @@ public void setUp()
}

Game.game.window.soundPlayer.registerCombinedMusic("/music/battle.ogg", "battle");
Game.game.window.soundPlayer.registerCombinedMusic("/music/battle_night.ogg", "battle");
Game.game.window.soundPlayer.registerCombinedMusic("/music/battle_paused.ogg", "battle");
Game.game.window.soundPlayer.registerCombinedMusic("/music/battle_timed.ogg", "battle_timed");
Game.game.window.soundPlayer.registerCombinedMusic("/music/battle_timed_paused.ogg", "battle_timed");

Game.game.window.soundPlayer.registerCombinedMusic("/music/editor.ogg", "editor");
Game.game.window.soundPlayer.registerCombinedMusic("/music/editor_paused.ogg", "editor");
}

if (Game.game.window.soundsEnabled)
Expand Down Expand Up @@ -281,7 +285,7 @@ public void update()
return;
}

synchronized(Game.eventsIn)
synchronized (Game.eventsIn)
{
for (int i = 0; i < Game.eventsIn.size(); i++)
{
Expand Down Expand Up @@ -312,7 +316,7 @@ public void update()

ScreenPartyHost.includedPlayers.remove(ScreenPartyHost.disconnectedPlayers.get(i));

for (Player p: Game.players)
for (Player p : Game.players)
{
if (p.clientID.equals(ScreenPartyHost.disconnectedPlayers.get(i)))
{
Expand Down Expand Up @@ -385,6 +389,13 @@ else if (((ScreenGame) Game.screen).spectatingTank instanceof TankPlayerRemote)
this.pastPlayerY.add(Drawing.drawing.playerY);
this.pastPlayerTime.add(this.age);

while (Panel.panel.pastPlayerTime.size() > 1 && Panel.panel.pastPlayerTime.get(1) < Panel.panel.age - Drawing.track_offset)
{
Panel.panel.pastPlayerX.remove(0);
Panel.panel.pastPlayerY.remove(0);
Panel.panel.pastPlayerTime.remove(0);
}

if (Drawing.drawing.movingCamera)
{
this.zoomTimer += 0.04 * Panel.frameFrequency;
Expand Down Expand Up @@ -468,6 +479,12 @@ else if (((ScreenGame) Game.screen).spectatingTank instanceof TankPlayerRemote)
}

forceRefreshMusic = false;

if (Game.game.window.validPressedKeys.contains(InputCodes.KEY_F12) && Game.game.window.validPressedKeys.contains(InputCodes.KEY_LEFT_ALT) && Game.debug)
{
Game.game.window.validPressedKeys.clear();
Game.exitToCrash(new Exception("Manually initiated crash"));
}
}

public void playScreenMusic(long fadeTime)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tanks/gui/screen/ScreenAddSavedItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ else if (p == 1)
}
catch (Exception e)
{
Game.exitToCrash(e);
e.printStackTrace();
}
});

Expand Down
45 changes: 14 additions & 31 deletions src/main/java/tanks/gui/screen/ScreenChangelog.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void draw()
else
Drawing.drawing.setInterfaceFontSize(this.textSize);

Drawing.drawing.drawInterfaceText(this.centerX, this.centerY + (-(pageContents.length - 1) / 2.0 + i) * this.objYSpace / 2 - this.objYSpace, s);
Drawing.drawing.drawInterfaceText(this.centerX - 400, this.centerY + (-(pageContents.length - 1) / 2.0 + i) * this.objYSpace / 2 - this.objYSpace, s, false);
}
}
}
Expand Down Expand Up @@ -296,40 +296,23 @@ public static void setupLogs()
"Bug fixes and other minor improvements"
});

new Changelog("v1.2.2a", new String[]
new Changelog("v1.2.2", new String[]
{
"*What's new in Tanks v1.2.2a:\n\n" +
"Added indicator for where arc bullets will land\n" +
"Hovering over the item bar slots shows keybinds\n" +
"Added option to show level names in crusades\n" +
"Bug fixes and other minor improvements"
});

new Changelog("v1.2.2b", new String[]
{
"*What's new in Tanks v1.2.2b:\n\n" +
"Added crusade statistics screen (still work in progress)\n" +
"Leaving and rejoining a party crusade before a level is loaded recovers progress\n" +
"Explosive blocks now award players coins for kills\n" +
"Added mini tank to level editor\n" +
"Bug fixes and other minor improvements"
});

new Changelog("v1.2.2c", new String[]
{
"*What's new in Tanks v1.2.2c:\n\n" +
"Added more stats to the crusade stats screen\n" +
"Added built-in item templates\n" +
"Crusade stats screen shows in multiplayer\n" +
"*What's new in Tanks v1.2.2:\n\n" +
"*New features:\n\n" +
"Added crusade statistics screen\n" +
"Added music for editor and dark levels\n" +
"Added deterministic mode for speedrunners\n" +
"Bug fixes and other minor improvements"
});
"Added built-in item templates\n" +
"Added option to show level names in crusades\n" +
"Added indicator for where arc bullets will land\n" +
"Added mini tank to level editor\n",

new Changelog("v1.2.2d", new String[]
{
"*What's new in Tanks v1.2.2d:\n\n" +
"Tweaked editor and dark level music\n" +
"*Improvements:\n\n" +
"Hovering over the item bar slots shows keybinds\n" +
"Leaving and rejoining a party crusade before a new level is\n" +
" loaded recovers progress\n" +
"Explosive blocks now award players coins for kills\n" +
"Level timer now shows in editor after playing from 'My levels'\n" +
"Reworked the 'Save this level' button\n" +
"You can now save levels you play in parties\n" +
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/tanks/gui/screen/ScreenCrusadeStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public ScreenCrusadeStats(Crusade crusade, CrusadePlayer p, boolean intro)
playerNames[i] = pl.player.username;
playerObjects[i] = pl;

if (pl.player.clientID.equals(Game.clientID))
if (pl.player.clientID.equals(p.player.clientID))
us = i;

i++;
Expand All @@ -149,6 +149,9 @@ public void run()
changePlayer.selectedOption = us;

changePlayer.quick = true;

if (ScreenPartyLobby.isClient || ScreenPartyHost.isServer)
exit.text = "Back to party";
}

public void addTanks()
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tanks/gui/screen/ScreenGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -2086,6 +2086,9 @@ else if (ScreenPartyLobby.isClient)
double posX = Drawing.drawing.interfaceSizeX + (Game.game.window.absoluteWidth / Drawing.drawing.interfaceScale - Drawing.drawing.interfaceSizeX) / 2 - Game.game.window.getEdgeBounds() / Drawing.drawing.interfaceScale - 50;
double posY = -((Game.game.window.absoluteHeight - Drawing.drawing.statsHeight) / Drawing.drawing.interfaceScale - Drawing.drawing.interfaceSizeY) / 2 + 50;

if (Drawing.drawing.interfaceScaleZoom > 1)
posX -= 50;

Drawing.drawing.setInterfaceFontSize(24);
Drawing.drawing.drawInterfaceText(posX, posY, "Deterministic mode", true);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tanks/gui/screen/ScreenInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void draw()
Drawing.drawing.setColor(255, 255, 255);
for (int i = 0; i < text.length; i++)
{
Drawing.drawing.drawInterfaceText(Drawing.drawing.interfaceSizeX / 2, Drawing.drawing.interfaceSizeY / 2 + (i - (text.length - 1) / 2.0) * this.objYSpace / 2, this.text[i]);
Drawing.drawing.drawInterfaceText(Drawing.drawing.interfaceSizeX / 2 - 300, Drawing.drawing.interfaceSizeY / 2 + (i - (text.length - 1) / 2.0) * this.objYSpace / 2, this.text[i], false);
}

back.draw();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/tanks/gui/screen/ScreenInterlevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@ public void draw()
this.drawDefaultBackground();

save.posX = (Game.game.window.absoluteWidth / Drawing.drawing.interfaceScale - Drawing.drawing.interfaceSizeX) / 2
+ Drawing.drawing.interfaceSizeX - 50 - Game.game.window.getEdgeBounds() / Drawing.drawing.interfaceScale;
+ Drawing.drawing.interfaceSizeX - 50 * Drawing.drawing.interfaceScaleZoom - Game.game.window.getEdgeBounds() / Drawing.drawing.interfaceScale;
save.posY = ((Game.game.window.absoluteHeight - Drawing.drawing.statsHeight) / Drawing.drawing.interfaceScale - Drawing.drawing.interfaceSizeY) / 2
+ Drawing.drawing.interfaceSizeY - 50;
+ Drawing.drawing.interfaceSizeY - 50 * Drawing.drawing.interfaceScaleZoom;

if (Panel.win && Game.effectsEnabled && !Game.game.window.drawingShadow)
{
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/tanks/gui/screen/ScreenOptionsGraphics.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ public void update()
if (Game.framework == Game.Framework.libgdx)
{
fullscreen.enabled = false;
fullscreen.hoverText[0] = "This option is unavailable on mobile---because all apps are fullscreen!";
fullscreen.hoverText[0] = "This option is unavailable on mobile";
fullscreen.hoverText[1] = "because all apps are fullscreen!";
}

fullscreen.update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ public ScreenPartyCrusadeInterlevel(boolean win)
}
}

save.posX = Drawing.drawing.interfaceSizeX - 40;
save.posY = Drawing.drawing.interfaceSizeY - 90;
save.posX = Drawing.drawing.interfaceSizeX - Drawing.drawing.interfaceScaleZoom * 40;
save.posY = Drawing.drawing.interfaceSizeY - 50 - Drawing.drawing.interfaceScaleZoom * 40;
save.image = "save.png";

save.imageSizeX = this.objHeight;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/tanks/gui/screen/ScreenPartyInterlevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ public ScreenPartyInterlevel()
}
}

save.posX = Drawing.drawing.interfaceSizeX - 40;
save.posY = Drawing.drawing.interfaceSizeY - 90;
save.posX = Drawing.drawing.interfaceSizeX - Drawing.drawing.interfaceScaleZoom * 40;
save.posY = Drawing.drawing.interfaceSizeY - 50 - Drawing.drawing.interfaceScaleZoom * 40;
save.image = "save.png";

save.imageSizeX = this.objHeight;
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/tanks/gui/screen/leveleditor/OverlayObjectMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,26 @@ public OverlayObjectMenu(Screen previous, ScreenLevelEditor screenLevelEditor)
{
super(previous, screenLevelEditor);

rotateTankButton.imageXOffset = -155;
rotateTankButton.imageSizeX = 30;
rotateTankButton.imageSizeY = 30;
rotateTankButton.image = "rotate_tank.png";

selectTeam.imageXOffset = -150;
selectTeam.imageSizeX = 30;
selectTeam.imageSizeY = 30;
selectTeam.image = "team.png";

editHeight.imageXOffset = -155;
editHeight.imageSizeX = 30;
editHeight.imageSizeY = 30;
editHeight.image = "obstacle_height.png";

editGroupID.imageXOffset = -155;
editGroupID.imageSizeX = 30;
editGroupID.imageSizeY = 30;
editGroupID.image = "id.png";

for (int i = 0; i < Game.registryTank.tankEntries.size(); i++)
{
int rows = objectButtonRows;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tanks/hotbar/ItemBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public void draw()
{
for (int i = 0; i < this.slotButtons.length; i++)
{
if (this.slotButtons[i].selected)
if (this.slotButtons[i].selected && !Game.game.window.touchscreen)
{
InputBindingGroup g = null;

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tanks/tank/TankPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ public void fireBullet(double speed, int bounces, Bullet.BulletEffect effect)

public void fireBullet(Bullet b, double speed)
{
if (speed <= 0)
speed = Double.MIN_NORMAL;

if (b.itemSound != null)
Drawing.drawing.playGlobalSound(b.itemSound, (float) (Bullet.bullet_size / b.size));

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tanks/tank/TankPlayerRemote.java
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@ public void fireBullet(double speed, int bounces, Bullet.BulletEffect effect)

public void fireBullet(Bullet b, double speed)
{
if (speed <= 0)
speed = Double.MIN_NORMAL;

if (b.itemSound != null)
Drawing.drawing.playGlobalSound(b.itemSound, (float) (Bullet.bullet_size / b.size));

Expand Down

0 comments on commit 41d227a

Please sign in to comment.