From db3b4f0df8adcdf5fc2caf9fc22631267ab7c238 Mon Sep 17 00:00:00 2001 From: nothere Date: Thu, 5 Aug 2004 21:43:26 +0000 Subject: [PATCH] =?utf8?q?=E3=82=B7=E3=83=B3=E3=83=80=E3=83=AA=E3=83=B3?= =?utf8?q?=E9=8A=98=E3=82=92=E4=B8=8E=E3=81=88=E3=82=8B=E3=82=B3=E3=83=BC?= =?utf8?q?=E3=83=89=E3=82=92XAngband=E3=82=88=E3=82=8A=E7=A7=BB=E6=A4=8D.?= =?utf8?q?=20=E6=AC=A1=E3=81=AE=E3=82=88=E3=81=86=E3=81=AB=E4=BD=BF?= =?utf8?q?=E3=82=8F=E3=82=8C=E3=82=8B.=20*=20=E3=82=A2=E3=83=BC=E3=83=86?= =?utf8?q?=E3=82=A3=E3=83=95=E3=82=A1=E3=82=AF=E3=83=88=E7=94=9F=E6=88=90?= =?utf8?q?=E3=81=A7=E9=8A=98=E3=82=92=E4=B8=8E=E3=81=88=E3=81=AA=E3=81=8B?= =?utf8?q?=E3=81=A3=E3=81=9F=E5=A0=B4=E5=90=88=E3=81=AB,=20=E5=BE=93?= =?utf8?q?=E6=9D=A5=E3=81=AE=E7=B5=84=E3=81=BF=E5=90=88=E3=82=8F=E3=81=9B?= =?utf8?q?=E9=8A=98=E3=81=A8=20=20=20=E3=82=B7=E3=83=B3=E3=83=80=E3=83=AA?= =?utf8?q?=E3=83=B3=E9=8A=98=E3=81=8C=E3=81=9D=E3=82=8C=E3=81=9E=E3=82=8C1?= =?utf8?q?/2=E3=81=A7=E7=94=A8=E3=81=84=E3=82=89=E3=82=8C=E3=82=8B.=20*=20?= =?utf8?q?=E3=81=93=E3=82=8C=E3=81=BE=E3=81=A7=E3=81=AF=E3=83=A9=E3=83=B3?= =?utf8?q?=E3=83=80=E3=83=A0=E3=82=A2=E3=83=BC=E3=83=86=E3=82=A3=E3=83=95?= =?utf8?q?=E3=82=A1=E3=82=AF=E3=83=88=E3=81=AF20%=E3=81=A7=E5=BC=B7?= =?utf8?q?=E3=81=95=E3=81=AB=E9=96=A2=E4=BF=82=E3=81=AA=E3=81=8F=E7=B5=84?= =?utf8?q?=E3=81=BF=E5=90=88=E3=82=8F=E3=81=9B=E9=8A=98=20=20=20=E3=81=8C?= =?utf8?q?=E4=B8=8E=E3=81=88=E3=82=89=E3=82=8C=E3=81=A6=E3=81=84=E3=81=9F?= =?utf8?q?=E3=81=8C,=2010%=E3=81=A7=E3=82=B7=E3=83=B3=E3=83=80=E3=83=AA?= =?utf8?q?=E3=83=B3=E9=8A=98,=2010%=E3=81=A7=E7=B5=84=E3=81=BF=E5=90=88?= =?utf8?q?=E3=82=8F=E3=81=9B=E9=8A=98=E3=81=A8=E3=81=AA=E3=82=8B.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit なお, 以下の修正を含む. * get_table_name()のコメントミス修正. --- lib/file/sname.txt | 259 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/artifact.c | 39 ++++---- src/externs.h | 3 + src/flavor.c | 45 +++++++++- src/japanese.c | 100 +++++++++++++++++++++ 5 files changed, 424 insertions(+), 22 deletions(-) create mode 100644 lib/file/sname.txt diff --git a/lib/file/sname.txt b/lib/file/sname.txt new file mode 100644 index 000000000..556368dd0 --- /dev/null +++ b/lib/file/sname.txt @@ -0,0 +1,259 @@ +N:1:First +#blue +ihun +#red +caran +#light brue +vinde +#light dark +dim +#singing +lin +#stealed +neithan +#loudly +brui +#proudly +aglar +#terrible +naer +#man's +hanu +#manly +vea +#heavy +lung +#shining +gal +#shining +thil +#huge +beleg +#blinking +bril +#slaying +cris +#golden +glor +#silver +celeb +#hollowed +nov +#frosted +fanui +#black +vor +#unpleasant +thaur +#deadly +gur +#cilently +din +#must be die +fir +#powerful +tur +#brown +bar +#cold +him +#cold +ring +#strong +thalion +#bitter +holme +#gray +mith +#obsequious +faika +#broad +laden +#deep +im +#slender +fim +#gave up +egla +#green +calen +#wildly +dru +#dark +dur +#cruel +aeg +#king's +aran +#sting +maeg +#control +tur + +N:2:Second +#daemon +rauko +#imp +orch +#foot +dal +#pressure +thang +#bubble +roth +#evil technics +morgul +#anger +ruth +#lake +aelin +#stone +gond +#well +eithel +#song +laer +#party +mereth +#horse +roch +#sea (ocean) +gaer +#king +erain +#prince +ernil +#dog +huan +#wolf +draug +#spike +reg +#aula +fana +#end +meth +#flog +cabor +#silver metal +slime +#shadow +wath +#wind +gwae +#sad +nien +#helm +thol +#wall +ram +#hunter +faroth +#river +duin +#spy +athir +#crown +rhi +#tree +orn +#knight +roquen +#woodpecker +tavor +#fang +carak +#hope +estel +#bad luck +umarth +#frog +hith +#air +vista +#sword +megil +#swordman +vagor +#ice +khelek +#zombie +firn +#spray +roth +#lady +hiril +#winner +dacil +#fighter +ohtar +#hatred +deloth +#twilight +moth +#war +dagor +#blood +sereg +#father +adar +#moon +ithil +#horn +ras +#hand +carn +#enemy +glam +#iron +ang +#tower +barad +#fire +lach +#friend +mellon +#stream +sirith +#root +thond +#tooth +cost +#swan +alph +#ruin +dagnir +#hummer +dring +#sun +aur +#spark or star +gil +#summer +laer +#winter +rhiw +#wanderer +randir +#mant +gol +#watchman +tirith +#eye +hen +#firer +thoniel +#gate +annon +#forest +aron +#mountain +orod +#darkness +mornie +#snow +loss +#eagle +thoron +#laugh +lalaith diff --git a/src/artifact.c b/src/artifact.c index 8b25c7549..8bad46b0c 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -12,6 +12,7 @@ /* Chance of using syllables to form the name instead of the "template" files */ +#define SINDARIN_NAME 10 #define TABLE_NAME 20 #define A_CURSED 13 #define WEIRD_LUCK 12 @@ -1537,7 +1538,13 @@ static void give_activation_power(object_type *o_ptr) static void get_random_name(char *return_name, bool armour, int power) { - if (randint1(100) <= TABLE_NAME) + int prob = randint1(100); + + if (prob <= SINDARIN_NAME) + { + get_table_sindarin(return_name); + } + else if (prob <= TABLE_NAME) { get_table_name(return_name); } @@ -1552,35 +1559,31 @@ static void get_random_name(char *return_name, bool armour, int power) { case 0: #ifdef JP -filename = "a_cursed_j.txt"; + filename = "a_cursed_j.txt"; #else filename = "a_cursed.txt"; #endif - break; case 1: #ifdef JP -filename = "a_low_j.txt"; + filename = "a_low_j.txt"; #else filename = "a_low.txt"; #endif - break; case 2: #ifdef JP -filename = "a_med_j.txt"; + filename = "a_med_j.txt"; #else filename = "a_med.txt"; #endif - break; default: #ifdef JP -filename = "a_high_j.txt"; + filename = "a_high_j.txt"; #else filename = "a_high.txt"; #endif - } break; default: @@ -1588,41 +1591,37 @@ filename = "a_high_j.txt"; { case 0: #ifdef JP -filename = "w_cursed_j.txt"; + filename = "w_cursed_j.txt"; #else filename = "w_cursed.txt"; #endif - break; case 1: #ifdef JP -filename = "w_low_j.txt"; + filename = "w_low_j.txt"; #else filename = "w_low.txt"; #endif - break; case 2: #ifdef JP -filename = "w_med_j.txt"; + filename = "w_med_j.txt"; #else filename = "w_med.txt"; #endif - break; default: #ifdef JP -filename = "w_high_j.txt"; + filename = "w_high_j.txt"; #else filename = "w_high.txt"; #endif - } } (void)get_rnd_line(filename, artifact_bias, return_name); #ifdef JP - if(return_name[0]==0)get_table_name(return_name); + if (return_name[0] == 0) get_table_name(return_name); #endif } } @@ -1921,13 +1920,11 @@ bool create_artifact(object_type *o_ptr, bool a_scroll) || !dummy_name[0]) { /* Cancelled */ -#if 0 if (one_in_(2)) { - get_table_sindarin(dummy_name); + get_table_sindarin_aux(dummy_name); } else -#endif { get_table_name_aux(dummy_name); } diff --git a/src/externs.h b/src/externs.h index 626d7d6c9..e2c32d7a2 100644 --- a/src/externs.h +++ b/src/externs.h @@ -863,6 +863,8 @@ extern u32b counts_read(int where); /* flavor.c */ extern void get_table_name_aux(char *out_string); extern void get_table_name(char *out_string); +extern void get_table_sindarin_aux(char *out_string); +extern void get_table_sindarin(char *out_string); extern void flavor_init(void); extern char *object_desc_kosuu(char *t, object_type *o_ptr); extern void object_desc(char *buf, object_type *o_ptr, u32b mode); @@ -1687,6 +1689,7 @@ extern void dump_virtues(FILE * OutFile); #ifdef JP /* japanese.c */ +extern void sindarin_to_kana(char *kana, const char *sindarin); extern void jverb1( const char *in , char *out); extern void jverb2( const char *in , char *out); extern void jverb3( const char *in , char *out); diff --git a/src/flavor.c b/src/flavor.c index af5f5d2c0..83d1ef17a 100644 --- a/src/flavor.c +++ b/src/flavor.c @@ -130,7 +130,7 @@ void get_table_name_aux(char *out_string) /* - * Create a name from random parts without quotes. + * Create a name from random parts with quotes. */ void get_table_name(char *out_string) { @@ -146,6 +146,49 @@ void get_table_name(char *out_string) /* + * Make random Sindarin name + */ +void get_table_sindarin_aux(char *out_string) +{ + char Syllable[80]; +#ifdef JP + char tmp[80]; +#endif + + get_rnd_line("sname.txt", 1, Syllable); +#ifdef JP + strcpy(tmp, Syllable); +#else + strcpy(out_string, Syllable); +#endif + + get_rnd_line("sname.txt", 2, Syllable); +#ifdef JP + strcat(tmp, Syllable); + sindarin_to_kana(out_string, tmp); +#else + strcat(out_string, Syllable); +#endif +} + + +/* + * Make random Sindarin name with quotes + */ +void get_table_sindarin(char *out_string) +{ + char buff[80]; + get_table_sindarin_aux(buff); + +#ifdef JP + sprintf(out_string, "¡Ø%s¡Ù", buff); +#else + sprintf(out_string, "'%s'", buff); +#endif +} + + +/* * Shuffle flavor indices of a group of objects with given tval */ static void shuffle_flavors(byte tval) diff --git a/src/japanese.c b/src/japanese.c index e864d8436..353c94769 100644 --- a/src/japanese.c +++ b/src/japanese.c @@ -5,6 +5,106 @@ #ifdef JP +typedef struct convert_key convert_key; + +struct convert_key +{ + cptr key1; + cptr key2; +}; + +static const convert_key s2j_table[] = { + {"mb","nb"}, {"mp","np"}, {"mv","nv"}, {"mm","nm"}, + {"x","ks"}, + /* sindar:¥·¥ó¥À¡¼¥ë parantir:¥Ñ¥é¥ó¥Æ¥£¥¢ feanor:¥Õ¥§¥¢¥Î¡¼¥ë */ + {"ar$","a-ru$"}, {"ir$","ia$"}, {"or$","o-ru$"}, + {"ra","¥é"}, {"ri","¥ê"}, {"ru","¥ë"}, {"re","¥ì"}, {"ro","¥í"}, + {"ir","ia"}, {"ur","ua"}, {"er","ea"}, {"ar","a¥ë"}, + {"sha","¥·¥ã"}, {"shi","¥·"}, {"shu","¥·¥å"}, {"she","¥·¥§"}, {"sho","¥·¥ç"}, + {"tha","¥µ"}, {"thi","¥·"}, {"thu","¥¹"}, {"the","¥»"}, {"tho","¥½"}, + {"cha","¥Ï"}, {"chi","¥Ò"}, {"chu","¥Õ"}, {"che","¥Ø"}, {"cho","¥Û"}, + {"dha","¥¶"}, {"dhi","¥¸"}, {"dhu","¥º"}, {"dhe","¥¼"}, {"dho","¥¾"}, + {"ba","¥Ð"}, {"bi","¥Ó"}, {"bu","¥Ö"}, {"be","¥Ù"}, {"bo","¥Ü"}, + {"ca","¥«"}, {"ci","¥­"}, {"cu","¥¯"}, {"ce","¥±"}, {"co","¥³"}, + {"da","¥À"}, {"di","¥Ç¥£"}, {"du","¥É¥¥"}, {"de","¥Ç"}, {"do","¥É"}, + {"fa","¥Õ¥¡"}, {"fi","¥Õ¥£"}, {"fu","¥Õ"}, {"fe","¥Õ¥§"}, {"fo","¥Õ¥©"}, + {"ga","¥¬"}, {"gi","¥®"}, {"gu","¥°"}, {"ge","¥²"}, {"go","¥´"}, + {"ha","¥Ï"}, {"hi","¥Ò"}, {"hu","¥Õ"}, {"he","¥Ø"}, {"ho","¥Û"}, + {"ja","¥¸¥ã"}, {"ji","¥¸"}, {"ju","¥¸¥å"}, {"je","¥¸¥§"}, {"jo","¥¸¥ç"}, + {"ka","¥«"}, {"ki","¥­"}, {"ku","¥¯"}, {"ke","¥±"}, {"ko","¥³"}, + {"la","¥é"}, {"li","¥ê"}, {"lu","¥ë"}, {"le","¥ì"}, {"lo","¥í"}, + {"ma","¥Þ"}, {"mi","¥ß"}, {"mu","¥à"}, {"me","¥á"}, {"mo","¥â"}, + {"na","¥Ê"}, {"ni","¥Ë"}, {"nu","¥Ì"}, {"ne","¥Í"}, {"no","¥Î"}, + {"pa","¥Ñ"}, {"pi","¥Ô"}, {"pu","¥×"}, {"pe","¥Ú"}, {"po","¥Ý"}, + {"qu","¥¯"}, + {"sa","¥µ"}, {"si","¥·"}, {"su","¥¹"}, {"se","¥»"}, {"so","¥½"}, + {"ta","¥¿"}, {"ti","¥Æ¥£"}, {"tu","¥È¥¥"}, {"te","¥Æ"}, {"to","¥È"}, + {"va","¥ô¥¡"}, {"vi","¥ô¥£"}, {"vu","¥ô"}, {"ve","¥ô¥§"}, {"vo","¥ô¥©"}, + {"wa","¥ï"}, {"wi","¥¦¥£"}, {"wu","¥¦"}, {"we","¥¦¥§"}, {"wo","¥¦¥©"}, + {"ya","¥ä"}, {"yu","¥æ"}, {"yo","¥è"}, + {"za","¥¶"}, {"zi","¥¸"}, {"zu","¥º"}, {"ze","¥¼"}, {"zo","¥¾"}, + {"dh","¥º"}, {"ch","¥Õ"}, {"th","¥¹"}, + {"b","¥Ö"}, {"c","¥¯"}, {"d","¥É"}, {"f","¥Õ"}, {"g","¥°"}, + {"h","¥Õ"}, {"j","¥¸¥å"}, {"k","¥¯"}, {"l","¥ë"}, {"m","¥à"}, + {"n","¥ó"}, {"p","¥×"}, {"q","¥¯"}, {"r","¥ë"}, {"s","¥¹"}, + {"t","¥È"}, {"v","¥ô"}, {"w","¥¦"}, {"y","¥¤"}, + {"a","¥¢"}, {"i","¥¤"}, {"u","¥¦"}, {"e","¥¨"}, {"o","¥ª"}, + {"-","¡¼"}, + {NULL,NULL} +}; + +/* ¥·¥ó¥À¥ê¥ó¤òÆüËܸì¤ÎÆɤߤËÊÑ´¹¤¹¤ë */ +void sindarin_to_kana(char *kana, const char *sindarin) +{ + char buf[256]; + int idx; + + sprintf(kana, "%s$", sindarin); + for (idx = 0; kana[idx]; idx++) + if (isupper(kana[idx])) kana[idx] = tolower(kana[idx]); + + for (idx = 0; s2j_table[idx].key1 != NULL; idx++) + { + cptr pat1 = s2j_table[idx].key1; + cptr pat2 = s2j_table[idx].key2; + int len = strlen(pat1); + char *src = kana; + char *dest = buf; + + while (*src) + { + if (strncmp(src, pat1, len) == 0) + { + strcpy(dest, pat2); + src += len; + dest += strlen(pat2); + } + else + { + if (iskanji(*src)) + { + *dest = *src; + src++; + dest++; + } + *dest = *src; + src++; + dest++; + } + } + + *dest = 0; + strcpy(kana, buf); + } + + idx = 0; + + while (kana[idx] != '$') idx++; + + kana[idx] = '\0'; +} + + /*ÆüËܸìÆ°»ì³èÍÑ (ÂǤġäÂǤäÆ,ÂǤÁ etc) */ #define CMPTAIL(y) strncmp(&in[l-strlen(y)],y,strlen(y)) -- 2.11.0