Quote
It's just there's very little time of reaction to press USE button. If it's too late, you won't be able to shake it off (that makes Hands very unfair enemies...). And I just tested it, it's the same in Dosbox and GDX, so no issue here.
Quote
This post has been edited by Dzierzan: 21 July 2017 - 03:13 AM
Dzierzan, on 21 July 2017 - 03:12 AM, said:
This post has been edited by fgsfds: 21 July 2017 - 03:23 AM
Quote
This post has been edited by Spiker: 21 July 2017 - 10:00 AM
This post has been edited by Fantinaikos: 21 July 2017 - 12:36 PM
Fantinaikos, on 21 July 2017 - 12:35 PM, said:
Tiddalick, on 21 July 2017 - 03:19 PM, said:
This post has been edited by J432: 22 July 2017 - 01:12 PM
This post has been edited by J432: 22 July 2017 - 11:59 PM
This post has been edited by J432: 23 July 2017 - 01:23 PM
public class TextureCache { private final Map<TextureKey, pthtyp> cache = new HashMap<TextureKey, pthtyp>(); ... private pthtyp get(int picnum, int palnum, boolean clamped) { return this.cache.get(new TextureKey(picnum, palnum, clamped)); // <----- this is a problem } ... }
public class TextureCache { private final Map<TextureKey, pthtyp> cache = new HashMap<TextureKey, pthtyp>(); private final MutableTextureKey mutableTextureKey = new MutableTextureKey(); // <----- reusable mutable key ... private pthtyp get(int picnum, int palnum, boolean clamped) { return this.cache.get(this.mutableTextureKey .picnum(picnum).palnum(palnum).clamped(clamped));// <----- not creating new instances } private void add(int picnum, pthtyp tex) { this.cache.put(this.mutableTextureKey .picnum(picnum) .palnum(tex.palnum) .clamped(tex.isClamped()) .toImmutable(), // <----- creates immutable key only when necessary, i.e. when adding a texture to the cache tex ); } }
abstract class TextureKey { abstract int picnum(); abstract int palnum(); abstract boolean clamped(); @Override public int hashCode() { return (this.clamped() ? 31 : 0) ^ this.picnum() ^ this.palnum(); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } // Not doing reflection to avoid additional cost // if (!TextureKey.class.isAssignableFrom(obj.getClass())) { // return false; // } final TextureKey other = (TextureKey) obj; if (this.picnum() != other.picnum()) { return false; } if (this.palnum() != other.palnum()) { return false; } if (this.clamped() != other.clamped()) { return false; } return true; } }
class MutableTextureKey extends TextureKey { private int picnum; private int palnum; private boolean clamped; MutableTextureKey() { } @Override boolean clamped() { return this.clamped; } @Override int palnum() { return this.palnum; } @Override int picnum() { return this.picnum; } /** * Factory method for immutable keys. */ public TextureKey toImmutable() { return new ImmutableTextureKey(picnum, palnum, clamped); } public MutableTextureKey picnum(int i) { this.picnum = i; return this; } public MutableTextureKey palnum(int i) { this.palnum = i; return this; } public MutableTextureKey clamped(boolean :thumbsup: { this.clamped = b; return this; } }
class ImmutableTextureKey extends TextureKey { final int picnum; final int palnum; final boolean clamped; ImmutableTextureKey(int picnum, int palnum, boolean clamped) { this.picnum = picnum; this.palnum = palnum; this.clamped = clamped; } @Override boolean clamped() { return this.clamped; } @Override int palnum() { return this.palnum; } @Override int picnum() { return this.picnum; } }
Tekedon, on 23 July 2017 - 10:41 AM, said:
kimec, on 24 July 2017 - 01:57 AM, said:
public int hashCode() { return (clamped ? 31 : 0) ^ picnum ^ palnum ^ surfnum; }
Quote
Zaxx, on 24 July 2017 - 09:39 AM, said:
Zaxx, on 24 July 2017 - 09:39 AM, said:
This post has been edited by M210: 24 July 2017 - 11:22 AM
Drek, on 24 July 2017 - 11:36 AM, said:
M210, on 24 July 2017 - 12:12 PM, said:
M210, on 24 July 2017 - 12:12 PM, said:
M210, on 24 July 2017 - 11:21 AM, said:
This post has been edited by Devon: 25 July 2017 - 02:07 AM
Devon, on 25 July 2017 - 02:04 AM, said:
This post has been edited by Mark.: 25 July 2017 - 11:07 AM
Mark., on 25 July 2017 - 11:05 AM, said: