Collision detector fixing on going, hangul combining (johab) font

Former-commit-id: d225fb399ea7ca6c80da1fa35db3c13a1505f1cc
Former-commit-id: e218312c567bb7b2ea30961076e8bd24a8f2c131
This commit is contained in:
Song Minjae
2016-03-02 14:30:44 +09:00
parent 630f0c6118
commit b759f0e5e1
40 changed files with 228 additions and 12 deletions

View File

@@ -1,4 +1,5 @@
{
"smoothlighting" : true,
"imtooyoungtodie" : false
"imtooyoungtodie" : false,
"language" : "enUS"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 KiB

After

Width:  |  Height:  |  Size: 673 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

Binary file not shown.

View File

@@ -1,7 +1,7 @@
"STRING_ID";"IETF language tag(s) without dash";"enUS";"frFR";"esES";"deDE";"itIT";"ptBR";"ptPT";"ruRU";"elGR";"trTR";"daDK";"noNB";"svSE";"nlNL";"plPL";"fiFI";"jaJP";"zhCN";"zhTW";"koKR";"csCZ";"huHU";"roRO";"thTH";"bgBG";"heIL";"jakanaJP";"isIC"
"DEV_MEMORY_SHORT_CAP";;"MEM";"MEM";;;;;;;;;;;;;;;"メモリー";;;"메모리";;;;;;;"メモリー";"MIN"
"DEV_MEMORY_A_OF_B";;"%1$sM out of %2$sM";"%1$sM sur %2$sM";;;;;;;;;;;;;;;"%2$sM中%1$sM";;;"%2$sM 중 %1$sM";;;;;;;"%2$sM ちゅう %1$sM";"%1$sM af %2$s"
"DEV_MEMORY_A_OF_B";;"%1$sM out of %2$sM";"%1$sM sur %2$sM";;;;;;;;;;;;;;;"%2$sM中%1$sM";;;"%2$sM 중 %1$sM";;;;;;;"%2$sM ちゅう %1$sM";"%1$sM af %2$sM"
"DEV_COLOUR_LEGEND_GREEN";;" GREEN";" VERT";;;;;;;;;;;;;;;"緑";;;"녹";;;;;;;" みどり";"grænn"
"DEV_COLOUR_LEGEND_BLUE";;" BLUE";" BLEU";;;;;;;;;;;;;;;"青";;;"청";;;;;;;"  あお";"blár"
1 STRING_ID IETF language tag(s) without dash enUS frFR esES deDE itIT ptBR ptPT ruRU elGR trTR daDK noNB svSE nlNL plPL fiFI jaJP zhCN zhTW koKR csCZ huHU roRO thTH bgBG heIL jakanaJP isIC
2 DEV_MEMORY_SHORT_CAP MEM MEM メモリー 메모리 メモリー MIN
3 DEV_MEMORY_A_OF_B %1$sM out of %2$sM %1$sM sur %2$sM %2$sM中%1$sM %2$sM 중 %1$sM %2$sM ちゅう %1$sM %1$sM af %2$s %1$sM af %2$sM
4 DEV_COLOUR_LEGEND_GREEN GREEN VERT  みどり grænn
5 DEV_COLOUR_LEGEND_BLUE BLUE BLEU   あお blár
6 DEV_COLOUR_LEGEND_ORANGE ORANGE ORANGE オレンジ rauðugulur
7 DEV_COLOUR_LEGEND_RED RED ROUGE   あか rauður

View File

@@ -98,6 +98,25 @@ public class GameFontBase implements Font {
return ret;
}
private int getHanChosung(int hanIndex) {
return hanIndex / (JUNG_COUNT * JONG_COUNT);
}
private int getHanJungseong(int hanIndex) {
return hanIndex / (JONG_COUNT) % JUNG_COUNT;
}
private int getHanJongseong(int hanIndex) {
return hanIndex % JONG_COUNT;
}
private int getHanChosungShift(int hanIndex) {
int jungseongIndex = getHanJungseong(hanIndex);
Integer[] jungseongWide = {8, 12, 13, 17, 18, 21};
return (Arrays.asList(jungseongWide).contains(jungseongIndex))
? 1 : 0;
}
private boolean isAsciiEF(char c) {
return (Arrays.asList(asciiEFList).contains(c));
}
@@ -288,7 +307,8 @@ public class GameFontBase implements Font {
public void drawString(float x, float y, String s) {
// hangul fonts first
hangulSheet.startUse();
for (int i = 0; i < s.length(); i++) {
// WANSEONG
/*for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
if (isHangul(ch)) {
@@ -303,6 +323,53 @@ public class GameFontBase implements Font {
, hanPos[1]
);
}
}*/
// JOHAB
for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
if (isHangul(ch)) {
int hIndex = ch - 0xAC00;
int indexCho = getHanChosung(hIndex);
int indexJung = getHanJungseong(hIndex);
int indexJong = getHanJongseong(hIndex);
int choRow = getHanChosungShift(hIndex);
int jungRow = 2;
int jongRow = 3;
int glyphW = getWidth("" + ch);
// chosung
hangulSheet.renderInUse(
Math.round(x
+ getWidthSubstr(s, i + 1) - glyphW
)
, Math.round((H - H_HANGUL) / 2 + y + 1)
, indexCho
, choRow
);
// jungseong
hangulSheet.renderInUse(
Math.round(x
+ getWidthSubstr(s, i + 1) - glyphW
)
, Math.round((H - H_HANGUL) / 2 + y + 1)
, indexJung
, jungRow
);
// jongseong
hangulSheet.renderInUse(
Math.round(x
+ getWidthSubstr(s, i + 1) - glyphW
)
, Math.round((H - H_HANGUL) / 2 + y + 1)
, indexJong
, jongRow
);
}
}
hangulSheet.endUse();

View File

@@ -12,7 +12,7 @@ public class GameFontBlack extends GameFontBase {
super();
hangulSheet = new SpriteSheet(
"./res/graphics/fonts/han_atlas_black.png"
"./res/graphics/fonts/han_johab_black.png"
, W_CJK, H_HANGUL
);
asciiSheet = new SpriteSheet(

View File

@@ -12,7 +12,7 @@ public class GameFontWhite extends GameFontBase {
super();
hangulSheet = new SpriteSheet(
"./res/graphics/fonts/han_atlas.png"
"./res/graphics/fonts/han_johab.png"
, W_CJK, H_HANGUL
);
asciiSheet = new SpriteSheet(

View File

@@ -182,8 +182,14 @@ public class ActorWithBody implements Actor, Visible, Glowing {
updateNextHitboxFromVelo();
updateHorizontalPos();
updateVerticalPos();
if (Math.abs(veloX) < 0.5) {
updateVerticalPos();
updateHorizontalPos();
}
else {
updateHorizontalPos();
updateVerticalPos();
}
updateHitboxX();
updateHitboxY();
@@ -358,7 +364,7 @@ public class ActorWithBody implements Actor, Visible, Glowing {
} while (newXOff < TSIZE && colliding);
float newX = nextHitbox.getPosX() + newXOff;
nextHitbox.setPosition(newX, newY);
nextHitbox.setPosition(newX + 1, newY);
}
private boolean isColliding(int side) {

View File

@@ -62,7 +62,7 @@ public class PBFSigrid {
p.actorValue.set("luminosity", 22819);
p.setHitboxDimension(18, 47, 8, 0);
p.setHitboxDimension(18, 46, 8, 0);
p.inventory = new ActorInventory(0x7FFFFFFF, true);

View File

@@ -104,7 +104,7 @@ public class Player extends ActorWithBody implements Controllable, Pocketed, Fac
* @param absAxisVal (set AXIS_POSMAX if keyboard controlled)
*/
private void walkHorizontal(boolean left, float absAxisVal) {
if ((!super.isWalledLeft() && left) || (!super.isWalledRight() && !left)) {
//if ((!super.isWalledLeft() && left) || (!super.isWalledRight() && !left)) {
readonly_totalX = super.getVeloX()
+
actorValue.getAsFloat("accel")
@@ -132,7 +132,7 @@ public class Player extends ActorWithBody implements Controllable, Pocketed, Fac
// Heading flag
if (left) walkHeading = LEFT;
else walkHeading = RIGHT;
}
//}
}
/**

View File

@@ -49,7 +49,7 @@ public class Terrarum extends StateBasedGame {
public static String defaultDir;
public static String defaultSaveDir;
public static String gameLocale = "isIC";
public static String gameLocale = ""; // locale override
public static Font gameFontWhite;
@@ -70,6 +70,22 @@ public class Terrarum extends StateBasedGame {
catch (IOException e) {
e.printStackTrace();
}
// TODO if config language is not defined
if (gameLocale.length() < 2) { // get system language if not overridden
String lan = System.getProperty("user.language");
String country = System.getProperty("user.country");
// exception handling
if (lan.equals("en")) country = "US";
else if (lan.equals("fr")) country = "FR";
else if (lan.equals("de")) country = "DE";
else if (lan.equals("ko")) country = "KR";
gameLocale = lan + country;
}
System.out.println("[Terrarum] Locale: " + gameLocale);
}
@Override

View File

@@ -0,0 +1,126 @@
# encoding: utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
def encrypt(ch):
base = 0xAC00
if ord(ch) == 0x20:
return ''
if ord(ch) < 0xAC00 or ord(ch) > 0xD7A3:
return ''
crypt_initials = [
'',
'거거',
'',
'',
'자자',
'',
'',
'',
'러러',
'',
'구구',
'', # ㅇ
'',
'저저',
'',
'',
'',
'',
''
]
crypt_medians = [
'',
'',
'',
'',
'',
'',
'',
'',
'',
'므그',
'므지',
'므미',
'',
'',
'드리',
'드르',
'드미',
'',
'',
'',
''
]
crypt_finals = [
'', # x
'', # ㄱ
'더더',
'더오',
'',
'어무',
'어아',
'',
'',
'보더',
'보버',
'보다',
'보오',
'보부',
'보우',
'보아',
'',
'',
'다오',
'',
'',
'',
'',
'',
'',
'',
'',
''
]
key = ord(ch) - base
size_f = len(crypt_finals)
size_m = len(crypt_medians)
initial = key / (size_m * size_f)
median = (key / size_f) % size_m
final = key % size_f
return crypt_initials[initial] + crypt_medians[median] + crypt_finals[final]
plainmsg = u'''동해 물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라 만세
남산 위에 저 소나무 철갑을 두른 듯 바람서리 불변함은 우리 기상일세
가을 하늘 공활한데 높고 구름 없이 밝은 달은 우리 가슴 일편단심일세
무궁화 삼천리 화려강산 대한 사람 대한으로 길이 보전하세'''
cryptmsg = []
width = 24
for i in range(len(plainmsg)):
crypted = unicode(encrypt(plainmsg[i]))
for j in range(len(crypted)):
cryptmsg.append(crypted[j])
for i in range(len(cryptmsg)):
if i % width == 0 and i > 0:
sys.stdout.write("\n")
sys.stdout.write(cryptmsg[i])
sys.stdout.write("\n")