linear-time jump power mode, resulting better control that allows (bit) more instinctive jump, added jump time doc, fullwidth punctuation for the chinese language

Former-commit-id: e45c825db3642f1134c37c2e568917239b00c125
Former-commit-id: 3a9a5454f6b7c9cd67659fe56cf6593d94d8963c
This commit is contained in:
Song Minjae
2016-02-26 02:32:31 +09:00
parent c56e09505b
commit f78f8e2306
12 changed files with 51 additions and 10 deletions

View File

@@ -32,7 +32,7 @@
"27";"TILE_SNOW" ; "8205"; "6"; "0"; "N/A"; "1"; "1"; "0"; "27"; "0";"16"
"28";"TILE_ICE_FRAGILE" ; "3282"; "1"; "0"; "N/A"; "1"; "0"; "0"; "28"; "0";"16"
"29";"TILE_ICE_NATURAL" ; "6564"; "25"; "0"; "N/A"; "1"; "1"; "0"; "29"; "0"; "8"
"30";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25"; "0"; "N/A"; "1"; "1"; "4967"; "30"; "0"; "8"
"30";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25"; "0"; "N/A"; "1"; "1";"14949"; "30"; "0"; "8"
# see scandinavian name set female of this tile id!
"31";"TILE_PLATFORM_STONE" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "31"; "0";"16"
"32";"TILE_PLATFORM_WOODEN" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "32"; "0";"16"
Can't render this file because it contains an unexpected character in line 1 and column 12.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -20,6 +20,7 @@ public class GameFontBase implements Font {
static SpriteSheet uniHan;
static SpriteSheet cyrilic;
static SpriteSheet cyrilicEF;
static SpriteSheet fullwidthForms;
static final int JUNG_COUNT = 21;
static final int JONG_COUNT = 28;
@@ -44,6 +45,7 @@ public class GameFontBase implements Font {
static final int SHEET_UNIHAN = 8;
static final int SHEET_CYRILIC_EM = 9;
static final int SHEET_CYRILIC_EF = 10;
static final int SHEET_FW_UNI = 11;
static SpriteSheet[] sheetKey;
static final Character[] asciiEFList = {
@@ -136,6 +138,10 @@ public class GameFontBase implements Font {
return (Arrays.asList(cyrilecEFList).contains(c));
}
private boolean isFullwidthUni(char c) {
return (c >= 0xFF00 && c < 0xFF60);
}
private int asciiEFindexX(char c) {
return (Arrays.asList(asciiEFList).indexOf(c) % 16);
}
@@ -200,6 +206,14 @@ public class GameFontBase implements Font {
return (Arrays.asList(cyrilecEFList).indexOf(c) / 16);
}
private int fullwidthUniIndexX(char c) {
return (c - 0xFF00) % 16;
}
private int fullwidthUniIndexY(char c) {
return (c - 0xFF00) / 16;
}
@Override
public int getWidth(String s) {
return getWidthSubstr(s, s.length());
@@ -234,7 +248,7 @@ public class GameFontBase implements Font {
len += W_LATIN_NARROW;
else if (c == SHEET_KANA || c == SHEET_HANGUL || c == SHEET_CJK_PUNCT)
len += W_CJK;
else if (c == SHEET_UNIHAN)
else if (c == SHEET_UNIHAN || c == SHEET_FW_UNI)
len += W_UNIHAN;
else
len += W_LATIN_WIDE;
@@ -292,7 +306,7 @@ public class GameFontBase implements Font {
Math.round(x
+ getWidthSubstr(s, i + 1) - glyphW
)
, Math.round((H - H_HANGUL) / 2 + y)
, Math.round((H - H_UNIHAN) / 2 + y)
, uniHanIndexX(ch)
, uniHanIndexY(ch)
);
@@ -350,6 +364,10 @@ public class GameFontBase implements Font {
sheetX = cyrilicEFindexX(ch);
sheetY = cyrilicEFindexY(ch);
break;
case SHEET_FW_UNI:
sheetX = fullwidthUniIndexX(ch);
sheetY = fullwidthUniIndexY(ch);
break;
default:
sheetX = ch % 16;
sheetY = ch / 16;
@@ -363,7 +381,8 @@ public class GameFontBase implements Font {
// Interchar: pull punct right next to hangul to the left
+ ((i > 0 && isHangul(s.charAt(i - 1))) ? -3 : 0)
, Math.round(y)
- ((prevInstance == SHEET_CJK_PUNCT) ? 1 : 0)
+ ((prevInstance == SHEET_CJK_PUNCT) ? -1 :
(prevInstance == SHEET_FW_UNI) ? (H - H_HANGUL) / 2 : 0)
, sheetX
, sheetY
);
@@ -399,6 +418,7 @@ public class GameFontBase implements Font {
else if (isCyrilic(c)) return SHEET_CYRILIC_EM;
// fixed width punctuations
else if (isCJKPunct(c)) return SHEET_CJK_PUNCT;
else if (isFullwidthUni(c)) return SHEET_FW_UNI;
else return SHEET_ASCII_EM; // fallback
}

View File

@@ -58,6 +58,10 @@ public class GameFontWhite extends GameFontBase {
"./res/graphics/fonts/cyrilic_ef.png"
, W_LATIN_NARROW, H
);
fullwidthForms = new SpriteSheet(
"./res/graphics/fonts/fullwidth_forms.png"
, W_UNIHAN, H_UNIHAN
);
SpriteSheet[] shk = {
asciiSheet
@@ -71,6 +75,7 @@ public class GameFontWhite extends GameFontBase {
, uniHan
, cyrilic
, cyrilicEF
, fullwidthForms
};
sheetKey = shk;
}

View File

@@ -25,11 +25,12 @@ public class Player extends ActorWithBody implements Controllable, Pocketed, Fac
int jumpCounter = 0;
int walkPowerCounter = 0;
private final int MAX_JUMP_LENGTH = 15;
private final int MAX_JUMP_LENGTH = 17; // use 17; in internal frames
/**
* experimental value.
*/
private final float JUMP_ACCELERATION_MOD = 180f / 10000f;
// private final float JUMP_ACCELERATION_MOD = ???f / 10000f; //quadratic mode
private final float JUMP_ACCELERATION_MOD = 170f / 10000f; //linear mode
private final int WALK_FRAMES_TO_MAX_ACCEL = 6;
public float readonly_totalX = 0, readonly_totalY = 0;
@@ -45,9 +46,9 @@ public class Player extends ActorWithBody implements Controllable, Pocketed, Fac
private int prevVMoveKey = -1;
private final int KEY_NULL = -1;
static final float ACCEL_MULT_IN_FLIGHT = 0.45f;
static final float WALK_STOP_ACCEL = 0.2f;
static final float WALK_ACCEL_BASE = 0.2f;
static final float ACCEL_MULT_IN_FLIGHT = 0.22f;
static final float WALK_STOP_ACCEL = 0.32f;
static final float WALK_ACCEL_BASE = 0.32f;
private boolean noClip = false;
@@ -433,7 +434,8 @@ public class Player extends ActorWithBody implements Controllable, Pocketed, Fac
// increment jump counter
if (jumpCounter < len) jumpCounter += 1;
// quadratic time (convex) mode
/*
float sumT = (jumpCounter * (jumpCounter + 1)) / 2f;
float timedJumpCharge = ((len + 1) / 2f) - (sumT / len);
if (timedJumpCharge < 0) timedJumpCharge = 0;
@@ -443,6 +445,20 @@ public class Player extends ActorWithBody implements Controllable, Pocketed, Fac
super.setVeloY(super.getVeloY()
- jumpAcc
);
*/
// linear time mode
float init = (len + 1) / 2f;
float timedJumpCharge = init - (init / len) * jumpCounter;
if (timedJumpCharge < 0) timedJumpCharge = 0;
float jumpAcc = pwr * timedJumpCharge * JUMP_ACCELERATION_MOD;
super.setVeloY(super.getVeloY()
- jumpAcc
);
// concave mode?
}
// for mob AI:

Binary file not shown.