Merge branch 'sprites'

This commit is contained in:
yenatch 2013-08-03 16:34:51 -04:00
commit a2242e1b9d
381 changed files with 59025 additions and 6045 deletions

View File

@ -6850,7 +6850,7 @@ Function0x365d7: ; 365d7
ld a, $5
call Function0x3661d
ld hl, $6d45
ld hl, BadgeStatBoosts
call CallBankF
call SwitchTurn
@ -8385,7 +8385,7 @@ BattleCommand98: ; 36f25
; doubleflyingdamage
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call CleanGetBattleVarPair
bit 6, a ; flying
bit SUBSTATUS_FLYING, a
ret z
jr DoubleDamage
; 36f2f
@ -8395,7 +8395,7 @@ BattleCommand99: ; 36f2f
; doubleundergrounddamage
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call CleanGetBattleVarPair
bit 5, a ; underground
bit SUBSTATUS_UNDERGROUND, a
ret z
; fallthrough

File diff suppressed because it is too large Load Diff

View File

@ -221,8 +221,22 @@ PREDEF_FLAG EQU $03
PREDEF_FILLPP EQU $05
PREDEF_ADDPARTYMON EQU $06
PREDEF_FILLSTATS EQU $0C
PREDEF_PRINT_MOVE_DESCRIPTION EQU $11
PREDEF_UPDATE_PLAYER_HUD EQU $12
PREDEF_FILL_BOX EQU $13
PREDEF_UPDATE_ENEMY_HUD EQU $15
PREDEF_FILL_IN_EXP_BAR EQU $17
PREDEF_FILLMOVES EQU $1B
PREDEF_GETUNOWNLETTER EQU $2D
PREDEF_GET_GENDER EQU $24
PREDEF_STATS_SCREEN EQU $25
PREDEF_DRAW_PLAYER_HP EQU $26
PREDEF_DRAW_ENEMY_HP EQU $27
PREDEF_GET_TYPE_NAME EQU $29
PREDEF_PRINT_MOVE_TYPE EQU $2A
PREDEF_PRINT_TYPE EQU $2B
PREDEF_GET_UNOWN_LETTER EQU $2D
PREDEF_LOAD_SGB_LAYOUT EQU $31
PREDEF_PARTYMON_ITEM_NAME EQU $3B
PREDEF_DECOMPRESS EQU $40
@ -247,6 +261,20 @@ D_UP EQU %01000000
D_DOWN EQU %10000000
; screen
HP_BAR_LENGTH EQU 6
HP_BAR_LENGTH_PX EQU 48
EXP_BAR_LENGTH EQU 8
EXP_BAR_LENGTH_PX EQU 64
SCREEN_WIDTH EQU 20
SCREEN_HEIGHT EQU 18
SCREEN_WIDTH_PX EQU 160
SCREEN_HEIGHT_PX EQU 144
TILE_WIDTH EQU 8
; movement
STEP_SLOW EQU 0
STEP_WALK EQU 1

View File

@ -1583,3 +1583,187 @@ EAST EQU 1
WEST EQU 2
SOUTH EQU 4
NORTH EQU 8
; sprites
SPRITE_CHRIS EQU $01
SPRITE_CHRIS_BIKE EQU $02
SPRITE_GAMEBOY_KID EQU $03
SPRITE_SILVER EQU $04
SPRITE_OAK EQU $05
SPRITE_RED EQU $06
SPRITE_BLUE EQU $07
SPRITE_BILL EQU $08
SPRITE_ELDER EQU $09
SPRITE_JANINE EQU $0a
SPRITE_KURT EQU $0b
SPRITE_MOM EQU $0c
SPRITE_BLAINE EQU $0d
SPRITE_REDS_MOM EQU $0e
SPRITE_DAISY EQU $0f
SPRITE_ELM EQU $10
SPRITE_WILL EQU $11
SPRITE_FALKNER EQU $12
SPRITE_WHITNEY EQU $13
SPRITE_BUGSY EQU $14
SPRITE_MORTY EQU $15
SPRITE_CHUCK EQU $16
SPRITE_JASMINE EQU $17
SPRITE_PRYCE EQU $18
SPRITE_CLAIR EQU $19
SPRITE_BROCK EQU $1a
SPRITE_KAREN EQU $1b
SPRITE_BRUNO EQU $1c
SPRITE_MISTY EQU $1d
SPRITE_LANCE EQU $1e
SPRITE_SURGE EQU $1f
SPRITE_ERIKA EQU $20
SPRITE_KOGA EQU $21
SPRITE_SABRINA EQU $22
SPRITE_COOLTRAINER_M EQU $23
SPRITE_COOLTRAINER_F EQU $24
SPRITE_BUG_CATCHER EQU $25
SPRITE_TWIN EQU $26
SPRITE_YOUNGSTER EQU $27
SPRITE_LASS EQU $28
SPRITE_TEACHER EQU $29
SPRITE_BUENA EQU $2a
SPRITE_SUPER_NERD EQU $2b
SPRITE_ROCKER EQU $2c
SPRITE_POKEFAN_M EQU $2d
SPRITE_POKEFAN_F EQU $2e
SPRITE_GRAMPS EQU $2f
SPRITE_GRANNY EQU $30
SPRITE_SWIMMER_GUY EQU $31
SPRITE_SWIMMER_GIRL EQU $32
SPRITE_BIG_SNORLAX EQU $33
SPRITE_SURFING_PIKACHU EQU $34
SPRITE_ROCKET EQU $35
SPRITE_ROCKET_GIRL EQU $36
SPRITE_NURSE EQU $37
SPRITE_LINK_RECEPTIONIST EQU $38
SPRITE_CLERK EQU $39
SPRITE_FISHER EQU $3a
SPRITE_FISHING_GURU EQU $3b
SPRITE_SCIENTIST EQU $3c
SPRITE_KIMONO_GIRL EQU $3d
SPRITE_SAGE EQU $3e
SPRITE_UNUSED_GUY EQU $3f
SPRITE_GENTLEMAN EQU $40
SPRITE_BLACK_BELT EQU $41
SPRITE_RECEPTIONIST EQU $42
SPRITE_OFFICER EQU $43
SPRITE_CAL EQU $44
SPRITE_SLOWPOKE EQU $45
SPRITE_CAPTAIN EQU $46
SPRITE_BIG_LAPRAS EQU $47
SPRITE_GYM_GUY EQU $48
SPRITE_SAILOR EQU $49
SPRITE_BIKER EQU $4a
SPRITE_PHARMACIST EQU $4b
SPRITE_MONSTER EQU $4c
SPRITE_FAIRY EQU $4d
SPRITE_BIRD EQU $4e
SPRITE_DRAGON EQU $4f
SPRITE_BIG_ONIX EQU $50
SPRITE_N64 EQU $51
SPRITE_SUDOWOODO EQU $52
SPRITE_SURF EQU $53
SPRITE_POKE_BALL EQU $54
SPRITE_POKEDEX EQU $55
SPRITE_PAPER EQU $56
SPRITE_VIRTUAL_BOY EQU $57
SPRITE_OLD_LINK_RECEPTIONIST EQU $58
SPRITE_ROCK EQU $59
SPRITE_BOULDER EQU $5a
SPRITE_SNES EQU $5b
SPRITE_FAMICOM EQU $5c
SPRITE_FRUIT_TREE EQU $5d
SPRITE_GOLD_TROPHY EQU $5e
SPRITE_SILVER_TROPHY EQU $5f
SPRITE_KRIS EQU $60
SPRITE_KRIS_BIKE EQU $61
SPRITE_KURT_OUTSIDE EQU $62
SPRITE_SUICUNE EQU $63
SPRITE_ENTEI EQU $64
SPRITE_RAIKOU EQU $65
SPRITE_STANDING_YOUNGSTER EQU $66
SPRITE_POKEMON EQU $80
SPRITE_UNOWN EQU $80
SPRITE_GEODUDE EQU $81
SPRITE_GROWLITHE EQU $82
SPRITE_WEEDLE EQU $83
SPRITE_SHELLDER EQU $84
SPRITE_ODDISH EQU $85
SPRITE_GENGAR EQU $86
SPRITE_ZUBAT EQU $87
SPRITE_MAGIKARP EQU $88
SPRITE_SQUIRTLE EQU $89
SPRITE_TOGEPI EQU $8a
SPRITE_BUTTERFREE EQU $8b
SPRITE_DIGLETT EQU $8c
SPRITE_POLIWAG EQU $8d
SPRITE_PIKACHU EQU $8e
SPRITE_CLEFAIRY EQU $8f
SPRITE_CHARMANDER EQU $90
SPRITE_JYNX EQU $91
SPRITE_STARMIE EQU $92
SPRITE_BULBASAUR EQU $93
SPRITE_JIGGLYPUFF EQU $94
SPRITE_GRIMER EQU $95
SPRITE_EKANS EQU $96
SPRITE_PARAS EQU $97
SPRITE_TENTACOOL EQU $98
SPRITE_TAUROS EQU $99
SPRITE_MACHOP EQU $9a
SPRITE_VOLTORB EQU $9b
SPRITE_LAPRAS EQU $9c
SPRITE_RHYDON EQU $9d
SPRITE_MOLTRES EQU $9e
SPRITE_SNORLAX EQU $9f
SPRITE_GYARADOS EQU $a0
SPRITE_LUGIA EQU $a1
SPRITE_HO_OH EQU $a2
SPRITE_DAYCARE_MON_1 EQU $e0
SPRITE_DAYCARE_MON_2 EQU $e1
SPRITE_VARS EQU $f0
SPRITE_CONSOLE EQU $f0
SPRITE_DOLL_1 EQU $f1
SPRITE_DOLL_2 EQU $f2
SPRITE_BIG_DOLL EQU $f3
SPRITE_WEIRD_TREE EQU $f4
SPRITE_OLIVINE_RIVAL EQU $f5
SPRITE_AZALEA_ROCKET EQU $f6
SPRITE_FUSCHIA_GYM_1 EQU $f7
SPRITE_FUSCHIA_GYM_2 EQU $f8
SPRITE_FUSCHIA_GYM_3 EQU $f9
SPRITE_FUSCHIA_GYM_4 EQU $fa
SPRITE_COPYCAT EQU $fb
SPRITE_JANINE_IMPERSONATOR EQU $fc
; sprite types
WALKING_SPRITE EQU 1
STANDING_SPRITE EQU 2
STILL_SPRITE EQU 3
; sprite palettes
PAL_OW_RED EQU 0
PAL_OW_BLUE EQU 1
PAL_OW_GREEN EQU 2
PAL_OW_BROWN EQU 3
PAL_OW_PINK EQU 4
PAL_OW_SILVER EQU 5
PAL_OW_TREE EQU 6
PAL_OW_ROCK EQU 7
; permissions
TOWN EQU 1
ROUTE EQU 2
INDOOR EQU 3
CAVE EQU 4
GATE EQU 6
DUNGEON EQU 7

View File

@ -149,7 +149,7 @@ SFX_POKEFLUTE EQU $26
SFX_ELEVATOR_END EQU $27
SFX_THROW_BALL EQU $28
SFX_BALL_POOF EQU $29
SFX_UNKNOWN_3A EQU $2a
SFX_UNKNOWN_2A EQU $2a
SFX_RUN EQU $2b
SFX_SLOT_MACHINE_START EQU $2c
SFX_FANFARE EQU $2d
@ -254,7 +254,7 @@ SFX_MORNING_SUN EQU $8f
SFX_LEVEL_UP EQU $90
SFX_KEY_ITEM EQU $91
SFX_FANFARE_2 EQU $92
SFX_REGISTER_PHONE_# EQU $93
SFX_REGISTER_PHONE_NUMBER EQU $93
SFX_3RD_PLACE EQU $94
SFX_GET_EGG_FROM_DAYCARE_MAN EQU $95
SFX_GET_EGG_FROM_DAYCARE_LADY EQU $96

View File

@ -103,7 +103,7 @@ Joypad: ; 935
; For example, soft reset:
and BUTTON_A | BUTTON_B | SELECT | START
cp BUTTON_A | BUTTON_B | SELECT | START
jp z, $0150 ; reset
jp z, Reset
ret
; 984

829
engine/movement.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@ -485,11 +485,11 @@ Script_verbosegiveitem: ; 0x96f60
; item (ItemLabelByte)
; quantity (DecimalParam)
call $77ca
call Script_giveitem
call CurItemName
ld de, StringBuffer1
ld a, $1
call $76c8
call Function976c8
ld b, BANK(GiveItemScript)
ld de, GiveItemScript
jp ScriptCall
@ -535,7 +535,7 @@ Script_verbosegiveitem2: ; 0x96f8e
.asm_96f98
ld [$d106], a
call GetScriptByte
call $769e
call Unknown_0x9769e
ld a, [de]
ld [$d10c], a
ld hl, $d892
@ -548,7 +548,7 @@ Script_verbosegiveitem2: ; 0x96f8e
call CurItemName
ld de, StringBuffer1
ld a, $1
call $76c8
call Function976c8
ld b, BANK(GiveItemScript)
ld de, GiveItemScript
jp ScriptCall
@ -1021,6 +1021,9 @@ Script_applymovement: ; 0x971f3
call GetScriptByte
call Unknown_0x971e3
ld c, a
; 971fa
Function971fa: ; 971fa
push bc
ld a, c
ld a, $1
@ -1028,7 +1031,7 @@ Script_applymovement: ; 0x971f3
rst $8
pop bc
push bc
call $7221
call Unknown_0x97221
pop bc
call GetScriptByte
ld l, a
@ -1058,7 +1061,7 @@ Script_applymovement2: ; 0x97228
ld a, [$ffe0]
ld c, a
jp $71fa
jp Function971fa
; 0x9722e
Script_faceplayer: ; 0x9722e
@ -1079,7 +1082,7 @@ Script_faceplayer: ; 0x9722e
ld e, a
ld a, [$ffe0]
ld d, a
call $728b
call Unknown_0x9728b
ret
; 0x97248
@ -1114,7 +1117,7 @@ Script_faceperson: ; 0x97248
add a
ld e, a
ld d, c
call $728b
call Unknown_0x9728b
ret
; 0x97274
@ -1135,7 +1138,7 @@ Script_spriteface: ; 0x97274
add a
add a
ld e, a
call $728b
call Unknown_0x9728b
ret
; 0x9728b
@ -1161,7 +1164,7 @@ Unknown_0x9728b: ; 0x9728b
ld hl, $d0ed
bit 6, [hl]
jr nz, .asm_972b5 ; 0x972b0 $3
call $72bc
call Unknown_0x972bc
.asm_972b5
call $1ad2
ret
@ -1173,7 +1176,7 @@ Unknown_0x9728b: ; 0x9728b
Unknown_0x972bc: ; 0x972bc
call $217a
ld hl, $c4a0
ld hl, TileMap
ld bc, $0168
.asm_972c5
res 7, [hl]
@ -1211,7 +1214,7 @@ Script_appear: ; 0x972dd
call $1956
ld a, [$ffaf]
ld b, $0
call $730b
call Unknown_0x9730b
ret
; 0x972ee
@ -1229,7 +1232,7 @@ Script_disappear: ; 0x972ee
call $199f
ld a, [$ffaf]
ld b, $1
call $730b
call Unknown_0x9730b
ld a, $1
ld hl, $5920
rst $8
@ -1543,9 +1546,7 @@ Script_returnafterbattle: ; 0x97459
jr z, .asm_9748e ; 0x97481 $b
ld b, $24
ld de, $4255
ld a, $25
ld hl, $7c4f
rst $8
callba Function97c4f
.asm_9748e
jp Script_reloadmap
; 0x97491
@ -1978,7 +1979,7 @@ Script_random: ; 0x97640
and a
ret z
ld c, a
call $7673
call Unknown_0x97673
and a
jr z, .asm_9765f ; 0x9764d $10
ld b, a
@ -2027,7 +2028,7 @@ Script_checkcode: ; 0x9767d
; variable_id (SingleByteParam)
call GetScriptByte
call $769e
call Unknown_0x9769e
ld a, [de]
ld [$c2dd], a
ret
@ -2039,7 +2040,7 @@ Script_writevarcode: ; 0x97688
; variable_id (SingleByteParam)
call GetScriptByte
call $769e
call Unknown_0x9769e
ld a, [$c2dd]
ld [de], a
ret
@ -2052,7 +2053,7 @@ Script_writecode: ; 0x97693
; value (SingleByteParam)
call GetScriptByte
call $769e
call Unknown_0x9769e
call GetScriptByte
ld [de], a
ret
@ -2096,9 +2097,12 @@ Script_pokenamemem: ; 0x976ae
Unknown_976c0: ; 0x976c0
call GetScriptByte
cp $3
jr c, .asm_976c8 ; 0x976c5 $1
jr c, .asm_976c8
xor a
.asm_976c8
; 976c8
Function976c8: ; 976c8
ld hl, StringBuffer3
ld bc, 19
call AddNTimes
@ -2197,8 +2201,8 @@ Script_readmoney: ; 0x97732
; account (SingleByteParam)
; memory (SingleByteParam)
call $7771
call $7861
call Unknown_0x97771
call Unknown_0x97861
ld hl, StringBuffer1
ld bc, $4306
call $3198
@ -2211,7 +2215,7 @@ Script_readcoins: ; 0x97747
; parameters:
; memory (SingleByteParam)
call $7771
call Unknown_0x97771
ld hl, StringBuffer1
ld de, $d855
ld bc, $4206
@ -2225,7 +2229,7 @@ Script_RAM2MEM: ; 0x9775c
; parameters:
; memory (SingleByteParam)
call $7771
call Unknown_0x97771
ld de, $c2dd
ld hl, StringBuffer1
ld bc, $4103
@ -2372,8 +2376,8 @@ Script_givemoney: ; 0x97829
; account (SingleByteParam)
; money (MoneyByteParam)
call $7861
call $786d
call Unknown_0x97861
call Unknown_0x9786d
ld a, $5
ld hl, $5fd7
rst $8
@ -2386,8 +2390,8 @@ Script_takemoney: ; 0x97836
; account (SingleByteParam)
; money (MoneyByteParam)
call $7861
call $786d
call Unknown_0x97861
call Unknown_0x9786d
ld a, $5
ld hl, $5ffa
rst $8
@ -2400,8 +2404,8 @@ Script_checkmoney: ; 0x97843
; account (SingleByteParam)
; money (MoneyByteParam)
call $7861
call $786d
call Unknown_0x97861
call Unknown_0x9786d
ld a, $5
ld hl, $600b
rst $8
@ -2451,7 +2455,7 @@ Script_givecoins: ; 0x97881
; parameters:
; coins (CoinByteParam)
call $78a0
call Function978a0
ld a, $5
ld hl, $606f
rst $8
@ -2463,7 +2467,7 @@ Script_takecoins: ; 0x9788b
; parameters:
; coins (CoinByteParam)
call $78a0
call Function978a0
ld a, $5
ld hl, $608f
rst $8
@ -2475,11 +2479,14 @@ Script_checkcoins: ; 0x97895
; parameters:
; coins (CoinByteParam)
call $78a0
call Function978a0
ld a, $5
ld hl, $60a1
rst $8
jr Unknown_9784f ; 0x9789e $af
jr Unknown_9784f
; 978a0
Function978a0: ; 978a0
call GetScriptByte
ld [$ffc4], a
call GetScriptByte
@ -2718,7 +2725,7 @@ Script_setbit2: ; 0x979bb
call GetScriptByte
ld d, a
ld b, $1
call $79ee
call Unknown_0x979ee
ret
; 0x979c9
@ -2732,7 +2739,7 @@ Script_clearbit2: ; 0x979c9
call GetScriptByte
ld d, a
ld b, $0
call $79ee
call Unknown_0x979ee
ret
; 0x979d7
@ -2746,7 +2753,7 @@ Script_checkbit2: ; 0x979d7
call GetScriptByte
ld d, a
ld b, $2
call $79ee
call Unknown_0x979ee
ld a, c
and a
jr z, .asm_979ea ; 0x979e6 $2
@ -2897,9 +2904,7 @@ Script_writecmdqueue: ; 0x97a8b
ld d, a
ld a, [ScriptBank]
ld b, a
ld a, $25
ld hl, $7e31
rst $8
callba Function97e31
ret
; 0x97a9e
@ -2912,9 +2917,7 @@ Script_delcmdqueue: ; 0x97a9e
ld [$c2dd], a
call GetScriptByte
ld b, a
ld a, $25
ld hl, $7e5c
rst $8
callba Function97e5c
ret c
ld a, $1
ld [$c2dd], a
@ -2976,16 +2979,12 @@ Script_warpcheck: ; 0x97af6
call $224a
ret nc
ld a, $25
ld hl, $66d0
rst $8
callba Function966d0
ret
; 0x97b01
Unknown_0x97b01: ; 0x97b01
ld a, $25
ld hl, $66d0
rst $8
callba Function966d0
ret
; 0x97b08
@ -3005,7 +3004,7 @@ Script_newloadmap: ; 0x97b08
Script_reloadandreturn: ; 0x97b16
; script command 0x92
call $7b08
call Script_newloadmap
jp Script_end
; 0x97b1c
@ -3203,8 +3202,9 @@ Script_credits: ; 0x97bf3
ld hl, $6455
rst $8
; fallthrough
DisplayCredits:
call $7bc0
call Script_resetfuncs
ld a, $3
call $261b
call StopScript

View File

@ -146,12 +146,12 @@ VBlank0: ; 2b1
xor a
ld [VBlankOccurred], a
; dec $cfb1 until 0
ld a, [$cfb1]
; dec OverworldDelay until 0
ld a, [OverworldDelay]
and a
jr z, .textdelay
dec a
ld [$cfb1], a
ld [OverworldDelay], a
.textdelay
; dec text delay counter until 0

View File

@ -270,6 +270,7 @@ jap_chars.update({
0xE1: "",
0xE2: "",
0xE3: "",
0xE9: "",
})
#some of the japanese characters can probably fit into the english table

View File

@ -1993,7 +1993,7 @@ movement_command_bases = {
0x45: "accelerate_last",
0x46: ["step_sleep", ["duration", DecimalParam]],
0x47: "step_end",
0x49: "hide_person",
0x49: "remove_person",
# do these next two have any params ??
0x4C: "teleport_from",
@ -2811,7 +2811,7 @@ pksv_crystal_more = {
0x8F: ["ptpriorityjump", ["pointer", ScriptPointerLabelParam]],
0x90: ["return"],
0x91: ["end"],
0x92: ["reloadandreturn"],
0x92: ["reloadandreturn", ["which_method", SingleByteParam]],
0x93: ["resetfuncs"],
0x94: ["pokemart", ["dialog_id", SingleByteParam], ["mart_id", MultiByteParam]], # maybe it should be a pokemark constant id/label?
0x95: ["elevator", ["floor_list_pointer", PointerLabelParam]],

View File

@ -293,11 +293,8 @@ pksv_crystal = {
}
#these cause the script to end; used in create_command_classes
pksv_crystal_more_enders = [0x03, 0x04, 0x05, 0x0C, 0x51, 0x52,
0x53, 0x8D, 0x8F, 0x90, 0x91, 0x92,
0x9B,
0xB2, #maybe?
0xCC, #maybe?
pksv_crystal_more_enders = [0x03, 0x04, 0x05, 0x0C, 0x51, 0x52, 0x53,
0x65, 0x8D, 0x8F, 0x90, 0x91, 0x92, 0x9B,
0x9A, # describedecoration
]

View File

@ -1,54 +1,100 @@
# -*- coding: utf-8 -*-
# coding: utf-8
import os
import sys
import json
# from crystal import load_rom
# from gbz80disasm import load_labels
def make_sym_from_json(filename = '../pokecrystal.sym', j = 'labels.json'):
# todo: delete and remake labels.json at runtime
with open(filename, 'w') as sym:
for label in json.load(open(j)):
sym.write('{0:x}:{1:x} {2}\n'.format(label['bank'], label['address']%0x4000 + (0x4000 if label['bank'] else 0), label['label']))
def make_sym_from_mapfile(filename = '../pokecrystal.sym', mapfile = '../mapfile.txt'):
# todo: sort label definitions by address
output = ''
# get label definitions
with open(mapfile,'r') as map:
labels = json.load(open(j))
for label in labels:
output += '{0:x}:{1:x} {2}\n'.format(label['bank'], label['address'], label['label'])
with open(filename, 'w') as sym:
sym.write(output)
def make_json_from_mapfile(filename = 'labels.json', mapfile = '../pokecrystal.map'):
output = []
labels = filter_wram_addresses(read_mapfile(mapfile))
with open(filename, 'w') as out:
out.write(json.dumps(labels))
def read_mapfile(filename = '../pokecrystal.map'):
"""
Scrape label addresses from an rgbds mapfile.
"""
labels = []
with open(filename,'r') as map:
lines = map.readlines()
for line in lines:
# bank #
if 'Bank #' in line:
cur_bank = int(line.lstrip('Bank #').strip(':\n').strip(' (HOME)'))
# label definition
elif '=' in line:
thing = line.split('=')
spacing = ' ' * 11 # arbitrary
addr = int(thing[0].lstrip(spacing)[1:5],16)
# rgbds doesn't support wram banks yet,
# so this hack is applied instead
if addr > 0xbfff: # 0xc000+ (wram only)
cur_bank = 0
if addr > 0xcfff: # 0xd000+ (wram only)
cur_bank = 1
# convert to sym format (bank:addr label)
label = thing[1].strip('\n')
output += hex(cur_bank)[2:] + ':' + hex(addr)[2:] + ' ' + label + '\n'
for line in lines:
# bank #
if 'Bank #' in line:
cur_bank = int(line.lstrip('Bank #').strip(':\n').strip(' (HOME)'))
# label definition
elif '=' in line:
address, label = line.split('=')
address = int(address.lstrip().replace('$','0x'), 16)
label = label.strip()
# rgbds doesn't support ram banks yet
bank = cur_bank
offset = address
if 0x8000 <= address < 0xa000:
bank = 0
elif 0xa000 <= address < 0xc000:
bank = 0
elif 0xc000 <= address < 0xd000:
bank = 0
elif 0xd000 <= address < 0xe000:
bank = 0
else:
offset += (bank * 0x4000 - 0x4000) if bank > 0 else 0
labels += [{
'label': label,
'bank': bank,
'address': offset,
'offset': offset,
'local_address': address,
}]
return labels
def filter_wram_addresses(labels):
filtered_labels = []
for label in labels:
if label['local_address'] < 0x8000:
filtered_labels += [label]
return filtered_labels
def make_sym_from_mapfile(filename = '../pokecrystal.sym'):
# todo: sort label definitions by address
output = ''
labels = read_mapfile()
# convert to sym format (bank:addr label)
for label in labels:
output += '%.2x:%.4x %s\n' % (label['bank'], label['address'], label['label'])
# dump contents to symfile
with open(filename, 'w') as sym:
sym.write(output)
if __name__ == "__main__":
# default behavior: generate sym file from rgbds mapfile
try: make_sym_from_mapfile()
# if no mapfile exists, generate from labels.json
except: make_sym_from_json()
#if os.path.exists('../pokecrystal.sym'):
# sys.exit()
#elif os.path.exists('../pokecrystal.map'):
# make_sym_from_mapfile()
#elif os.path.exists('labels.json'):
# make_sym_from_json()
make_json_from_mapfile()

BIN
gfx/frames/1.1bpp Normal file

Binary file not shown.

BIN
gfx/frames/2.1bpp Normal file

Binary file not shown.

BIN
gfx/frames/3.1bpp Normal file

Binary file not shown.

BIN
gfx/frames/4.1bpp Normal file

Binary file not shown.

BIN
gfx/frames/5.1bpp Normal file

Binary file not shown.

BIN
gfx/frames/6.1bpp Normal file

Binary file not shown.

BIN
gfx/frames/7.1bpp Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More