Refine product copy and native Korean menu with lossless character previews
This commit is contained in:
1 parent
5e3303cba8
commit
dbe2c1f41f
30 files changed
+342
-282
No files matched your search
@@ -3,21 +3,21 @@ module.exports=function(s,enc){
|
||||
const start=s.indexOf('static void main_menu(void){'), end=s.indexOf('\nstatic void run(void)',start);
|
||||
let menu=s.slice(start,end);
|
||||
const a=menu.indexOf(' rect(0,0,128,128,BG);'),b=menu.indexOf(' show(); wait_release();',a);
|
||||
menu=menu.slice(0,a)+` rect(0,0,128,128,BG);
|
||||
ctext(3,"${enc('다마고치 편집')}",WHITE,1);
|
||||
menu=menu.slice(0,a)+` ko_surface();
|
||||
ctext(4,"${enc('치트 메뉴')}",RGB(255,255,255),1);
|
||||
for(u32 i=0;i<n;i++){
|
||||
const char *label;
|
||||
switch(kinds[i]){case 0:label="${enc('지역과 저장')}";break;case 1:label="${enc('아이템')}";break;case 2:label="${enc('다마포인트')}";break;case 4:label="${enc('다마고치')}";break;default:label="${enc('프로그램')}";}
|
||||
int y=22+(int)i*18;
|
||||
if(i==sel){rect(5,y-3,123,y+13,GOLD);rect(7,y-1,121,y+11,RGB(205,225,169));}
|
||||
int y=24+(int)i*17;
|
||||
ko_row(y-2,i==sel);
|
||||
text(14,y,label,WHITE,1);
|
||||
}
|
||||
ctext(117,"${enc('A 이동 B 선택 C 뒤로')}",GREY,1);
|
||||
ctext(117,"${enc('A 이동 B 선택 C 뒤로')}",RGB(255,255,255),1);
|
||||
`+menu.slice(b);
|
||||
menu=menu.replace('int ok=set_load()==0;','set_load();');
|
||||
s=s.slice(0,start)+menu+s.slice(end);
|
||||
// Original Paradise uses a light menu surface and a colored selection frame.
|
||||
s=s.replace(/#define BG\s+[^\n]+/,'#define BG RGB(246,247,221)');
|
||||
// Paradise text-menu layout: navy heading, cyan stripes, white rows and pink cursor.
|
||||
s=s.replace(/#define BG\s+[^\n]+/,'#define BG RGB(248,252,255)');
|
||||
s=s.replace(/#define WHITE\s+[^\n]+/,'#define WHITE RGB(33,48,72)');
|
||||
s=s.replace(/#define GREY\s+[^\n]+/,'#define GREY RGB(75,96,108)');
|
||||
s=s.replace(/#define GOLD\s+[^\n]+/,'#define GOLD RGB(157,95,8)').replace(/#define ORANGE\s+[^\n]+/,'#define ORANGE RGB(160,80,12)').replace(/#define PINK\s+[^\n]+/,'#define PINK RGB(176,45,100)');
|
||||
@@ -25,7 +25,7 @@ module.exports=function(s,enc){
|
||||
const pos=s.indexOf('static void chr_pick(void){');
|
||||
const helpers=`static u32 ko_names(void){u32 a=g_cfg.cat_off+12u+40u*g_cfg.cat_n;return rd32(a)==0x31464f4bu?a+8u+13u*rd32(a+4u):0;}
|
||||
static u32 ko_le32(u32 a){const volatile u8 *p=fl(a);return (u32)p[0]|((u32)p[1]<<8)|((u32)p[2]<<16)|((u32)p[3]<<24);}
|
||||
static void ko_portrait(u32 k){u32 a=ko_names();if(!a)return;u32 o=ko_le32(a+26u*g_cfg.cat_n+4u*k);if(!o)return;for(u32 y=0;y<32;y++)for(u32 x=0;x<32;x++){const volatile u8 *p=fl(g_cfg.cat_off+o+2u*(y*32u+x));u32 c=p[0]|((u32)p[1]<<8);if(c!=0xf81fu)rect(32+x*2,27+y*2,34+x*2,29+y*2,(u16)c);}}
|
||||
static void ko_portrait(u32 k){u32 a=ko_names();if(!a)return;u32 o=ko_le32(a+26u*g_cfg.cat_n+4u*k);if(!o)return;u32 at=g_cfg.cat_off+o,w=32,h=32,sc=2;if(ko_le32(at)==0x3154504bu){w=fl(at+4)[0];h=fl(at+6)[0];at+=8;sc=1;}if(!w||!h||w>64||h>64)return;int left=(128-(int)(w*sc))/2,top=27+(64-(int)(h*sc))/2;for(u32 y=0;y<h;y++)for(u32 x=0;x<w;x++){const volatile u8 *p=fl(at+2u*(y*w+x));u32 c=p[0]|((u32)p[1]<<8);if(c!=0xf81fu)rect(left+x*sc,top+y*sc,left+(x+1)*sc,top+(y+1)*sc,(u16)c);}}
|
||||
`;
|
||||
s=s.slice(0,pos)+helpers+s.slice(pos);
|
||||
s=s.replace('static char g_nm[24];','static char g_nm[64];');
|
||||
@@ -36,15 +36,31 @@ static void ko_portrait(u32 k){u32 a=ko_names();if(!a)return;u32 o=ko_le32(a+26u
|
||||
const split=s.indexOf('static const char *item_name');
|
||||
s=s.slice(0,split)+`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?10: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);}\n`+s.slice(split);
|
||||
s=s.replace('if(L<=20) ctext(4,nm,WHITE,1); else { textn(4,2,nm,20,WHITE,1); textn(4,11,nm+20,20,WHITE,1); }','ko_title(nm,2);');
|
||||
// Eight legible Korean rows. Keep scrolling and scrollbar geometry in agreement.
|
||||
s=s.replace('r<10u && top+r<n','r<8u && top+r<n').replace('int y=12+(int)r*10','int y=16+(int)r*12');
|
||||
s=s.replace('128,y+8,RGB','128,y+10,RGB');
|
||||
s=s.replace('if(n>10u){ int h=100*10/(int)n; if(h<6) h=6; int y=12+(int)(100-h)*(int)top/(int)(n-10u);','if(n>8u){ int h=96*8/(int)n; if(h<6) h=6; int y=16+(int)(96-h)*(int)top/(int)(n-8u);');
|
||||
s=s.replaceAll('if(sel>=top+10u) top=sel-9u;','if(sel>=top+8u) top=sel-7u;');
|
||||
s=s.replace('q<3){ right[q]=fn[q];','q<4){ right[q]=fn[q];');
|
||||
const ui=s.indexOf('static void list_draw(');
|
||||
s=s.slice(0,ui)+`static void ko_surface(void){rect(0,0,128,128,RGB(0,169,209));for(int y=19;y<113;y++)for(int x=0;x<128;x++)if(((x+y)&7)<2)rect(x,y,x+1,y+1,RGB(0,157,199));rect(0,0,128,19,RGB(18,58,112));rect(0,113,128,128,RGB(18,58,112));}
|
||||
static void ko_row(int y,int selected){rect(5,y+2,123,y+14,RGB(18,96,136));rect(3,y+3,125,y+11,RGB(255,255,255));rect(5,y+1,123,y+13,RGB(255,255,255));rect(7,y,121,y+14,RGB(255,255,255));if(selected)for(int x=0;x<5;x++)rect(5+x,y+3+x,6+x,y+11-x,RGB(224,80,152));}
|
||||
`+s.slice(ui);
|
||||
s=s.replace(' rect(0,0,128,128,BG);\n ctext(2,title,WHITE,1);',' ko_surface();\n ctext(4,title,RGB(255,255,255),1);');
|
||||
s=s.replace('r<10u && top+r<n','r<6u && top+r<n').replace('int y=12+(int)r*10','int y=23+(int)r*15');
|
||||
s=s.replace('if(i==sel) rect(0,y-1,128,y+8,RGB(60,60,110));','ko_row(y-2,i==sel);');
|
||||
s=s.replace('int maxc = (122-rw)/6;','int maxc = (111-rw)/6;').replace('textn(3,y,nm,maxc,c,1);','textn(13,y,nm,maxc,c,1);').replace('text(125-rw,y,rt,GREY,1);','text(120-rw,y,rt,GREY,1);');
|
||||
s=s.replace('if(n>10u){ int h=100*10/(int)n; if(h<6) h=6; int y=12+(int)(100-h)*(int)top/(int)(n-10u);','if(n>6u){ int h=90*6/(int)n; if(h<6) h=6; int y=21+(int)(90-h)*(int)top/(int)(n-6u);');
|
||||
s=s.replace('ctext(118,foot,GREY,1);','ctext(117,foot,RGB(255,255,255),1);');
|
||||
s=s.replaceAll('if(sel>=top+10u) top=sel-9u;','if(sel>=top+6u) top=sel-5u;');
|
||||
// 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];');
|
||||
s=s.replace('fn=fname(f-1u); *col=fcol(f-1u);','fn=fname(f-1u); *col=WHITE;');
|
||||
s=s.replace(/ rect\(0,0,128,128,BG\); ctext\(24,[^\n]+\n ctext\(76,[^\n]+/,` rect(0,0,128,128,BG);ko_title(nm,2);ko_portrait(kk);
|
||||
ctext(95,stage_name(st),GREY,1);ctext(117,"${enc('B 변경 C 목록')}",GREY,1);show();`);
|
||||
const previewStart=s.indexOf(' u32 kk=g_chr[sel]'),previewEnd=s.indexOf(' u32 to=g_cfg.tama_off;',previewStart);
|
||||
if(previewStart<0||previewEnd<0)throw Error('Character preview not found');
|
||||
s=s.slice(0,previewStart)+` u32 nw=0,st=0,old=t_id();int accepted=0,back=0;
|
||||
while(!accepted&&!back){
|
||||
u32 kk=g_chr[sel],o=g_cfg.cat_off+8u+28u*kk;nw=rd16(o);st=fl(o+6)[0];
|
||||
char nm[64];chr_name(kk,nm);rect(0,0,128,128,BG);ko_title(nm,2);ko_portrait(kk);
|
||||
ctext(93,stage_name(st),GREY,1);ctext(105,"${enc('휠 이전 다음')}",GREY,1);ctext(117,"${enc('B 변경 C 목록')}",GREY,1);show();wait_release();
|
||||
for(;;){int key=input();if(key==1){int next=(int)sel+g_step;if(next<0)next=0;if(next>=(int)g_chrn)next=(int)g_chrn-1;sel=(u32)next;break;}if(key==K_OK){accepted=1;break;}if(key==K_BACK){back=1;break;}}
|
||||
}
|
||||
if(!accepted)break;
|
||||
`+s.slice(previewEnd);
|
||||
// A newly selected item adds the requested amount to the existing stack. The
|
||||
// native save stores each quantity in four bits, so the total cannot exceed 15.
|
||||
const countStart=s.indexOf('#ifdef BAG_DEL\nstatic u32 count_edit('), countEnd=s.indexOf('static int g_dirty;',countStart);
|
||||
|
||||
Reference in new issue
Block a user