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.6.2b-0.6.2d changes
Browse files Browse the repository at this point in the history
  • Loading branch information
00-Evan committed Nov 18, 2017
1 parent 030616e commit ee5df16
Show file tree
Hide file tree
Showing 122 changed files with 3,647 additions and 762 deletions.
14 changes: 6 additions & 8 deletions PD-classes/src/com/watabou/noosa/Camera.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

public class Camera extends Gizmo {

protected static ArrayList<Camera> all = new ArrayList<Camera>();
private static ArrayList<Camera> all = new ArrayList<Camera>();

protected static float invW2;
protected static float invH2;
Expand Down Expand Up @@ -66,7 +66,7 @@ public static Camera reset() {
return reset( createFullscreen( 1 ) );
}

public static Camera reset( Camera newCamera ) {
public static synchronized Camera reset( Camera newCamera ) {

invW2 = 2f / Game.width;
invH2 = 2f / Game.height;
Expand All @@ -80,20 +80,18 @@ public static Camera reset( Camera newCamera ) {
return main = add( newCamera );
}

public static Camera add( Camera camera ) {
public static synchronized Camera add( Camera camera ) {
all.add( camera );
return camera;
}

public static Camera remove( Camera camera ) {
public static synchronized Camera remove( Camera camera ) {
all.remove( camera );
return camera;
}

public static void updateAll() {
int length = all.size();
for (int i=0; i < length; i++) {
Camera c = all.get( i );
public static synchronized void updateAll() {
for (Camera c : all) {
if (c.exists && c.active) {
c.update();
}
Expand Down
4 changes: 3 additions & 1 deletion PD-classes/src/com/watabou/noosa/audio/Music.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public enum Music {
private boolean lastLooping;

private boolean enabled = true;
private float volume = 1f;

public void play( String assetName, boolean looping ) {

Expand All @@ -51,7 +52,7 @@ public void play( String assetName, boolean looping ) {

player = Gdx.audio.newMusic(Gdx.files.internal(assetName));
player.setLooping(looping);

player.setVolume(volume);
player.play();
}

Expand Down Expand Up @@ -81,6 +82,7 @@ public void stop() {
}

public void volume( float value ) {
volume = value;
if (player != null) {
player.setVolume( value );
}
Expand Down
Binary file modified android/assets/pixelfont.ttf
Binary file not shown.
Binary file modified android/assets/tiles_caves.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/assets/tiles_city.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/assets/tiles_halls.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/assets/tiles_prison.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/assets/tiles_sewers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ allprojects {
apply plugin: "eclipse"
apply plugin: "idea"

version = '0.6.2a'
version = '0.6.2d'
ext {
versionCode = 224
versionCode = 228
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 @@ -136,6 +136,7 @@ public void create() {
fullscreen( prefs.getBoolean(Preferences.KEY_WINDOW_FULLSCREEN, false) );

Music.INSTANCE.enable( music() );
Music.INSTANCE.volume( musicVol()/10f );
Sample.INSTANCE.enable( soundFx() );
Sample.INSTANCE.volume( SFXVol()/10f );

Expand Down Expand Up @@ -261,7 +262,6 @@ public static int zoom() {

public static void music( boolean value ) {
Music.INSTANCE.enable( value );
Music.INSTANCE.volume( musicVol()/10f );
Preferences.INSTANCE.put( Preferences.KEY_MUSIC, value );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public static void process() {
current = null;
} else {
doNext = acting.act();
if (doNext && !Dungeon.hero.isAlive()) {
if (doNext && (Dungeon.hero == null || !Dungeon.hero.isAlive())) {
doNext = false;
current = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public boolean attachTo( Char target ) {
}

public void detach() {
fx( false );
if (target.sprite != null) fx( false );
target.remove( this );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Languages;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
Expand Down Expand Up @@ -99,11 +98,7 @@ public void onDeath() {
Badges.validateDeathFromPoison();

Dungeon.fail( getClass() );
if (Messages.lang() == Languages.ENGLISH){
GLog.n("You died from venom...");
} else {
GLog.n(Messages.get(Poison.class, "ondeath"));
}
GLog.n(Messages.get(Poison.class, "ondeath"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public boolean reset() {
}

public static Mimic spawnAt( int pos, List<Item> items ) {
if (Dungeon.level.pit[pos]) return null;
Char ch = Actor.findChar( pos );
if (ch != null) {
ArrayList<Integer> candidates = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ protected boolean doAttack(Char enemy) {
private void jump() {

Level level = Dungeon.level;

//incase tengu hasn't had a chance to act yet
if (fieldOfView == null || fieldOfView.length != Dungeon.level.length()){
fieldOfView = new boolean[Dungeon.level.length()];
Dungeon.level.updateFieldOfView( this, fieldOfView );
}

if (enemy == null) enemy = chooseEnemy();
if (enemy == null) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ protected void emit( int index ) {
for (int i = blob.area.left; i < blob.area.right; i++) {
for (int j = blob.area.top; j < blob.area.bottom; j++) {
cell = i + j*Dungeon.level.width();
if (map[cell] > 0 && Dungeon.level.heroFOV[cell]) {
if (map[cell] > 0
&& cell < Dungeon.level.heroFOV.length
&& Dungeon.level.heroFOV[cell]) {
float x = (i + Random.Float()) * size;
float y = (j + Random.Float()) * size;
factory.emit(this, index, x, y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ public void reset( int index ) {
public void update() {
super.update();

x = target.sprite.center().x - SIZE / 2;
y = target.sprite.y - SIZE;
if (target.sprite != null) {
x = target.sprite.center().x - SIZE / 2;
y = target.sprite.y - SIZE;
}

switch (phase) {
case FADE_IN:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public Flow( int pos ) {
@Override
public void update() {

if (visible = Dungeon.level.heroFOV[pos]) {
if (visible = (pos < Dungeon.level.heroFOV.length && Dungeon.level.heroFOV[pos])) {

super.update();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static class WarriorShield extends Buff {
private float partialShield;

@Override
public boolean act() {
public synchronized boolean act() {
if (armor == null) detach();
else if (armor.isEquipped((Hero)target)) {
if (target.SHLD < maxShield()){
Expand All @@ -121,11 +121,11 @@ else if (armor.isEquipped((Hero)target)) {
return true;
}

public void setArmor(Armor arm){
public synchronized void setArmor(Armor arm){
armor = arm;
}

public int maxShield() {
public synchronized int maxShield() {
return 1 + armor.tier + armor.level();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ public int DRMax(int lvl){
int effectiveTier = armorTier;
if (glyph != null) effectiveTier += glyph.tierDRAdjust();
effectiveTier = Math.max(0, effectiveTier);

return effectiveTier * (2 + lvl);
return Math.max(DRMin(lvl), effectiveTier * (2 + lvl));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class MageArmor extends ClassArmor {
@Override
public void doSpecial() {

for (Mob mob : Dungeon.level.mobs) {
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
if (Dungeon.level.heroFOV[mob.pos]) {
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 @@ -170,7 +170,7 @@ public boolean act() {
if (charge < chargeCap) {
LockedFloor lock = target.buff(LockedFloor.class);
if (!stealthed && (lock == null || lock.regenOn())) {
float turnsToCharge = (60 - 2*(chargeCap - charge));
float turnsToCharge = (50 - (chargeCap - charge));
if (level() > 7) turnsToCharge -= 10*(level() - 7)/3f;
partialCharge += (1f / turnsToCharge);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,14 @@ public boolean collect( Bag container ) {

for (Item item : container.items.toArray( new Item[0] )) {
if (grab( item )) {
item.detachAll( container );
if (!item.collect( this ))
item.collect( container );
int slot = Dungeon.quickslot.getSlot(item);
item.detachAll(container);
if (!item.collect(this)) {
item.collect(container);
}
if (slot != -1) {
Dungeon.quickslot.setSlot(slot, item);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Languages;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
Expand Down Expand Up @@ -56,8 +55,10 @@ protected void onItemSelected(Item item) {
Enchanting.show( curUser, item );

//FIXME add this to translations
if (Messages.lang() == Languages.ENGLISH) {
GLog.w("your %s glows in the dark", item.name());
if (item instanceof Weapon) {
GLog.p(Messages.get(this, "weapon"));
} else {
GLog.p(Messages.get(this, "armor"));
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ public class WandOfCorruption extends Wand {
protected void onZap(Ballistica bolt) {
Char ch = Actor.findChar(bolt.collisionPos);

if (ch != null && ch instanceof Mob && !(ch instanceof NPC)){
if (ch != null){

if (!(ch instanceof Mob) || ch instanceof NPC){
return;
}

Mob enemy = (Mob) ch;

Expand Down Expand Up @@ -172,6 +176,9 @@ protected void onZap(Ballistica bolt) {
}

processSoulMark(ch, chargesPerCast());

} else {
Dungeon.level.press(bolt.collisionPos, null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ protected void onZap(Ballistica bolt) {
else
Buff.prolong(ch, Chill.class, 2+level());
}
} else {
Dungeon.level.press(bolt.collisionPos, null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.items.wands;

import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
Expand Down Expand Up @@ -54,6 +55,8 @@ protected void onZap( Ballistica bolt ) {

ch.sprite.burst(0xFFFFFFFF, level() / 2 + 2);

} else {
Dungeon.level.press(bolt.collisionPos, null);
}
}

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

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.blobs.Blob;
Expand Down Expand Up @@ -56,6 +57,10 @@ protected void onZap(Ballistica bolt) {
processSoulMark(ch, chargesPerCast());
}
}

if (Actor.findChar(bolt.collisionPos) == null){
Dungeon.level.press(bolt.collisionPos, null);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,8 @@ public static <T extends Record> ArrayList<T> getRecords( Class<T> recordType ){
return filtered;
}

public static void remove( Record rec ){
records.remove(rec);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,14 @@ public int distance( int a, int b ) {
public boolean adjacent( int a, int b ) {
return distance( a, b ) == 1;
}

public int distNoDiag( int a, int b){
int ax = a % width();
int ay = a / width();
int bx = b % width();
int by = b / width();
return Math.abs( ax - bx ) + Math.abs( ay - by );
}

//returns true if the input is a valid tile within the level
public boolean insideMap( int tile ){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void activate() {
for (Char ch : Actor.chars()){
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
if (bolt.collisionPos == ch.pos &&
(target == null || Dungeon.level.distance(pos, ch.pos) < Dungeon.level.distance(pos, target.pos))){
(target == null || Dungeon.level.distNoDiag(pos, ch.pos) < Dungeon.level.distNoDiag(pos, target.pos))){
target = ch;
}
}
Expand Down
Loading

0 comments on commit ee5df16

Please sign in to comment.