Skip to content

Instantly share code, notes, and snippets.

@charasyn
Created July 29, 2021 18:46
Show Gist options
  • Select an option

  • Save charasyn/6b3baf0090808483fac52d7df21cde49 to your computer and use it in GitHub Desktop.

Select an option

Save charasyn/6b3baf0090808483fac52d7df21cde49 to your computer and use it in GitHub Desktop.
import asm65816
// startup.ccs
// A script that skips the Onett Meteor sequence, as well as
// a new ASM patch that allows you to run a CCScript text block before
// the map is loaded.
////////////////////////////////////////////////////////////////////////////////
////// Setup CCScript stuff: "newgame" commands, hijacks and pointer overwrites
//// "Normal" CCScript commands
// Set Ness' initial position
newgame_location(7720, 360)
// Set the "Startup" text. This normally handles the whole
// Onett night-time flyover sequence.
newgame_startup(newgame_text_in_map)
//// New ASM patch that runs when a new game is created, but
//// before the map is loaded.
ROM[0xc1feb2] = {
// We just call the new text block.
MText(newgame_text_before_map)
BRA(0) // 2-byte no-op
// This skips the following:
// - Set flag 11
// - Disable NPCs
// So if you want those things, make sure to do them yourselves!
// Specifically, if you want to disable/enable NPCs, try this:
// https://github.com/pk-hack/CoilSnake/wiki/CCScript-Library#enabledisable-all-npcs-by-cooprocks123e
}
//// Change a text pointer that is always called after loading a
//// save file but before loading the map.
_asmptr(0xC1FF1C, always_text_before_map)
////////////////////////////////////////////////////////////////////////////////
////// Actual text
newgame_text_before_map:
// This is where you should set all your flags, especially if
// you are adjusting some that affect the map.
call(newgame_set_flags_to_post_meteor)
// If you want to display text, make sure to close all windows first,
// since a bunch are open from the final naming screen
window_closeall
window_open(1)
"@Newgame text before map!" next
window_closeall
eob
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 you want to show text:
window_open(1)
"@Always text before map!" next
window_closeall
eob
newgame_text_in_map:
// You probably want to save here!
// This is the equivalent
save
// If you want to show text:
window_open(1)
"@Newgame text in map!" next
window_closeall
eob
newgame_set_flags_to_post_meteor:
unset(flag 11) // Disable "peaceful mode"
set(flag 20) // 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?
eob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment