Skip to content

Instantly share code, notes, and snippets.

@charasyn
Created August 8, 2023 20:17
Show Gist options
  • Save charasyn/d102e6e9a170766c1452dc5de0175b3d to your computer and use it in GitHub Desktop.
Save charasyn/d102e6e9a170766c1452dc5de0175b3d to your computer and use it in GitHub Desktop.
Earthbound Intro.ccs upgrade to support setting flags before loading the map
//The flyover sequence uses warps 150 and 151 by default
//Warp coordinates can be changed in teleport_destination_table.yml
//Flyover Text
Flyover1:
"[02 0C][01 32]The year is 199X[09][00]"
Flyover2:
"[02 0C][01 0C]Onett, a small town in Eagleland[09][00]"
Flyover3:
"[02 0C][01 3D][08 01]'s house[09][00]"
//Setup stuff
newgame_location (2112, 1768) //Should be the same coordinates as flyover1mov
newgame_startup (Intro)
//These two commands control the coordinates of the first two flyovers, and the direction they move in
//For directions, 0 is north, 1 is northeast, 2 is east, etc.
flyover1mov (2112, 1768, 7) //First two numbers should be the same coordinates as newgame_location
flyover2mov (2000, 1424, 1) //First two numbers should be same as the coordinates of Warp 150, multiplied by 8
//This command controls the starting coordinates of the third flyover
flyover3start (2664, 888) //Should be same as the coordinates of Warp 151, multiplied by 8
//This command controls the coordinates the third flyover will move to
flyover3mov (2664, 336)
//Intro string
Intro:
hide_party
gen_sprite (106, 476, 1) //Activates first flyover
call (0xc9b4b8)
warp (150) //Warps to initial coordinates of flyover 2
gen_sprite (106, 477, 1) //Activates first flyover
call (0xc9b4b8)
warp (151) //Warps to initial coordinates of flyover 3
gen_sprite (106, 478, 1) //Activates first flyover
call (0xc9b4b8)
warp (0xC4) //Warps to Ness's room
show_party (1)
eob
// IntroFlags will be called before entering the map,
// only when flg_IntroDone is clear.
define flg_IntroDone = 20
IntroFlags:
set(flg_IntroDone) // Picky joined your party. Never unset
set(flag 34) // Post Starman Jr / Picky left party. Never unset
set(flag 94) // Seems to fix your mom
unset(flag 95) // Makes phones work (might already be unset)
set(flag 98) // Makes Ness's phone specifically work
set(flag 100) // King doesn't want to go outside
set(flag 104) // Pokey/Picky punished, first day events cleaned up
unset(flag 107) // When on, primes sunrise transition exiting Pokey's house
set(flag 199) // Know how to call Ness's dad
set(flag 200) // Know how to call Ness's mom
set(flag 209) // Onett warp - necessary to have correct Mom text
set(flag 375) // Most Onett townsfolk
set(flag 422) // Onett daytime palette
set(flag 469) // Suppresses the day 1 townsfolk
unset(flag 476) // Onett roadblocks
unset(flag 477) // Ness head in his room
set(flag 517) // Ness's house's lights are on
unset(flag 532) // No meteor sound in Ness' house
unset(flag 533) // No meteor sound in Ness' room
unset(flag 749) // No pajamas?
unset(flag 11) // Disable "peaceful mode"
eob
///////////////////////////////////////////////////////////////////////////////
//// DON'T EDIT ANYTHING BELOW
//// New stuff relating to setting flags
// Change a text pointer that is always called after loading a
// save file but before loading the map.
_asmptr(0xC1FF1C, always_text_before_map)
always_text_before_map:
// Unset flag indicating that you just slept in a hotel.
// If this is set, it will play the Good Morning music,
// and you won't be able to sleep in the hotel again (without leaving).
unset(flag 383)
// If flag 20 is clear, go to IntroFlags
"[07 {short flg_IntroDone}][1B 02 {long IntroFlags}]"
eob
//New commands
command e(label) "{long label}"
command gen_sprite (sprite, move, style) "[1F 15 {short sprite} {short move} {byte style}]"
command flyover1mov (x, y, direction) {
ROM[0xC3ABEE] = "{short x}"
ROM[0xC3ABF1] = "{short y}"
ROM[0xC3AC06] = "{byte direction}"
}
command flyover2mov (x, y, direction) {
ROM[0xC3AC28] = "{short x}"
ROM[0xC3AC2B] = "{short y}"
ROM[0xC3AC40] = "{byte direction}"
}
command flyover3start (x, y) {
ROM[0xC3AC62] = "{short x}"
ROM[0xC3AC65] = "{short y}"
}
command flyover3mov (x, y) {
ROM[0xC3AC85] = "{short x}"
ROM[0xC3AC89] = "{short y}"
}
//Rom Locations
ROM[0xC49EA4] = "[{e(Flyover1)}]"
ROM[0xC49EA8] = "[{e(Flyover2)}]"
ROM[0xC49EAC] = "[{e(Flyover3)}]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment