diff --git a/feld/feld-auto.bin b/feld/feld-auto.bin index 2401c2e..6b3c3ec 100644 Binary files a/feld/feld-auto.bin and b/feld/feld-auto.bin differ diff --git a/feld/feld-ko.bin b/feld/feld-ko.bin index 98bc302..9baae42 100644 Binary files a/feld/feld-ko.bin and b/feld/feld-ko.bin differ diff --git a/feld/feldc-auto.bin b/feld/feldc-auto.bin index dec5a98..df3b57d 100644 Binary files a/feld/feldc-auto.bin and b/feld/feldc-auto.bin differ diff --git a/feld/feldc-ko.bin b/feld/feldc-ko.bin index bc6cfbe..44af292 100644 Binary files a/feld/feldc-ko.bin and b/feld/feldc-ko.bin differ diff --git a/feld/src/feld/main-auto.c b/feld/src/feld/main-auto.c index cd00be9..6d44ac2 100644 --- a/feld/src/feld/main-auto.c +++ b/feld/src/feld/main-auto.c @@ -1099,7 +1099,19 @@ static int cat_find(u32 id){ } static int cat_fixed(u32 id){ int k=cat_find(id); return k>=0 && fl(g_cfg.cat_off+8u+28u*(u32)k+2u)[0]; } static char g_nm[64]; -static void ko_title(const char *s,int y){int n=0,w=0;while(s[n]){int z=ko_pair(s+n)?2:1,px=z==2?al_width(128+(((u8)s[n]&127)<<7)+((u8)s[n+1]&127)):6;if(w+px>116)break;w+=px;n+=z;}textn((128-w)/2,y,s,n,WHITE,1);if(s[n])ctext(y+11,s+n,WHITE,1);} +static int ko_title(const char *s,int y){ + int n=0,w=0,h=7; + while(s[n]){int z=ko_pair(s+n)?2:1,c=z==2?128+(((u8)s[n]&127)<<7)+((u8)s[n+1]&127):(u8)s[n]; + int px=al_width(c);if(w+px>116)break;w+=px;n+=z; + const volatile u8 *g=c>=128?al_glyph(c):0;if(g&&g[1]>h)h=g[1]; + } + textn((128-w)/2,y,s,n,WHITE,1); + if(s[n]){y+=h>=11?h+1:11;AlText it={s+n,0,0};int c;h=7; + while((c=al_next(&it,999))>=0){const volatile u8*g=c>=128?al_glyph(c):0;if(g&&g[1]>h)h=g[1];} + ctext(y,s+n,WHITE,1); + } + return y+h+1; +} static const char *item_name(u32 id){ int k=cat_find(id); if(k>=0)return al_string((u32)k,1); @@ -1295,7 +1307,7 @@ static int cat_row(u32 i, char *name, char *right, u16 *col){ static u32 count_choose(u32 id,u32 v,u32 lo,u32 hi,int adding){ if(vhi)v=hi; for(;;){ - rect(0,0,128,128,BG);ko_title(item_name(id),2);draw_item_pic(id,64,54,60); + rect(0,0,128,128,BG);int title_end=ko_title(item_name(id),2);int box=60,cy=54;if(title_end>24){box=85-title_end;cy=(85+title_end)/2;}draw_item_pic(id,64,cy,box); char num[8];utoa_(v,num); text(20,87,adding?"\037\041\173":"\037\041\174",WHITE,1);text(65,85,num,GOLD,2);text(103,87,"",WHITE,1); ctext(101,"\037\041\175",GREY,1);ctext(115,"\037\041\176",GREY,1);show();wait_release(); diff --git a/feld/src/feld/main-ko.c b/feld/src/feld/main-ko.c index f269196..b6c28c6 100644 --- a/feld/src/feld/main-ko.c +++ b/feld/src/feld/main-ko.c @@ -1602,7 +1602,7 @@ static void tama_menu(void){ if(sel==1)ko_detail(nm); { u32 to=g_cfg.tama_off; char *p=st; const char *a="\200\304\200\313\200\271 "; while(*a) *p++=*a++; utoa_(g_set[to+0x1Cu],p); while(*p) p++; a=" \201\266\200\310 "; while(*a) *p++=*a++; utoa_(g_set[to+0x1Du],p); while(*p) p++; if(g_set[to+0x10u]){ a=" \200\344\201\257"; while(*a) *p++=*a++; } *p=0; } if(sel==2)ko_detail(st); - ctext(117,"B \201\273\201\200 C \200\252\200\265",GREY,1); + ctext(115,"B \201\273\201\200 C \200\252\200\265",RGB(255,255,255),1); show(); wait_release(); for(;;){ int k=input(); diff --git a/feld/src/feld/qa-auto-preview.h b/feld/src/feld/qa-auto-preview.h new file mode 100644 index 0000000..30f53ae --- /dev/null +++ b/feld/src/feld/qa-auto-preview.h @@ -0,0 +1,25 @@ +/* Exercise every native name against the actual preview framebuffer. */ +static void verify_preview_names(void){ + for(u32 k=0;k=2 && last24){box=85-bottom;cy=(85+bottom)/2;} + draw_item_pic(id,64,cy,box); + assert(!memcmp(title,g_fb,(size_t)bottom*128*sizeof(u16))); + } + /* This two-line Chinese name previously joined its rows at y=13. */ + if(al_lang()==7 && id==6021){ + rect(0,0,128,128,BG);ko_title(s,2); + for(int x=0;x<128;x++)assert(g_fb[14*128+x]==BG); + } + } +} diff --git a/feld/src/feld/qa-native-auto.c b/feld/src/feld/qa-native-auto.c index 4987473..6338045 100644 --- a/feld/src/feld/qa-native-auto.c +++ b/feld/src/feld/qa-native-auto.c @@ -8,6 +8,7 @@ #undef g_out #include #include +#include "qa-auto-preview.h" static const char *proof_root; static void proof(const char *name,void (*fn)(void),const char *keys){ static char folder[512];snprintf(folder,sizeof folder,"%s/%s",proof_root,name);mkdir(folder,0700);g_dir=folder;g_frame=0; @@ -17,6 +18,7 @@ static void fields(void){field_menu(0,0);} static void persist(void){set_write("OK");} static u32 quantity_result,quantity_owned; static void quantity(void){quantity_result=count_add(5001,quantity_owned);} +static void long_item(void){count_add(6021,0);} #include "qa-character-genes.h" int main(int argc,char **argv){ if(argc!=4)return 2; @@ -68,9 +70,12 @@ int main(int argc,char **argv){ snprintf(name,sizeof name,"language-%u-points",l);proof(name,points_menu,"c"); for(u32 i=0;i=0){ u32 o=g_cfg.cat_off+8u+28u*(u32)k;', 'if(k>=0)return al_string((u32)k,1);\n if(k>=0){ u32 o=g_cfg.cat_off+8u+28u*(u32)k;'); s=s.replace("s[5]=(char)('0'+code/10); s[6]=(char)('0'+code%10);", "s[3]=(char)('0'+code/10); s[4]=(char)('0'+code%10); s[5]=0;"); s=s.replace("t[5]=(char)('1'+sel); t[6]=0;", "t[3]=(char)('1'+sel); t[4]=0;"); -s=s.replace('px=z==2?10:6','px=z==2?al_width(128+(((u8)s[n]&127)<<7)+((u8)s[n+1]&127)):6'); +const titleStart=s.indexOf('static void ko_title('),titleEnd=s.indexOf('static const char *item_name',titleStart); +if(titleStart<0||titleEnd116)break;w+=px;n+=z; + const volatile u8 *g=c>=128?al_glyph(c):0;if(g&&g[1]>h)h=g[1]; + } + textn((128-w)/2,y,s,n,WHITE,1); + if(s[n]){y+=h>=11?h+1:11;AlText it={s+n,0,0};int c;h=7; + while((c=al_next(&it,999))>=0){const volatile u8*g=c>=128?al_glyph(c):0;if(g&&g[1]>h)h=g[1];} + ctext(y,s+n,WHITE,1); + } + return y+h+1; +} +`+s.slice(titleEnd); +s=s.replace('ko_title(item_name(id),2);draw_item_pic(id,64,54,60);', + 'int title_end=ko_title(item_name(id),2);int box=60,cy=54;if(title_end>24){box=85-title_end;cy=(85+title_end)/2;}draw_item_pic(id,64,cy,box);'); s=s.replace('static const char *fname(u32 i){ return i<4u ? (const char*)g_cfg.field_name[i] : (const char*)g_cfg.field_name2[i-4u]; }','static const char *fname(u32 i){const char*s=i<4u?(const char*)g_cfg.field_name[i]:(const char*)g_cfg.field_name2[i-4u];'+['LAND','WATER','SKY','FOREST','TROPICAL','GLACIER'].map(k=>'{const char*t="'+k+'";int j=0;while(s[j]&&s[j]==t[j])j++;if(!s[j]&&!t[j])return '+token(k)+';}').join('')+'return s;}'); s=s.replaceAll('ctext(117,','ctext(115,').replaceAll('ctext(105,','ctext(101,').replace('ctext(93,ko_color_name()','ctext(88,ko_color_name()').replace('top=27+','top=22+'); s=s.replaceAll('text(5,119,','text(5,114,'); diff --git a/scripts/native-menu-layout.cjs b/scripts/native-menu-layout.cjs index ab949bd..7de25fc 100644 --- a/scripts/native-menu-layout.cjs +++ b/scripts/native-menu-layout.cjs @@ -81,7 +81,9 @@ static void ko_row(int y,int selected){rect(5,y+2,123,y+14,RGB(18,96,136));rect( screen=screen.replace(/utoa_\(lv_get\(\),st\); big_entry\(12,sel==0,.*?,st,GOLD,GREY\);/,`for(u32 i=0;i<3;i++){int y=25+(int)i*18;ko_row(y-2,i==sel);text(14,y,i==0?${labels[0]}:i==1?${labels[1]}:${labels[2]},WHITE,1);}\n utoa_(lv_get(),st);if(sel==0)ko_detail(st);`); screen=screen.replace(/big_entry\(41,sel==1,.*?,nm,PINK,GREY\);/,'if(sel==1)ko_detail(nm);'); screen=screen.replace(/big_entry\(70,sel==2,.*?,st,ORANGE,GREY\);/,'if(sel==2)ko_detail(st);'); - screen=screen.replace(/ctext\(119,("(?:\\.|[^"\\])*"),GREY,1\);/,'ctext(115,$1,RGB(255,255,255),1);'); + const footer=/ctext\(11[79],("(?:\\.|[^"\\])*"),GREY,1\);/; + if(!footer.test(screen))throw Error('Character settings footer changed'); + screen=screen.replace(footer,'ctext(115,$1,RGB(255,255,255),1);'); s=s.slice(0,ta)+screen+s.slice(tb); // The full name and growth stage appear in the picture screen; keep list rows uncluttered. s=s.replace('q<3){ right[q]=fn[q];','q<0){ right[q]=fn[q];');