Skip to content
This repository has been archived by the owner on Jul 15, 2020. It is now read-only.

Commit

Permalink
ported over 0.7.4c changes, updated version info
Browse files Browse the repository at this point in the history
  • Loading branch information
00-Evan committed Aug 15, 2019
1 parent e41193c commit fc6e951
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 37 deletions.
13 changes: 7 additions & 6 deletions PD-classes/src/com/watabou/noosa/Tilemap.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ protected void updateVertices() {

}

private int camX, camY, camW, camH;
private int topLeft, bottomRight, length;
//private int camX, camY, camW, camH;
//private int topLeft, bottomRight, length;

@Override
public void draw() {
Expand All @@ -214,8 +214,9 @@ public void draw() {
topLeftUpdating = -1;
updating.setEmpty();
}

Camera c = Camera.main;

//FIXME temporarily disabled this optimization as it is suspected to cause crashes
/*Camera c = Camera.main;
//we treat the position of the tilemap as (0,0) here
camX = (int)(c.scroll.x/cellW - x/cellW);
camY = (int)(c.scroll.y/cellH - y/cellH);
Expand All @@ -242,7 +243,7 @@ public void draw() {
length = bottomRight - topLeft + 1;
if (length <= 0)
return;
return;*/

NoosaScript script = NoosaScriptNoLighting.get();

Expand All @@ -252,7 +253,7 @@ public void draw() {

script.camera( camera );

script.drawQuadSet( buffer, length, topLeft );
script.drawQuadSet( buffer, size, 0 );

}

Expand Down
18 changes: 9 additions & 9 deletions PD-classes/src/com/watabou/noosa/audio/Music.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public enum Music {
private boolean enabled = true;
private float volume = 1f;

public void play( String assetName, boolean looping ) {
public synchronized void play( String assetName, boolean looping ) {

if (isPlaying() && lastPlayed.equals( assetName )) {
return;
Expand All @@ -56,43 +56,43 @@ public void play( String assetName, boolean looping ) {
player.play();
}

public void mute() {
public synchronized void mute() {
lastPlayed = null;
stop();
}

public void pause() {
public synchronized void pause() {
if (player != null) {
player.pause();
}
}

public void resume() {
public synchronized void resume() {
if (player != null) {
player.play();
}
}

public void stop() {
public synchronized void stop() {
if (player != null) {
player.stop();
player.dispose();
player = null;
}
}

public void volume( float value ) {
public synchronized void volume( float value ) {
volume = value;
if (player != null) {
player.setVolume( value );
}
}

public boolean isPlaying() {
public synchronized boolean isPlaying() {
return player != null && player.isPlaying();
}

public void enable( boolean value ) {
public synchronized void enable( boolean value ) {
enabled = value;
if (isPlaying() && !value) {
stop();
Expand All @@ -102,7 +102,7 @@ public void enable( boolean value ) {
}
}

public boolean isEnabled() {
public synchronized boolean isEnabled() {
return enabled;
}
}
3 changes: 3 additions & 0 deletions PD-classes/src/com/watabou/utils/Bundle.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ public <E extends Enum<E>> E getEnum( String key, Class<E> enumClass ) {
} catch (JSONException e) {
Game.reportException(e);
return enumClass.getEnumConstants()[0];
} catch (IllegalArgumentException e) {
Game.reportException(e);
return enumClass.getEnumConstants()[0];
}
}

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ allprojects {
apply plugin: "eclipse"
apply plugin: "idea"

version = '0.7.4b'
version = '0.7.4c'
ext {
versionCode = 361
versionCode = 362
appName = 'shattered-pixel-dungeon'
appTitle = 'Shattered Pixel Dungeon'
appId = 'com.shatteredpixel.shatteredpixeldungeon'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public class MagicMissile extends Emitter {

private Callback callback;

private PointF to;

private float sx;
private float sy;
private float time;
Expand Down Expand Up @@ -89,6 +91,8 @@ public void reset( int type, PointF from, PointF to, Callback callback ) {

revive();

this.to = to;

x = from.x;
y = from.y;
width = 0;
Expand Down Expand Up @@ -159,15 +163,24 @@ public void size( float size ) {
y -= size / 2;
width = height = size;
}

public void setSpeed( float newSpeed ){
PointF d = PointF.diff( to, new PointF(x, y) );
PointF speed = new PointF( d ).normalize().scale( newSpeed );
sx = speed.x;
sy = speed.y;
time = d.length() / newSpeed;
}

//convenience method for the common case of a bolt going from a character to a tile or enemy
public static void boltFromChar(Group group, int type, Visual sprite, int to, Callback callback){
public static MagicMissile boltFromChar(Group group, int type, Visual sprite, int to, Callback callback){
MagicMissile missile = ((MagicMissile)group.recycle( MagicMissile.class ));
if (Actor.findChar(to) != null){
missile.reset(type, sprite.center(), Actor.findChar(to).sprite.destinationCenter(), callback);
} else {
missile.reset(type, sprite, to, callback);
}
return missile;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.items.armor;

import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken;
Expand All @@ -39,7 +40,7 @@ public class HuntressArmor extends ClassArmor {
image = ItemSpriteSheet.ARMOR_HUNTRESS;
}

private HashMap<Callback, Mob> targets = new HashMap<Callback, Mob>();
private HashMap<Callback, Mob> targets = new HashMap<>();

@Override
public void doSpecial() {
Expand All @@ -48,7 +49,8 @@ public void doSpecial() {

for (Mob mob : Dungeon.level.mobs) {
if (Dungeon.level.distance(curUser.pos, mob.pos) <= 12
&& Dungeon.level.heroFOV[mob.pos]) {
&& Dungeon.level.heroFOV[mob.pos]
&& mob.alignment != Char.Alignment.ALLY) {

Callback callback = new Callback() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots;
Expand All @@ -41,7 +42,8 @@ public class MageArmor extends ClassArmor {
public void doSpecial() {

for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
if (Dungeon.level.heroFOV[mob.pos]) {
if (Dungeon.level.heroFOV[mob.pos]
&& mob.alignment != Char.Alignment.ALLY) {
Buff.affect( mob, Burning.class ).reignite( mob );
Buff.prolong( mob, Roots.class, 3 );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
Expand Down Expand Up @@ -67,8 +68,8 @@ public void onSelect( Integer target ) {

curUser.HP -= (curUser.HP / 3);

for (Mob mob : Dungeon.level.mobs.toArray(new Mob[Dungeon.level.mobs.size()])) {
if (Dungeon.level.heroFOV[mob.pos]) {
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
if (Dungeon.level.heroFOV[mob.pos] && mob.alignment != Char.Alignment.ALLY) {
Buff.prolong( mob, Blindness.class, 2 );
if (mob.state == mob.HUNTING) mob.state = mob.WANDERING;
mob.sprite.emitter().burst( Speck.factory( Speck.LIGHT ), 4 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void call() {

for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
Char mob = Actor.findChar(curUser.pos + PathFinder.NEIGHBOURS8[i]);
if (mob != null && mob != curUser) {
if (mob != null && mob != curUser && mob.alignment != Char.Alignment.ALLY) {
Buff.prolong(mob, Paralysis.class, SHOCK_TIME);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,15 @@ public String desc() {
@Override
public String status() {
if (ghost == null && ghostID != 0){
Actor a = Actor.findById(ghostID);
if (a != null){
ghost = (GhostHero)a;
} else {
try {
Actor a = Actor.findById(ghostID);
if (a != null) {
ghost = (GhostHero) a;
} else {
ghostID = 0;
}
} catch ( ClassCastException e ){
ShatteredPixelDungeon.reportException(e);
ghostID = 0;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,15 @@ protected void onZap(Ballistica bolt) {

@Override
protected void fx(Ballistica bolt, Callback callback) {
MagicMissile.boltFromChar(curUser.sprite.parent,
MagicMissile m = MagicMissile.boltFromChar(curUser.sprite.parent,
MagicMissile.WARD,
curUser.sprite,
bolt.collisionPos,
callback);

if (bolt.dist > 10){
m.setSpeed(bolt.dist*20);
}
Sample.INSTANCE.play(Assets.SND_ZAP);
}

Expand Down Expand Up @@ -207,6 +211,7 @@ public void upgrade( int wandLevel ){
viewDistance++;
name = Messages.get(this, "name_" + tier );
updateSpriteState();
GameScene.updateFog(pos, viewDistance+1);
}
}

Expand Down Expand Up @@ -347,6 +352,7 @@ public void updateSpriteState() {
public void destroy() {
super.destroy();
Dungeon.observe();
GameScene.updateFog(pos, viewDistance+1);
}

@Override
Expand All @@ -364,7 +370,6 @@ public boolean interact() {
protected void onSelect(int index) {
if (index == 0){
die(null);
Dungeon.observe();
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,24 @@ public static void add_v0_7_4_Changes( ArrayList<ChangeInfo> changeInfos ){
changes.hardlight( Window.TITLE_COLOR );
changeInfos.add(changes);

changes = new ChangeInfo("", false, null);
changes.hardlight( Window.TITLE_COLOR );
changeInfos.add(changes);

changes = new ChangeInfo("v0.7.4c", false, null);
changes.hardlight( Window.TITLE_COLOR );
changeInfos.add(changes);

changes.addButton( new ChangeButton(Icons.get(Icons.PREFS), Messages.get(ChangesScene.class, "misc"),
"_-_ Shots from the wand of warding now travel more quickly if they are going a great distance.\n\n" +
"_-_ Class armor abilities no longer affect allies"));

changes.addButton( new ChangeButton(new Image(Assets.SPINNER, 144, 0, 16, 16), Messages.get(ChangesScene.class, "bugfixes"),
"Fixed (caused by 0.7.4):\n" +
"_-_ Various rare crash bugs\n" +
"_-_ Software keyboard not automatically hiding correctly\n" +
"_-_ Various fog of war errors when distant wards die"));

changes = new ChangeInfo("v0.7.4b", false, null);
changes.hardlight( Window.TITLE_COLOR );
changeInfos.add(changes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ public void run() {
public void update() {
super.update();

if (thread != null && !thread.isAlive()) {
thread = null;
if (thread != null && !thread.isAlive() && busy != null) {
if (error == null) {
remove( busy );
busy = null;
if (Dungeon.hero != null) {
createControls();
} else {
Expand All @@ -109,6 +109,12 @@ public void update() {
}
}

@Override
public void destroy() {
super.destroy();
thread = null;
}

private void createControls() {

String[] labels =
Expand Down
6 changes: 3 additions & 3 deletions desktop/VersionInfo.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
361
362
356
v0.7.4b
v0.7.4c
v0.7.4!
github.com/00-Evan/shattered-pixel-dungeon-gdx/releases/download/v0.7.4b/ShatteredPD.Desktop.v0.7.4b.jar
github.com/00-Evan/shattered-pixel-dungeon-gdx/releases/download/v0.7.4c/ShatteredPD.Desktop.v0.7.4c.jar
4 changes: 2 additions & 2 deletions desktop/src/com/watabou/pd/desktop/DesktopLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ public class DesktopLauncher {
public static void main (String[] arg) {
String version = DesktopLauncher.class.getPackage().getSpecificationVersion();
if (version == null) {
version = "0.7.4b";
version = "0.7.4c";
}

int versionCode;
try {
versionCode = Integer.parseInt(DesktopLauncher.class.getPackage().getImplementationVersion());
} catch (NumberFormatException e) {
versionCode = 361;
versionCode = 362;
}

LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
Expand Down

0 comments on commit fc6e951

Please sign in to comment.