Val{ BRK(max=220,step=50,disp=0) CANGY(default=90,max=240,disp=0) COL1(default=16777220,disp=0) COLBRK(default=5570560,disp=0) COLBRKF(default=251,disp=0) COLHL(default=11579570,disp=0) COLHLF(default=251,disp=0) COLHLF2(default=37115,disp=0) COLL(default=10053120,disp=0) COLLF(default=251,disp=0) COLMADO(default=1250067,disp=0) COLMADOF(default=20480,disp=0) COLR(default=10053120,disp=0) COLRF(default=251,disp=0) DAMF(default=0.42,max=1,disp=0) DAMR(default=0.42,max=1,disp=0) DCP1(default=178,min=35,max=178,disp=0) DCP2(default=180,max=180,disp=0) DOA(default=-2,min=-2,max=120,disp=0) ENG1(min=-70,max=100,step=10,disp=0) ENG2(default=1,min=1,max=50,disp=0) ENGFL(min=-60000,max=200000,disp=0) ENGFR(min=-60000,max=200000,disp=0) ENGINE(min=-60000,max=200000,disp=0) ENGRL(min=-60000,max=200000,disp=0) ENGRR(min=-60000,max=200000,disp=0) FLBRK(max=2000,disp=0) FRBRK(max=2000,disp=0) FVW(default=180,min=-180,max=360,disp=0) FWL(default=187,min=150,max=230,disp=0) FWR(default=187,min=150,max=230,disp=0) HANDLE(min=-26,max=26,step=3,disp=0) LHANDLE(default=180,min=-180,max=360,disp=0) RHANDLE(default=180,min=-180,max=360,disp=0) RLBRK(max=2000,disp=0) RRBRK(max=2000,disp=0) RVWING(default=78,max=120,disp=0) RWL(default=185,min=-400,max=400,disp=0) RWR(default=185,min=-400,max=400,disp=0) SPRF(default=0.34,max=1,disp=0) SPRR(default=0.36,max=1,disp=0) TOU(default=61440,disp=0) H(min=-28,max=28,step=4) HLIGHT(default=8421504,max=16776960,step=16776960) DL1(max=80,step=3) DL2(max=80,step=3) DD1(default=90,max=178,step=3) DD2(default=90,max=95,step=3) DD3(max=90,step=3) EN(min=-1500,max=1500,step=1500) CB(default=8060928,max=167444500,step=167444500) DD1_copy(default=90,max=178,step=3) DD2_copy(default=90,max=95,step=3) DD3_copy(max=90,step=3) CB_E(default=251,max=8060928,step=8060928) TO(max=70,step=3) Brake(max=150,step=150) JET(min=-40000,max=40000,step=599990) BO(max=75,step=3) TT2(default=91,max=179,step=3) TT1(default=91,max=179,step=3) } Key{ 0:EN(step=500) 1:EN(step=-500) 2:H(step=-1) 3:H(step=1) 4:JET(step=5000) 5:HLIGHT(step=16776960) 6:JET(step=5000) 7:Brake(step=30),CB(step=8060928),CB_E(step=16744450) 8:DD1(step=4),DD2(step=4),DD3(step=4) 9:DD1_copy(step=4),DD2_copy(step=4),DD3_copy(step=4) 13:BO(step=3) 14:DL1(step=4),TT1(step=4) 15:TO(step=4) 16:DL2(step=4),TT2(step=4) } Body{ Core(Color=#222222){ N:TrimF(Angle=90,Option=1){ N:RudderF(Angle=27,Option=1){ N:Wheel(Angle=-H,Power=EN,Brake=Brake,Effect=2){} } } S:Chip(Color=#222222){ E:Cowl(Color=#222222){ N:Cowl(Color=#222222){ N:Cowl(Color=#222222,Angle=-45){ E:Cowl(Color=#808000,Angle=115,Option=3){} N:Cowl(Color=#222222,Angle=180){} } E:Cowl(Color=#808000,Angle=90){} N:Cowl(Color=#222222,Angle=-175){ N:Cowl(Color=#222222,Angle=75,Option=5){} } } S:Cowl(Color=#808000){ E:Cowl(Color=#808000,Angle=90){} W:Cowl(Color=#808000){ S:Cowl(Color=#808000,Angle=90){ E:Cowl(Color=#808000){ S:Cowl(Color=COLR,Angle=-178,Option=3,Effect=COLRF){} } W:Cowl(Color=#808000){ S:Cowl(Color=COLL,Angle=-178,Option=4,Effect=COLLF){} } N:Cowl(Color=#808000,Angle=45){ W:Cowl(Color=#808000){ S:Cowl(Color=CB,Angle=-178,Option=5,Effect=CB_E){} } E:Cowl(Color=#808000){ S:Cowl(Color=CB,Angle=-178,Option=5,Effect=CB_E){} } N:Cowl(Color=#000000,Effect=#00AAAA){ E:Cowl(Color=#000000,Effect=#00AAAA){} W:Cowl(Color=#000000,Effect=#00AAAA){} N:Cowl(Color=#000000,Angle=135,Effect=#00AAAA){ W:Cowl(Color=#000000,Effect=#00AAAA){ W:Cowl(Color=#808000,Angle=91,Option=3){} } E:Cowl(Color=#000000,Effect=#00AAAA){ E:Cowl(Color=#808000,Angle=91,Option=4){} } N:Cowl(Color=#808000){ E:Cowl(Color=#808000){ E:Cowl(Color=#808000,Angle=90){ W:Cowl(Color=#808000,Angle=-DL2){ W:Cowl(Color=#808000,Option=4){} S:Cowl(Color=#000000,Effect=#00AAAA){ W:Cowl(Color=#000000,Option=3,Effect=#00AAAA){} } } } } W:Cowl(Color=#808000){ W:Cowl(Color=#808000,Angle=90){ E:Cowl(Color=#808000,Angle=-DL1){ E:Cowl(Color=#808000,Option=3){} S:Cowl(Color=#000000,Effect=#00AAAA){ E:Cowl(Color=#000000,Option=4,Effect=#00AAAA){} } } } } } } N:Cowl(Color=#808000,Angle=45){ E:Cowl(Color=#808000){} W:Cowl(Color=#808000){} N:Cowl(Color=#808000,Angle=5){ W:Cowl(Color=#808000){} E:Cowl(Color=#808000){} } } } } } } E:Cowl(Color=#808000,Angle=-90,Option=4){} } } W:Cowl(Color=#222222){ N:Cowl(Color=#222222){ N:Cowl(Color=#222222,Angle=-45){ E:Cowl(Color=#222222){ S:Cowl(Color=#808000,Angle=45){ E:Cowl(Color=#808000){ E:Cowl(Color=#808000,Angle=109){ E:Cowl(Color=#808000){ E:Cowl(Color=#808000){} } N:Cowl(Color=#808000,Angle=90){ E:Cowl(Color=#808000){ E:Cowl(Color=#808000){} } } } } W:Cowl(Color=#808000){ E:Cowl(Color=#808000){} W:Cowl(Color=#808000,Angle=109){ W:Cowl(Color=#808000){ W:Cowl(Color=#808000){} } N:Cowl(Color=#808000,Angle=90){ W:Cowl(Color=#808000){ W:Cowl(Color=#808000){} } } } } } N:Cowl(Color=#808000,Angle=65){ N:Cowl(Color=#808000){ N:Cowl(Color=#808000,Angle=30){ W:Cowl(Color=#808000,Angle=91,Option=4){} E:Cowl(Color=#808000,Angle=91,Option=3){} } E:Cowl(Color=#808000,Angle=90){ S:Cowl(Color=#808000){ S:Cowl(Color=#808000,Angle=-90){} } } W:Cowl(Color=#808000,Angle=90){ S:Cowl(Color=#808000){ S:Cowl(Color=#808000,Angle=-90){} } } W:Cowl(Color=HLIGHT,Option=2){ N:Cowl(Color=COLL,Angle=60,Option=3,Effect=COLLF){} } E:Cowl(Color=HLIGHT,Option=2){ N:Cowl(Color=COLR,Angle=60,Option=4,Effect=COLRF){} } } E:Cowl(Color=#808000,Option=3){} W:Cowl(Color=#808000,Option=4){} S:Cowl(Color=#000000,Angle=-20,Effect=#00AAAA){ W:Cowl(Color=#000000,Effect=#00AAAA){ W:Cowl(Color=#000000,Angle=91,Effect=#00AAAA){} } E:Cowl(Color=#000000,Effect=#00AAAA){ E:Cowl(Color=#000000,Angle=91,Effect=#00AAAA){} } S:Cowl(Color=#000000,Angle=37,Effect=#00AAAA){ W:Cowl(Color=#000000,Effect=#00AAAA){ W:Cowl(Color=#000000,Angle=TT1,Effect=#00AAAA){} } E:Cowl(Color=#000000,Effect=#00AAAA){ E:Cowl(Color=#000000,Angle=TT2,Effect=#00AAAA){} } } } } } W:Cowl(Color=#808000,Angle=115,Option=4){} N:Cowl(Angle=-178,Option=2){} } W:Cowl(Color=#808000,Angle=90){} N:Cowl(Color=#000000,Angle=-175){ N:Cowl(Color=#222222,Angle=75,Option=5){} } } S:Cowl(Color=#808000){ W:Cowl(Color=#808000,Angle=90){} W:Cowl(Color=#808000,Angle=-90,Option=3){} } } E:Frame(Color=#808000,Angle=9,Option=1){ E:Wheel(Angle=80,Power=EN,Brake=Brake,Effect=2){} } W:Frame(Color=#808000,Angle=10,Option=1){ W:Wheel(Angle=80,Power=-EN,Brake=Brake,Effect=2){} } } } } Lua{ function ang(m,n,v) if m-n-v then m=n elseif mn then m=m-v end return m end function rgb(r,g,b) return math.floor(math.min(r,255)) * 65536 + math.floor(math.min(g,255)) * 256 + math.floor(math.min(b,255)) end function spcl(d,c,b,a) return math.floor(math.min(a,15)) + math.floor(math.min(b,15)) * 16 + math.floor(math.min(c,15)) * 256 + math.floor(math.min(d,15)) * 4096 end function m_input(free) if free==nil then free=0 end local mx=(math.min(math.max(_MX(),0),_WIDTH()))/_WIDTH()-0.5 local my=(math.min(math.max(_MY(),0),_HEIGHT()))/_HEIGHT()-0.5 if math.abs(mx)<=free then mx=0 else mx=mx-free*(mx/math.abs(mx)) end if math.abs(my)<=free then my=0 else my=my-free*(my/math.abs(my)) end return mx,my end function graph(val,min,max,wake,mode) local o="" local tmp2=max-min local tmp=val-min+tmp2/wake/2 if mode==0 then for i=1,wake do if tmp>=tmp2/wake then o=o.."■" else o=o.."□" end tmp=tmp-tmp2/wake end elseif mode==1 then o="■" j=0 wake=wake-1 for i=1,wake do if tmp<=tmp2/wake then break else o="□"..o tmp=tmp-tmp2/wake j=i end end for i=1,wake-j do o=o.."□" end end return o end ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- function handle()--ハンドル-------------------------------- if(_KEY(2)==1 and _KEY(3)==0)then HANDLE=HANDLE-3 FLBRK=FLBRK+inbk RLBRK=RLBRK+inbk end if(_KEY(3)==1 and _KEY(2)==0)then HANDLE=HANDLE+3 FRBRK=FRBRK+inbk RRBRK=RRBRK+inbk end if(HANDLE > 0)then RHANDLE = HANDLE * 1.35 + 182 LHANDLE = HANDLE + 178 else RHANDLE = HANDLE + 182 LHANDLE = HANDLE * 1.35 + 178 end FVW=HANDLE*0.2+180 end function engine1()--エンジン出力--------------------------------------- if(_KEY(0)==1 and _KEY(1)==0)then ENG1=ENG1+5 end if(_KEY(1)==1 and _KEY(0)==0)then ENG1=ENG1-5 end if(_KEY(5)==1 and _H(C2)<1)then TB=0.070 --パワーアップ時のターボブースト係数 limit.l[1]=120000 else TB=0.036 --通常時のターボブースト係数 limit.l[1]=100000 end ENG2=1.0+(math.abs(_VX(C2))*TB)--速度に応じて出力を調整 ENGINE=(ENG1*110)*ENG2 if(HANDLE<0 and _VX(C2)<0) then engl=ENGINE*(1-def) ; engr=ENGINE*(1+def) elseif(HANDLE>0 and _VX(C2)<0) then engr=ENGINE*(1-def) ; engl=ENGINE*(1+def) else engl=ENGINE ; engr=ENGINE end --engl=ENGINE ; engr=ENGINE tcs() end slip={} tc={} tc[1]=0 tc[2]=0 tc[3]=0 tc[4]=0 bc={} bc[1]=0 bc[2]=0 bc[3]=0 bc[4]=0 function tcs() if tcsmode==1 then TCSstat="○" for i=1,4 do if slip[i]>tcset then TCSstat="●" tc[i]=math.max(1.8/slip[i],0.1) else tc[i]=1 end end if (emode<3 and ENG1==0) or (emode==3 and ep==0) then TCSstat="○" end else TCSstat="×" tc={1,1,1,1} end e1fl=engl*tc[1]*kudou.l[kudou.m].f e1fr=engr*tc[2]*kudou.l[kudou.m].f e1rl=engl*tc[3]*kudou.l[kudou.m].r -- *0.86 e1rr=engr*tc[4]*kudou.l[kudou.m].r -- *0.86 --リミッター if emode<3 then while e1fl+e1fr+e1rl+e1rr > limit.l[limit.m] do e1fl=e1fl*0.98 e1fr=e1fr*0.98 e1rl=e1rl*0.973 e1rr=e1rr*0.973 end local t=(limit.l[limit.m]-(e1fl+e1fr+e1rl+e1rr)) if e1rl+e1rr > limit.l[limit.m]*0.66 then e1fl=e1fl+t/2 e1fr=e1fr+t/2 elseif t30 then ee[i]=ee[i]+5000*math.min(math.max(1-(slip[i]/(e2set+_KEY(5)*e2set*0.07)),-0.7),1.5) if _KEYUP(5)==1 then ee[i]=3000 + 120 * math.abs(_VX(C2)) end else ee[i]=ee[i]+2000 end end elseif _KEY(1)==1 then for i=st,ed do if ee[i]>-2000 then ee[i]=-4000 - 100 * math.abs(_VZ(0))end if math.abs(wy[i])>30 then ee[i]=ee[i]+ee[i]*math.min(math.max(1-(slip[i]/e2set),-0.5),1.5) else ee[i]=ee[i]-1000 end end else ee={0,0,0,0} end e2fl=ee[1]*kudou.l[kudou.m].f * (1+def*HANDLE/25) e2fr=ee[2]*kudou.l[kudou.m].f * (1-def*HANDLE/25) e2rl=ee[3]*kudou.l[kudou.m].r * (1+def*HANDLE/25) e2rr=ee[4]*kudou.l[kudou.m].r * (1-def*HANDLE/25) --out(10,"& ",slip[1]," ",slip[2]," ",slip[3]," ",slip[4]) --out(11,"& ",ee[1]," ",ee[2]," ",ee[3]," ",ee[4]) --out(12,"& ",wy[1]," ",wy[2]," ",wy[3]," ",wy[4]) end ep=0 function engine()--エンジン出力--------------------------------------- if emode==0 then engine2() engine1() ENGFL= e1fl*e0set + e2fl*(1-e0set) ENGFR= e1fr*e0set + e2fr*(1-e0set) ENGRL= e1rl*e0set + e2rl*(1-e0set) ENGRR= e1rr*e0set + e2rr*(1-e0set) elseif emode==1 then engine1() ENGFL=e1fl ENGFR=e1fr ENGRL=e1rl ENGRR=e1rr elseif emode==2 then engine2() ENGFL=e2fl ENGFR=e2fr ENGRL=e2rl ENGRR=e2rr elseif emode==3 then ep=ang(ep,_KEY(0)*e3max/4-_KEY(1)*e3max/6,750) if _KEY(0)+_KEY(1)==0 then ep=ang(ep,0,1500) end engl=ep * (1+def*HANDLE/25) engr=ep * (1-def*HANDLE/25) tcs() ENGFL=e1fl ENGFR=e1fr ENGRL=e1rl ENGRR=e1rr end end function brake() if _KEY(4)==1 then BRK=BRK+30 end if absmode==1 then absstat="○" if _VX(C2)<-3 then for i=1,4 do if slip[i]0 then s_temp=0 end s_tmp=s_tmp-1 if s_tmp==-15 then s_tmp=-10 val=val-mb end else s_tmp=0 end val=math.min(math.max(val,min),max) return val end ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- setmode=0 col={ m=0, c={ [0]={ [1]=rgb(255,255,255), }, [1]={ [1]=rgb(20,20,20), }, [2]={ [1]=rgb(222,180,160), }, [3]={ [1]=rgb(100,100,100), }, [4]={ [1]=rgb(64,0,0), }, [5]={ [1]=rgb(0,0,64), }, [6]={ [1]=rgb(0,25,36), }, }, p=7 } limit={ m=0, n={ [0]="無制限", [1]="100k+ ", [2]="50k " }, l={ [0]=90000000, [1]=100000, [2]=50000 } } rvw={ m=0, n={ [0]="Grip ", [1]="Drift" } } kudou={ m=3, n={ [0]="4WD ", [1]="RWD ", [2]="FWD ", [3]="4WD2" }, l={ [0]={f=1,r=1}, [1]={f=0,r=1}, [2]={f=1,r=0}, [3]={f=1,r=0.91} } } ename={ [0]="ハイブリッド", [1]="旧型制御", [2]="新型制御", [3]="固定出力" } cname={ [0]="定地旋回", [1]="サイドブレーキ" } tcsmode=1 absmode=1 bcset=3.55 tcset=3.60 autowingf=1 autowingr=1 fwing=24 rwing=27 def=0.5 inbk=50 emode=0 e3max=100000 e2set=3.5 e0set=0.3 sprf=0.34 sprr=0.36 damf=0.42 damr=0.42 cmode=0 premode=1 pre={ [0]={ name="カスタム", colm=0, limitm=0, kudoum=3, tcsmode=1, absmode=1, bcset=3.55, tcset=3.60, autowingf=1, autowingr=1, fwing=24, rwing=27, def=0.5, inbk=50, emode=0, e3max=100000, e2set=3.5, e0set=0.3, sprf=0.34, sprr=0.36, damf=0.42, damr=0.42, cmode=0 }, [1]={ name="デフォ", colm=0, limitm=0, kudoum=3, tcsmode=1, absmode=1, bcset=3.55, tcset=3.60, autowingf=1, autowingr=1, fwing=24, rwing=27, def=0.5, inbk=50, emode=0, e3max=100000, e2set=3.5, e0set=0.3, sprf=0.34, sprr=0.36, damf=0.42, damr=0.42, cmode=0 }, [2]={ name="高速重視", colm=1, limitm=0, kudoum=3, tcsmode=1, absmode=1, bcset=3.60, tcset=3.7, autowingf=1, autowingr=1, fwing=24, rwing=27, def=0.45, inbk=50, emode=0, e3max=100000, e2set=3.65, e0set=0.5, sprf=0.4, sprr=0.42, damf=0.42, damr=0.42, cmode=0 }, [3]={ name="ハイテクOFF", colm=3, limitm=0, kudoum=0, tcsmode=0, tcset=3.55, absmode=0, bcset=3.6, autowingf=0, autowingr=0, fwing=23, rwing=25, def=0, inbk=0, emode=3, e3max=100000, e2set=2.42, e0set=0.5, e0set=0.5, sprf=0.3, sprr=0.3, damf=0.35, damr=0.35, cmode=0 } } awshow={ [0]="固定", [1]="自動" } ------------------------------------------------------------------------ ----------------------セッティング用単体関数---------------------------- ------------------------------------------------------------------------ setf={ preset=function(n,m) if m==0 then out(n,string.format(" セッティング読込  %s",pre[premode].name)) else if _KEYDOWN(3)==1 then premode=math.mod(premode+1,4) end if _KEYDOWN(2)==1 then premode=premode-1 if premode<0 then premode=3 end end out(n,string.format("<セッティング読込  %s A:決定 >",pre[premode].name)) if _KEYDOWN(7)==1 then col.m= pre[premode].colm limit.m= pre[premode].limitm kudou.m= pre[premode].kudoum tcsmode= pre[premode].tcsmode tcset= pre[premode].tcset absmode= pre[premode].absmode bcset= pre[premode].bcset autowingf= pre[premode].autowingf autowingr= pre[premode].autowingr fwing= pre[premode].fwing rwing= pre[premode].rwing def= pre[premode].def inbk= pre[premode].inbk emode= pre[premode].emode e3max= pre[premode].e3max e2set= pre[premode].e2set e0set= pre[premode].e0set sprf= pre[premode].sprf sprr= pre[premode].sprr damf= pre[premode].damf damr= pre[premode].damr cmode= pre[premode].cmode for i=1,3 do _G["COL"..i]=col.c[col.m][i] end if autowingf==0 then FWL=fwing+182 FWR=fwing+182 end if autowingr==0 then RWL=rwing+182 RWR=rwing+182 end end end end, col=function(n,m) if m==0 then out(n,string.format(" 色       パターン "..(col.m+1))) else out(n,string.format("<色       パターン "..(col.m+1).." >")) if _KEYDOWN(3)==1 then col.m=math.mod(col.m+1,col.p) end if _KEYDOWN(2)==1 then col.m=col.m-1 if col.m==-1 then col.m=col.p-1 end end if _KEYDOWN(2)==1 or _KEYDOWN(3)==1 then for i=1,3 do _G["COL"..i]=col.c[col.m][i] end --COL1=col.c[col.m][1] end end end, limit=function(n,m) if m==0 then out(n,string.format(" リミッター   "..limit.n[limit.m])) else out(n,string.format("<リミッター   "..limit.n[limit.m].." >")) if _KEYDOWN(3)==1 then limit.m=math.mod(limit.m+1,3) end if _KEYDOWN(2)==1 then limit.m=limit.m-1 if limit.m==-1 then limit.m=2 end end end end, kudou=function(n,m) if m==0 then out(n,string.format(" 駆動モード   "..kudou.n[kudou.m])) else out(n,string.format("<駆動モード   "..kudou.n[kudou.m].." >")) if _KEYDOWN(3)==1 then kudou.m=math.mod(kudou.m+1,4) end if _KEYDOWN(2)==1 then kudou.m=kudou.m-1 if kudou.m==-1 then kudou.m=3 end end end end, engmode=function(n,m) if m==0 then out(n,string.format(" エンジン制御   "..ename[emode])) else out(n,string.format("<エンジン制御   "..ename[emode].." >")) if _KEYDOWN(3)==1 then emode=math.mod(emode+1,4) end if _KEYDOWN(2)==1 then emode=emode-1 if emode==-1 then emode=3 end end end end, eng0set=function(n,m) if m==0 then out(n,string.format(" エンジン出力混合 %.02f",e0set)) else out(n,string.format("<エンジン出力混合 %.02f >",e0set)) e0set=s_int(e0set,1,0,3,2,0.01,0.03) end end, eng2set=function(n,m) if m==0 then out(n,string.format(" 新型エンジン出力 %.02f",e2set)) else out(n,string.format("<新型エンジン出力 %.02f >",e2set)) e2set=s_int(e2set,4.0,3.0,3,2,0.01,0.03) end end, eng3set=function(n,m) if m==0 then out(n,string.format(" 固定エンジン出力  %.02f",e3max)) else out(n,string.format("<固定エンジン出力  %.02f >",e3max)) e3max=s_int(e3max,300000,0,3,2,1000,5000) end end, tcs=function(n,m) if m==0 then out(n,string.format(" TCS      "..TCSstat.." %.02f",tcset)) else out(n,string.format("<TCS      "..TCSstat.." %.02f A:ON/OFF >",tcset)) tcset=s_int(tcset,4.0,3.0,3,2,0.01,0.03) tcs() if _KEYDOWN(7)==1 then tcsmode=math.mod(tcsmode+1,2) end end end, abs=function(n,m) if m==0 then out(n,string.format(" ABS      "..absstat.." %.02f",bcset)) else out(n,string.format("<ABS      "..absstat.." %.02f A:ON/OFF >",bcset)) bcset=s_int(bcset,4.0,3.0,3,2,0.01,0.03) brake() if _KEYDOWN(7)==1 then absmode=math.mod(absmode+1,2) end end end, inbk=function(n,m) if m==0 then out(n,string.format(" イン側ブレーキ   %.0f",inbk)) else out(n,string.format("<イン側ブレーキ   %.0f >",inbk)) inbk=s_int(inbk,100,0,3,2,5,10) end end, wingf=function(n,m) if m==0 then out(n,string.format(" 空力前     %s %d",awshow[autowingf],fwing)) else out(n,string.format("<空力前     %s %d A:自動/固定 >",awshow[autowingf],fwing)) fwing=s_int(fwing,35,0,3,2,1,3) if autowingf==0 then FWL=fwing+182 FWR=fwing+182 end if _KEYDOWN(7)==1 then autowingf=math.mod(autowingf+1,2) end end end, wingr=function(n,m) if m==0 then out(n,string.format(" 空力後     %s %d",awshow[autowingr],rwing)) else out(n,string.format("<空力後     %s %d A:自動/固定 >",awshow[autowingr],rwing)) rwing=s_int(rwing,35,0,3,2,1,3) if autowingr==0 then RWL=rwing+182 RWR=rwing+182 end if _KEYDOWN(7)==1 then autowingr=math.mod(autowingr+1,2) end end end, def=function(n,m) if m==0 then out(n,string.format(" デフ回転差   %1.2f",def)) else out(n,string.format("<デフ回転差   %1.2f >",def)) def=s_int(def,1,0,3,2,0.01,0.03) end end, sprf=function(n,m) if m==0 then out(n,string.format(" スプリングF  %.02f",sprf)) else out(n,string.format("<スプリングF  %.02f >",sprf)) sprf=s_int(sprf,1,0,3,2,0.01,0.03) end end, sprr=function(n,m) if m==0 then out(n,string.format(" スプリングR  %.02f",sprr)) else out(n,string.format("<スプリングR  %.02f >",sprr)) sprr=s_int(sprr,1,0,3,2,0.01,0.03) end end, damf=function(n,m) if m==0 then out(n,string.format(" ダンパーF   %.02f",damf)) else out(n,string.format("<ダンパーF   %.02f >",damf)) damf=s_int(damf,1,0,3,2,0.01,0.03) end end, damr=function(n,m) if m==0 then out(n,string.format(" ダンパーR   %.02f",damr)) else out(n,string.format("<ダンパーR   %.02f >",damr)) damr=s_int(damr,1,0,3,2,0.01,0.03) end end, cmode=function(n,m) if m==0 then out(n," Cキー機能   ",cname[cmode]) else out(n,"<Cキー機能   ",cname[cmode]," >") if _KEYDOWN(2) + _KEYDOWN(3) > 0 then cmode=math.mod(cmode+1,2) end end end, null=function(n,m) if m==0 then out(n," - - - - - - - - - -") else out(n,"<- - - - - - - - - - >") end end } ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- function setting() if _KEYDOWN(0)==1 then setmode=setmode-1 if setmode<0 then setmode=16 end end if _KEYDOWN(1)==1 then setmode=math.mod(setmode+1,17) end if emode==0 then set={ [1]=setf.preset, [2]=setf.col, [3]=setf.engmode, [4]=setf.eng0set, [5]=setf.tcs, [6]=setf.eng2set, [7]=setf.abs, [8]=setf.kudou, [9]=setf.wingf, [10]=setf.wingr, [11]=setf.inbk, [12]=setf.def, [13]=setf.sprf, [14]=setf.sprr, [15]=setf.damf, [16]=setf.damr, [17]=setf.cmode } elseif emode==1 then set={ [1]=setf.preset, [2]=setf.col, [3]=setf.engmode, [4]=setf.tcs, [5]=setf.limit, [6]=setf.null, [7]=setf.abs, [8]=setf.kudou, [9]=setf.wingf, [10]=setf.wingr, [11]=setf.inbk, [12]=setf.def, [13]=setf.sprf, [14]=setf.sprr, [15]=setf.damf, [16]=setf.damr, [17]=setf.cmode } elseif emode==2 then set={ [1]=setf.preset, [2]=setf.col, [3]=setf.engmode, [4]=setf.eng2set, [5]=setf.null, [6]=setf.null, [7]=setf.abs, [8]=setf.kudou, [9]=setf.wingf, [10]=setf.wingr, [11]=setf.inbk, [12]=setf.def, [13]=setf.sprf, [14]=setf.sprr, [15]=setf.damf, [16]=setf.damr, [17]=setf.cmode } elseif emode==3 then set={ [1]=setf.preset, [2]=setf.col, [3]=setf.engmode, [4]=setf.eng3set, [5]=setf.tcs, [6]=setf.null, [7]=setf.abs, [8]=setf.kudou, [9]=setf.wingf, [10]=setf.wingr, [11]=setf.inbk, [12]=setf.def, [13]=setf.sprf, [14]=setf.sprr, [15]=setf.damf, [16]=setf.damr, [17]=setf.cmode } end for i=1,17 do if i==setmode+1 then m=1 else m=0 end set[i](i,m) end out(19,"[Q:セッティング終了]") if premode~=0 and setmode~=0 and _KEY(2)+_KEY(3)+_KEY(7)>0 then premode=0 end if setmode~=0 and premode==0 then pre[0].colm = col.m pre[0].limitm = limit.m pre[0].kudoum = kudou.m pre[0].tcsmode = tcsmode pre[0].tcset = tcset pre[0].absmode = absmode pre[0].bcset = bcset pre[0].autowingf = autowingf pre[0].autowingr = autowingr pre[0].fwing = fwing pre[0].rwing = rwing pre[0].def = def pre[0].inbk = inbk pre[0].emode = emode pre[0].e3max = e3max pre[0].e2set = e2set pre[0].e0set = e0set pre[0].sprf = sprf pre[0].sprr = sprr pre[0].damf = damf pre[0].damr = damr pre[0].cmode = cmode end SPRF=sprf SPRR=sprr DAMF=damf DAMR=damr end fwl=0 fwr=0 rwl=0 rwr=0 function wing_f() if _H(WFL)>0 then local tmp=math.min(((_H(WFL)-0.45)*15)+math.abs((LHANDLE-180)*0.33,0)+fwing,35) fwl=ang(fwl,tmp,5) end if _H(WFR)>0 then local tmp=math.min(((_H(WFR)-0.45)*15)+math.abs((RHANDLE-180)*0.33,0)+fwing,35) fwr=ang(fwr,tmp,5) end if ((_H(WFL)>2 or _H(WFL)<-100) and (_H(WFR)>2 or _H(WFR)<-100)and (_H(WRL)>2 or _H(WRL)<-100)and (_H(WRR)>2 or _H(WRR)<-100)) then fwl=ang(fwl,sxf*5+szl*4+fwing*0.36,7) fwr=ang(fwr,-sxf*5+szr*4+fwing*0.36,7) elseif _H(WFL)>1.2 and _H(WFR)>1.2 and _H(WRL)>0.9 and _H(WRR)>0.9 and (_H(WFL)+_H(WFR))>(_H(WRL)+_H(WRR)+0.5) then fwl=fwl*1.04+1 fwr=fwr*1.04+1 end FWL=fwl*wvel+182 FWR=fwr*wvel+182 end function wing_r() if _H(WRL)>0 then local tmp=math.min(((_H(WRL)-0.45)*12)+math.abs((LHANDLE-180)*0.2)+rwing,35) rwl=ang(rwl,tmp,5) end if _H(WRR)>0 then local tmp=math.min(((_H(WRR)-0.45)*12)+math.abs((RHANDLE-180)*0.2)+rwing,35) rwr=ang(rwr,tmp,5) end if ((_H(WFL)>2 or _H(WFL)<-100) and (_H(WFR)>2 or _H(WFR)<-100)and (_H(WRL)>2 or _H(WRL)<-100)and (_H(WRR)>2 or _H(WRR)<-100)) then rwl=ang(rwl,sxr*5-szl*4+rwing*0.3,7) rwr=ang(rwr,-sxr*5-szr*4+rwing*0.3,7) end RWL=rwl*wvel+182 RWR=rwr*wvel+182 end time=0 lmode=0 rmode=0 lightmode=0 doa={ mode=0 } function gimic() if _KEYDOWN(10)==1 then lmode=math.mod(lmode+1,2) end if _KEYDOWN(11)==1 then rmode=math.mod(rmode+1,2) end if _KEYDOWN(12)==1 then lightmode=math.mod(lightmode+1,2) end --テールランプ if _KEY(4)==1 then COLBRK=16711680 COLBRKF=spcl(0,15,4,15) else COLBRK=5570560 COLBRKF=spcl(0,0,15,11) end if lmode+rmode==0 then time=0 end if lmode==1 and time<12 then COLL=16759552 COLLF=spcl(0,15,4,15) else COLL=10053120 COLLF=spcl(0,0,15,0) end if rmode==1 and time<12 then COLR=16759552 COLRF=spcl(0,15,4,15) else COLR=10053120 COLRF=spcl(0,0,15,0) end time=math.mod(time+1,25) if lightmode==0 then COLHL=rgb(120,120,120) COLHLF=spcl(0,0,15,11) --COLHLF2=spcl(9,0,15,11) else COLHL=rgb(255,255,255) COLHLF=spcl(3,15,0,15) --COLHLF2=spcl(9,15,0,15) end --ドア+α if _KEYDOWN(13)==1 then doa.mode=math.mod(doa.mode+1,2) end if doa.mode==0 then --閉 if DCP1 > 177 then DOA=DOA-4 elseif DCP2 > 179 then DCP1=DCP1+10 else DCP2=DCP2+10 end else --開 if DOA < 119 then DOA=DOA+4 elseif DCP1 > 36 then DCP1=DCP1-10 else DCP2=DCP2-10 end end CANGY=CANGY+(_KEY(15)-_KEY(16))*3 end ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- setmode2=0 function main() if _KEYDOWN(14)==1 then setmode2=math.mod(setmode2+1,2) end if setmode2==0 then if _VX(C2)==0 then for i=1,i<4 do slip[i]=0 end else slip[1]=math.abs(_WY(WFL)/_VX(C2)) slip[2]=math.abs(_WY(WFR)/_VX(C2)) slip[3]=math.abs(_WY(WRL)/_VX(C2)) slip[4]=math.abs(_WY(WRR)/_VX(C2)) end sxf=_Y(WFL)-_Y(WFR) sxr=_Y(WRL)-_Y(WRR) szl=_Y(WFL)-_Y(WRL) szr=_Y(WFR)-_Y(WRR) wvel=1-math.min(math.max(math.abs(_VX(C2))*0.0075-0.2,0),0.84) --out(7,"slip1 ",slip[1]) brake() handle() --ステアリング if _KEY(6) == 1 then if cmode==0 then teiti() --定地旋回 else RLBRK=500 RRBRK=500 end else engine() --エンジンパワー end if emode==3 then if _KEY(5)==1 then RLBRK=500 RRBRK=500 end out(3,"&[Z:ブレーキ] [X:サイドブレーキ] [C:",cname[cmode],"]") else out(3,"&[Z:ブレーキ] [X:ブースト] [C:",cname[cmode],"]") end out(1,"[Q:セッティング]") out(5,string.format("出力 %d",math.abs(ENGFL)+math.abs(ENGFR)+math.abs(ENGRL)+math.abs(ENGRR))) out(6,"TCS:"..TCSstat.." ABS:"..absstat) else ENGFL=0 ENGFR=0 ENGRL=0 ENGRR=0 setting() end if autowingf==1 then wing_f() end if autowingr==1 then wing_r() end --out(10,wvel) gimic() _ZOOM(60) vel=math.sqrt( _VX(0)^2 + _VY(0)^2 + _VZ(0)^2 )*3.6 out(0,string.format("&FPS:%2.1f Chips:%d Weight:%.1f %3.1fkm/h %3.1fkm/h",_FPS(),_CHIPS(),_WEIGHT(),-(_VX(C2)*3.6),vel)) end }