; ; HGIMG3 2D Elements Editor ; onion software/onitama ; ; ; 詳しい使用方法は、doclibフォルダのelm2d_edit.txtを参照してください。 ; #include "hgimg3.as" #include "mod_elm2d.as" #packopt name "elm2d_edit" #define global EDNAME "2D ElementEditor v1.0" #module "hged" #deffunc edinit edsx=640:edsy=480 edbx=800:edby=600 edwx=64:edwy=64 ptmax=1:curpt=0 ptuse=0 sw_normal=1 sw_loop=0 sw_posini=3 ed_fr=10:ed_scx=1.0:ed_scy=1.0:ed_rz=0:ed_efx=256 ed_dist=40 ptfr=ed_fr ptx=0:pty=0 ptrz=0:ptefx=256:ptanm=0 ptscx=1.0:ptscy=1.0 return #deffunc ptuse_update ptuse=0 repeat ptmax if ptx(cnt)!=0 : ptuse|=PTUSE_POS if pty(cnt)!=0 : ptuse|=PTUSE_POS if ptrz(cnt)!=0 : ptuse|=PTUSE_ANG if ptscx(cnt)!=1.0 : ptuse|=PTUSE_SCALE if ptscy(cnt)!=1.0 : ptuse|=PTUSE_SCALE if ptefx(cnt)!=256 : ptuse|=PTUSE_EFX if ptanm(cnt)!=0 : ptuse|=PTUSE_ANM|PTUSE_POS loop return #deffunc edload str fname sdim s1,$1000 sdim s2,256 elm2d_init fname elm2d_load ptmax=0+elm2d_getvar("ptmax") curpt=0+elm2d_getvar("curpt") edsx=0+elm2d_getvar("edsx") edsy=0+elm2d_getvar("edsy") edbx=0+elm2d_getvar("edbx") edby=0+elm2d_getvar("edby") edwx=0+elm2d_getvar("edwx") edwy=0+elm2d_getvar("edwy") ptuse=0+elm2d_getvar("ptuse") ed_loopid=0+elm2d_getvar("loopid") ed_dist=0+elm2d_getvar("dist") sw_loop=0+elm2d_getvar("loop") sw_normal=0+elm2d_getvar("normal") sw_posini=0+elm2d_getvar("posini") repeat ptmax elm2d_getdata s1 i=0 getstr s2,s1,i,',':i+=strsize ptfr(cnt)=0+s2 getstr s2,s1,i,',':i+=strsize ptx(cnt)=0+s2 getstr s2,s1,i,',':i+=strsize pty(cnt)=0+s2 getstr s2,s1,i,',':i+=strsize ptrz(cnt)=0+s2 getstr s2,s1,i,',':i+=strsize ptscx(cnt)=0.0+s2 getstr s2,s1,i,',':i+=strsize ptscy(cnt)=0.0+s2 getstr s2,s1,i,',':i+=strsize ptefx(cnt)=0+s2 getstr s2,s1,i,',':i+=strsize ptanm(cnt)=0+s2 loop return #deffunc edsave str fname elm2d_init fname elm2d_seti "ptmax",ptmax elm2d_seti "curpt",curpt elm2d_seti "edsx",edsx elm2d_seti "edsy",edsy elm2d_seti "edbx",edbx elm2d_seti "edby",edby elm2d_seti "edwx",edwx elm2d_seti "edwy",edwy ptuse_update elm2d_seti "ptuse",ptuse elm2d_seti "loopid",ed_loopid elm2d_seti "dist",ed_dist elm2d_seti "loop",sw_loop elm2d_seti "normal",sw_normal elm2d_seti "posini",sw_posini repeat ptmax elm2d_data ""+ptfr(cnt)+","+ptx(cnt)+","+pty(cnt)+","+ptrz(cnt)+","+ptscx(cnt)+","+ptscy(cnt)+","+ptefx(cnt)+","+ptanm(cnt) loop elm2d_save return #deffunc edpv_init screen 4,edsx,edsy,8+2:cls 4 title "Preview" hgini return #defcfunc rotadj int oldang, int newang told = oldang \ 1000 loc_dist=abs( newang - told ) if oldang<=newang { loc_cmp = abs( newang - 1000 - told ) if loc_cmp=ptmax : i=curpt curpt=i return #deffunc ptdec i=curpt-1 if i<0 : i=0 curpt=i return #deffunc ptdel int id i=id:if i<0 : i=curpt if ptmax<=1 : return repeat if (i+1)>=ptmax : break ptx(i)=ptx(i+1) pty(i)=pty(i+1) ptfr(i)=ptfr(i+1) ptrz(i)=ptrz(i+1) ptscx(i)=ptscx(i+1) ptscy(i)=ptscy(i+1) ptefx(i)=ptefx(i+1) ptanm(i)=ptanm(i+1) i++ loop ptmax-- if curpt=ptmax : curpt-- return #deffunc pttrans int xx, int yy repeat ptmax ptx(cnt)+=xx pty(cnt)+=yy loop return #deffunc ptcheck int xx,int yy x=xx-edcx:y=yy-edcy res=-1 repeat ptmax if cnt=curpt { x1=ptx(cnt)-(edwx>>1) y1=pty(cnt)-(edwy>>1) x2=x1+edwx y2=y1+edwy } else { x1=ptx(cnt)-4 y1=pty(cnt)-4 x2=x1+8:y2=y1+8 } if (x>=x1)&(x=y1)&(y>1:edcy=edby>>1 buffer 2,edwx,edwy color 0,0,128:boxf 2,2,edwx-5,edwy-3 i=edwx color 255,255,255:font "Arial",i,1 pos (edwx>>3)+2,0:mes "A" ; screen 1,edbx,edby,8 title "View screen" eddraw return #deffunc edinfo_init gsel 0 x=200:y=8 objsize 48,20 pos x,y+24:mes "座標XY" pos x+50,y+20:input ed_x:obj_edx=stat pos x+105,y+20:input ed_y:obj_edy=stat pos x+160,y+24:mes "倍率XY" pos x+210,y+20:input ed_scx:obj_edscx=stat pos x+265,y+20:input ed_scy:obj_edscy=stat ; pos x,y+58:mes "角度" pos x+50,y+54:input ed_rz:obj_edrz=stat pos x+160,y+58:mes "EFX" pos x+190,y+54:input ed_efx:obj_edefx=stat pos x,y+92:mes "フレーム" pos x+50,y+88:input ed_fr:obj_edfr=stat pos x+160,y+92:mes "アニメ" pos x+190,y+88:input ed_anm:obj_edanm=stat ; objsize 100,20 pos x,y+130 combox sw_loop,100,"通常\n繰り返し\n最後に消滅" pos x,y+158 chkbox "距離を補正する",sw_normal ; objsize 128,20 pos x+190,y+130 combox sw_posini,200,"リニア移動(絶対)\nスプライン移動(絶対)\nリニア移動(相対)\nスプライン移動(相対)" objsize 48,20 pos x+120,y+132:input ed_loopid pos x+120,y+158:input ed_dist ; return #deffunc edinfo gsel 0 x=200:y=8 redraw 0 syscolor 15:boxf x,y,640,y+20 color 0,0,0 pos x,y:mes "#"+curpt+" ("+ptmax+")" redraw 1 return #global ; Starting point ; onexit gosub *cmd_bye *boot edinit *boot2 screen 0,640,200 syscolor 15:boxf title EDNAME color 0,0,0:sysfont 17 y=8 pos 8,y+4:mes "編集サイズ":objsize 32,20 pos 96,y:input edbx@hged:pos 136,y:input edby@hged y=32 pos 8,y+4:mes "画面サイズ":objsize 32,20 pos 96,y:input edsx@hged:pos 136,y:input edsy@hged y=56 pos 8,y+4:mes "キャラクタサイズ":objsize 32,20 pos 96,y:input edwx@hged:pos 136,y:input edwy@hged objsize 80,80 pos 540,96:button "プレビュー...",*cmd_prev objsize 80,20 pos 96,92 button "変換...",*cmd_make pos 8,92 button "ロード...",*cmd_load button "セーブ...",*cmd_save button "リフレッシュ",*main0 button "新規...",*cmd_new button gosub "終了...",*cmd_bye pos 540,22:button "データ変更",*cmd_update pos 540,44:button "ポイント挿入",*cmd_ins pos 540,66:button "ポイント削除",*cmd_del ; x=200:y=4 objsize 20,20 pos x+60,y button "前",*cmd_dec pos x+80,y button "次",*cmd_inc pos x+100,y button "終",*cmd_last ; edinfo_init edpv_init *main0 edreset gsel 0,1 *main1 edinfo eddraw *main2 await 15 stick key,64 if dlgmode : goto *main2 ; if key&$100 : goto *clk1 if key&$200 : goto *clk2 ; if ginfo_act!=1 : goto *main2 ; if key&$20 : goto *cmd_prev if key&1 : ptdec : goto *main1 if key&4 : ptinc : goto *main1 goto *main2 *clk1 if ginfo_act!=1 : goto *main2 ptcheck mousex,mousey if stat>=0 : goto *clkmove *clk1x await 15 stick key,$3ff if key&$100 : goto *clk1x ; ptadd mousex,mousey goto *main1 *clk2 if ginfo_act!=1 : goto *main2 ptcheck mousex,mousey if stat<0 : goto *main2 ptset stat goto *main1 *clkmove target=stat if key&64 : goto *main4 getkey a,16:if a : goto *main5 *main3 edinfo eddraw await 15 stick key,$3ff if (key&$100)=0 : goto *main1 ptmove target,mousex,mousey goto *main3 *main4 x=mousex:y=mousey edinfo eddraw await 15 stick key,$3ff if (key&$100)=0 : goto *main1 pttrans mousex-x, mousey-y goto *main4 *main5 edinfo eddraw await 15 stick key,$3ff if (key&$100)=0 : goto *main1 ptrot mousex, mousey goto *main5 *cmd_inc curpt++ if curpt>=ptmax : curpt = ptmax-1 goto *main1 *cmd_dec curpt-- if curpt<0 : curpt = 0 goto *main1 *cmd_last curpt = ptmax-1 goto *main1 *cmd_del ptdel -1 goto *main1 *cmd_ins ptinsert goto *main1 *cmd_update edinfo_update goto *main1 *cmd_save dlgmode=1 dialog "elm2d",17,"2D Element" dlgmode=0 if stat=0 : goto *main1 edsave refstr goto *main1 *cmd_load dlgmode=1 dialog "elm2d",16,"2D Element" dlgmode=0 if stat=0 : goto *main1 edload refstr goto *boot2 *cmd_prev edpv_exec goto *main1 *cmd_make dlgmode=1 dialog "hsp",17,"HSP Script" dlgmode=0 if stat=0 : goto *main1 edpv_make refstr goto *main1 *cmd_new dlgmode=1 dialog "初期状態に戻していいですか?",2 dlgmode=0 if stat!=6 : goto *main1 goto *boot *cmd_bye dlgmode=1 dialog "終了していいですか?",2 dlgmode=0 if stat!=6 : return end