Skip to content

Instantly share code, notes, and snippets.

@charasyn
charasyn / helicopter.ccs
Created June 17, 2021 19:26
EarthBound movement script decompiler
// NPCs and Sprites used:
// TPT 989: Body ; Spr=410 ; Mov=711
// TPT 990: Main rotor ; Spr=420 ; Mov=8,713
// TPT 991: Tail rotor ; Spr=424 ; Mov=8,714
// TPT 992: Shadow ; Spr=230 ; Mov=704,715
// Spr 106: Coordinator ; Spr=106 ; Mov=712
/* Pokey text, triggered by movement 711 once players enter region
text_pokey:
unset(flag 522)
// floor_it_tessie.ccs
// v2 with audio changes
import movscr
// Tessie pt 1 tempo 0xecbfb3 is originally 0x13
// 2x = 0x26
// 3x = 0x39 <- Audio engine lags trying to play it faster than this
// 4x = 0x4c
ROM[0xecbfb3] = byte 0x32
// Truncate the first pattern in Tessie song
import asm65816
import cc_asmcall
command cc_disable_npcs cc_asmcall(asm_disable_npcs, RET_NONE)
command cc_enable_npcs cc_asmcall(asm_enable_npcs, RET_NONE)
command cc_check_npcs_disabled cc_asmcall(asm_check_npcs_disabled, RET_RESULT)
asm_disable_npcs: {
LDA_i(0x0001)
STA_a(0x4A66)
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
import asm65816
import ccexpand
import cc_asmcall
define SPRITE_GROUPING_PTR_TABLE = 0xEF133F
define SPRITE_GROUPING_PTR_TABLE_p2 = 0xEF1341
define SPRITEMAP_UNUSED_PTR = 0xabb0
define SPRITEMAP_PALETTE = 0xabb2
define SPRITEMAP_PALETTE_p2 = 0xabb4
@charasyn
charasyn / 1 expand_text_windows.ccs
Last active May 19, 2023 17:55
expand_text_windows.ccs
import asm65816
// expand_text_windows.ccs v2
// cooprocks123e, 2021-2022
// public domain
// v2:
// - fixes weird bug with Escargo Express, ATM, etc.
// thanks ShrineFox for reporting the bug!
// X,Y,W,H are (X-position, Y-position, Width, Height) in 8x8 tiles
// The screen's width and height are 32x28 tiles, but the outer tile probably won't be visible
// custom_windows_at_runtime.ccs - v1
// Allows you to open windows with variable sizes
// cooprocks123e 2021
import asm65816
import ccexpand
import cc_asmcall
import expand_text_windows
// Summary:
// custom_windows_standalone.ccs - v1
// Allows you to open 2 windows simultaneously with variable sizes
// Doesn't require expand_text_windows (hence the standalone part)
// cooprocks123e 2021
import asm65816
import ccexpand
import cc_asmcall
// Summary:
// Condense title screen letters together
// Useful if you are replacing the letters with your own graphics
// cooprocks123e, public domain
// Letter "E"
ROM[0xC422F8] = short -664 // Starting X pos
ROM[0xC422FB] = short 1187 // X velocity
ROM[0xC42301] = short 32 // Ending X pos
// Letter "A"
ROM[0xC42313] = short -504 // Starting X pos
@charasyn
charasyn / Block.py
Last active December 19, 2021 14:53
# CoilSnake code :) pls don't hurt me
import array
import copy
import os
from zlib import crc32
InvalidArgumentError = ValueError
OutOfBoundsError = ValueError
def check_range_validity(range, size):