Skip to content

Instantly share code, notes, and snippets.

@LuigiBlood
Last active January 30, 2024 23:20
Show Gist options
  • Save LuigiBlood/375eb90959322f224a32fa7bf867ce5d to your computer and use it in GitHub Desktop.
Save LuigiBlood/375eb90959322f224a32fa7bf867ce5d to your computer and use it in GitHub Desktop.
SMA4 eCard Maker 0.03 Source Code - My first programming project
'Super Mario Advance 4 eCard Maker by LuigiBlood
'version 0.03
'Liberty BASIC v4.03
'nomainwin
'Powerup List Array
DIM pwrup$(14)
pwrup$(0)="Mushroom"
pwrup$(1)="Fire Flower"
pwrup$(2)="Leaf"
pwrup$(3)="Frog Suit"
pwrup$(4)="Tanooki Suit"
pwrup$(5)="Hammer Suit"
pwrup$(6)="Cloud"
pwrup$(7)="P-Wing"
pwrup$(8)="Star"
pwrup$(9)="Anchor"
pwrup$(10)="Hammer"
pwrup$(11)="Warp Whistle"
pwrup$(12)="Music Box"
pwrup$(13)="Cape Feather (SMW)"
pwrup$(14)="Boomerang"
'SwitchColor Array
DIM swicolor$(6)
swicolor$(0)="Blue"
swicolor$(1)="Orange"
swicolor$(2)="Green-Blue"
swicolor$(3)="Yellow"
swicolor$(4)="Green"
swicolor$(5)="Cyan"
swicolor$(6)="Red"
'SwitchEffects Array
DIM swieffects$(15)
swieffects$(0)="1ups replaced with 3ups Moon"
swieffects$(1)="Slow Down the Timer"
swieffects$(2)="Double Scores on Everything"
swieffects$(3)="1/2 Power Meter"
swieffects$(4)="Flying platforms saves you from dying twice"
swieffects$(5)="Add grass on levels (SMB2 Style)"
swieffects$(6)="Turn Enemies into Coins (SMW Style)"
swieffects$(7)="Low Gravity Luigi"
swieffects$(8)="Nothing"
swieffects$(9)="Enemies replaced by harder ones"
swieffects$(10)="Nothing"
swieffects$(11)="Nothing"
swieffects$(12)="Nothing"
swieffects$(13)="Nothing"
swieffects$(14)="Nothing"
swieffects$(15)="Random Item Box (SMW Style)"
'GUI
WindowWidth = 300
WindowHeight = 300
BUTTON #maker.quit, " Quit ", [quit], LR, 52, 5
BUTTON #maker.makecrd, "Make the card !", [makecrd], LL, 82, 0-11
STATICTEXT #maker, "Card Identifier (0-255) :", 75, 8, 107, 15
TEXTBOX #maker.crdID, 185, 5, 30, 20
'Power-up Card Group
GROUPBOX #maker.pwrupgrp, "Power-up Card", 5, 32, 270+13, 72-10
RADIOBUTTON #maker.item, "Item :", [pwrupitemradio], [wait], 5+10, 45+5, 44, 15
'STATICTEXT #maker, "Item :", 5+10, 45+5, 30, 15
COMBOBOX #maker.pwrup, pwrup$(), [pwrup], 5+10+30+15, 60-13, 125, 15
RADIOBUTTON #maker.1up, "1-ups (1-255) :", [pwrup1upradio], [wait], 5+10, 45+5+22, 44+15+25, 15
'STATICTEXT #maker, "1-ups (1-999) :", 5+10, 85-12, 70, 15
TEXTBOX #maker.oneUP, 75+10+17, 82-12, 30, 20
BUTTON #maker.manyitem, "Multi Item Card", [MultiItemWin], UR, -23, 50, 80, 30
'Switch Card Group
GROUPBOX #maker.switchgrp, "Switch Card", 5, 100, 270+13, 72-25+15
STATICTEXT #maker, "Switch Color :", 10, 130-10-1-2, 70, 15
COMBOBOX #maker.swicolor, swicolor$(), [wait], 80, 130-10-5-2, 80, 15
STATICTEXT #maker, "Effect :", 10, 130-10-1+19, 35, 15
COMBOBOX #maker.swieffect, swieffects$(), [wait], 80-35, 130-10-5-2+20, 240, 15
'Card-Making Group
GROUPBOX #maker.crdmakgrp, "Which card to make:", 5, 150+15, 120, 65
RADIOBUTTON #maker.makpwrup, "Power-up Card", [ChooseMAKPWR], [wait], 10, 165+15, 90, 15
RADIOBUTTON #maker.makswitch, "Switch Card", [ChooseMAKSWI], [wait], 10, 180+15, 90, 15
RADIOBUTTON #maker.makdemo, "Demo Card", [wait], [wait], 10, 195+15, 90, 15
'Region Group
GROUPBOX #maker.regiongrp, "Region:", 188+38, 150+15, 62, 50
RADIOBUTTON #maker.regUS, "US", [US], [wait], 192+38, 165+15, 30, 15
RADIOBUTTON #maker.regJA, "Japan+", [Jap], [wait], 192+38, 180+15, 52, 15
'Other Options Group
GROUPBOX #maker.other, "Other:", 130, 150+15, 62+30, 40
CHECKBOX #maker.eWorldDeny, "Deny World-e", [eWorldDenyYES], [eWorldDenyNO], 135, 180, 85, 15
open "SMA4 eCard Maker v0.03" for window_nf as #maker
print #maker, "trapclose [quit]"
'Default Options
print #maker.pwrup, "selectindex 1"
print #maker.item, "set"
print #maker.oneUP, "1"
print #maker.oneUP, "!disable"
print #maker.makpwrup, "set"
print #maker.makdemo, "disable"
print #maker.regUS, "set"
print #maker.crdID, "0"
pwrupchoose=0
region=0
CARDMAKE=0
DenyE=0
print #maker.swicolor, "selectindex 1"
print #maker.swieffect, "selectindex 1"
print #maker.swicolor, "disable"
print #maker.swieffect, "disable"
'debug
print "Program Started."
wait
[quit]
close #maker
print "Program Stopped."
end
[eWorldDenyYES]
DenyE=1
wait
[eWorldDenyNO]
DenyE=0
wait
[ChooseMAKPWR]
CARDMAKE=0
print #maker.swicolor, "disable"
print #maker.swieffect, "disable"
print #maker.item, "enable"
print #maker.1up, "enable"
if pwrupchoose=0 then
gosub [pwrupitemradio]
else
gosub [pwrup1upradio]
end if
wait
[ChooseMAKSWI]
CARDMAKE=1
print #maker.swicolor, "enable"
print #maker.swieffect, "enable"
print #maker.item, "disable"
print #maker.1up, "disable"
if pwrupchoose=0 then
print #maker.pwrup, "disable"
else
print #maker.oneUP, "!disable"
end if
wait
[wait]
wait
[pwrup]
wait
[pwrupitemradio]
pwrupchoose=0
print #maker.oneUP, "!disable"
print #maker.pwrup, "enable"
wait
[pwrup1upradio]
pwrupchoose=1
print #maker.oneUP, "!enable"
print #maker.pwrup, "disable"
wait
[US]
region=0
wait
[Jap]
region=1
wait
[makecrd]
filedialog "Save SMA4 Card...", "*.bin", fileName$
if fileName$ <> "" then
print "Création du fichier..."
print #maker.crdID, "!contents? crdID$";
if crdID$="" then crdID$="0"
if CARDMAKE=0 then
if pwrupchoose=0 then
print #maker.pwrup, "selectionindex? makpwr$"
print makpwr$
gosub [MAKEPWRCARD]
end if
if pwrupchoose=1 then
print #maker.oneUP, "!contents? makpwr$"
print makpwr$
if val(makpwr$)>255 then
notice "Change your 1up numbers, not more than 255."
wait
else
gosub [MAKELIFECARD]
end if
end if
end if
if CARDMAKE=1 then
print #maker.swicolor, "selectionindex? makpwr$"
print #maker.swieffect, "selectionindex? makpwr2$"
gosub [MAKESWITCHCARD]
end if
wait
else
wait
end if
[MAKEPWRCARD]
open fileName$ for binary as #card
print "Fichier Crée"
print #card, chr$(hexdec("71")+region)+chr$(hexdec("F0"))+chr$(hexdec("10"))+chr$(hexdec("18"))+chr$(hexdec("22"))+chr$(hexdec("1a"))+chr$(0)+chr$(hexdec("02"))+chr$(0)+chr$(0)+chr$(0)+chr$(0)+"Super Mario Advance 4"+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+"Super Mario Advance 4"+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(val(crdID$))+chr$(6)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(1)+chr$(0)+chr$(DenyE)+chr$(val(makpwr$))
print "Insertion du header."
fill=hexdec("0f")
while loc(#card) < 2076
print #card, chr$(fill)
fill=fill+1
if fill = 256 then fill=0
wend
close #card
print "Terminé."
notice "Creating Power-up Card (Item) is a success."
wait
[MAKELIFECARD]
open fileName$ for binary as #card
print "Fichier Crée"
print #card, chr$(hexdec("71")+region)+chr$(hexdec("F0"))+chr$(hexdec("10"))+chr$(hexdec("18"))+chr$(hexdec("22"))+chr$(hexdec("18"))+chr$(0)+chr$(hexdec("02"))+chr$(0)+chr$(0)+chr$(0)+chr$(0)+"Super Mario Advance 4"+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+"Super Mario Advance 4"+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(val(crdID$))+chr$(6)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(1)+chr$(val(makpwr$))+chr$(0)+chr$(DenyE)
print "Insertion du header."
fill=hexdec("0e")
while loc(#card) < 2076
print #card, chr$(fill)
fill=fill+1
if fill = 256 then fill=0
wend
close #card
print "Terminé."
notice "Creating Power-up Card (1ups) is a success."
wait
[MAKESWITCHCARD]
open fileName$ for binary as #card
print "Fichier Crée"
print #card, chr$(hexdec("71")+region)+chr$(hexdec("F0"))+chr$(hexdec("10"))+chr$(hexdec("18"))+chr$(hexdec("22"))+chr$(hexdec("18"))+chr$(0)+chr$(hexdec("02"))+chr$(0)+chr$(0)+chr$(0)+chr$(0)+"Super Mario Advance 4"+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+"Super Mario Advance 4"+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(val(crdID$))+chr$(6)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(3)+chr$(val(makpwr$)-1)+chr$(0)+chr$(DenyE)+chr$(val(makpwr2$)-1)
print "Insertion du header."
fill=hexdec("0f")
while loc(#card) < 2076
print #card, chr$(fill)
fill=fill+1
if fill = 256 then fill=0
wend
close #card
print "Terminé."
notice "Creating Switch Card is a success."
wait
'Multi Item Window !
'-----------------------------------------------------
'*---------------------------------------------------*
[MultiItemWin]
WindowWidth = 300
WindowHeight = 340
BUTTON #multi.quit, " Quit ", [QuitMulti], LR, 52, 5
BUTTON #multi.makecrd, "Make the card !", [makemulticrd], LL, 82, 0-11
STATICTEXT #multi, "Card Identifier (0-255) :", 75, 8, 107, 15
TEXTBOX #multi.crdID, 185, 5, 30, 20
GROUPBOX #multi.options, "Multi Item Options", 5, 32, 175, 40
STATICTEXT #multi, "Number of Items (15 MAX) :", 10, 50, 133, 15
TEXTBOX #multi.number, 75+10+9+50, 47, 30, 20
GROUPBOX #multi.regiongrp, "Region:", 188+38, 150-150, 62, 50
RADIOBUTTON #multi.regUS, "US", [USm], [wait], 192+38, 165-150, 30, 15
RADIOBUTTON #multi.regJA, "Japan+", [Japm], [wait], 192+38, 180-150, 52, 15
GROUPBOX #multi.items, "Items", 5, 78, 270+13, 150+37
STATICTEXT #multi, "1", 10, 99, 6, 15
COMBOBOX #multi.item1, pwrup$(), [pwrup], 5+10+5-1, 95, 125, 15
STATICTEXT #multi, "2", 10+125+12, 99, 6, 15
COMBOBOX #multi.item2, pwrup$(), [pwrup], 5+10+5+125+12, 95, 125, 15
STATICTEXT #multi, "3", 10, 99+20, 6, 15
COMBOBOX #multi.item3, pwrup$(), [pwrup], 5+10+5-1, 95+20, 125, 15
STATICTEXT #multi, "4", 10+125+12, 99+20, 6, 15
COMBOBOX #multi.item4, pwrup$(), [pwrup], 5+10+5+125+12, 95+20, 125, 15
STATICTEXT #multi, "5", 10, 99+20+20, 6, 15
COMBOBOX #multi.item5, pwrup$(), [pwrup], 5+10+5-1, 95+20+20, 125, 15
STATICTEXT #multi, "6", 10+125+12, 99+20+20, 6, 15
COMBOBOX #multi.item6, pwrup$(), [pwrup], 5+10+5+125+12, 95+20+20, 125, 15
STATICTEXT #multi, "7", 10, 99+20+20+20, 6, 15
COMBOBOX #multi.item7, pwrup$(), [pwrup], 5+10+5-1, 95+20+20+20, 125, 15
STATICTEXT #multi, "8", 10+125+12, 99+20+20+20, 6, 15
COMBOBOX #multi.item8, pwrup$(), [pwrup], 5+10+5+125+12, 95+20+20+20, 125, 15
STATICTEXT #multi, "9", 10, 99+20+20+20+20, 6, 15
COMBOBOX #multi.item9, pwrup$(), [pwrup], 5+10+5-1, 95+20+20+20+20, 125, 15
STATICTEXT #multi, "10", 10+125+12-3, 99+20+20+20+20, 12, 15
COMBOBOX #multi.item10, pwrup$(), [pwrup], 5+10+5+125+12, 95+20+20+20+20, 125, 15
STATICTEXT #multi, "11", 10-3, 99+20+20+20+20+20, 12, 15
COMBOBOX #multi.item11, pwrup$(), [pwrup], 5+10+5-1, 95+20+20+20+20+20, 125, 15
STATICTEXT #multi, "12", 10+125+12-3, 99+20+20+20+20+20, 12, 15
COMBOBOX #multi.item12, pwrup$(), [pwrup], 5+10+5+125+12, 95+20+20+20+20+20, 125, 15
STATICTEXT #multi, "13", 10-3, 99+20+20+20+20+20+20, 12, 15
COMBOBOX #multi.item13, pwrup$(), [pwrup], 5+10+5-1, 95+20+20+20+20+20+20, 125, 15
STATICTEXT #multi, "14", 10+125+12-3, 99+20+20+20+20+20+20, 12, 15
COMBOBOX #multi.item14, pwrup$(), [pwrup], 5+10+5+125+12, 95+20+20+20+20+20+20, 125, 15
STATICTEXT #multi, "15", 10-3, 99+20+20+20+20+20+20+20, 12, 15
COMBOBOX #multi.item15, pwrup$(), [pwrup], 5+10+5-1, 95+20+20+20+20+20+20+20, 125, 15
open "Multi-Item (Power-Up Card)" for window_nf as #multi
print #multi, "trapclose [QuitMulti]"
print #multi.crdID, "0"
print #multi.number, "1"
print #multi.item1, "selectindex 1"
print #multi.item2, "selectindex 1"
print #multi.item3, "selectindex 1"
print #multi.item4, "selectindex 1"
print #multi.item5, "selectindex 1"
print #multi.item6, "selectindex 1"
print #multi.item7, "selectindex 1"
print #multi.item8, "selectindex 1"
print #multi.item9, "selectindex 1"
print #multi.item10, "selectindex 1"
print #multi.item11, "selectindex 1"
print #multi.item12, "selectindex 1"
print #multi.item13, "selectindex 1"
print #multi.item14, "selectindex 1"
print #multi.item15, "selectindex 1"
print #multi.regUS, "set"
regionm=0
wait
[QuitMulti]
close #multi
wait
[USm]
regionm=0
wait
[Japm]
regionm=1
wait
[makemulticrd]
filedialog "Save SMA4 Card...", "*.bin", fileName$
if fileName$ <> "" then
print "Création du fichier (multi)..."
print #multi.crdID, "!contents? crdID$";
print #multi.number, "!contents? numberitems";
if crdID$="" then crdID$="0"
if numberitems=0 then
notice "Hey ! No items on a Power-Up Card ?!"
wait
end if
if numberitems>=16 then
notice "Too much items !"
wait
end if
DIM makpwrmulti$(numberitems)
if numberitems>0 then
if numberitems>=1 then
print #multi.item1, "selectionindex? makpwr1$"
makpwrmulti$(1)=makpwr1$
if numberitems>=2 then
print #multi.item2, "selectionindex? makpwr2$"
makpwrmulti$(2)=makpwr2$
if numberitems>=3 then
print #multi.item3, "selectionindex? makpwr3$"
makpwrmulti$(3)=makpwr3$
if numberitems>=4 then
print #multi.item4, "selectionindex? makpwr4$"
makpwrmulti$(4)=makpwr4$
if numberitems>=5 then
print #multi.item5, "selectionindex? makpwr5$"
makpwrmulti$(5)=makpwr5$
if numberitems>=6 then
print #multi.item6, "selectionindex? makpwr6$"
makpwrmulti$(6)=makpwr6$
if numberitems>=7 then
print #multi.item7, "selectionindex? makpwr7$"
makpwrmulti$(7)=makpwr7$
if numberitems>=8 then
print #multi.item8, "selectionindex? makpwr8$"
makpwrmulti$(8)=makpwr8$
if numberitems>=9 then
print #multi.item9, "selectionindex? makpwr9$"
makpwrmulti$(9)=makpwr9$
if numberitems>=10 then
print #multi.item10, "selectionindex? makpwr10$"
makpwrmulti$(10)=makpwr10$
if numberitems>=11 then
print #multi.item11, "selectionindex? makpwr11$"
makpwrmulti$(11)=makpwr11$
if numberitems>=12 then
print #multi.item12, "selectionindex? makpwr12$"
makpwrmulti$(12)=makpwr12$
if numberitems>=13 then
print #multi.item13, "selectionindex? makpwr13$"
makpwrmulti$(13)=makpwr13$
if numberitems>=14 then
print #multi.item14, "selectionindex? makpwr14$"
makpwrmulti$(14)=makpwr14$
if numberitems=15 then
print #multi.item15, "selectionindex? makpwr15$"
makpwrmulti$(15)=makpwr15$
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
gosub [MAKEITEMSCARD]
end if
wait
[MAKEITEMSCARD]
open fileName$ for binary as #card
print "Fichier Crée"
print #card, chr$(hexdec("71")+regionm)+chr$(hexdec("F0"))+chr$(hexdec("10"))+chr$(hexdec("18"))+chr$(hexdec("22"))+chr$(hexdec("1a"))+chr$(0)+chr$(hexdec("02"))+chr$(0)+chr$(0)+chr$(0)+chr$(0)+"Super Mario Advance 4"+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+"Super Mario Advance 4"+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(val(crdID$))+chr$(6)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(numberitems)+chr$(0)+chr$(DenyE)
print "Insertion du header."
carditems=1
'for carditems = 1 to numberitems
while numberitems+1 > carditems
'makpwrmul2=val(makpwrmulti$(carditems))
print #card, chr$(val(makpwrmulti$(carditems)))
carditems=carditems+1
print makpwrmul2
wend
'next
fill=hexdec("0e")+numberitems
while loc(#card) < 2076
print #card, chr$(fill)
fill=fill+1
if fill = 256 then fill=0
wend
close #card
print "Terminé."
notice "Creating Power-up Card (Multi-Item) is a success."
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment