-- ゼルダの伝説(FC・FDS・NES共用) サブウェポン即時選択スクリプト等 -- 作成者:魂太郎@regamer --製作日 2021/03/04 --追記 2021/03/18 --長さを設定出来る項目 hnof = 45 --A押しっぱで炎が出るフレーム数 huekotei = 30 --笛を吹いている際に止まるフレーム数(ゲームのデフォルトは159) --オンオフフラグ spt = {"off", "off", "on", "on", "on", "on", "on", "off", "on"} --他の代入変数 stmi ={ "1.Cross line",--罫線 "2.Obstacle indication",--障害物表示 "3.SEL change subwepon",--セレクトでサブウェポン選択 "4.Crosskey+SEL -subwepon selection fixed-",--セレクト十字キーでアイテム固定選択 "5.Automatic candle use",--ロウソク自動使用 "6.Slash around",--回転斬り "7.High Speed Comment",--コメント時のみ高速化 "8.Enemy HP display",--敵HP表示 "9.Use boomerang enemy stoptime display",--敵気絶時間表示 } fs = 0 ITM = 0 ITC = {} for f = 0, 9, 1 do ITC[f] = 0 end pl = 0 pl2 = 0 fc = 0 hk = 0 khk = {8,2,4,1} yk = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p"} clrp = {"red", "blue", "white", "lime", "yellow", "black"} clr = "red" clrn = 1 swd = {12, 28, 48} xyz ={0, 0} spc = 1 print("") print("説明:") print("サブウェポン選択画面で、補助ツールのオンオフが選択できます。") print(" 十\字キーの上下で選択し、Aボタンでオンオフの設定") print("") print("@Cross line: onで画面右上に「##」と表\示") print(" onで、画面に縦横の線を表\示します") print("") print("AObstacle indication: onで画面右上に「@@」と表\示") print(" onで、障害物・扉や壊れた壁を表\示します") print(" 迷宮内でしかonに出来ません。") print(" ※非推奨。どうしても進めない時に。") print("") print("BSEL change subwepon: onで画面右上に「SEL」と表\示") print(" onで、ウェポン選択画面に遷移せずとも、") print(" 随時セレクトボタンでサブウェポン選択が出来ます") print(" 本来のポーズ機能\はoffにすると復活します") print("") print("CCrosskey+SEL -subwepon selection fixed-:") print(" onで画面右上に「S+」と表\示") print(" セレクトボタンと十\字キーでウェポン固定選択") print("  上+SEL:ブーメラン") print("  下+SEL:爆弾") print("  左+SEL:弓矢") print("  右+SEL:ロッド") print("") print("DAutomatic candle use:") print(" onで画面右下に「AutoCandle:on」と表\示") print(" ロウソ\クを選択せずとも、Aボタン長押しで使用出来るようにします") print("") print("ESlash around: onで画面右上に「SA」と表\示") print(" 残り体力がハート半分のピンチの時、") print(" リンクの周囲上下左右に一斉に攻撃が出来るようになります") print("") print("FHigh Speed Comment: onで画面右上に「SC」と表\示") print(" 商人や情報をくれる人のコメント中のみ、フレームスピードを") print(" 最大にし、コメントが終わったら元に戻ります") print("") print("GEnemy HP display: onで画面右上に「EHP」と表\示") print(" 敵の残り体力を、敵の真下に横バーで表\示します") print(" リンクの攻撃力によって長さが変わり、リンクが強くなると短くなります") print(" ※敵が見えなくても位置が解るので非推奨") print("") print("HUse boomerang enemy stoptime display:") print(" onで画面右上に「EST」と表\示") print(" ブーメランで敵を止めた際、敵の真下に横場バーで残り気絶時間を表\示") print("") print("") print("◆それ以外の補助機能\") print("・今現在持てる爆弾の最大個数を表\示") print("・笛を吹いて竜巻を呼ぶ際:") print("  画面左上に(決められた場所への)移動先が表\示") print("  笛使用中の停止時間を1/4に短縮") print("・バブル・赤バブルに触れた際:") print("  バブルに触れた際、剣使用解除までの時間を表\示") print("  赤バブルに触れた場合は剣使用NGを表\示") print("・ウェポン選択画面の地下迷宮マップに罫線と、") print(" マップ左と下に文字数字を表\示") print("  現在位置や重要箇所の位置を記憶する為に表\記") --***************************************************************************** while true do --***************************************************************************** -- オンオフ出来る補助機能の選択 if (memory.readbyte(0x00E1) ~= 0) then if (emu.framecount() % 70 < 35) then jg = {2, 20} gui.drawpixel(jg[1]+2,jg[2],"#ffffff") gui.drawline(jg[1]+1,jg[2]+1,jg[1]+3,jg[2]+1,white) gui.drawline(jg[1],jg[2]+2,jg[1]+4,jg[2]+2,white) gui.drawline(jg[1],jg[2]+4,jg[1]+4,jg[2]+4,white) gui.drawline(jg[1]+1,jg[2]+5,jg[1]+3,jg[2]+5,white) gui.drawpixel(jg[1]+2,jg[2]+6,"#ffffff") end gui.text(10,20,spt[spc].." : "..stmi[spc]) if (AND(memory.readbyte(0x00FA),140) == 0) then pl2 = 0 end if ( AND(memory.readbyte(0x00FA),8) == 8) then if (pl2 == 0) then pl2 = 1 spc = spc - 1 if (spc < 1) then spc = 9 end end end if ( AND(memory.readbyte(0x00FA),4) == 4) then if (pl2 == 0) then pl2 = 1 spc = spc + 1 if (spc > 9) then spc = 1 end end end if ( AND(memory.readbyte(0x00FA),128) == 128) then if (spt[spc] == "off" and pl2 == 0) then spt[spc] = "on" pl2 = 1 end if (spt[spc] == "on" and pl2 == 0) then spt[spc] = "off" pl2 = 1 end end end --罫線表示中マーク if (spt[1] == "on") then gui.text(243,9,"##")--罫線表示中マーク end --障害物 表示中マーク if (spt[2] == "on") then gui.text(243,17,"@@")--障害物表示中マーク end --SELボタンアイテム選択表示中 if (spt[3] == "on") then gui.text(140, 9,"SEL")--SEL選択マーク end if (spt[4] == "on") then gui.text(161, 9,"S+")--SEL+選択マーク end --STP[5]はロウソク自動使用の項目へ if (spt[6] == "on") then gui.text(175,9,"SA")--回転斬りマーク end if (spt[7] == "on") then gui.text(189,9,"SC")--コメント高速化マーク end if (spt[8] == "on") then gui.text(203,9,"EHP")--敵HP表示中マーク end if (spt[9] == "on") then gui.text(223,9,"EST")--敵気絶値表示中マーク end --カラー選択 clr = clrp[clrn] clrn = clrn + 1 if (clrn == 7) then clrn = 1 end --***地下地図の罫線 if (memory.readbyte(0x00E1) == 7) then if (memory.readbyte(0x1010) > 0 and memory.readbyte(0x1010) < 10) then gui.transparency(2) for free = 0, 15, 1 do--縦軸 gui.drawline(96 + (8*free),94,96 + (8*free),176,"#00ff00") gui.text(98 + (8*free),175,yk[free + 1]) end for free = 0, 9, 1 do--横軸 gui.drawline(90,94 + (8*free),223,94 + (8*free),"#00ff00") gui.text(89,95 + (8*free),free) end gui.transparency(0) end end --********** 罫線 --罫線 表示部分 if (memory.readbyte(0x00E1) == 0 and spt[1] == "on") then gui.transparency(2) for free = 0, 15, 1 do--縦軸 gui.drawline(15 + (16*free),64,15 + (16*free),255, "#"..memory.readbyte(0x1015) * memory.readbyte(0x1015) * memory.readbyte(0x1015) % 65536) end for free = 0, 9, 1 do--横軸 gui.drawline(0,80 + (16*free),255,80 + (16*free), "#"..memory.readbyte(0x1015) * memory.readbyte(0x1015) * memory.readbyte(0x1015) % 65536) end gui.transparency(0) end --罫線 終 --*****障害物表記 if (memory.readbyte(0x1010) == 0) then spt[2] = "off" end if (memory.readbyte(0x00E1) == 0 and spt[2] == "on") then for free = 0, 672, 1 do xyz[1] = math.floor(free / 22) xyz[2] = free % 22 if (memory.readbyte(0x6530 + free) == 0x94 or memory.readbyte(0x6530 + free) == 0xB0 or memory.readbyte(0x6530 + free) == 0xB4 ) then--壁・砲台・撃たない砲台 gui.drawbox(0+xyz[1]*8,64+xyz[2]*8,15+xyz[1]*8,79+xyz[2]*8,white)--0x6644 end if (memory.readbyte(0x6530 + free) == 0xF4 ) then--水辺 gui.transparency(2) gui.drawbox(0+xyz[1]*8,64+xyz[2]*8,7+xyz[1]*8,71+xyz[2]*8,white)--0x6644 gui.transparency(0) end if (memory.readbyte(0x6530 + free) == 0x79) then--ドア上 gui.transparency(2) gui.drawbox(0+xyz[1]*8,64+xyz[2]*8,31+xyz[1]*8,79+xyz[2]*8,"#FF00FF") gui.transparency(0) end if (memory.readbyte(0x6530 + free) == 0x7E) then--ドア下 gui.transparency(2) gui.drawbox(0+xyz[1]*8,64+xyz[2]*8,31+xyz[1]*8,79+xyz[2]*8,"#FF00FF") gui.transparency(0) end if (memory.readbyte(0x6530 + free) == 0x83) then--ドア左 gui.transparency(2) gui.drawbox(0+xyz[1]*8,64+xyz[2]*8,15+xyz[1]*8,95+xyz[2]*8,"#FF00FF") gui.transparency(0) end if (memory.readbyte(0x6530 + free) == 0x88) then--ドア右 gui.transparency(2) gui.drawbox(0+xyz[1]*8,64+xyz[2]*8,15+xyz[1]*8,95+xyz[2]*8,"#FF00FF") gui.transparency(0) end if (memory.readbyte(0x6530 + free) == 0x90 or memory.readbyte(0x6530 + free) == 0x92 ) then--爆弾壁左右 gui.transparency(2) gui.drawbox(0+xyz[1]*8,64+xyz[2]*8,7+xyz[1]*8,79+xyz[2]*8,"#FF00FF") gui.transparency(0) end if (memory.readbyte(0x6530 + free) == 0x8E or memory.readbyte(0x6530 + free) == 0x8C ) then--爆弾壁上下 gui.transparency(2) gui.drawbox(0+xyz[1]*8,64+xyz[2]*8,15+xyz[1]*8,71+xyz[2]*8,"#FF00FF") gui.transparency(0) end if (memory.readbyte(0x6530 + free) == 0x70 ) then--階段 gui.transparency(2) gui.drawbox(0+xyz[1]*8,64+xyz[2]*8,15+xyz[1]*8,79+xyz[2]*8,"#FF00FF") gui.transparency(0) end end end --********** アイテムをセレクトボタンで随時変更 --ポーズの廃止(機能オフでポーズ機能に) if ( memory.readbyte(0x08E0) == 01 and spt[3] == "on") then--ポーズ状態 memory.writebyte(0x8E0, 00) end --所有判定(0以上で所有となる) if ( AND(memory.readbyte(0x00FA),32) == 32 and memory.readbyte(0x00E1) == 0) then--SELボタンを押した時 --ブーメラン ITC[0] = memory.readbyte(0x0674) + memory.readbyte(0x0675) --爆弾 ITC[1] = memory.readbyte(0x0658) --弓矢 ITC[2] = memory.readbyte(0x0659) * memory.readbyte(0x065A) --ロウソク ITC[4] = memory.readbyte(0x065B) --笛 ITC[5] = memory.readbyte(0x065C) --肉 ITC[6] = memory.readbyte(0x065D) --ロッド ITC[8] = memory.readbyte(0x065F) ITC[9] = 0 for e = 0, 8, 1 do ITC[9] = ITC[9] + ITC[e] end end --セレボタンでアイテム選択遷移 if ( AND(memory.readbyte(0x00FA),32) == 32 and memory.readbyte(0x00E1) == 0 and spt[3] == "on") then--SELのみ ITM = memory.readbyte(0x0656) if (pl == 0) then while true do ITM = ITM + 1 if (ITM == 7) then ITM = 8 pl = 0 end if (ITM > 8) then ITM = 0 pl = 0 end if (ITC[ITM] > 0) then memory.writebyte(0x0656, ITM) pl = 1 break end if (ITC[9] == 0) then ITM = 0 memory.writebyte(0x0656, ITM) break end end end end --セレクト武器選択 終 if (spt[4] == "on") then --SELと↑でブーメラン装備 if ( AND(memory.readbyte(0x00FA),40) == 40) then--SEL+↑ if (ITC[0] > 0) then memory.writebyte(0x0656, 0)--ブーメラン end end --SELと↓で爆弾装備 if ( AND(memory.readbyte(0x00FA),36) == 36) then--SEL+↓ if (ITC[1] > 0) then memory.writebyte(0x0656, 1)--爆弾 end end --SELと←で弓矢装備 if ( AND(memory.readbyte(0x00FA),34) == 34) then--SEL+← if (ITC[2] > 0) then memory.writebyte(0x0656, 2)--弓矢 end end --SELと→でロッド装備 if ( AND(memory.readbyte(0x00FA),33) == 33) then--SEL+→ if (ITC[8] > 0) then memory.writebyte(0x0656, 8)--爆弾 end end end --押しっぱなしで選択出来ないように if( AND(memory.readbyte(0x00FA),32) == 0 and pl == 1)then pl = 0 end --*****Aボタン押しっぱなしで炎が出る if (spt[5] == "on") then if ( AND(memory.readbyte(0x00FA),160) == 128 and memory.readbyte(0x065B) > 0 and memory.readbyte(0x00E1) == 0) then FC = FC + 1 if (hnof >= FC) then gui.text(220,223,hnof - FC) else gui.text(220,223,"fire") end else gui.text(193,223,"AutoCandle:on")--ロウソク自動使用中マーク FC = 0 end end if ( FC == hnof) then--押しっぱなしでhnofで設定したフレ経ったら ITM = memory.readbyte(0x0656)--元のアイテムを記憶 memory.writebyte(0x0656, 4)--ロウソクを装備 joypad.set(1, {B = true})--ロウソク使う FCEU.frameadvance() memory.writebyte(0x0656, ITM)--元のアイテムに戻す end --*****剣が振れない状態の描写 if (memory.readbyte(0x052E) == 1 and memory.readbyte(0x00E1) == 0 or memory.readbyte(0x004C) ~= 0 and memory.readbyte(0x00E1) == 0) then--剣が振れなくなったら gui.drawline(149,30,162,50,"#ffCC00")--バッテン gui.drawline(149,50,162,30,"#ffCC00")--バッテン end if (memory.readbyte(0x004C) ~= 0 and memory.readbyte(0x052E) == 0) then--バブルからダメージ受けた後、剣が振れるまでのカウント表示 gui.text(5,223,"sword ok at "..memory.readbyte(0x004C)) end if (memory.readbyte(0x052E) == 1) then--赤バブルからダメージ受けて剣が振れなくなったら gui.text(5,223,"sword NG") end --*****爆弾MAX所持数はいくつ?の表示 if (memory.readbyte(0x00E1) == 0 and memory.readbyte(0x0005) < 3) then if (memory.readbyte(0x067C) < 10) then gui.text(112,55,"/"..memory.readbyte(0x067C)) else gui.text(120,55,"/"..memory.readbyte(0x067C)) end end --*****笛関連 --笛吹いて竜巻に乗って行ける箇所番号記述 if (memory.readbyte(0x0508) == 1) then gui.text(15,15,"move place No."..(memory.readbyte(0x0523) % 8) + 1) --笛のメロディ中の動作停止を端折る if (memory.readbyte(0x083C) == 150) then memory.writebyte(0x083C, huekotei) end end --*****残り体力0.5の時に回転斬り if ( memory.readbyte(0x00B9) > 1 and memory.readbyte(0x00AC) == 17 and memory.readbyte(0x066F) % 16 == 0 and memory.readbyte(0x0670) < 128 and spt[6] == "on" ) then hk = memory.readbyte(0x0098) while true do for re = 1, 4, 1 do memory.writebyte(0x0098, khk[re]) FCEU.frameadvance() if (memory.readbyte(0x00B9) == 0) then memory.writebyte(0x0098, hk) break end end if (memory.readbyte(0x00B9) == 0) then memory.writebyte(0x0098, hk) break end end end --*****店員のコメントの時だけ高速化 if ( memory.readbyte(0x00AC) == 64 and memory.readbyte(0x00AD) == 1 and memory.readbyte(0x0351) == 64 and fs == 0 and spt[7] == "on") then emu.speedmode("nothrottle")--6400% fs = 1 end if ( memory.readbyte(0x00AC) ~= 64 and fs == 1) then emu.speedmode("normal")--100% fs = 0 end --*****敵の体力表記 mmr = 0 if (memory.readbyte(0x00E1) == 0 and memory.readbyte(0x00ED) == 255) then for ee = 0, 9, 1 do if (memory.readbyte(0x0486+ee) ~= 0 and memory.readbyte(0x0493+ee) ~= 255 and spt[8] == "on") then mmr = memory.readbyte(0x0486+ee)/swd[memory.readbyte(0x0657)]*2 if (mmr > 16) then mmr = 16 end gui.drawbox( memory.readbyte(0x0071+ee), memory.readbyte(0x0085+ee)+16, memory.readbyte(0x0071+ee) + mmr, memory.readbyte(0x0085+ee)+16, clr) end --***気絶時間表示 if (memory.readbyte(0x003E+ee) ~= 0 and spt[9] == "on") then gui.drawbox( memory.readbyte(0x0071+ee), memory.readbyte(0x0085+ee)+18, memory.readbyte(0x0071+ee) + memory.readbyte(0x003E+ee), memory.readbyte(0x0085+ee)+18, clr) end end end FCEU.frameadvance() end