Merge branch 'master' into work9

This commit is contained in:
luckytyphlosion 2024-09-30 19:10:37 -04:00 committed by GitHub
commit e1eeb8862b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
120 changed files with 16262 additions and 15532 deletions

View File

@ -5,6 +5,9 @@ ifeq (compare,$(MAKECMDGOALS))
COMPARE := 1
endif
# Default make rule
all: rom
# don't use dkP's base_tools anymore
# because the redefinition of $(CC) conflicts
# with when we want to use $(CC) to preprocess files
@ -70,6 +73,10 @@ CPP := $(PREFIX)cpp
LD := $(PREFIX)ld
OBJCOPY := $(PREFIX)objcopy
# Variable filled out in other make files
AUTO_GEN_TARGETS :=
include make_tools.mk
SHA1SUM := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c
GBAGFX := tools/gbagfx/gbagfx$(EXE)
RSFONT := tools/rsfont/rsfont$(EXE)
@ -106,6 +113,7 @@ ELF := $(ROM:%.gba=%.elf)
SYM := $(ROM:%.gba=%.sym)
BUILD_DIR := build/$(BUILD_NAME)
DATA_ASM_SUBDIR = data
C_SOURCES := $(wildcard src/*.c src/*/*.c src/*/*/*.c)
ASM_SOURCES := $(wildcard src/*.s src/*/*.s asm/*.s data/*.s sound/*.s sound/*/*.s)
@ -151,14 +159,15 @@ ALL_BUILDS := ruby ruby_debug ruby_rev1 ruby_rev2 sapphire sapphire_debug sapphi
MODERN_BUILDS := $(ALL_BUILDS:%=%_modern)
# Available targets
.PHONY: all clean mostlyclean tidy tools syms $(ALL_BUILDS)
.PHONY: all clean tidy syms $(ALL_BUILDS)
infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line))))
# Build tools when building the rom
# Disable dependency scanning for clean/tidy/tools
ifeq (,$(filter-out all modern compare syms,$(MAKECMDGOALS)))
$(call infoshell, $(MAKE) tools)
$(call infoshell, $(MAKE) -f make_tools.mk)
$(call infoshell, $(MAKE) generated)
else
NODEP := 1
endif
@ -184,18 +193,19 @@ MAKEFLAGS += --no-print-directory
# Create build subdirectories
$(shell mkdir -p $(SUBDIRS))
AUTO_GEN_TARGETS :=
# Pretend rules that are actually flags defer to `make all`
modern: all
compare: all
all: $(ROM)
# Other rules
rom: $(ROM)
ifeq ($(COMPARE),1)
@$(SHA1SUM) $(BUILD_NAME).sha1
endif
compare: ; @$(MAKE) COMPARE=1
syms: $(SYM)
mostlyclean: tidy
clean: tidy
find sound/direct_sound_samples \( -iname '*.bin' \) -exec rm {} +
$(RM) $(ALL_OBJECTS)
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' \) -exec rm {} +
@ -204,31 +214,6 @@ mostlyclean: tidy
find data/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} +
rm -f $(AUTO_GEN_TARGETS)
clean: mostlyclean
$(MAKE) clean -C tools/gbagfx
$(MAKE) clean -C tools/scaninc
$(MAKE) clean -C tools/preproc
$(MAKE) clean -C tools/bin2c
$(MAKE) clean -C tools/rsfont
$(MAKE) clean -C tools/aif2pcm
$(MAKE) clean -C tools/ramscrgen
$(MAKE) clean -C tools/gbafix
$(MAKE) clean -C tools/mapjson
$(MAKE) clean -C tools/jsonproc
tools:
@$(MAKE) -C tools/gbagfx
@$(MAKE) -C tools/scaninc
@$(MAKE) -C tools/preproc
@$(MAKE) -C tools/bin2c
@$(MAKE) -C tools/rsfont
@$(MAKE) -C tools/aif2pcm
@$(MAKE) -C tools/ramscrgen
@$(MAKE) -C tools/mid2agb
@$(MAKE) -C tools/gbafix
@$(MAKE) -C tools/mapjson
@$(MAKE) -C tools/jsonproc
tidy:
$(RM) $(ALL_BUILDS:%=poke%{.gba,.elf,.map})
$(RM) $(MODERN_BUILDS:%=poke%{.gba,.elf,.map})
@ -323,6 +308,8 @@ include override.mk
include map_data_rules.mk
include json_data_rules.mk
generated: $(AUTO_GEN_TARGETS)
%.1bpp: %.png ; $(GBAGFX) $< $@ $(GFX_OPTS)
%.4bpp: %.png ; $(GBAGFX) $< $@ $(GFX_OPTS)
%.8bpp: %.png ; $(GBAGFX) $< $@ $(GFX_OPTS)

View File

@ -9,28 +9,7 @@ It builds the following roms:
To set up the repository, see [INSTALL.md](INSTALL.md).
## See also
For contacts and other pret projects, see [pret.github.io](https://pret.github.io/).
* Disassembly of [**Pokémon Red/Blue**][pokered]
* Disassembly of [**Pokémon Yellow**][pokeyellow]
* Disassembly of [**Pokémon Gold**][pokegold]
* Disassembly of [**Pokémon Crystal**][pokecrystal]
* Disassembly of [**Pokémon Pinball**][pokepinball]
* Disassembly of [**Pokémon TCG**][poketcg]
* Disassembly of [**Pokémon Fire Red**][pokefirered]
* Disassembly of [**Pokémon Emerald**][pokeemerald]
* Discord: [**pret**][Discord]
* irc: **irc.libera.net** [**#pret**][irc]
[pokered]: https://github.com/pret/pokered
[pokeyellow]: https://github.com/pret/pokeyellow
[pokegold]: https://github.com/pret/pokegold
[pokecrystal]: https://github.com/pret/pokecrystal
[pokepinball]: https://github.com/pret/pokepinball
[poketcg]: https://github.com/pret/poketcg
[pokefirered]: https://github.com/pret/pokefirered
[pokeemerald]: https://github.com/pret/pokeemerald
[Discord]: https://discord.gg/d5dubZ3
[irc]: https://web.libera.chat/?#pret
[travis]: https://travis-ci.org/pret/pokeruby
[travis-badge]: https://travis-ci.org/pret/pokeruby.svg?branch=master

View File

@ -660,11 +660,11 @@ gStdScripts_End::
.include "data/maps/AbandonedShip_Corridors_1F/text.inc"
.include "data/maps/AbandonedShip_Rooms_1F/text.inc"
.include "data/maps/AbandonedShip_Corridors_B1F/text.inc"
.include "data/maps/AbandonedShip_HiddenFloorCorridors/text.inc"
.include "data/maps/AbandonedShip_Rooms_B1F/text.inc"
.include "data/maps/AbandonedShip_Rooms2_B1F/text.inc"
.include "data/maps/AbandonedShip_Rooms2_1F/text.inc"
.include "data/maps/AbandonedShip_CaptainsOffice/text.inc"
.include "data/maps/AbandonedShip_HiddenFloorCorridors/text.inc"
.include "data/maps/AbandonedShip_HiddenFloorRooms/text.inc"
.include "data/maps/SecretBase_RedCave1/text.inc"
.include "data/maps/InsideOfTruck/text.inc"

View File

@ -1,28 +1,31 @@
AbandonedShip_Corridors_B1F_Text_19856F:: @ 819856F
AbandonedShip_Corridors_B1F_Text_DuncanIntro::
.string "Wenn wir zur See fahren, nehmen wir\n"
.string "MATROSEN immer unsere POKéMON mit.\l"
.string "Wie wäre es mit einem schnellen Kampf?$"
AbandonedShip_Corridors_B1F_Text_1985C5:: @ 81985C5
AbandonedShip_Corridors_B1F_Text_DuncanDefeat::
.string "Huups, da bin ich abgesoffen.$"
AbandonedShip_Corridors_B1F_Text_1985D7:: @ 81985D7
AbandonedShip_Corridors_B1F_Text_DuncanPostBattle::
.string "Der Schiffsrumpf liegt tief unter der\n"
.string "Wasserlinie.\p"
.string "Wenn ein POKéMON wissen würde, wie\n"
.string "man taucht, würden wir Fortschritte\l"
.string "machen.$"
AbandonedShip_Corridors_B1F_Text_19864A:: @ 819864A
AbandonedShip_Corridors_B1F_Text_YayItsAShip::
.string "Jahaa!\n"
.string "Ein Schiff!$"
AbandonedShip_Corridors_B1F_Text_19865C:: @ 819865C
AbandonedShip_Corridors_B1F_Text_DoorIsLocked::
.string "Die Tür ist verschlossen.\p"
.string "“LAGER” steht auf dem Schild.$"
AbandonedShip_Corridors_B1F_Text_198692:: @ 8198692
AbandonedShip_Corridors_B1F_Text_InsertedStorageKey::
.string "{PLAYER} steckt den SCHLÜSSEL zum\n"
.string "LAGER ins Schlüsselloch und dreht ihn.\p"
.string "Der SCHLÜSSEL ist schwergängig, aber\n"
.string "das Schloss lässt sich öffnen.$"
AbandonedShip_Text_TheDoorIsOpen::
.string "Die Tür ist offen.$"

View File

@ -1,3 +1,21 @@
AbandonedShip_Corridors_B1F_Text_1986EC:: @ 81986EC
AbandonedShip_HiddenFloorCorridors_Text_1986EC:: @ 81986EC
.string "Die Tür ist offen.$"
AbandonedShip_HiddenFloorCorridors_Text_Rm1DoorIsLocked::
.string "Die Tür ist verschlossen.\p"
.string "“K. 1” steht auf der Tür.$"
AbandonedShip_HiddenFloorCorridors_Text_Rm2DoorIsLocked::
.string "Die Tür ist verschlossen.\p"
.string "“K. 2” steht auf der Tür.$"
AbandonedShip_HiddenFloorCorridors_Text_Rm4DoorIsLocked::
.string "Die Tür ist verschlossen.\p"
.string "“K. 4” steht auf der Tür.$"
AbandonedShip_HiddenFloorCorridors_Text_Rm6DoorIsLocked::
.string "Die Tür ist verschlossen.\p"
.string "“K. 6” steht auf der Tür.$"
AbandonedShip_HiddenFloorCorridors_Text_InsertedKey::
.string "{PLAYER} steckt den SCHLÜSSEL ins\n"
.string "Schloss und dreht ihn um.\p"
.string "Der SCHLÜSSEL ist schwergängig, aber\n"
.string "die Tür öffnet sich.$"

View File

@ -1,35 +1,3 @@
AbandonedShip_HiddenFloorCorridors_Text_198DC0:: @ 8198DC0
.string "Die Tür ist verschlossen.\p"
.string "“K. 1” steht auf der Tür.$"
AbandonedShip_HiddenFloorCorridors_Text_198DF4:: @ 8198DF4
.string "Die Tür ist verschlossen.\p"
.string "“K. 2” steht auf der Tür.$"
AbandonedShip_HiddenFloorCorridors_Text_198E28:: @ 8198E28
.string "Die Tür ist verschlossen.\p"
.string "“K. 4” steht auf der Tür.$"
AbandonedShip_HiddenFloorCorridors_Text_198E5C:: @ 8198E5C
.string "Die Tür ist verschlossen.\p"
.string "“K. 6” steht auf der Tür.$"
AbandonedShip_HiddenFloorCorridors_Text_198E90:: @ 8198E90
.string "{PLAYER} steckt den SCHLÜSSEL ins\n"
.string "Schloss und dreht ihn um.\p"
.string "Der SCHLÜSSEL ist schwergängig, aber\n"
.string "die Tür öffnet sich.$"
AbandonedShip_HiddenFloorRooms_Text_198EE2:: @ 8198EE2
.string "Es ist hell und glänzend!\n"
.string "Aber es ist trotzdem nur Müll...$"
UnknownString_8198F10: @ 8198F10
.string "In der Wand ist eine kleine Einkerbung.$"
UnknownString_8198F34: @ 8198F34
.string "In der Wand ist eine kleine Einkerbung.\p"
.string "Möchtest du GEHEIMPOWER einsetzen?$"
UnknownString_8198F6E: @ 8198F6E
.string "Eine kleine Höhle wird sichtbar.$"
AbandonedShip_HiddenFloorRooms_Text_BrightShinyTrash::
.string "Es ist hell und glänzend!\n"
.string "Aber es ist trotzdem nur Müll...$"

View File

@ -1,3 +1,13 @@
SecretBase_RedCave1_Text_198F89:: @ 8198F89
SecretBase_Text_SmallIndentInWall:
.string "In der Wand ist eine kleine Einkerbung.$"
SecretBase_Text_IndentUseSecretPower:
.string "In der Wand ist eine kleine Einkerbung.\p"
.string "Möchtest du GEHEIMPOWER einsetzen?$"
SecretBase_Text_DiscoveredSmallCavern:
.string "Eine kleine Höhle wird sichtbar.$"
SecretBase_Text_WantToMakeYourSecretBaseHere::
.string "Möchtest du hier deine GEHEIMBASIS\n"
.string "einrichten?$"

View File

@ -660,11 +660,11 @@ gStdScripts_End::
.include "data/maps/AbandonedShip_Corridors_1F/text.inc"
.include "data/maps/AbandonedShip_Rooms_1F/text.inc"
.include "data/maps/AbandonedShip_Corridors_B1F/text.inc"
.include "data/maps/AbandonedShip_HiddenFloorCorridors/text.inc"
.include "data/maps/AbandonedShip_Rooms_B1F/text.inc"
.include "data/maps/AbandonedShip_Rooms2_B1F/text.inc"
.include "data/maps/AbandonedShip_Rooms2_1F/text.inc"
.include "data/maps/AbandonedShip_CaptainsOffice/text.inc"
.include "data/maps/AbandonedShip_HiddenFloorCorridors/text.inc"
.include "data/maps/AbandonedShip_HiddenFloorRooms/text.inc"
.include "data/maps/SecretBase_RedCave1/text.inc"
.include "data/maps/InsideOfTruck/text.inc"

View File

@ -1,3 +1,4 @@
#include "constants/global.h"
#include "constants/layouts.h"
#include "constants/map_types.h"
#include "constants/maps.h"

View File

@ -21,7 +21,7 @@
"movement_range_y": 1,
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "AbandonedShip_Corridors_B1F_EventScript_15E9CA",
"script": "AbandonedShip_Corridors_B1F_EventScript_TuberM",
"flag": "0"
},
{
@ -34,7 +34,7 @@
"movement_range_y": 0,
"trainer_type": "TRAINER_TYPE_NORMAL",
"trainer_sight_or_berry_tree_id": "4",
"script": "AbandonedShip_Corridors_B1F_EventScript_15EA1E",
"script": "AbandonedShip_Corridors_B1F_EventScript_Duncan",
"flag": "0"
}
],
@ -104,7 +104,7 @@
"y": 4,
"elevation": 3,
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "AbandonedShip_Corridors_B1F_EventScript_15E9D3"
"script": "AbandonedShip_Corridors_B1F_EventScript_StorageRoomDoor"
}
]
}

View File

@ -1,55 +1,55 @@
AbandonedShip_Corridors_B1F_MapScripts:: @ 815E98F
map_script MAP_SCRIPT_ON_RESUME, AbandonedShip_Corridors_B1F_MapScript1_15E99A
map_script MAP_SCRIPT_ON_LOAD, AbandonedShip_Corridors_B1F_MapScript1_15E9A3
AbandonedShip_Corridors_B1F_MapScripts::
map_script MAP_SCRIPT_ON_RESUME, AbandonedShip_Corridors_B1F_OnResume
map_script MAP_SCRIPT_ON_LOAD, AbandonedShip_Corridors_B1F_OnLoad
.byte 0
AbandonedShip_Corridors_B1F_MapScript1_15E99A:: @ 815E99A
AbandonedShip_Corridors_B1F_OnResume::
setdivewarp MAP_ABANDONED_SHIP_UNDERWATER1, 255, 5, 4
end
AbandonedShip_Corridors_B1F_MapScript1_15E9A3:: @ 815E9A3
call_if_unset FLAG_USED_STORAGE_KEY, AbandonedShip_Corridors_B1F_EventScript_15E9B6
call_if_set FLAG_USED_STORAGE_KEY, AbandonedShip_Corridors_B1F_EventScript_15E9C0
AbandonedShip_Corridors_B1F_OnLoad::
call_if_unset FLAG_USED_STORAGE_KEY, AbandonedShip_Corridors_B1F_EventScript_LockStorageRoom
call_if_set FLAG_USED_STORAGE_KEY, AbandonedShip_Corridors_B1F_EventScript_UnlockStorageRoom
end
AbandonedShip_Corridors_B1F_EventScript_15E9B6:: @ 815E9B6
setmetatile 11, 4, METATILE_InsideShip_InTactDoor0_Bottom, 1
AbandonedShip_Corridors_B1F_EventScript_LockStorageRoom::
setmetatile 11, 4, METATILE_Facility_IntactDoor_Bottom_Locked, TRUE
return
AbandonedShip_Corridors_B1F_EventScript_15E9C0:: @ 815E9C0
setmetatile 11, 4, METATILE_InsideShip_InTactDoor1_Bottom, 1
AbandonedShip_Corridors_B1F_EventScript_UnlockStorageRoom::
setmetatile 11, 4, METATILE_Facility_IntactDoor_Bottom_Unlocked, TRUE
return
AbandonedShip_Corridors_B1F_EventScript_15E9CA:: @ 815E9CA
msgbox AbandonedShip_Corridors_B1F_Text_19864A, MSGBOX_NPC
AbandonedShip_Corridors_B1F_EventScript_TuberM::
msgbox AbandonedShip_Corridors_B1F_Text_YayItsAShip, MSGBOX_NPC
end
AbandonedShip_Corridors_B1F_EventScript_15E9D3:: @ 815E9D3
AbandonedShip_Corridors_B1F_EventScript_StorageRoomDoor::
lockall
goto_if_set FLAG_USED_STORAGE_KEY, AbandonedShip_Corridors_B1F_EventScript_15EA14
goto_if_set FLAG_USED_STORAGE_KEY, AbandonedShip_Corridors_B1F_EventScript_DoorIsUnlocked
checkitem ITEM_STORAGE_KEY, 1
compare VAR_RESULT, 0
goto_if_eq AbandonedShip_Corridors_B1F_EventScript_15EA0A
msgbox AbandonedShip_Corridors_B1F_Text_198692, MSGBOX_DEFAULT
goto_if_eq AbandonedShip_Corridors_B1F_EventScript_DoorIsLocked
msgbox AbandonedShip_Corridors_B1F_Text_InsertedStorageKey, MSGBOX_DEFAULT
playse SE_PIN
removeitem ITEM_STORAGE_KEY, 1
setflag FLAG_USED_STORAGE_KEY
call AbandonedShip_Corridors_B1F_EventScript_15E9C0
call AbandonedShip_Corridors_B1F_EventScript_UnlockStorageRoom
special DrawWholeMapView
releaseall
end
AbandonedShip_Corridors_B1F_EventScript_15EA0A:: @ 815EA0A
msgbox AbandonedShip_Corridors_B1F_Text_19865C, MSGBOX_DEFAULT
AbandonedShip_Corridors_B1F_EventScript_DoorIsLocked::
msgbox AbandonedShip_Corridors_B1F_Text_DoorIsLocked, MSGBOX_DEFAULT
releaseall
end
AbandonedShip_Corridors_B1F_EventScript_15EA14:: @ 815EA14
msgbox AbandonedShip_Corridors_B1F_Text_1986EC, MSGBOX_DEFAULT
AbandonedShip_Corridors_B1F_EventScript_DoorIsUnlocked::
msgbox AbandonedShip_Text_TheDoorIsOpen, MSGBOX_DEFAULT
releaseall
end
AbandonedShip_Corridors_B1F_EventScript_15EA1E:: @ 815EA1E
trainerbattle_single TRAINER_DUNCAN, AbandonedShip_Corridors_B1F_Text_19856F, AbandonedShip_Corridors_B1F_Text_1985C5
msgbox AbandonedShip_Corridors_B1F_Text_1985D7, MSGBOX_AUTOCLOSE
AbandonedShip_Corridors_B1F_EventScript_Duncan::
trainerbattle_single TRAINER_DUNCAN, AbandonedShip_Corridors_B1F_Text_DuncanIntro, AbandonedShip_Corridors_B1F_Text_DuncanDefeat
msgbox AbandonedShip_Corridors_B1F_Text_DuncanPostBattle, MSGBOX_AUTOCLOSE
end

View File

@ -1,29 +1,30 @@
AbandonedShip_Corridors_B1F_Text_19856F:: @ 819856F
AbandonedShip_Corridors_B1F_Text_DuncanIntro::
.string "When we go out to sea, we SAILORS\n"
.string "always bring our POKéMON.\l"
.string "How about a quick battle?$"
AbandonedShip_Corridors_B1F_Text_1985C5:: @ 81985C5
AbandonedShip_Corridors_B1F_Text_DuncanDefeat::
.string "Whoops, I'm sunk!$"
AbandonedShip_Corridors_B1F_Text_1985D7:: @ 81985D7
AbandonedShip_Corridors_B1F_Text_DuncanPostBattle::
.string "The ship's bottom has sunk into the\n"
.string "depths.\p"
.string "If a POKéMON knew how to go underwater,\n"
.string "we might make some progress...$"
AbandonedShip_Corridors_B1F_Text_19864A:: @ 819864A
AbandonedShip_Corridors_B1F_Text_YayItsAShip::
.string "Yay!\n"
.string "It's a ship!$"
AbandonedShip_Corridors_B1F_Text_19865C:: @ 819865C
AbandonedShip_Corridors_B1F_Text_DoorIsLocked::
.string "The door is locked.\p"
.string "“STORAGE” is painted on the door.$"
AbandonedShip_Corridors_B1F_Text_198692:: @ 8198692
AbandonedShip_Corridors_B1F_Text_InsertedStorageKey::
.string "{PLAYER} inserted and turned the\n"
.string "STORAGE KEY.\p"
.string "The inserted KEY stuck fast, but the\n"
.string "door opened.$"
AbandonedShip_Corridors_B1F_Text_1986EC:: @ 81986EC
AbandonedShip_Text_TheDoorIsOpen::
.string "The door is open.$"

View File

@ -63,7 +63,7 @@
"y": 8,
"elevation": 3,
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "AbandonedShip_HiddenFloorCorridors_EventScript_15EBF3"
"script": "AbandonedShip_HiddenFloorCorridors_EventScript_Room1Door"
},
{
"type": "sign",
@ -71,7 +71,7 @@
"y": 8,
"elevation": 3,
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "AbandonedShip_HiddenFloorCorridors_EventScript_15EC2A"
"script": "AbandonedShip_HiddenFloorCorridors_EventScript_Room2Door"
},
{
"type": "sign",
@ -79,7 +79,7 @@
"y": 4,
"elevation": 0,
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "AbandonedShip_HiddenFloorCorridors_EventScript_15EC61"
"script": "AbandonedShip_HiddenFloorCorridors_EventScript_Room4Door"
},
{
"type": "sign",
@ -87,7 +87,7 @@
"y": 4,
"elevation": 0,
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "AbandonedShip_HiddenFloorCorridors_EventScript_15EC98"
"script": "AbandonedShip_HiddenFloorCorridors_EventScript_Room6Door"
}
]
}

View File

@ -1,136 +1,136 @@
AbandonedShip_HiddenFloorCorridors_MapScripts:: @ 815EB46
map_script MAP_SCRIPT_ON_RESUME, AbandonedShip_HiddenFloorCorridors_MapScript1_15EB51
map_script MAP_SCRIPT_ON_LOAD, AbandonedShip_HiddenFloorCorridors_MapScript1_15EB5A
AbandonedShip_HiddenFloorCorridors_MapScripts::
map_script MAP_SCRIPT_ON_RESUME, AbandonedShip_HiddenFloorCorridors_OnResume
map_script MAP_SCRIPT_ON_LOAD, AbandonedShip_HiddenFloorCorridors_OnLoad
.byte 0
AbandonedShip_HiddenFloorCorridors_MapScript1_15EB51:: @ 815EB51
AbandonedShip_HiddenFloorCorridors_OnResume::
setdivewarp MAP_ABANDONED_SHIP_UNDERWATER1, 255, 5, 4
end
AbandonedShip_HiddenFloorCorridors_MapScript1_15EB5A:: @ 815EB5A
call_if_unset FLAG_USED_ROOM_1_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_15EBCB
call_if_unset FLAG_USED_ROOM_2_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_15EBD5
call_if_unset FLAG_USED_ROOM_4_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_15EBDF
call_if_unset FLAG_USED_ROOM_6_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_15EBE9
call_if_set FLAG_USED_ROOM_1_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_15EBA3
call_if_set FLAG_USED_ROOM_2_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_15EBAD
call_if_set FLAG_USED_ROOM_4_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_15EBB7
call_if_set FLAG_USED_ROOM_6_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_15EBC1
AbandonedShip_HiddenFloorCorridors_OnLoad::
call_if_unset FLAG_USED_ROOM_1_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_LockRoom1
call_if_unset FLAG_USED_ROOM_2_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_LockRoom2
call_if_unset FLAG_USED_ROOM_4_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_LockRoom4
call_if_unset FLAG_USED_ROOM_6_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_LockRoom6
call_if_set FLAG_USED_ROOM_1_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_UnlockRoom1
call_if_set FLAG_USED_ROOM_2_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_UnlockRoom2
call_if_set FLAG_USED_ROOM_4_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_UnlockRoom4
call_if_set FLAG_USED_ROOM_6_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_UnlockRoom6
end
AbandonedShip_HiddenFloorCorridors_EventScript_15EBA3:: @ 815EBA3
setmetatile 3, 8, METATILE_InsideShip_InTactDoor1_Bottom, 1
AbandonedShip_HiddenFloorCorridors_EventScript_UnlockRoom1::
setmetatile 3, 8, METATILE_Facility_IntactDoor_Bottom_Unlocked, TRUE
return
AbandonedShip_HiddenFloorCorridors_EventScript_15EBAD:: @ 815EBAD
setmetatile 6, 8, METATILE_InsideShip_InTactDoor1_Bottom, 1
AbandonedShip_HiddenFloorCorridors_EventScript_UnlockRoom2::
setmetatile 6, 8, METATILE_Facility_IntactDoor_Bottom_Unlocked, TRUE
return
AbandonedShip_HiddenFloorCorridors_EventScript_15EBB7:: @ 815EBB7
setmetatile 3, 3, METATILE_InsideShip_DoorIndent1, 0
AbandonedShip_HiddenFloorCorridors_EventScript_UnlockRoom4::
setmetatile 3, 3, METATILE_Facility_DoorIndent_Unlocked, FALSE
return
AbandonedShip_HiddenFloorCorridors_EventScript_15EBC1:: @ 815EBC1
setmetatile 9, 3, METATILE_InsideShip_DoorIndent1, 0
AbandonedShip_HiddenFloorCorridors_EventScript_UnlockRoom6::
setmetatile 9, 3, METATILE_Facility_DoorIndent_Unlocked, FALSE
return
AbandonedShip_HiddenFloorCorridors_EventScript_15EBCB:: @ 815EBCB
setmetatile 3, 8, METATILE_InsideShip_InTactDoor0_Bottom, 1
AbandonedShip_HiddenFloorCorridors_EventScript_LockRoom1::
setmetatile 3, 8, METATILE_Facility_IntactDoor_Bottom_Locked, TRUE
return
AbandonedShip_HiddenFloorCorridors_EventScript_15EBD5:: @ 815EBD5
setmetatile 6, 8, METATILE_InsideShip_InTactDoor0_Bottom, 1
AbandonedShip_HiddenFloorCorridors_EventScript_LockRoom2::
setmetatile 6, 8, METATILE_Facility_IntactDoor_Bottom_Locked, TRUE
return
AbandonedShip_HiddenFloorCorridors_EventScript_15EBDF:: @ 815EBDF
setmetatile 3, 3, METATILE_InsideShip_DoorIndent0, 0
AbandonedShip_HiddenFloorCorridors_EventScript_LockRoom4::
setmetatile 3, 3, METATILE_Facility_DoorIndent_Locked, FALSE
return
AbandonedShip_HiddenFloorCorridors_EventScript_15EBE9:: @ 815EBE9
setmetatile 9, 3, METATILE_InsideShip_DoorIndent0, 0
AbandonedShip_HiddenFloorCorridors_EventScript_LockRoom6::
setmetatile 9, 3, METATILE_Facility_DoorIndent_Locked, FALSE
return
AbandonedShip_HiddenFloorCorridors_EventScript_15EBF3:: @ 815EBF3
AbandonedShip_HiddenFloorCorridors_EventScript_Room1Door::
lockall
goto_if_set FLAG_USED_ROOM_1_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_15ECF7
goto_if_set FLAG_USED_ROOM_1_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_TheDoorIsOpen
checkitem ITEM_ROOM_1_KEY, 1
compare VAR_RESULT, 0
goto_if_eq AbandonedShip_HiddenFloorCorridors_EventScript_15ECCF
msgbox AbandonedShip_HiddenFloorCorridors_Text_198E90, MSGBOX_DEFAULT
goto_if_eq AbandonedShip_HiddenFloorCorridors_EventScript_Rm1IsLocked
msgbox AbandonedShip_HiddenFloorCorridors_Text_InsertedKey, MSGBOX_DEFAULT
playse SE_PIN
removeitem ITEM_ROOM_1_KEY
setflag FLAG_USED_ROOM_1_KEY
call AbandonedShip_HiddenFloorCorridors_EventScript_15EBA3
call AbandonedShip_HiddenFloorCorridors_EventScript_UnlockRoom1
special DrawWholeMapView
releaseall
end
AbandonedShip_HiddenFloorCorridors_EventScript_15EC2A:: @ 815EC2A
AbandonedShip_HiddenFloorCorridors_EventScript_Room2Door::
lockall
goto_if_set FLAG_USED_ROOM_2_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_15ECF7
goto_if_set FLAG_USED_ROOM_2_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_TheDoorIsOpen
checkitem ITEM_ROOM_2_KEY, 1
compare VAR_RESULT, 0
goto_if_eq AbandonedShip_HiddenFloorCorridors_EventScript_15ECD9
msgbox AbandonedShip_HiddenFloorCorridors_Text_198E90, MSGBOX_DEFAULT
goto_if_eq AbandonedShip_HiddenFloorCorridors_EventScript_Rm2IsLocked
msgbox AbandonedShip_HiddenFloorCorridors_Text_InsertedKey, MSGBOX_DEFAULT
playse SE_PIN
removeitem ITEM_ROOM_2_KEY
setflag FLAG_USED_ROOM_2_KEY
call AbandonedShip_HiddenFloorCorridors_EventScript_15EBAD
call AbandonedShip_HiddenFloorCorridors_EventScript_UnlockRoom2
special DrawWholeMapView
releaseall
end
AbandonedShip_HiddenFloorCorridors_EventScript_15EC61:: @ 815EC61
AbandonedShip_HiddenFloorCorridors_EventScript_Room4Door::
lockall
goto_if_set FLAG_USED_ROOM_4_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_15ECF7
goto_if_set FLAG_USED_ROOM_4_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_TheDoorIsOpen
checkitem ITEM_ROOM_4_KEY, 1
compare VAR_RESULT, 0
goto_if_eq AbandonedShip_HiddenFloorCorridors_EventScript_15ECE3
msgbox AbandonedShip_HiddenFloorCorridors_Text_198E90, MSGBOX_DEFAULT
goto_if_eq AbandonedShip_HiddenFloorCorridors_EventScript_Rm4IsLocked
msgbox AbandonedShip_HiddenFloorCorridors_Text_InsertedKey, MSGBOX_DEFAULT
playse SE_PIN
removeitem ITEM_ROOM_4_KEY
setflag FLAG_USED_ROOM_4_KEY
call AbandonedShip_HiddenFloorCorridors_EventScript_15EBB7
call AbandonedShip_HiddenFloorCorridors_EventScript_UnlockRoom4
special DrawWholeMapView
releaseall
end
AbandonedShip_HiddenFloorCorridors_EventScript_15EC98:: @ 815EC98
AbandonedShip_HiddenFloorCorridors_EventScript_Room6Door::
lockall
goto_if_set FLAG_USED_ROOM_6_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_15ECF7
goto_if_set FLAG_USED_ROOM_6_KEY, AbandonedShip_HiddenFloorCorridors_EventScript_TheDoorIsOpen
checkitem ITEM_ROOM_6_KEY, 1
compare VAR_RESULT, 0
goto_if_eq AbandonedShip_HiddenFloorCorridors_EventScript_15ECED
msgbox AbandonedShip_HiddenFloorCorridors_Text_198E90, MSGBOX_DEFAULT
goto_if_eq AbandonedShip_HiddenFloorCorridors_EventScript_Rm6IsLocked
msgbox AbandonedShip_HiddenFloorCorridors_Text_InsertedKey, MSGBOX_DEFAULT
playse SE_PIN
removeitem ITEM_ROOM_6_KEY
setflag FLAG_USED_ROOM_6_KEY
call AbandonedShip_HiddenFloorCorridors_EventScript_15EBC1
call AbandonedShip_HiddenFloorCorridors_EventScript_UnlockRoom6
special DrawWholeMapView
releaseall
end
AbandonedShip_HiddenFloorCorridors_EventScript_15ECCF:: @ 815ECCF
msgbox AbandonedShip_HiddenFloorCorridors_Text_198DC0, MSGBOX_DEFAULT
AbandonedShip_HiddenFloorCorridors_EventScript_Rm1IsLocked::
msgbox AbandonedShip_HiddenFloorCorridors_Text_Rm1DoorIsLocked, MSGBOX_DEFAULT
releaseall
end
AbandonedShip_HiddenFloorCorridors_EventScript_15ECD9:: @ 815ECD9
msgbox AbandonedShip_HiddenFloorCorridors_Text_198DF4, MSGBOX_DEFAULT
AbandonedShip_HiddenFloorCorridors_EventScript_Rm2IsLocked::
msgbox AbandonedShip_HiddenFloorCorridors_Text_Rm2DoorIsLocked, MSGBOX_DEFAULT
releaseall
end
AbandonedShip_HiddenFloorCorridors_EventScript_15ECE3:: @ 815ECE3
msgbox AbandonedShip_HiddenFloorCorridors_Text_198E28, MSGBOX_DEFAULT
AbandonedShip_HiddenFloorCorridors_EventScript_Rm4IsLocked::
msgbox AbandonedShip_HiddenFloorCorridors_Text_Rm4DoorIsLocked, MSGBOX_DEFAULT
releaseall
end
AbandonedShip_HiddenFloorCorridors_EventScript_15ECED:: @ 815ECED
msgbox AbandonedShip_HiddenFloorCorridors_Text_198E5C, MSGBOX_DEFAULT
AbandonedShip_HiddenFloorCorridors_EventScript_Rm6IsLocked::
msgbox AbandonedShip_HiddenFloorCorridors_Text_Rm6DoorIsLocked, MSGBOX_DEFAULT
releaseall
end
AbandonedShip_HiddenFloorCorridors_EventScript_15ECF7:: @ 815ECF7
msgbox AbandonedShip_HiddenFloorCorridors_Text_1986EC, MSGBOX_DEFAULT
AbandonedShip_HiddenFloorCorridors_EventScript_TheDoorIsOpen::
msgbox AbandonedShip_Text_TheDoorIsOpen, MSGBOX_DEFAULT
releaseall
end

View File

@ -1,2 +1,21 @@
AbandonedShip_HiddenFloorCorridors_Text_1986EC:: @ 81986EC
.string "The door is open.$"
AbandonedShip_HiddenFloorCorridors_Text_Rm1DoorIsLocked::
.string "The door is locked.\p"
.string "“RM. 1” is painted on the door.$"
AbandonedShip_HiddenFloorCorridors_Text_Rm2DoorIsLocked::
.string "The door is locked.\p"
.string "“RM. 2” is painted on the door.$"
AbandonedShip_HiddenFloorCorridors_Text_Rm4DoorIsLocked::
.string "The door is locked.\p"
.string "“RM. 4” is painted on the door.$"
AbandonedShip_HiddenFloorCorridors_Text_Rm6DoorIsLocked::
.string "The door is locked.\p"
.string "“RM. 6” is painted on the door.$"
AbandonedShip_HiddenFloorCorridors_Text_InsertedKey::
.string "{PLAYER} inserted and turned the\n"
.string "KEY.\p"
.string "The inserted KEY stuck fast, but the\n"
.string "door opened.$"

View File

@ -138,6 +138,6 @@ AbandonedShip_HiddenFloorRooms_EventScript_15EE9B:: @ 815EE9B
AbandonedShip_HiddenFloorRooms_EventScript_15EEAB:: @ 815EEAB
lockall
msgbox AbandonedShip_HiddenFloorRooms_Text_198EE2, MSGBOX_DEFAULT
msgbox AbandonedShip_HiddenFloorRooms_Text_BrightShinyTrash, MSGBOX_DEFAULT
releaseall
end

View File

@ -1,35 +1,3 @@
AbandonedShip_HiddenFloorCorridors_Text_198DC0:: @ 8198DC0
.string "The door is locked.\p"
.string "“RM. 1” is painted on the door.$"
AbandonedShip_HiddenFloorCorridors_Text_198DF4:: @ 8198DF4
.string "The door is locked.\p"
.string "“RM. 2” is painted on the door.$"
AbandonedShip_HiddenFloorCorridors_Text_198E28:: @ 8198E28
.string "The door is locked.\p"
.string "“RM. 4” is painted on the door.$"
AbandonedShip_HiddenFloorCorridors_Text_198E5C:: @ 8198E5C
.string "The door is locked.\p"
.string "“RM. 6” is painted on the door.$"
AbandonedShip_HiddenFloorCorridors_Text_198E90:: @ 8198E90
.string "{PLAYER} inserted and turned the\n"
.string "KEY.\p"
.string "The inserted KEY stuck fast, but the\n"
.string "door opened.$"
AbandonedShip_HiddenFloorRooms_Text_198EE2:: @ 8198EE2
.string "It's bright and shiny!\n"
.string "But it's just trash...$"
UnknownString_8198F10: @ 8198F10
.string "There's a small indent in the wall.$"
UnknownString_8198F34: @ 8198F34
.string "There's a small indent in the wall.\p"
.string "Use the SECRET POWER?$"
UnknownString_8198F6E: @ 8198F6E
.string "Discovered a small cavern!$"
AbandonedShip_HiddenFloorRooms_Text_BrightShinyTrash::
.string "It's bright and shiny!\n"
.string "But it's just trash...$"

View File

@ -1,2 +1,12 @@
SecretBase_RedCave1_Text_198F89:: @ 8198F89
SecretBase_Text_SmallIndentInWall:
.string "There's a small indent in the wall.$"
SecretBase_Text_IndentUseSecretPower:
.string "There's a small indent in the wall.\p"
.string "Use the SECRET POWER?$"
SecretBase_Text_DiscoveredSmallCavern:
.string "Discovered a small cavern!$"
SecretBase_Text_WantToMakeYourSecretBaseHere::
.string "Want to make your SECRET BASE here?$"

View File

@ -25,7 +25,7 @@ EventScript_1A2CB0:
compare VAR_RESULT, 6
goto_if_eq EventScript_1A2CF1
bufferpartymonnick 0, VAR_RESULT
msgbox UnknownString_8198F34, MSGBOX_YESNO
msgbox SecretBase_Text_IndentUseSecretPower, MSGBOX_YESNO
compare VAR_RESULT, NO
goto_if_eq EventScript_1A2F3A
msgbox UsedCutRockSmashText, MSGBOX_DEFAULT
@ -43,11 +43,11 @@ DoSecretBaseCaveFieldEffectScript:: @ 81A2CE6
end
EventScript_1A2CF1:
msgbox UnknownString_8198F10, MSGBOX_SIGN
msgbox SecretBase_Text_SmallIndentInWall, MSGBOX_SIGN
end
EventScript_1A2CFA:
msgbox UnknownString_8198F6E, MSGBOX_DEFAULT
msgbox SecretBase_Text_DiscoveredSmallCavern, MSGBOX_DEFAULT
goto EventScript_1A2DB8
end
@ -131,7 +131,7 @@ SecretBase_EventScript_FirstEntrance:: @ 81A2DDE
applymovement OBJ_EVENT_ID_PLAYER, SecretBase_RedCave1_Movement_1A2E11
waitmovement 0
setvar VAR_INIT_SECRET_BASE, 1
msgbox SecretBase_RedCave1_Text_198F89, MSGBOX_YESNO
msgbox SecretBase_Text_WantToMakeYourSecretBaseHere, MSGBOX_YESNO
compare VAR_RESULT, YES
goto_if_eq SecretBase_RedCave1_EventScript_1A2E08
closemessage

View File

@ -21,7 +21,7 @@ void nullsub_11();
void UpdateOamPriorityInAllHealthboxes(u8);
void sub_8043F44(u8);
void sub_804454C(void);
u8 sub_8044804(u8, const struct HpAndStatus *, u8, u8);
u8 CreatePartyStatusSummarySprites(u8, const struct HpAndStatus *, u8, u8);
void sub_8044CA0(u8);
void sub_8045A5C(u8, struct Pokemon *, u8);
s32 sub_8045C78(u8, u8, u8, u8);

190
include/characters.h Normal file
View File

@ -0,0 +1,190 @@
#ifndef GUARD_CHARACTERS_H
#define GUARD_CHARACTERS_H
#define CHAR_SPACE 0x00
#define CHAR_LV 0x34
#define CHAR_SONG_WORD_SEPARATOR 0x37 // separates words in the bard song. Not sure if it's used for anything else
#define CHAR_0 0xA1
#define CHAR_EXCL_MARK 0xAB
#define CHAR_QUESTION_MARK 0xAC
#define CHAR_PERIOD 0xAD
#define CHAR_HYPHEN 0xAE
#define CHAR_ELLIPSIS 0xB0
#define CHAR_DBL_QUOT_LEFT 0xB1
#define CHAR_DBL_QUOT_RIGHT 0xB2
#define CHAR_SGL_QUOT_LEFT 0xB3
#define CHAR_SGL_QUOT_RIGHT 0xB4
#define CHAR_MALE 0xB5
#define CHAR_FEMALE 0xB6
#define CHAR_CURRENCY 0xB7
#define CHAR_COMMA 0xB8
#define CHAR_MULT_SIGN 0xB9
#define CHAR_SLASH 0xBA
#define CHAR_A 0xBB
#define CHAR_B 0xBC
#define CHAR_C 0xBD
#define CHAR_D 0xBE
#define CHAR_E 0xBF
#define CHAR_F 0xC0
#define CHAR_G 0xC1
#define CHAR_H 0xC2
#define CHAR_I 0xC3
#define CHAR_J 0xC4
#define CHAR_K 0xC5
#define CHAR_L 0xC6
#define CHAR_M 0xC7
#define CHAR_N 0xC8
#define CHAR_O 0xC9
#define CHAR_P 0xCA
#define CHAR_Q 0xCB
#define CHAR_R 0xCC
#define CHAR_S 0xCD
#define CHAR_T 0xCE
#define CHAR_U 0xCF
#define CHAR_V 0xD0
#define CHAR_W 0xD1
#define CHAR_X 0xD2
#define CHAR_Y 0xD3
#define CHAR_Z 0xD4
#define CHAR_a 0xD5
#define CHAR_b 0xD6
#define CHAR_c 0xD7
#define CHAR_d 0xD8
#define CHAR_e 0xD9
#define CHAR_f 0xDA
#define CHAR_g 0xDB
#define CHAR_h 0xDC
#define CHAR_i 0xDD
#define CHAR_j 0xDE
#define CHAR_k 0xDF
#define CHAR_l 0xE0
#define CHAR_m 0xE1
#define CHAR_n 0xE2
#define CHAR_o 0xE3
#define CHAR_p 0xE4
#define CHAR_q 0xE5
#define CHAR_r 0xE6
#define CHAR_s 0xE7
#define CHAR_t 0xE8
#define CHAR_u 0xE9
#define CHAR_v 0xEA
#define CHAR_w 0xEB
#define CHAR_x 0xEC
#define CHAR_y 0xED
#define CHAR_z 0xEE
#define CHAR_COLON 0xF0
#define CHAR_PROMPT_SCROLL 0xFA // waits for button press and scrolls dialog
#define CHAR_PROMPT_CLEAR 0xFB // waits for button press and clears dialog
#define EXT_CTRL_CODE_BEGIN 0xFC // extended control code
#define PLACEHOLDER_BEGIN 0xFD // string placeholder
#define CHAR_NEWLINE 0xFE
#define EOS 0xFF // end of string
#define TEXT_COLOR_TRANSPARENT 0x00
#define TEXT_COLOR_DARK_GREY 0x01
#define TEXT_COLOR_RED 0x02
#define TEXT_COLOR_GREEN 0x03
#define TEXT_COLOR_BLUE 0x04
#define TEXT_COLOR_YELLOW 0x05
#define TEXT_COLOR_CYAN 0x06
#define TEXT_COLOR_MAGENTA 0x07
#define TEXT_COLOR_LIGHT_GREY 0x08
#define TEXT_COLOR_BLACK 0x09
#define TEXT_COLOR_BLACK2 0x0A
#define TEXT_COLOR_SILVER 0x0B
#define TEXT_COLOR_WHITE 0x0C
#define TEXT_COLOR_SKY_BLUE 0x0D
#define TEXT_COLOR_LIGHT_BLUE 0x0E
#define TEXT_COLOR_WHITE2 0x0F
#define EXT_CTRL_CODE_COLOR 0x01
#define EXT_CTRL_CODE_HIGHLIGHT 0x02
#define EXT_CTRL_CODE_SHADOW 0x03
#define EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW 0x04
#define EXT_CTRL_CODE_PALETTE 0x05
#define EXT_CTRL_CODE_SIZE 0x06
#define EXT_CTRL_CODE_RESET_SIZE 0x07
#define EXT_CTRL_CODE_PAUSE 0x08
#define EXT_CTRL_CODE_PAUSE_UNTIL_PRESS 0x09
#define EXT_CTRL_CODE_WAIT_SE 0x0A
#define EXT_CTRL_CODE_PLAY_BGM 0x0B
#define EXT_CTRL_CODE_ESCAPE 0x0C
#define EXT_CTRL_CODE_SHIFT_TEXT 0x0D // nop
#define EXT_CTRL_CODE_SHIFT_DOWN 0x0E
#define EXT_CTRL_CODE_FILL_WINDOW 0x0F
#define EXT_CTRL_CODE_PLAY_SE 0x10
#define EXT_CTRL_CODE_CLEAR 0x11
#define EXT_CTRL_CODE_SKIP 0x12
#define EXT_CTRL_CODE_CLEAR_TO 0x13
#define EXT_CTRL_CODE_MIN_LETTER_SPACING 0x14
#define EXT_CTRL_CODE_JPN 0x15
#define EXT_CTRL_CODE_ENG 0x16
// Note that while all dot combinations are represented in
// the Braille font, they are not all meaningful characters.
// Only those that have direct single-character translations are listed.
#define BRAILLE_CHAR_SPACE 0x00
#define BRAILLE_CHAR_A 0x01
//
#define BRAILLE_CHAR_C 0x03
#define BRAILLE_CHAR_COMMA 0x04
#define BRAILLE_CHAR_B 0x05
#define BRAILLE_CHAR_I 0x06
#define BRAILLE_CHAR_F 0x07
//
#define BRAILLE_CHAR_E 0x09
//
#define BRAILLE_CHAR_D 0x0B
#define BRAILLE_CHAR_COLON 0x0C
#define BRAILLE_CHAR_H 0x0D
#define BRAILLE_CHAR_J 0x0E
#define BRAILLE_CHAR_G 0x0F
#define BRAILLE_CHAR_APOSTROPHE 0x10
#define BRAILLE_CHAR_K 0x11
#define BRAILLE_CHAR_SLASH 0x12
#define BRAILLE_CHAR_M 0x13
#define BRAILLE_CHAR_SEMICOLON 0x14
#define BRAILLE_CHAR_L 0x15
#define BRAILLE_CHAR_S 0x16
#define BRAILLE_CHAR_P 0x17
//
#define BRAILLE_CHAR_O 0x19
//
#define BRAILLE_CHAR_N 0x1B
#define BRAILLE_CHAR_EXCL_MARK 0x1C
#define BRAILLE_CHAR_R 0x1D
#define BRAILLE_CHAR_T 0x1E
#define BRAILLE_CHAR_Q 0x1F
//
#define BRAILLE_CHAR_PERIOD 0x2C
//
#define BRAILLE_CHAR_W 0x2E
//
#define BRAILLE_CHAR_HYPHEN 0x30
#define BRAILLE_CHAR_U 0x31
//
#define BRAILLE_CHAR_X 0x33
#define BRAILLE_CHAR_QUESTION_MARK 0x34 // Also double quote left
#define BRAILLE_CHAR_V 0x35
//
#define BRAILLE_CHAR_DBL_QUOTE_RIGHT 0x38
#define BRAILLE_CHAR_Z 0x39
#define BRAILLE_CHAR_NUMBER 0x3A
#define BRAILLE_CHAR_Y 0x3B
#define BRAILLE_CHAR_PAREN 0x3C
//
#define NUM_BRAILLE_CHARS 0x40
// Digits must be preceded by BRAILLE_CHAR_NUMBER
#define BRAILLE_CHAR_1 BRAILLE_CHAR_A
#define BRAILLE_CHAR_2 BRAILLE_CHAR_B
#define BRAILLE_CHAR_3 BRAILLE_CHAR_C
#define BRAILLE_CHAR_4 BRAILLE_CHAR_D
#define BRAILLE_CHAR_5 BRAILLE_CHAR_E
#define BRAILLE_CHAR_6 BRAILLE_CHAR_F
#define BRAILLE_CHAR_7 BRAILLE_CHAR_G
#define BRAILLE_CHAR_8 BRAILLE_CHAR_H
#define BRAILLE_CHAR_9 BRAILLE_CHAR_I
#define BRAILLE_CHAR_0 BRAILLE_CHAR_J
#endif // GUARD_CHARACTERS_H

3
include/constants/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Will be moved to build/ eventually
map_groups.h
layouts.h

View File

@ -150,7 +150,7 @@
#define HITMARKER_ATTACKSTRING_PRINTED 0x00000400
#define HITMARKER_NO_PPDEDUCT 0x00000800
#define HITMARKER_SWAP_ATTACKER_TARGET 0x00001000
#define HITMARKER_IGNORE_SAFEGUARD 0x00002000
#define HITMARKER_STATUS_ABILITY_EFFECT 0x00002000
#define HITMARKER_SYNCHRONISE_EFFECT 0x00004000
#define HITMARKER_RUN 0x00008000
#define HITMARKER_IGNORE_ON_AIR 0x00010000

View File

@ -252,6 +252,9 @@
#define TRACKS_FOOT 1
#define TRACKS_BIKE_TIRE 2
#define OBJ_KIND_NORMAL 0
#define OBJ_KIND_CLONE 255 // Exclusive to FRLG
#define OBJ_EVENT_ID_PLAYER 0xFF
#define OBJ_EVENT_ID_CAMERA 0x7F

View File

@ -89,4 +89,13 @@
#define BAG_BERRIES 4
#define BAG_KEYITEMS 5
#define CONNECTION_INVALID -1
#define CONNECTION_NONE 0
#define CONNECTION_SOUTH 1
#define CONNECTION_NORTH 2
#define CONNECTION_WEST 3
#define CONNECTION_EAST 4
#define CONNECTION_DIVE 5
#define CONNECTION_EMERGE 6
#endif // GUARD_CONSTANTS_GLOBAL_H

View File

@ -1,337 +0,0 @@
#ifndef GUARD_CONSTANTS_LAYOUTS_H
#define GUARD_CONSTANTS_LAYOUTS_H
#define LAYOUT_PETALBURG_CITY 1
#define LAYOUT_SLATEPORT_CITY 2
#define LAYOUT_MAUVILLE_CITY 3
#define LAYOUT_RUSTBORO_CITY 4
#define LAYOUT_FORTREE_CITY 5
#define LAYOUT_LILYCOVE_CITY 6
#define LAYOUT_MOSSDEEP_CITY 7
#define LAYOUT_SOOTOPOLIS_CITY 8
#define LAYOUT_EVER_GRANDE_CITY 9
#define LAYOUT_LITTLEROOT_TOWN 10
#define LAYOUT_OLDALE_TOWN 11
#define LAYOUT_DEWFORD_TOWN 12
#define LAYOUT_LAVARIDGE_TOWN 13
#define LAYOUT_FALLARBOR_TOWN 14
#define LAYOUT_VERDANTURF_TOWN 15
#define LAYOUT_PACIFIDLOG_TOWN 16
#define LAYOUT_ROUTE101 17
#define LAYOUT_ROUTE102 18
#define LAYOUT_ROUTE103 19
#define LAYOUT_ROUTE104 20
#define LAYOUT_ROUTE105 21
#define LAYOUT_ROUTE106 22
#define LAYOUT_ROUTE107 23
#define LAYOUT_ROUTE108 24
#define LAYOUT_ROUTE109 25
#define LAYOUT_ROUTE110 26
#define LAYOUT_ROUTE111 27
#define LAYOUT_ROUTE112 28
#define LAYOUT_ROUTE113 29
#define LAYOUT_ROUTE114 30
#define LAYOUT_ROUTE115 31
#define LAYOUT_ROUTE116 32
#define LAYOUT_ROUTE117 33
#define LAYOUT_ROUTE118 34
#define LAYOUT_ROUTE119 35
#define LAYOUT_ROUTE120 36
#define LAYOUT_ROUTE121 37
#define LAYOUT_ROUTE122 38
#define LAYOUT_ROUTE123 39
#define LAYOUT_ROUTE124 40
#define LAYOUT_ROUTE125 41
#define LAYOUT_ROUTE126 42
#define LAYOUT_ROUTE127 43
#define LAYOUT_ROUTE128 44
#define LAYOUT_ROUTE129 45
#define LAYOUT_UNREFERENCED_MAP 46
#define LAYOUT_ROUTE131 47
#define LAYOUT_ROUTE132 48
#define LAYOUT_ROUTE133 49
#define LAYOUT_ROUTE134 50
#define LAYOUT_UNDERWATER2 51
#define LAYOUT_UNDERWATER3 52
#define LAYOUT_UNDERWATER4 53
#define LAYOUT_LITTLEROOT_TOWN_BRENDANS_HOUSE_1F 54
#define LAYOUT_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F 55
#define LAYOUT_LITTLEROOT_TOWN_MAYS_HOUSE_1F 56
#define LAYOUT_LITTLEROOT_TOWN_MAYS_HOUSE_2F 57
#define LAYOUT_LITTLEROOT_TOWN_PROFESSOR_BIRCHS_LAB 58
#define LAYOUT_HOUSE1 59
#define LAYOUT_HOUSE2 60
#define LAYOUT_POKEMON_CENTER_1F 61
#define LAYOUT_POKEMON_CENTER_2F 62
#define LAYOUT_POKE_MART 63
#define LAYOUT_HOUSE3 64
#define LAYOUT_DEWFORD_TOWN_GYM 65
#define LAYOUT_DEWFORD_TOWN_HALL 66
#define LAYOUT_HOUSE4 67
#define LAYOUT_LAVARIDGE_TOWN_HERB_SHOP 68
#define LAYOUT_LAVARIDGE_TOWN_GYM_1F 69
#define LAYOUT_LAVARIDGE_TOWN_GYM_B1F 70
#define LAYOUT_LAVARIDGE_TOWN_POKEMON_CENTER_1F 71
#define LAYOUT_CONTEST_LOBBY 72
#define LAYOUT_CONTEST_HALL 73
#define LAYOUT_LILYCOVE_CITY_HOUSE2 74
#define LAYOUT_UNKNOWN_MAP_082CF564 75
#define LAYOUT_VERDANTURF_TOWN_WANDAS_HOUSE 76
#define LAYOUT_PACIFIDLOG_TOWN_HOUSE1 77
#define LAYOUT_PACIFIDLOG_TOWN_HOUSE2 78
#define LAYOUT_PETALBURG_CITY_GYM 79
#define LAYOUT_HOUSE_WITH_BED 80
#define LAYOUT_SLATEPORT_CITY_STERNS_SHIPYARD_1F 81
#define LAYOUT_SLATEPORT_CITY_STERNS_SHIPYARD_2F 82
#define LAYOUT_UNKNOWN_MAP_082D05D8 83
#define LAYOUT_UNKNOWN_MAP_082D05FC 84
#define LAYOUT_SLATEPORT_CITY_POKEMON_FAN_CLUB 85
#define LAYOUT_SLATEPORT_CITY_OCEANIC_MUSEUM_1F 86
#define LAYOUT_SLATEPORT_CITY_OCEANIC_MUSEUM_2F 87
#define LAYOUT_HARBOR 88
#define LAYOUT_MAUVILLE_CITY_GYM 89
#define LAYOUT_MAUVILLE_CITY_BIKE_SHOP 90
#define LAYOUT_MAUVILLE_CITY_GAME_CORNER 91
#define LAYOUT_RUSTBORO_CITY_DEVON_CORP_1F 92
#define LAYOUT_RUSTBORO_CITY_DEVON_CORP_2F 93
#define LAYOUT_RUSTBORO_CITY_GYM 94
#define LAYOUT_RUSTBORO_CITY_POKEMON_SCHOOL 95
#define LAYOUT_RUSTBORO_CITY_HOUSE 96
#define LAYOUT_RUSTBORO_CITY_HOUSE1 97
#define LAYOUT_RUSTBORO_CITY_CUTTERS_HOUSE 98
#define LAYOUT_FORTREE_CITY_HOUSE1 99
#define LAYOUT_FORTREE_CITY_GYM 100
#define LAYOUT_FORTREE_CITY_HOUSE2 101
#define LAYOUT_ROUTE104_MR_BRINEYS_HOUSE 102
#define LAYOUT_LILYCOVE_CITY_LILYCOVE_MUSEUM_1F 103
#define LAYOUT_LILYCOVE_CITY_LILYCOVE_MUSEUM_2F 104
#define LAYOUT_LILYCOVE_CITY_CONTEST_LOBBY 105
#define LAYOUT_LILYCOVE_CITY_CONTEST_HALL 106
#define LAYOUT_LILYCOVE_CITY_POKEMON_TRAINER_FAN_CLUB 107
#define LAYOUT_LILYCOVE_CITY_EMPTY_MAP 108
#define LAYOUT_MOSSDEEP_CITY_GYM 109
#define LAYOUT_SOOTOPOLIS_CITY_GYM_1F 110
#define LAYOUT_SOOTOPOLIS_CITY_GYM_B1F 111
#define LAYOUT_EVER_GRANDE_CITY_SIDNEYS_ROOM 112
#define LAYOUT_EVER_GRANDE_CITY_PHOEBES_ROOM 113
#define LAYOUT_EVER_GRANDE_CITY_GLACIAS_ROOM 114
#define LAYOUT_EVER_GRANDE_CITY_DRAKES_ROOM 115
#define LAYOUT_EVER_GRANDE_CITY_CHAMPIONS_ROOM 116
#define LAYOUT_EVER_GRANDE_CITY_SHORT_CORRIDOR 117
#define LAYOUT_ROUTE104_PRETTY_PETAL_FLOWER_SHOP 118
#define LAYOUT_CABLE_CAR_STATION 119
#define LAYOUT_ROUTE114_FOSSIL_MANIACS_HOUSE 120
#define LAYOUT_ROUTE114_FOSSIL_MANIACS_TUNNEL 121
#define LAYOUT_ROUTE114_LANETTES_HOUSE 122
#define LAYOUT_ROUTE116_TUNNELERS_REST_HOUSE 123
#define LAYOUT_ROUTE117_POKEMON_DAY_CARE 124
#define LAYOUT_ROUTE121_SAFARI_ZONE_ENTRANCE 125
#define LAYOUT_METEOR_FALLS_1F_1R 126
#define LAYOUT_METEOR_FALLS_1F_2R 127
#define LAYOUT_METEOR_FALLS_B1F_1R 128
#define LAYOUT_METEOR_FALLS_B1F_2R 129
#define LAYOUT_RUSTURF_TUNNEL 130
#define LAYOUT_UNDERWATER_SOOTOPOLIS_CITY 131
#define LAYOUT_DESERT_RUINS 132
#define LAYOUT_GRANITE_CAVE_1F 133
#define LAYOUT_GRANITE_CAVE_B1F 134
#define LAYOUT_GRANITE_CAVE_B2F 135
#define LAYOUT_PETALBURG_WOODS 136
#define LAYOUT_MT_CHIMNEY 137
#define LAYOUT_MT_PYRE_1F 138
#define LAYOUT_MT_PYRE_2F 139
#define LAYOUT_MT_PYRE_3F 140
#define LAYOUT_MT_PYRE_4F 141
#define LAYOUT_MT_PYRE_5F 142
#define LAYOUT_MT_PYRE_6F 143
#define LAYOUT_AQUA_HIDEOUT_1F 144
#define LAYOUT_AQUA_HIDEOUT_B1F 145
#define LAYOUT_AQUA_HIDEOUT_B2F 146
#define LAYOUT_UNDERWATER_SEAFLOOR_CAVERN 147
#define LAYOUT_SEAFLOOR_CAVERN_ENTRANCE 148
#define LAYOUT_SEAFLOOR_CAVERN_ROOM1 149
#define LAYOUT_SEAFLOOR_CAVERN_ROOM2 150
#define LAYOUT_SEAFLOOR_CAVERN_ROOM3 151
#define LAYOUT_SEAFLOOR_CAVERN_ROOM4 152
#define LAYOUT_SEAFLOOR_CAVERN_ROOM5 153
#define LAYOUT_SEAFLOOR_CAVERN_ROOM6 154
#define LAYOUT_SEAFLOOR_CAVERN_ROOM7 155
#define LAYOUT_SEAFLOOR_CAVERN_ROOM8 156
#define LAYOUT_SEAFLOOR_CAVERN_ROOM9 157
#define LAYOUT_CAVE_OF_ORIGIN_ENTRANCE 158
#define LAYOUT_CAVE_OF_ORIGIN_1F 159
#define LAYOUT_CAVE_OF_ORIGIN_B1F 160
#define LAYOUT_CAVE_OF_ORIGIN_B2F 161
#define LAYOUT_CAVE_OF_ORIGIN_B3F 162
#define LAYOUT_CAVE_OF_ORIGIN_B4F 163
#define LAYOUT_VICTORY_ROAD_1F 164
#define LAYOUT_SHOAL_CAVE_LOW_TIDE_ENTRANCE_ROOM 165
#define LAYOUT_SHOAL_CAVE_LOW_TIDE_INNER_ROOM 166
#define LAYOUT_SHOAL_CAVE_LOW_TIDE_STAIRS_ROOM 167
#define LAYOUT_SHOAL_CAVE_LOW_TIDE_LOWER_ROOM 168
#define LAYOUT_SHOAL_CAVE_HIGH_TIDE_ENTRANCE_ROOM 169
#define LAYOUT_SHOAL_CAVE_HIGH_TIDE_INNER_ROOM 170
#define LAYOUT_UNKNOWN_MAP_082E55C8 171
#define LAYOUT_UNKNOWN_MAP_082E55EC 172
#define LAYOUT_UNKNOWN_MAP_082E5610 173
#define LAYOUT_UNKNOWN_MAP_082E5634 174
#define LAYOUT_UNKNOWN_MAP_082E5658 175
#define LAYOUT_UNKNOWN_MAP_082E567C 176
#define LAYOUT_UNKNOWN_MAP_082E56A0 177
#define LAYOUT_UNKNOWN_MAP_082E56C4 178
#define LAYOUT_UNKNOWN_MAP_082E56E8 179
#define LAYOUT_UNKNOWN_MAP_082E570C 180
#define LAYOUT_UNKNOWN_MAP_082E5730 181
#define LAYOUT_UNKNOWN_MAP_082E5754 182
#define LAYOUT_UNKNOWN_MAP_082E5778 183
#define LAYOUT_UNKNOWN_MAP_082E579C 184
#define LAYOUT_NEW_MAUVILLE_ENTRANCE 185
#define LAYOUT_NEW_MAUVILLE_INSIDE 186
#define LAYOUT_ABANDONED_SHIP_DECK 187
#define LAYOUT_ABANDONED_SHIP_CORRIDORS_1F 188
#define LAYOUT_ABANDONED_SHIP_ROOMS_1F 189
#define LAYOUT_ABANDONED_SHIP_CORRIDORS_B1F 190
#define LAYOUT_ABANDONED_SHIP_ROOMS_B1F 191
#define LAYOUT_ABANDONED_SHIP_ROOMS2_B1F 192
#define LAYOUT_ABANDONED_SHIP_UNDERWATER1 193
#define LAYOUT_ABANDONED_SHIP_ROOM_B1F 194
#define LAYOUT_ABANDONED_SHIP_ROOMS2_1F 195
#define LAYOUT_ABANDONED_SHIP_CAPTAINS_OFFICE 196
#define LAYOUT_ABANDONED_SHIP_UNDERWATER2 197
#define LAYOUT_SECRET_BASE_RED_CAVE1 198
#define LAYOUT_SECRET_BASE_BROWN_CAVE1 199
#define LAYOUT_SECRET_BASE_BLUE_CAVE1 200
#define LAYOUT_SECRET_BASE_YELLOW_CAVE1 201
#define LAYOUT_SECRET_BASE_TREE1 202
#define LAYOUT_SECRET_BASE_SHRUB1 203
#define LAYOUT_SECRET_BASE_RED_CAVE2 204
#define LAYOUT_SECRET_BASE_BROWN_CAVE2 205
#define LAYOUT_SECRET_BASE_BLUE_CAVE2 206
#define LAYOUT_SECRET_BASE_YELLOW_CAVE2 207
#define LAYOUT_SECRET_BASE_TREE2 208
#define LAYOUT_SECRET_BASE_SHRUB2 209
#define LAYOUT_SECRET_BASE_RED_CAVE3 210
#define LAYOUT_SECRET_BASE_BROWN_CAVE3 211
#define LAYOUT_SECRET_BASE_BLUE_CAVE3 212
#define LAYOUT_SECRET_BASE_YELLOW_CAVE3 213
#define LAYOUT_SECRET_BASE_TREE3 214
#define LAYOUT_SECRET_BASE_SHRUB3 215
#define LAYOUT_SECRET_BASE_RED_CAVE4 216
#define LAYOUT_SECRET_BASE_BROWN_CAVE4 217
#define LAYOUT_SECRET_BASE_BLUE_CAVE4 218
#define LAYOUT_SECRET_BASE_YELLOW_CAVE4 219
#define LAYOUT_SECRET_BASE_TREE4 220
#define LAYOUT_SECRET_BASE_SHRUB4 221
#define LAYOUT_SINGLE_BATTLE_COLOSSEUM 222
#define LAYOUT_TRADE_CENTER 223
#define LAYOUT_RECORD_CORNER 224
#define LAYOUT_DOUBLE_BATTLE_COLOSSEUM 225
#define LAYOUT_LINK_CONTEST_ROOM1 226
#define LAYOUT_UNKNOWN_MAP_25_29 227
#define LAYOUT_UNKNOWN_MAP_25_30 228
#define LAYOUT_UNKNOWN_MAP_25_31 229
#define LAYOUT_UNKNOWN_MAP_25_32 230
#define LAYOUT_UNKNOWN_MAP_25_33 231
#define LAYOUT_UNKNOWN_MAP_25_34 232
#define LAYOUT_LINK_CONTEST_ROOM2 233
#define LAYOUT_LINK_CONTEST_ROOM3 234
#define LAYOUT_LINK_CONTEST_ROOM4 235
#define LAYOUT_LINK_CONTEST_ROOM5 236
#define LAYOUT_LINK_CONTEST_ROOM6 237
#define LAYOUT_INSIDE_OF_TRUCK 238
#define LAYOUT_SAFARI_ZONE_NORTHWEST 239
#define LAYOUT_SAFARI_ZONE_NORTHEAST 240
#define LAYOUT_SAFARI_ZONE_SOUTHWEST 241
#define LAYOUT_SAFARI_ZONE_SOUTHEAST 242
#define LAYOUT_UNKNOWN_MAP_082EDF30 243
#define LAYOUT_ROUTE109_SEASHORE_HOUSE 244
#define LAYOUT_ROUTE110_TRICK_HOUSE_ENTRANCE 245
#define LAYOUT_ROUTE110_TRICK_HOUSE_END 246
#define LAYOUT_ROUTE110_TRICK_HOUSE_CORRIDOR 247
#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE1 248
#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE2 249
#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE3 250
#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE4 251
#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE5 252
#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE6 253
#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE7 254
#define LAYOUT_ROUTE110_TRICK_HOUSE_PUZZLE8 255
#define LAYOUT_FORTREE_CITY_DECORATION_SHOP 256
#define LAYOUT_ROUTE110_SEASIDE_CYCLING_ROAD_ENTRACE 257
#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_1F 258
#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_2F 259
#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_3F 260
#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_4F 261
#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_5F 262
#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP 263
#define LAYOUT_ROUTE130 264
#define LAYOUT_BATTLE_TOWER_LOBBY 265
#define LAYOUT_BATTLE_TOWER_OUTSIDE 266
#define LAYOUT_BATTLE_TOWER_ELEVATOR 267
#define LAYOUT_BATTLE_TOWER_CORRIDOR 268
#define LAYOUT_BATTLE_TOWER_BATTLE_ROOM 269
#define LAYOUT_RUSTBORO_CITY_DEVON_CORP_3F 270
#define LAYOUT_EVER_GRANDE_CITY_POKEMON_LEAGUE 271
#define LAYOUT_ROUTE119_WEATHER_INSTITUTE_1F 272
#define LAYOUT_ROUTE119_WEATHER_INSTITUTE_2F 273
#define LAYOUT_LILYCOVE_CITY_DEPARTMENT_STORE_ELEVATOR 274
#define LAYOUT_UNDERWATER1 275
#define LAYOUT_MOSSDEEP_CITY_SPACE_CENTER_1F 276
#define LAYOUT_MOSSDEEP_CITY_SPACE_CENTER_2F 277
#define LAYOUT_SS_TIDAL_CORRIDOR 278
#define LAYOUT_SS_TIDAL_LOWER_DECK 279
#define LAYOUT_SS_TIDAL_ROOMS 280
#define LAYOUT_ISLAND_CAVE 281
#define LAYOUT_ANCIENT_TOMB 282
#define LAYOUT_UNDERWATER_ROUTE134 283
#define LAYOUT_UNDERWATER_SEALED_CHAMBER 284
#define LAYOUT_SEALED_CHAMBER_OUTER_ROOM 285
#define LAYOUT_VICTORY_ROAD_B1F 286
#define LAYOUT_VICTORY_ROAD_B2F 287
#define LAYOUT_ROUTE104_PROTOTYPE 288
#define LAYOUT_GRANITE_CAVE_STEVENS_ROOM 289
#define LAYOUT_ABANDONED_SHIP_HIDDEN_FLOOR_CORRIDORS 290
#define LAYOUT_SOUTHERN_ISLAND_EXTERIOR 291
#define LAYOUT_SOUTHERN_ISLAND_INTERIOR 292
#define LAYOUT_JAGGED_PASS 293
#define LAYOUT_FIERY_PATH 294
#define LAYOUT_RUSTBORO_CITY_FLAT2_1F 295
#define LAYOUT_RUSTBORO_CITY_FLAT2_2F 296
#define LAYOUT_RUSTBORO_CITY_FLAT2_3F 297
#define LAYOUT_SOOTOPOLIS_CITY_HOUSE8 298
#define LAYOUT_EVER_GRANDE_CITY_HALL_OF_FAME 299
#define LAYOUT_LILYCOVE_CITY_COVE_LILY_MOTEL_1F 300
#define LAYOUT_LILYCOVE_CITY_COVE_LILY_MOTEL_2F 301
#define LAYOUT_ROUTE124_DIVING_TREASURE_HUNTERS_HOUSE 302
#define LAYOUT_MT_PYRE_EXTERIOR 303
#define LAYOUT_MT_PYRE_SUMMIT 304
#define LAYOUT_SEALED_CHAMBER_INNER_ROOM 305
#define LAYOUT_MOSSDEEP_CITY_GAME_CORNER_1F 306
#define LAYOUT_MOSSDEEP_CITY_GAME_CORNER_B1F 307
#define LAYOUT_SOOTOPOLIS_CITY_HOUSE1 308
#define LAYOUT_SOOTOPOLIS_CITY_HOUSE2 309
#define LAYOUT_SOOTOPOLIS_CITY_HOUSE3 310
#define LAYOUT_ABANDONED_SHIP_HIDDEN_FLOOR_ROOMS 311
#define LAYOUT_SCORCHED_SLAB 312
#define LAYOUT_UNKNOWN_MAP_082FF894 313
#define LAYOUT_RUSTBORO_CITY_FLAT1_1F 314
#define LAYOUT_RUSTBORO_CITY_FLAT1_2F 315
#define LAYOUT_EVER_GRANDE_CITY_CORRIDOR4 316
#define LAYOUT_MAGMA_HIDEOUT_1F 317
#define LAYOUT_MAGMA_HIDEOUT_B1F 318
#define LAYOUT_MAGMA_HIDEOUT_B2F 319
#define LAYOUT_UNKNOWN_MAP_08302970 320
#define LAYOUT_SKY_PILLAR_ENTRANCE 321
#define LAYOUT_SKY_PILLAR_OUTSIDE 322
#define LAYOUT_SKY_PILLAR_1F 323
#define LAYOUT_SKY_PILLAR_2F 324
#define LAYOUT_SKY_PILLAR_3F 325
#define LAYOUT_SKY_PILLAR_4F 326
#define LAYOUT_UNKNOWN_MAP_083041B4 327
#define LAYOUT_MOSSDEEP_CITY_STEVENS_HOUSE 328
#define LAYOUT_SHOAL_CAVE_LOW_TIDE_ICE_ROOM 329
#define LAYOUT_SAFARI_ZONE_REST_HOUSE 330
#define LAYOUT_SKY_PILLAR_5F 331
#define LAYOUT_SKY_PILLAR_TOP 332
#endif // GUARD_CONSTANTS_LAYOUTS_H

View File

@ -1,468 +0,0 @@
#ifndef GUARD_CONSTANTS_MAP_GROUPS_H
#define GUARD_CONSTANTS_MAP_GROUPS_H
// gMapGroup_TownsAndRoutes
#define MAP_PETALBURG_CITY (0 | (0 << 8))
#define MAP_SLATEPORT_CITY (1 | (0 << 8))
#define MAP_MAUVILLE_CITY (2 | (0 << 8))
#define MAP_RUSTBORO_CITY (3 | (0 << 8))
#define MAP_FORTREE_CITY (4 | (0 << 8))
#define MAP_LILYCOVE_CITY (5 | (0 << 8))
#define MAP_MOSSDEEP_CITY (6 | (0 << 8))
#define MAP_SOOTOPOLIS_CITY (7 | (0 << 8))
#define MAP_EVER_GRANDE_CITY (8 | (0 << 8))
#define MAP_LITTLEROOT_TOWN (9 | (0 << 8))
#define MAP_OLDALE_TOWN (10 | (0 << 8))
#define MAP_DEWFORD_TOWN (11 | (0 << 8))
#define MAP_LAVARIDGE_TOWN (12 | (0 << 8))
#define MAP_FALLARBOR_TOWN (13 | (0 << 8))
#define MAP_VERDANTURF_TOWN (14 | (0 << 8))
#define MAP_PACIFIDLOG_TOWN (15 | (0 << 8))
#define MAP_ROUTE101 (16 | (0 << 8))
#define MAP_ROUTE102 (17 | (0 << 8))
#define MAP_ROUTE103 (18 | (0 << 8))
#define MAP_ROUTE104 (19 | (0 << 8))
#define MAP_ROUTE105 (20 | (0 << 8))
#define MAP_ROUTE106 (21 | (0 << 8))
#define MAP_ROUTE107 (22 | (0 << 8))
#define MAP_ROUTE108 (23 | (0 << 8))
#define MAP_ROUTE109 (24 | (0 << 8))
#define MAP_ROUTE110 (25 | (0 << 8))
#define MAP_ROUTE111 (26 | (0 << 8))
#define MAP_ROUTE112 (27 | (0 << 8))
#define MAP_ROUTE113 (28 | (0 << 8))
#define MAP_ROUTE114 (29 | (0 << 8))
#define MAP_ROUTE115 (30 | (0 << 8))
#define MAP_ROUTE116 (31 | (0 << 8))
#define MAP_ROUTE117 (32 | (0 << 8))
#define MAP_ROUTE118 (33 | (0 << 8))
#define MAP_ROUTE119 (34 | (0 << 8))
#define MAP_ROUTE120 (35 | (0 << 8))
#define MAP_ROUTE121 (36 | (0 << 8))
#define MAP_ROUTE122 (37 | (0 << 8))
#define MAP_ROUTE123 (38 | (0 << 8))
#define MAP_ROUTE124 (39 | (0 << 8))
#define MAP_ROUTE125 (40 | (0 << 8))
#define MAP_ROUTE126 (41 | (0 << 8))
#define MAP_ROUTE127 (42 | (0 << 8))
#define MAP_ROUTE128 (43 | (0 << 8))
#define MAP_ROUTE129 (44 | (0 << 8))
#define MAP_ROUTE130 (45 | (0 << 8))
#define MAP_ROUTE131 (46 | (0 << 8))
#define MAP_ROUTE132 (47 | (0 << 8))
#define MAP_ROUTE133 (48 | (0 << 8))
#define MAP_ROUTE134 (49 | (0 << 8))
#define MAP_UNDERWATER1 (50 | (0 << 8))
#define MAP_UNDERWATER2 (51 | (0 << 8))
#define MAP_UNDERWATER3 (52 | (0 << 8))
#define MAP_UNDERWATER4 (53 | (0 << 8))
// gMapGroup_IndoorLittleroot
#define MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_1F (0 | (1 << 8))
#define MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F (1 | (1 << 8))
#define MAP_LITTLEROOT_TOWN_MAYS_HOUSE_1F (2 | (1 << 8))
#define MAP_LITTLEROOT_TOWN_MAYS_HOUSE_2F (3 | (1 << 8))
#define MAP_LITTLEROOT_TOWN_PROFESSOR_BIRCHS_LAB (4 | (1 << 8))
// gMapGroup_IndoorOldale
#define MAP_OLDALE_TOWN_HOUSE1 (0 | (2 << 8))
#define MAP_OLDALE_TOWN_HOUSE2 (1 | (2 << 8))
#define MAP_OLDALE_TOWN_POKEMON_CENTER_1F (2 | (2 << 8))
#define MAP_OLDALE_TOWN_POKEMON_CENTER_2F (3 | (2 << 8))
#define MAP_OLDALE_TOWN_MART (4 | (2 << 8))
// gMapGroup_IndoorDewford
#define MAP_DEWFORD_TOWN_HOUSE1 (0 | (3 << 8))
#define MAP_DEWFORD_TOWN_POKEMON_CENTER_1F (1 | (3 << 8))
#define MAP_DEWFORD_TOWN_POKEMON_CENTER_2F (2 | (3 << 8))
#define MAP_DEWFORD_TOWN_GYM (3 | (3 << 8))
#define MAP_DEWFORD_TOWN_HALL (4 | (3 << 8))
#define MAP_DEWFORD_TOWN_HOUSE2 (5 | (3 << 8))
// gMapGroup_IndoorLavaridge
#define MAP_LAVARIDGE_TOWN_HERB_SHOP (0 | (4 << 8))
#define MAP_LAVARIDGE_TOWN_GYM_1F (1 | (4 << 8))
#define MAP_LAVARIDGE_TOWN_GYM_B1F (2 | (4 << 8))
#define MAP_LAVARIDGE_TOWN_HOUSE (3 | (4 << 8))
#define MAP_LAVARIDGE_TOWN_MART (4 | (4 << 8))
#define MAP_LAVARIDGE_TOWN_POKEMON_CENTER_1F (5 | (4 << 8))
#define MAP_LAVARIDGE_TOWN_POKEMON_CENTER_2F (6 | (4 << 8))
// gMapGroup_IndoorFallarbor
#define MAP_FALLARBOR_TOWN_MART (0 | (5 << 8))
#define MAP_FALLARBOR_TOWN_CONTEST_LOBBY (1 | (5 << 8))
#define MAP_FALLARBOR_TOWN_CONTEST_HALL (2 | (5 << 8))
#define MAP_FALLARBOR_TOWN_POKEMON_CENTER_1F (3 | (5 << 8))
#define MAP_FALLARBOR_TOWN_POKEMON_CENTER_2F (4 | (5 << 8))
#define MAP_FALLARBOR_TOWN_HOUSE1 (5 | (5 << 8))
#define MAP_FALLARBOR_TOWN_HOUSE2 (6 | (5 << 8))
// gMapGroup_IndoorVerdanturf
#define MAP_VERDANTURF_TOWN_CONTEST_LOBBY (0 | (6 << 8))
#define MAP_VERDANTURF_TOWN_CONTEST_HALL (1 | (6 << 8))
#define MAP_VERDANTURF_TOWN_MART (2 | (6 << 8))
#define MAP_VERDANTURF_TOWN_POKEMON_CENTER_1F (3 | (6 << 8))
#define MAP_VERDANTURF_TOWN_POKEMON_CENTER_2F (4 | (6 << 8))
#define MAP_VERDANTURF_TOWN_WANDAS_HOUSE (5 | (6 << 8))
#define MAP_VERDANTURF_TOWN_FRIENDSHIP_RATERS_HOUSE (6 | (6 << 8))
#define MAP_VERDANTURF_TOWN_HOUSE (7 | (6 << 8))
// gMapGroup_IndoorPacifidlog
#define MAP_PACIFIDLOG_TOWN_POKEMON_CENTER_1F (0 | (7 << 8))
#define MAP_PACIFIDLOG_TOWN_POKEMON_CENTER_2F (1 | (7 << 8))
#define MAP_PACIFIDLOG_TOWN_HOUSE1 (2 | (7 << 8))
#define MAP_PACIFIDLOG_TOWN_HOUSE2 (3 | (7 << 8))
#define MAP_PACIFIDLOG_TOWN_HOUSE3 (4 | (7 << 8))
#define MAP_PACIFIDLOG_TOWN_HOUSE4 (5 | (7 << 8))
#define MAP_PACIFIDLOG_TOWN_HOUSE5 (6 | (7 << 8))
// gMapGroup_IndoorPetalburg
#define MAP_PETALBURG_CITY_WALLYS_HOUSE (0 | (8 << 8))
#define MAP_PETALBURG_CITY_GYM (1 | (8 << 8))
#define MAP_PETALBURG_CITY_HOUSE1 (2 | (8 << 8))
#define MAP_PETALBURG_CITY_HOUSE2 (3 | (8 << 8))
#define MAP_PETALBURG_CITY_POKEMON_CENTER_1F (4 | (8 << 8))
#define MAP_PETALBURG_CITY_POKEMON_CENTER_2F (5 | (8 << 8))
#define MAP_PETALBURG_CITY_MART (6 | (8 << 8))
// gMapGroup_IndoorSlateport
#define MAP_SLATEPORT_CITY_STERNS_SHIPYARD_1F (0 | (9 << 8))
#define MAP_SLATEPORT_CITY_STERNS_SHIPYARD_2F (1 | (9 << 8))
#define MAP_SLATEPORT_CITY_CONTEST_LOBBY (2 | (9 << 8))
#define MAP_SLATEPORT_CITY_CONTEST_HALL (3 | (9 << 8))
#define MAP_SLATEPORT_CITY_HOUSE1 (4 | (9 << 8))
#define MAP_SLATEPORT_CITY_POKEMON_FAN_CLUB (5 | (9 << 8))
#define MAP_SLATEPORT_CITY_OCEANIC_MUSEUM_1F (6 | (9 << 8))
#define MAP_SLATEPORT_CITY_OCEANIC_MUSEUM_2F (7 | (9 << 8))
#define MAP_SLATEPORT_CITY_HARBOR (8 | (9 << 8))
#define MAP_SLATEPORT_CITY_HOUSE2 (9 | (9 << 8))
#define MAP_SLATEPORT_CITY_POKEMON_CENTER_1F (10 | (9 << 8))
#define MAP_SLATEPORT_CITY_POKEMON_CENTER_2F (11 | (9 << 8))
#define MAP_SLATEPORT_CITY_MART (12 | (9 << 8))
// gMapGroup_IndoorMauville
#define MAP_MAUVILLE_CITY_GYM (0 | (10 << 8))
#define MAP_MAUVILLE_CITY_BIKE_SHOP (1 | (10 << 8))
#define MAP_MAUVILLE_CITY_HOUSE1 (2 | (10 << 8))
#define MAP_MAUVILLE_CITY_GAME_CORNER (3 | (10 << 8))
#define MAP_MAUVILLE_CITY_HOUSE2 (4 | (10 << 8))
#define MAP_MAUVILLE_CITY_POKEMON_CENTER_1F (5 | (10 << 8))
#define MAP_MAUVILLE_CITY_POKEMON_CENTER_2F (6 | (10 << 8))
#define MAP_MAUVILLE_CITY_MART (7 | (10 << 8))
// gMapGroup_IndoorRustboro
#define MAP_RUSTBORO_CITY_DEVON_CORP_1F (0 | (11 << 8))
#define MAP_RUSTBORO_CITY_DEVON_CORP_2F (1 | (11 << 8))
#define MAP_RUSTBORO_CITY_DEVON_CORP_3F (2 | (11 << 8))
#define MAP_RUSTBORO_CITY_GYM (3 | (11 << 8))
#define MAP_RUSTBORO_CITY_POKEMON_SCHOOL (4 | (11 << 8))
#define MAP_RUSTBORO_CITY_POKEMON_CENTER_1F (5 | (11 << 8))
#define MAP_RUSTBORO_CITY_POKEMON_CENTER_2F (6 | (11 << 8))
#define MAP_RUSTBORO_CITY_MART (7 | (11 << 8))
#define MAP_RUSTBORO_CITY_FLAT1_1F (8 | (11 << 8))
#define MAP_RUSTBORO_CITY_FLAT1_2F (9 | (11 << 8))
#define MAP_RUSTBORO_CITY_HOUSE1 (10 | (11 << 8))
#define MAP_RUSTBORO_CITY_CUTTERS_HOUSE (11 | (11 << 8))
#define MAP_RUSTBORO_CITY_HOUSE2 (12 | (11 << 8))
#define MAP_RUSTBORO_CITY_FLAT2_1F (13 | (11 << 8))
#define MAP_RUSTBORO_CITY_FLAT2_2F (14 | (11 << 8))
#define MAP_RUSTBORO_CITY_FLAT2_3F (15 | (11 << 8))
#define MAP_RUSTBORO_CITY_HOUSE3 (16 | (11 << 8))
// gMapGroup_IndoorFortree
#define MAP_FORTREE_CITY_HOUSE1 (0 | (12 << 8))
#define MAP_FORTREE_CITY_GYM (1 | (12 << 8))
#define MAP_FORTREE_CITY_POKEMON_CENTER_1F (2 | (12 << 8))
#define MAP_FORTREE_CITY_POKEMON_CENTER_2F (3 | (12 << 8))
#define MAP_FORTREE_CITY_MART (4 | (12 << 8))
#define MAP_FORTREE_CITY_HOUSE2 (5 | (12 << 8))
#define MAP_FORTREE_CITY_HOUSE3 (6 | (12 << 8))
#define MAP_FORTREE_CITY_HOUSE4 (7 | (12 << 8))
#define MAP_FORTREE_CITY_HOUSE5 (8 | (12 << 8))
#define MAP_FORTREE_CITY_DECORATION_SHOP (9 | (12 << 8))
// gMapGroup_IndoorLilycove
#define MAP_LILYCOVE_CITY_COVE_LILY_MOTEL_1F (0 | (13 << 8))
#define MAP_LILYCOVE_CITY_COVE_LILY_MOTEL_2F (1 | (13 << 8))
#define MAP_LILYCOVE_CITY_LILYCOVE_MUSEUM_1F (2 | (13 << 8))
#define MAP_LILYCOVE_CITY_LILYCOVE_MUSEUM_2F (3 | (13 << 8))
#define MAP_LILYCOVE_CITY_CONTEST_LOBBY (4 | (13 << 8))
#define MAP_LILYCOVE_CITY_CONTEST_HALL (5 | (13 << 8))
#define MAP_LILYCOVE_CITY_POKEMON_CENTER_1F (6 | (13 << 8))
#define MAP_LILYCOVE_CITY_POKEMON_CENTER_2F (7 | (13 << 8))
#define MAP_LILYCOVE_CITY_UNUSED_MART (8 | (13 << 8))
#define MAP_LILYCOVE_CITY_POKEMON_TRAINER_FAN_CLUB (9 | (13 << 8))
#define MAP_LILYCOVE_CITY_HARBOR (10 | (13 << 8))
#define MAP_LILYCOVE_CITY_EMPTY_MAP (11 | (13 << 8))
#define MAP_LILYCOVE_CITY_MOVE_DELETERS_HOUSE (12 | (13 << 8))
#define MAP_LILYCOVE_CITY_HOUSE1 (13 | (13 << 8))
#define MAP_LILYCOVE_CITY_HOUSE2 (14 | (13 << 8))
#define MAP_LILYCOVE_CITY_HOUSE3 (15 | (13 << 8))
#define MAP_LILYCOVE_CITY_HOUSE4 (16 | (13 << 8))
#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_1F (17 | (13 << 8))
#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_2F (18 | (13 << 8))
#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_3F (19 | (13 << 8))
#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_4F (20 | (13 << 8))
#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_5F (21 | (13 << 8))
#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP (22 | (13 << 8))
#define MAP_LILYCOVE_CITY_DEPARTMENT_STORE_ELEVATOR (23 | (13 << 8))
// gMapGroup_IndoorMossdeep
#define MAP_MOSSDEEP_CITY_GYM (0 | (14 << 8))
#define MAP_MOSSDEEP_CITY_HOUSE1 (1 | (14 << 8))
#define MAP_MOSSDEEP_CITY_HOUSE2 (2 | (14 << 8))
#define MAP_MOSSDEEP_CITY_POKEMON_CENTER_1F (3 | (14 << 8))
#define MAP_MOSSDEEP_CITY_POKEMON_CENTER_2F (4 | (14 << 8))
#define MAP_MOSSDEEP_CITY_MART (5 | (14 << 8))
#define MAP_MOSSDEEP_CITY_HOUSE3 (6 | (14 << 8))
#define MAP_MOSSDEEP_CITY_STEVENS_HOUSE (7 | (14 << 8))
#define MAP_MOSSDEEP_CITY_HOUSE4 (8 | (14 << 8))
#define MAP_MOSSDEEP_CITY_SPACE_CENTER_1F (9 | (14 << 8))
#define MAP_MOSSDEEP_CITY_SPACE_CENTER_2F (10 | (14 << 8))
#define MAP_MOSSDEEP_CITY_GAME_CORNER_1F (11 | (14 << 8))
#define MAP_MOSSDEEP_CITY_GAME_CORNER_B1F (12 | (14 << 8))
// gMapGroup_IndoorSootopolis
#define MAP_SOOTOPOLIS_CITY_GYM_1F (0 | (15 << 8))
#define MAP_SOOTOPOLIS_CITY_GYM_B1F (1 | (15 << 8))
#define MAP_SOOTOPOLIS_CITY_POKEMON_CENTER_1F (2 | (15 << 8))
#define MAP_SOOTOPOLIS_CITY_POKEMON_CENTER_2F (3 | (15 << 8))
#define MAP_SOOTOPOLIS_CITY_MART (4 | (15 << 8))
#define MAP_SOOTOPOLIS_CITY_HOUSE1 (5 | (15 << 8))
#define MAP_SOOTOPOLIS_CITY_HOUSE2 (6 | (15 << 8))
#define MAP_SOOTOPOLIS_CITY_HOUSE3 (7 | (15 << 8))
#define MAP_SOOTOPOLIS_CITY_HOUSE4 (8 | (15 << 8))
#define MAP_SOOTOPOLIS_CITY_HOUSE5 (9 | (15 << 8))
#define MAP_SOOTOPOLIS_CITY_HOUSE6 (10 | (15 << 8))
#define MAP_SOOTOPOLIS_CITY_HOUSE7 (11 | (15 << 8))
#define MAP_SOOTOPOLIS_CITY_HOUSE8 (12 | (15 << 8))
// gMapGroup_IndoorEverGrande
#define MAP_EVER_GRANDE_CITY_SIDNEYS_ROOM (0 | (16 << 8))
#define MAP_EVER_GRANDE_CITY_PHOEBES_ROOM (1 | (16 << 8))
#define MAP_EVER_GRANDE_CITY_GLACIAS_ROOM (2 | (16 << 8))
#define MAP_EVER_GRANDE_CITY_DRAKES_ROOM (3 | (16 << 8))
#define MAP_EVER_GRANDE_CITY_CHAMPIONS_ROOM (4 | (16 << 8))
#define MAP_EVER_GRANDE_CITY_CORRIDOR1 (5 | (16 << 8))
#define MAP_EVER_GRANDE_CITY_CORRIDOR2 (6 | (16 << 8))
#define MAP_EVER_GRANDE_CITY_CORRIDOR3 (7 | (16 << 8))
#define MAP_EVER_GRANDE_CITY_CORRIDOR4 (8 | (16 << 8))
#define MAP_EVER_GRANDE_CITY_CORRIDOR5 (9 | (16 << 8))
#define MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE (10 | (16 << 8))
#define MAP_EVER_GRANDE_CITY_HALL_OF_FAME (11 | (16 << 8))
#define MAP_EVER_GRANDE_CITY_POKEMON_CENTER_1F (12 | (16 << 8))
#define MAP_EVER_GRANDE_CITY_POKEMON_CENTER_2F (13 | (16 << 8))
// gMapGroup_IndoorRoute104
#define MAP_ROUTE104_MR_BRINEYS_HOUSE (0 | (17 << 8))
#define MAP_ROUTE104_PRETTY_PETAL_FLOWER_SHOP (1 | (17 << 8))
// gMapGroup_IndoorRoute111
#define MAP_ROUTE111_WINSTRATE_FAMILYS_HOUSE (0 | (18 << 8))
#define MAP_ROUTE111_OLD_LADYS_REST_STOP (1 | (18 << 8))
// gMapGroup_IndoorRoute112
#define MAP_ROUTE112_CABLE_CAR_STATION (0 | (19 << 8))
#define MAP_MT_CHIMNEY_CABLE_CAR_STATION (1 | (19 << 8))
// gMapGroup_IndoorRoute114
#define MAP_ROUTE114_FOSSIL_MANIACS_HOUSE (0 | (20 << 8))
#define MAP_ROUTE114_FOSSIL_MANIACS_TUNNEL (1 | (20 << 8))
#define MAP_ROUTE114_LANETTES_HOUSE (2 | (20 << 8))
// gMapGroup_IndoorRoute116
#define MAP_ROUTE116_TUNNELERS_REST_HOUSE (0 | (21 << 8))
// gMapGroup_IndoorRoute117
#define MAP_ROUTE117_POKEMON_DAY_CARE (0 | (22 << 8))
// gMapGroup_IndoorRoute121
#define MAP_ROUTE121_SAFARI_ZONE_ENTRANCE (0 | (23 << 8))
// gMapGroup_Dungeons
#define MAP_METEOR_FALLS_1F_1R (0 | (24 << 8))
#define MAP_METEOR_FALLS_1F_2R (1 | (24 << 8))
#define MAP_METEOR_FALLS_B1F_1R (2 | (24 << 8))
#define MAP_METEOR_FALLS_B1F_2R (3 | (24 << 8))
#define MAP_RUSTURF_TUNNEL (4 | (24 << 8))
#define MAP_UNDERWATER_SOOTOPOLIS_CITY (5 | (24 << 8))
#define MAP_DESERT_RUINS (6 | (24 << 8))
#define MAP_GRANITE_CAVE_1F (7 | (24 << 8))
#define MAP_GRANITE_CAVE_B1F (8 | (24 << 8))
#define MAP_GRANITE_CAVE_B2F (9 | (24 << 8))
#define MAP_GRANITE_CAVE_STEVENS_ROOM (10 | (24 << 8))
#define MAP_PETALBURG_WOODS (11 | (24 << 8))
#define MAP_MT_CHIMNEY (12 | (24 << 8))
#define MAP_JAGGED_PASS (13 | (24 << 8))
#define MAP_FIERY_PATH (14 | (24 << 8))
#define MAP_MT_PYRE_1F (15 | (24 << 8))
#define MAP_MT_PYRE_2F (16 | (24 << 8))
#define MAP_MT_PYRE_3F (17 | (24 << 8))
#define MAP_MT_PYRE_4F (18 | (24 << 8))
#define MAP_MT_PYRE_5F (19 | (24 << 8))
#define MAP_MT_PYRE_6F (20 | (24 << 8))
#define MAP_MT_PYRE_EXTERIOR (21 | (24 << 8))
#define MAP_MT_PYRE_SUMMIT (22 | (24 << 8))
#define MAP_AQUA_HIDEOUT_1F (23 | (24 << 8))
#define MAP_AQUA_HIDEOUT_B1F (24 | (24 << 8))
#define MAP_AQUA_HIDEOUT_B2F (25 | (24 << 8))
#define MAP_UNDERWATER_SEAFLOOR_CAVERN (26 | (24 << 8))
#define MAP_SEAFLOOR_CAVERN_ENTRANCE (27 | (24 << 8))
#define MAP_SEAFLOOR_CAVERN_ROOM1 (28 | (24 << 8))
#define MAP_SEAFLOOR_CAVERN_ROOM2 (29 | (24 << 8))
#define MAP_SEAFLOOR_CAVERN_ROOM3 (30 | (24 << 8))
#define MAP_SEAFLOOR_CAVERN_ROOM4 (31 | (24 << 8))
#define MAP_SEAFLOOR_CAVERN_ROOM5 (32 | (24 << 8))
#define MAP_SEAFLOOR_CAVERN_ROOM6 (33 | (24 << 8))
#define MAP_SEAFLOOR_CAVERN_ROOM7 (34 | (24 << 8))
#define MAP_SEAFLOOR_CAVERN_ROOM8 (35 | (24 << 8))
#define MAP_SEAFLOOR_CAVERN_ROOM9 (36 | (24 << 8))
#define MAP_CAVE_OF_ORIGIN_ENTRANCE (37 | (24 << 8))
#define MAP_CAVE_OF_ORIGIN_1F (38 | (24 << 8))
#define MAP_CAVE_OF_ORIGIN_B1F (39 | (24 << 8))
#define MAP_CAVE_OF_ORIGIN_B2F (40 | (24 << 8))
#define MAP_CAVE_OF_ORIGIN_B3F (41 | (24 << 8))
#define MAP_CAVE_OF_ORIGIN_B4F (42 | (24 << 8))
#define MAP_VICTORY_ROAD_1F (43 | (24 << 8))
#define MAP_VICTORY_ROAD_B1F (44 | (24 << 8))
#define MAP_VICTORY_ROAD_B2F (45 | (24 << 8))
#define MAP_SHOAL_CAVE_LOW_TIDE_ENTRANCE_ROOM (46 | (24 << 8))
#define MAP_SHOAL_CAVE_LOW_TIDE_INNER_ROOM (47 | (24 << 8))
#define MAP_SHOAL_CAVE_LOW_TIDE_STAIRS_ROOM (48 | (24 << 8))
#define MAP_SHOAL_CAVE_LOW_TIDE_LOWER_ROOM (49 | (24 << 8))
#define MAP_SHOAL_CAVE_HIGH_TIDE_ENTRANCE_ROOM (50 | (24 << 8))
#define MAP_SHOAL_CAVE_HIGH_TIDE_INNER_ROOM (51 | (24 << 8))
#define MAP_NEW_MAUVILLE_ENTRANCE (52 | (24 << 8))
#define MAP_NEW_MAUVILLE_INSIDE (53 | (24 << 8))
#define MAP_ABANDONED_SHIP_DECK (54 | (24 << 8))
#define MAP_ABANDONED_SHIP_CORRIDORS_1F (55 | (24 << 8))
#define MAP_ABANDONED_SHIP_ROOMS_1F (56 | (24 << 8))
#define MAP_ABANDONED_SHIP_CORRIDORS_B1F (57 | (24 << 8))
#define MAP_ABANDONED_SHIP_ROOMS_B1F (58 | (24 << 8))
#define MAP_ABANDONED_SHIP_ROOMS2_B1F (59 | (24 << 8))
#define MAP_ABANDONED_SHIP_UNDERWATER1 (60 | (24 << 8))
#define MAP_ABANDONED_SHIP_ROOM_B1F (61 | (24 << 8))
#define MAP_ABANDONED_SHIP_ROOMS2_1F (62 | (24 << 8))
#define MAP_ABANDONED_SHIP_CAPTAINS_OFFICE (63 | (24 << 8))
#define MAP_ABANDONED_SHIP_UNDERWATER2 (64 | (24 << 8))
#define MAP_ABANDONED_SHIP_HIDDEN_FLOOR_CORRIDORS (65 | (24 << 8))
#define MAP_ABANDONED_SHIP_HIDDEN_FLOOR_ROOMS (66 | (24 << 8))
#define MAP_ISLAND_CAVE (67 | (24 << 8))
#define MAP_ANCIENT_TOMB (68 | (24 << 8))
#define MAP_UNDERWATER_ROUTE134 (69 | (24 << 8))
#define MAP_UNDERWATER_SEALED_CHAMBER (70 | (24 << 8))
#define MAP_SEALED_CHAMBER_OUTER_ROOM (71 | (24 << 8))
#define MAP_SEALED_CHAMBER_INNER_ROOM (72 | (24 << 8))
#define MAP_SCORCHED_SLAB (73 | (24 << 8))
#define MAP_MAGMA_HIDEOUT_1F (74 | (24 << 8))
#define MAP_MAGMA_HIDEOUT_B1F (75 | (24 << 8))
#define MAP_MAGMA_HIDEOUT_B2F (76 | (24 << 8))
#define MAP_SKY_PILLAR_ENTRANCE (77 | (24 << 8))
#define MAP_SKY_PILLAR_OUTSIDE (78 | (24 << 8))
#define MAP_SKY_PILLAR_1F (79 | (24 << 8))
#define MAP_SKY_PILLAR_2F (80 | (24 << 8))
#define MAP_SKY_PILLAR_3F (81 | (24 << 8))
#define MAP_SKY_PILLAR_4F (82 | (24 << 8))
#define MAP_SHOAL_CAVE_LOW_TIDE_ICE_ROOM (83 | (24 << 8))
#define MAP_SKY_PILLAR_5F (84 | (24 << 8))
#define MAP_SKY_PILLAR_TOP (85 | (24 << 8))
// gMapGroup_IndoorDynamic
#define MAP_SECRET_BASE_RED_CAVE1 (0 | (25 << 8))
#define MAP_SECRET_BASE_BROWN_CAVE1 (1 | (25 << 8))
#define MAP_SECRET_BASE_BLUE_CAVE1 (2 | (25 << 8))
#define MAP_SECRET_BASE_YELLOW_CAVE1 (3 | (25 << 8))
#define MAP_SECRET_BASE_TREE1 (4 | (25 << 8))
#define MAP_SECRET_BASE_SHRUB1 (5 | (25 << 8))
#define MAP_SECRET_BASE_RED_CAVE2 (6 | (25 << 8))
#define MAP_SECRET_BASE_BROWN_CAVE2 (7 | (25 << 8))
#define MAP_SECRET_BASE_BLUE_CAVE2 (8 | (25 << 8))
#define MAP_SECRET_BASE_YELLOW_CAVE2 (9 | (25 << 8))
#define MAP_SECRET_BASE_TREE2 (10 | (25 << 8))
#define MAP_SECRET_BASE_SHRUB2 (11 | (25 << 8))
#define MAP_SECRET_BASE_RED_CAVE3 (12 | (25 << 8))
#define MAP_SECRET_BASE_BROWN_CAVE3 (13 | (25 << 8))
#define MAP_SECRET_BASE_BLUE_CAVE3 (14 | (25 << 8))
#define MAP_SECRET_BASE_YELLOW_CAVE3 (15 | (25 << 8))
#define MAP_SECRET_BASE_TREE3 (16 | (25 << 8))
#define MAP_SECRET_BASE_SHRUB3 (17 | (25 << 8))
#define MAP_SECRET_BASE_RED_CAVE4 (18 | (25 << 8))
#define MAP_SECRET_BASE_BROWN_CAVE4 (19 | (25 << 8))
#define MAP_SECRET_BASE_BLUE_CAVE4 (20 | (25 << 8))
#define MAP_SECRET_BASE_YELLOW_CAVE4 (21 | (25 << 8))
#define MAP_SECRET_BASE_TREE4 (22 | (25 << 8))
#define MAP_SECRET_BASE_SHRUB4 (23 | (25 << 8))
#define MAP_SINGLE_BATTLE_COLOSSEUM (24 | (25 << 8))
#define MAP_TRADE_CENTER (25 | (25 << 8))
#define MAP_RECORD_CORNER (26 | (25 << 8))
#define MAP_DOUBLE_BATTLE_COLOSSEUM (27 | (25 << 8))
#define MAP_LINK_CONTEST_ROOM1 (28 | (25 << 8))
#define MAP_UNKNOWN_MAP_25_29 (29 | (25 << 8))
#define MAP_UNKNOWN_MAP_25_30 (30 | (25 << 8))
#define MAP_UNKNOWN_MAP_25_31 (31 | (25 << 8))
#define MAP_UNKNOWN_MAP_25_32 (32 | (25 << 8))
#define MAP_UNKNOWN_MAP_25_33 (33 | (25 << 8))
#define MAP_UNKNOWN_MAP_25_34 (34 | (25 << 8))
#define MAP_LINK_CONTEST_ROOM2 (35 | (25 << 8))
#define MAP_LINK_CONTEST_ROOM3 (36 | (25 << 8))
#define MAP_LINK_CONTEST_ROOM4 (37 | (25 << 8))
#define MAP_LINK_CONTEST_ROOM5 (38 | (25 << 8))
#define MAP_LINK_CONTEST_ROOM6 (39 | (25 << 8))
#define MAP_INSIDE_OF_TRUCK (40 | (25 << 8))
#define MAP_SS_TIDAL_CORRIDOR (41 | (25 << 8))
#define MAP_SS_TIDAL_LOWER_DECK (42 | (25 << 8))
#define MAP_SS_TIDAL_ROOMS (43 | (25 << 8))
// gMapGroup_SpecialArea
#define MAP_SAFARI_ZONE_NORTHWEST (0 | (26 << 8))
#define MAP_SAFARI_ZONE_NORTHEAST (1 | (26 << 8))
#define MAP_SAFARI_ZONE_SOUTHWEST (2 | (26 << 8))
#define MAP_SAFARI_ZONE_SOUTHEAST (3 | (26 << 8))
#define MAP_BATTLE_TOWER_OUTSIDE (4 | (26 << 8))
#define MAP_BATTLE_TOWER_LOBBY (5 | (26 << 8))
#define MAP_BATTLE_TOWER_ELEVATOR (6 | (26 << 8))
#define MAP_BATTLE_TOWER_CORRIDOR (7 | (26 << 8))
#define MAP_BATTLE_TOWER_BATTLE_ROOM (8 | (26 << 8))
#define MAP_SOUTHERN_ISLAND_EXTERIOR (9 | (26 << 8))
#define MAP_SOUTHERN_ISLAND_INTERIOR (10 | (26 << 8))
#define MAP_SAFARI_ZONE_REST_HOUSE (11 | (26 << 8))
// gMapGroup_IndoorRoute104Prototype
#define MAP_ROUTE104_PROTOTYPE (0 | (27 << 8))
#define MAP_ROUTE104_PROTOTYPE_PRETTY_PETAL_FLOWER_SHOP (1 | (27 << 8))
// gMapGroup_IndoorRoute109
#define MAP_ROUTE109_SEASHORE_HOUSE (0 | (28 << 8))
// gMapGroup_IndoorRoute110
#define MAP_ROUTE110_TRICK_HOUSE_ENTRANCE (0 | (29 << 8))
#define MAP_ROUTE110_TRICK_HOUSE_END (1 | (29 << 8))
#define MAP_ROUTE110_TRICK_HOUSE_CORRIDOR (2 | (29 << 8))
#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE1 (3 | (29 << 8))
#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE2 (4 | (29 << 8))
#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE3 (5 | (29 << 8))
#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE4 (6 | (29 << 8))
#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE5 (7 | (29 << 8))
#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE6 (8 | (29 << 8))
#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE7 (9 | (29 << 8))
#define MAP_ROUTE110_TRICK_HOUSE_PUZZLE8 (10 | (29 << 8))
#define MAP_ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE (11 | (29 << 8))
#define MAP_ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE (12 | (29 << 8))
// gMapGroup_IndoorRoute113
#define MAP_ROUTE113_GLASS_WORKSHOP (0 | (30 << 8))
// gMapGroup_IndoorRoute123
#define MAP_ROUTE123_BERRY_MASTERS_HOUSE (0 | (31 << 8))
// gMapGroup_IndoorRoute119
#define MAP_ROUTE119_WEATHER_INSTITUTE_1F (0 | (32 << 8))
#define MAP_ROUTE119_WEATHER_INSTITUTE_2F (1 | (32 << 8))
#define MAP_ROUTE119_HOUSE (2 | (32 << 8))
// gMapGroup_IndoorRoute124
#define MAP_ROUTE124_DIVING_TREASURE_HUNTERS_HOUSE (0 | (33 << 8))
#define MAP_GROUPS_COUNT 34
#endif // GUARD_CONSTANTS_MAP_GROUPS_H

View File

@ -242,4 +242,6 @@
#define MB_UNUSED_EE 0xEE
#define MB_UNUSED_EF 0xEF
#define MB_INVALID 0xFF
#endif // GUARD_METATILE_BEHAVIORS

View File

@ -1,346 +1,344 @@
#ifndef GUARD_METATILE_LABELS_H
#define GUARD_METATILE_LABELS_H
// gTileset_General
#define METATILE_General_Grass 0x001
#define METATILE_General_TallGrass 0x00D
#define METATILE_General_LongGrass 0x015
#define METATILE_General_TallGrass_TreeUp 0x025
#define METATILE_General_Grass_TreeUp 0x00E
#define METATILE_General_TallGrass_TreeLeft 0x1C6
#define METATILE_General_TallGrass_TreeRight 0x1C7
#define METATILE_General_Grass_TreeLeft 0x1CE
#define METATILE_General_Grass_TreeRight 0x1CF
#define METATILE_General_MuddySlope_Frame0 0x0E8
#define METATILE_General_MuddySlope_Frame1 0x0E9
#define METATILE_General_MuddySlope_Frame2 0x0EA
#define METATILE_General_MuddySlope_Frame3 0x0EB
#define METATILE_General_SandPit_Center 0x121
#define METATILE_General_CaveEntrance_Top 0x09F
#define METATILE_General_CaveEntrance_Bottom 0x0A7
#define METATILE_General_RockWall_GrassBase 0x079
#define METATILE_General_RockWall_RockBase 0x07C
#define METATILE_General_RockWall_SandBase 0x091
#define METATILE_General_RockWall_WaterBase 0x0A9
#define METATILE_General_CalmWater 0x170
#define METATILE_General_RoughWater 0x14E
#define METATILE_General_RoughDeepWater 0x14F
#define METATILE_General_ReflectiveWater 0x0A1
#define METATILE_General_Shore_BottomLeft 0x1BD
#define METATILE_General_Shore_BottomMid 0x1BE
#define METATILE_General_Shore_BottomRight 0x1BF
// gTileset_Fortree
#define METATILE_Fortree_LongGrass_Root 0x208
#define METATILE_Fortree_BridgeOverGrass_Raised 0x24E
#define METATILE_Fortree_BridgeOverGrass_Lowered 0x24F
#define METATILE_Fortree_BridgeOverTrees_Raised 0x256
#define METATILE_Fortree_BridgeOverTrees_Lowered 0x257
#define METATILE_Fortree_SecretBase_LongGrass_TopLeft 0x279
#define METATILE_Fortree_SecretBase_LongGrass_TopMid 0x27A
#define METATILE_Fortree_SecretBase_LongGrass_TopRight 0x27B
#define METATILE_Fortree_SecretBase_LongGrass_BottomLeft 0x281
#define METATILE_Fortree_SecretBase_LongGrass_BottomMid 0x282
#define METATILE_Fortree_SecretBase_LongGrass_BottomRight 0x283
#define METATILE_Fortree_WoodBridge_Kecleon0 0x297
#define METATILE_Fortree_WoodBridge_Kecleon1 0x29F
// gTileset_Pacifidlog
#define METATILE_Pacifidlog_FloatingLogs_Horizontal0 0x250
#define METATILE_Pacifidlog_FloatingLogs_Horizontal1 0x251
#define METATILE_Pacifidlog_HalfSubmergedLogs_Horizontal0 0x252
#define METATILE_Pacifidlog_HalfSubmergedLogs_Horizontal1 0x253
#define METATILE_Pacifidlog_SubmergedLogs_Horizontal0 0x254
#define METATILE_Pacifidlog_SubmergedLogs_Horizontal1 0x255
#define METATILE_Pacifidlog_FloatingLogs_Vertical0 0x258
#define METATILE_Pacifidlog_FloatingLogs_Vertical1 0x260
#define METATILE_Pacifidlog_HalfSubmergedLogs_Vertical0 0x259
#define METATILE_Pacifidlog_HalfSubmergedLogs_Vertical1 0x261
#define METATILE_Pacifidlog_SubmergedLogs_Vertical0 0x25A
#define METATILE_Pacifidlog_SubmergedLogs_Vertical1 0x262
// gTileset_Fallarbor
#define METATILE_Fallarbor_AshGrass 0x20A
#define METATILE_Fallarbor_NormalGrass 0x212
#define METATILE_Fallarbor_AshField 0x218
// gTileset_Lavaridge
#define METATILE_Lavaridge_NormalGrass 0x206
#define METATILE_Lavaridge_AshGrass 0x207
#define METATILE_Lavaridge_LavaField 0x271
// gTileset_EliteFour
#define METATILE_EliteFour_OpenDoor_Frame 0x344
#define METATILE_EliteFour_OpenDoor_Opening 0x345
#define METATILE_EliteFour_OpenDoorChampion_Frame 0x346
#define METATILE_EliteFour_OpenDoorChampion_Opening 0x347
#define METATILE_EliteFour_LeftSpotlightOff 0x2DD
#define METATILE_EliteFour_RightSpotlightOff 0x2DE
#define METATILE_EliteFour_EntryDoor_ClosedTop 0x206
#define METATILE_EliteFour_EntryDoor_ClosedBottom 0x20E
// gTileset_InsideShip
#define METATILE_InsideShip_InTactDoor0_Bottom 0x233
#define METATILE_InsideShip_InTactDoor1_Bottom 0x22B
#define METATILE_InsideShip_DoorIndent1 0x21A
#define METATILE_InsideShip_DoorIndent0 0x234
// gTileset_Cave
#define METATILE_Cave_EntranceCover 0x229
#define METATILE_Cave_SealedChamberEntrance_TopLeft 0x22A
#define METATILE_Cave_SealedChamberEntrance_TopMid 0x22B
#define METATILE_Cave_SealedChamberEntrance_TopRight 0x22C
#define METATILE_Cave_SealedChamberEntrance_BottomLeft 0x232
#define METATILE_Cave_SealedChamberEntrance_BottomMid 0x233
#define METATILE_Cave_SealedChamberEntrance_BottomRight 0x234
#define METATILE_Cave_SealedChamberBraille_Mid 0x235
#define METATILE_Cave_ShoalCave_DirtPile_Large 0x358
#define METATILE_Cave_ShoalCave_DirtPile_Small 0x35A
#define METATILE_Cave_ShoalCave_BlueStone_Large 0x359
#define METATILE_Cave_ShoalCave_BlueStone_Small 0x35B
// gTileset_BattleTower
#define METATILE_BattleTower_CorridorOpenDoor_Top 0x207
#define METATILE_BattleTower_CorridorOpenDoor_Bottom 0x20F
#define METATILE_BattleTower_Elevator_Top0 0x268
#define METATILE_BattleTower_Elevator_Top1 0x269
#define METATILE_BattleTower_Elevator_Top2 0x26A
#define METATILE_BattleTower_Elevator_Mid0 0x270
#define METATILE_BattleTower_Elevator_Mid1 0x271
#define METATILE_BattleTower_Elevator_Mid2 0x272
#define METATILE_BattleTower_Elevator_Bottom0 0x278
#define METATILE_BattleTower_Elevator_Bottom1 0x279
#define METATILE_BattleTower_Elevator_Bottom2 0x27A
// gTileset_Contest
#define METATILE_Contest_WallShadow 0x221
#define METATILE_Contest_FloorShadow 0x261
#define METATILE_Contest_CounterFlap_Top 0x2D1
#define METATILE_Contest_CounterFlap_Bottom 0x2D9
// gTileset_LilycoveMuseum
#define METATILE_LilycoveMuseum_Painting0_Left 0x25A
#define METATILE_LilycoveMuseum_Painting0_Right 0x25B
#define METATILE_LilycoveMuseum_Painting1_Left 0x25C
#define METATILE_LilycoveMuseum_Painting1_Right 0x25D
#define METATILE_LilycoveMuseum_Painting2_Left 0x25E
#define METATILE_LilycoveMuseum_Painting2_Right 0x25F
#define METATILE_LilycoveMuseum_Painting3_Left 0x260
#define METATILE_LilycoveMuseum_Painting3_Right 0x261
#define METATILE_LilycoveMuseum_Painting4_Left 0x262
#define METATILE_LilycoveMuseum_Painting4_Right 0x263
// gTileset_InsideOfTruck
#define METATILE_InsideOfTruck_ExitLight_Top 0x208
#define METATILE_InsideOfTruck_ExitLight_Mid 0x210
#define METATILE_InsideOfTruck_ExitLight_Bottom 0x218
#define METATILE_InsideOfTruck_DoorClosedFloor_Top 0x20D
#define METATILE_InsideOfTruck_DoorClosedFloor_Mid 0x215
#define METATILE_InsideOfTruck_DoorClosedFloor_Bottom 0x21D
// gTileset_BrendansMaysHouse
#define METATILE_BrendansMaysHouse_BrendanPC_Off 0x25A
#define METATILE_BrendansMaysHouse_BrendanPC_On 0x27F
#define METATILE_BrendansMaysHouse_MayPC_Off 0x259
#define METATILE_BrendansMaysHouse_MayPC_On 0x27E
#define METATILE_BrendansMaysHouse_MovingBox_Closed 0x268
#define METATILE_BrendansMaysHouse_MovingBox_Open 0x270
#define METATILE_BrendansMaysHouse_BookOnTable 0x293
// gTileset_Lilycove
#define METATILE_Lilycove_AquaHideout_Entrance_TopLeft 0x2A8
#define METATILE_Lilycove_AquaHideout_Entrance_TopMid 0x2A9
#define METATILE_Lilycove_AquaHideout_Entrance_TopRight 0x2AA
#define METATILE_Lilycove_AquaHideout_Entrance_BottomLeft 0x2B0
#define METATILE_Lilycove_AquaHideout_Entrance_BottomMid 0x2B1
#define METATILE_Lilycove_AquaHideout_Entrance_BottomRight 0x2B2
#define METATILE_Lilycove_Wailmer0 0x290
#define METATILE_Lilycove_Wailmer1 0x291
#define METATILE_Lilycove_Wailmer2 0x2A0
#define METATILE_Lilycove_Wailmer3 0x2A1
#define METATILE_Lilycove_Wailmer0_Alt 0x298
#define METATILE_Lilycove_Wailmer1_Alt 0x299
// gTileset_MauvilleGym
#define METATILE_MauvilleGym_RaisedSwitch 0x205
#define METATILE_MauvilleGym_PressedSwitch 0x206
#define METATILE_MauvilleGym_FloorTile 0x21A
#define METATILE_MauvilleGym_GreenBeamH1_On 0x220
#define METATILE_MauvilleGym_GreenBeamH2_On 0x221
#define METATILE_MauvilleGym_GreenBeamH3_On 0x228
#define METATILE_MauvilleGym_GreenBeamH4_On 0x229
#define METATILE_MauvilleGym_GreenBeamH1_Off 0x230
#define METATILE_MauvilleGym_GreenBeamH2_Off 0x231
#define METATILE_MauvilleGym_GreenBeamH3_Off 0x238
#define METATILE_MauvilleGym_GreenBeamH4_Off 0x239
#define METATILE_MauvilleGym_RedBeamH1_On 0x222
#define METATILE_MauvilleGym_RedBeamH2_On 0x223
#define METATILE_MauvilleGym_RedBeamH3_On 0x22A
#define METATILE_MauvilleGym_RedBeamH4_On 0x22B
#define METATILE_MauvilleGym_RedBeamH1_Off 0x232
#define METATILE_MauvilleGym_RedBeamH2_Off 0x233
#define METATILE_MauvilleGym_RedBeamH3_Off 0x23A
#define METATILE_MauvilleGym_RedBeamH4_Off 0x23B
#define METATILE_MauvilleGym_GreenBeamV1_On 0x240
#define METATILE_MauvilleGym_GreenBeamV2_On 0x248
#define METATILE_MauvilleGym_RedBeamV1_On 0x241
#define METATILE_MauvilleGym_RedBeamV2_On 0x249
#define METATILE_MauvilleGym_PoleTop_On 0x250
#define METATILE_MauvilleGym_PoleTop_Off 0x251
#define METATILE_MauvilleGym_PoleBottom_On 0x242
#define METATILE_MauvilleGym_PoleBottom_Off 0x243
// gTileset_MossdeepGym
#define METATILE_MossdeepGym_RedArrow_Right 0x204
#define METATILE_MossdeepGym_RedArrow_Left 0x20C
#define METATILE_MossdeepGym_RedArrow_Up 0x20D
#define METATILE_MossdeepGym_RedArrow_Down 0x205
#define METATILE_MossdeepGym_Switch_Up 0x238
#define METATILE_MossdeepGym_Switch_Down 0x239
// gTileset_Building
#define METATILE_Building_TV_Off 0x002
#define METATILE_Building_TV_On 0x003
#define METATILE_Building_PC_Off 0x004
#define METATILE_Building_PC_On 0x005
// gTileset_GenericBuilding
#define METATILE_GenericBuilding_Doorway_ClosedTop 0x28D
#define METATILE_GenericBuilding_Doorway_ClosedBottom 0x295
#define METATILE_GenericBuilding_TableEdge 0x2F1
#define METATILE_GenericBuilding_TrickHouse_Door_Closed 0x21B
#define METATILE_GenericBuilding_TrickHouse_Stairs_Down 0x219
// gTileset_Shop
#define METATILE_Shop_Laptop1_Normal 0x29D
#define METATILE_Shop_Laptop2_Normal 0x2A5
#define METATILE_Shop_Laptop1_Flash 0x258
#define METATILE_Shop_Laptop2_Flash 0x260
// gTileset_Facility
#define METATILE_Facility_NewMauvilleDoor_Closed_Tile0 0x314
#define METATILE_Facility_NewMauvilleDoor_Closed_Tile1 0x315
#define METATILE_Facility_NewMauvilleDoor_Closed_Tile2 0x316
#define METATILE_Facility_NewMauvilleDoor_Closed_Tile3 0x31C
#define METATILE_Facility_NewMauvilleDoor_Closed_Tile4 0x31D
#define METATILE_Facility_NewMauvilleDoor_Closed_Tile5 0x31E
#define METATILE_Facility_NewMauvilleDoor_Open_Tile0 0x2C3
#define METATILE_Facility_NewMauvilleDoor_Open_Tile1 0x2C4
#define METATILE_Facility_NewMauvilleDoor_Open_Tile2 0x2C5
#define METATILE_Facility_NewMauvilleDoor_Open_Tile3 0x2CB
#define METATILE_Facility_NewMauvilleDoor_Open_Tile4 0x2CC
#define METATILE_Facility_NewMauvilleDoor_Open_Tile5 0x2CD
#define METATILE_Facility_DataPad 0x3E4
// gTileset_TrickHousePuzzle
#define METATILE_TrickHousePuzzle_Stairs_Down 0x20B
#define METATILE_TrickHousePuzzle_Lever_Off 0x23E
#define METATILE_TrickHousePuzzle_Lever_On 0x23F
#define METATILE_TrickHousePuzzle_Button_Up 0x258
#define METATILE_TrickHousePuzzle_Button_Pressed 0x259
#define METATILE_TrickHousePuzzle_Door_Shuttered 0x26A
#define METATILE_TrickHousePuzzle_Floor_ShadowTop_Alt 0x252
#define METATILE_TrickHousePuzzle_Floor_ShadowTop 0x255
#define METATILE_TrickHousePuzzle_BlueDoorH_Open_Tile0 0x24B
#define METATILE_TrickHousePuzzle_BlueDoorH_Open_Tile1 0x24C
#define METATILE_TrickHousePuzzle_BlueDoorH_Open_Tile2 0x253
#define METATILE_TrickHousePuzzle_BlueDoorH_Open_Tile3 0x254
#define METATILE_TrickHousePuzzle_BlueDoorH_Closed_Tile0 0x23B
#define METATILE_TrickHousePuzzle_BlueDoorH_Closed_Tile1 0x23C
#define METATILE_TrickHousePuzzle_BlueDoorH_Closed_Tile2 0x243
#define METATILE_TrickHousePuzzle_BlueDoorH_Closed_Tile3 0x244
#define METATILE_TrickHousePuzzle_RedDoorH_Open_Tile0 0x248
#define METATILE_TrickHousePuzzle_RedDoorH_Open_Tile1 0x249
#define METATILE_TrickHousePuzzle_RedDoorH_Open_Tile2 0x250
#define METATILE_TrickHousePuzzle_RedDoorH_Open_Tile3 0x251
#define METATILE_TrickHousePuzzle_RedDoorH_Closed_Tile0 0x238
#define METATILE_TrickHousePuzzle_RedDoorH_Closed_Tile1 0x239
#define METATILE_TrickHousePuzzle_RedDoorH_Closed_Tile2 0x240
#define METATILE_TrickHousePuzzle_RedDoorH_Closed_Tile3 0x241
#define METATILE_TrickHousePuzzle_BlueDoorV_Retracted 0x24D
#define METATILE_TrickHousePuzzle_RedDoorV_Retracted 0x24A
#define METATILE_TrickHousePuzzle_RedDoorV_Open0 0x23A
#define METATILE_TrickHousePuzzle_RedDoorV_Open1 0x242
#define METATILE_TrickHousePuzzle_BlueDoorV_Open0 0x23D
#define METATILE_TrickHousePuzzle_BlueDoorV_Open1 0x245
#define METATILE_TrickHousePuzzle_Arrow_RedOnBlack_Right 0x260
#define METATILE_TrickHousePuzzle_Arrow_RedOnBlack_Left 0x261
#define METATILE_TrickHousePuzzle_Arrow_RedOnBlack_Up 0x262
#define METATILE_TrickHousePuzzle_Arrow_RedOnBlack_Down 0x263
#define METATILE_TrickHousePuzzle_Arrow_RedOnBlack_Left_Alt 0x27B
#define METATILE_TrickHousePuzzle_Arrow_RedOnBlack_Right_Alt 0x27C
#define METATILE_BattleTower_CorridorOpenDoor_Bottom 0x20F
#define METATILE_BattleTower_CorridorOpenDoor_Top 0x207
#define METATILE_BattleTower_Elevator_Bottom0 0x278
#define METATILE_BattleTower_Elevator_Bottom1 0x279
#define METATILE_BattleTower_Elevator_Bottom2 0x27A
#define METATILE_BattleTower_Elevator_Mid0 0x270
#define METATILE_BattleTower_Elevator_Mid1 0x271
#define METATILE_BattleTower_Elevator_Mid2 0x272
#define METATILE_BattleTower_Elevator_Top0 0x268
#define METATILE_BattleTower_Elevator_Top1 0x269
#define METATILE_BattleTower_Elevator_Top2 0x26A
// gTileset_BikeShop
#define METATILE_BikeShop_Barrier_Hidden_Top 0x269
#define METATILE_BikeShop_Barrier_Hidden_Bottom 0x271
#define METATILE_BikeShop_Floor_Shadow_Top 0x26D
#define METATILE_BikeShop_Wall_Edge_Top 0x281
#define METATILE_BikeShop_Button_Pressed 0x24F
#define METATILE_BikeShop_Button_Green 0x22E
#define METATILE_BikeShop_Button_Blue 0x236
#define METATILE_BikeShop_Barrier_Green_Top 0x2B6
#define METATILE_BikeShop_Barrier_Green_TopMid 0x2BE
#define METATILE_BikeShop_Barrier_Green_BottomMid 0x2C6
#define METATILE_BikeShop_Barrier_Green_Bottom 0x2CE
#define METATILE_BikeShop_Barrier_Blue_Top 0x2B7
#define METATILE_BikeShop_Barrier_Blue_TopMid 0x2BF
#define METATILE_BikeShop_Barrier_Blue_BottomMid 0x2C7
#define METATILE_BikeShop_Barrier_Blue_Bottom 0x2CF
#define METATILE_BikeShop_Generator_Off_Tile0 0x2F0
#define METATILE_BikeShop_Generator_Off_Tile1 0x2F1
#define METATILE_BikeShop_Generator_Off_Tile2 0x2F2
#define METATILE_BikeShop_Generator_Off_Tile3 0x2F3
#define METATILE_BikeShop_Generator_Off_Tile4 0x2F4
#define METATILE_BikeShop_Generator_Off_Tile5 0x2F5
#define METATILE_BikeShop_Generator_Off_Tile6 0x2F6
#define METATILE_BikeShop_Generator_Off_Tile7 0x2F7
#define METATILE_BikeShop_Barrier_Blue_Bottom 0x2CF
#define METATILE_BikeShop_Barrier_Blue_BottomMid 0x2C7
#define METATILE_BikeShop_Barrier_Blue_Top 0x2B7
#define METATILE_BikeShop_Barrier_Blue_TopMid 0x2BF
#define METATILE_BikeShop_Barrier_Green_Bottom 0x2CE
#define METATILE_BikeShop_Barrier_Green_BottomMid 0x2C6
#define METATILE_BikeShop_Barrier_Green_Top 0x2B6
#define METATILE_BikeShop_Barrier_Green_TopMid 0x2BE
#define METATILE_BikeShop_Barrier_Hidden_Bottom 0x271
#define METATILE_BikeShop_Barrier_Hidden_Top 0x269
#define METATILE_BikeShop_Button_Blue 0x236
#define METATILE_BikeShop_Button_Green 0x22E
#define METATILE_BikeShop_Button_Pressed 0x24F
#define METATILE_BikeShop_Floor_Shadow_Top 0x26D
#define METATILE_BikeShop_Generator_Off_Tile0 0x2F0
#define METATILE_BikeShop_Generator_Off_Tile1 0x2F1
#define METATILE_BikeShop_Generator_Off_Tile2 0x2F2
#define METATILE_BikeShop_Generator_Off_Tile3 0x2F3
#define METATILE_BikeShop_Generator_Off_Tile4 0x2F4
#define METATILE_BikeShop_Generator_Off_Tile5 0x2F5
#define METATILE_BikeShop_Generator_Off_Tile6 0x2F6
#define METATILE_BikeShop_Generator_Off_Tile7 0x2F7
#define METATILE_BikeShop_Wall_Edge_Top 0x281
// gTileset_BrendansMaysHouse
#define METATILE_BrendansMaysHouse_BookOnTable 0x293
#define METATILE_BrendansMaysHouse_BrendanPC_Off 0x25A
#define METATILE_BrendansMaysHouse_BrendanPC_On 0x27F
#define METATILE_BrendansMaysHouse_MayPC_Off 0x259
#define METATILE_BrendansMaysHouse_MayPC_On 0x27E
#define METATILE_BrendansMaysHouse_MovingBox_Closed 0x268
#define METATILE_BrendansMaysHouse_MovingBox_Open 0x270
// gTileset_Building
#define METATILE_Building_PC_Off 0x004
#define METATILE_Building_PC_On 0x005
#define METATILE_Building_TV_Off 0x002
#define METATILE_Building_TV_On 0x003
// gTileset_Cave
#define METATILE_Cave_EntranceCover 0x229
#define METATILE_Cave_SealedChamberBraille_Mid 0x235
#define METATILE_Cave_SealedChamberEntrance_BottomLeft 0x232
#define METATILE_Cave_SealedChamberEntrance_BottomMid 0x233
#define METATILE_Cave_SealedChamberEntrance_BottomRight 0x234
#define METATILE_Cave_SealedChamberEntrance_TopLeft 0x22A
#define METATILE_Cave_SealedChamberEntrance_TopMid 0x22B
#define METATILE_Cave_SealedChamberEntrance_TopRight 0x22C
#define METATILE_Cave_ShoalCave_BlueStone_Large 0x359
#define METATILE_Cave_ShoalCave_BlueStone_Small 0x35B
#define METATILE_Cave_ShoalCave_DirtPile_Large 0x358
#define METATILE_Cave_ShoalCave_DirtPile_Small 0x35A
// gTileset_Contest
#define METATILE_Contest_CounterFlap_Bottom 0x2D9
#define METATILE_Contest_CounterFlap_Top 0x2D1
#define METATILE_Contest_FloorShadow 0x261
#define METATILE_Contest_WallShadow 0x221
// gTileset_EliteFour
#define METATILE_EliteFour_EntryDoor_ClosedBottom 0x20E
#define METATILE_EliteFour_EntryDoor_ClosedTop 0x206
#define METATILE_EliteFour_LeftSpotlightOff 0x2DD
#define METATILE_EliteFour_OpenDoorChampion_Frame 0x346
#define METATILE_EliteFour_OpenDoorChampion_Opening 0x347
#define METATILE_EliteFour_OpenDoor_Frame 0x344
#define METATILE_EliteFour_OpenDoor_Opening 0x345
#define METATILE_EliteFour_RightSpotlightOff 0x2DE
// gTileset_Facility
#define METATILE_Facility_DataPad 0x3E4
#define METATILE_Facility_DoorIndent_Locked 0x234
#define METATILE_Facility_DoorIndent_Unlocked 0x21A
#define METATILE_Facility_IntactDoor_Bottom_Locked 0x233
#define METATILE_Facility_IntactDoor_Bottom_Unlocked 0x22B
#define METATILE_Facility_NewMauvilleDoor_Closed_Tile0 0x314
#define METATILE_Facility_NewMauvilleDoor_Closed_Tile1 0x315
#define METATILE_Facility_NewMauvilleDoor_Closed_Tile2 0x316
#define METATILE_Facility_NewMauvilleDoor_Closed_Tile3 0x31C
#define METATILE_Facility_NewMauvilleDoor_Closed_Tile4 0x31D
#define METATILE_Facility_NewMauvilleDoor_Closed_Tile5 0x31E
#define METATILE_Facility_NewMauvilleDoor_Open_Tile0 0x2C3
#define METATILE_Facility_NewMauvilleDoor_Open_Tile1 0x2C4
#define METATILE_Facility_NewMauvilleDoor_Open_Tile2 0x2C5
#define METATILE_Facility_NewMauvilleDoor_Open_Tile3 0x2CB
#define METATILE_Facility_NewMauvilleDoor_Open_Tile4 0x2CC
#define METATILE_Facility_NewMauvilleDoor_Open_Tile5 0x2CD
// gTileset_Fallarbor
#define METATILE_Fallarbor_AshField 0x218
#define METATILE_Fallarbor_AshGrass 0x20A
#define METATILE_Fallarbor_NormalGrass 0x212
// gTileset_Fortree
#define METATILE_Fortree_BridgeOverGrass_Lowered 0x24F
#define METATILE_Fortree_BridgeOverGrass_Raised 0x24E
#define METATILE_Fortree_BridgeOverTrees_Lowered 0x257
#define METATILE_Fortree_BridgeOverTrees_Raised 0x256
#define METATILE_Fortree_LongGrass_Root 0x208
#define METATILE_Fortree_SecretBase_LongGrass_BottomLeft 0x281
#define METATILE_Fortree_SecretBase_LongGrass_BottomMid 0x282
#define METATILE_Fortree_SecretBase_LongGrass_BottomRight 0x283
#define METATILE_Fortree_SecretBase_LongGrass_TopLeft 0x279
#define METATILE_Fortree_SecretBase_LongGrass_TopMid 0x27A
#define METATILE_Fortree_SecretBase_LongGrass_TopRight 0x27B
#define METATILE_Fortree_WoodBridge_Kecleon0 0x297
#define METATILE_Fortree_WoodBridge_Kecleon1 0x29F
// gTileset_General
#define METATILE_General_CalmWater 0x170
#define METATILE_General_CaveEntrance_Bottom 0x0A7
#define METATILE_General_CaveEntrance_Top 0x09F
#define METATILE_General_Grass 0x001
#define METATILE_General_Grass_TreeLeft 0x1CE
#define METATILE_General_Grass_TreeRight 0x1CF
#define METATILE_General_Grass_TreeUp 0x00E
#define METATILE_General_LongGrass 0x015
#define METATILE_General_MuddySlope_Frame0 0x0E8
#define METATILE_General_MuddySlope_Frame1 0x0E9
#define METATILE_General_MuddySlope_Frame2 0x0EA
#define METATILE_General_MuddySlope_Frame3 0x0EB
#define METATILE_General_ReflectiveWater 0x0A1
#define METATILE_General_RockWall_GrassBase 0x079
#define METATILE_General_RockWall_RockBase 0x07C
#define METATILE_General_RockWall_SandBase 0x091
#define METATILE_General_RockWall_WaterBase 0x0A9
#define METATILE_General_RoughDeepWater 0x14F
#define METATILE_General_RoughWater 0x14E
#define METATILE_General_SandPit_Center 0x121
#define METATILE_General_Shore_BottomLeft 0x1BD
#define METATILE_General_Shore_BottomMid 0x1BE
#define METATILE_General_Shore_BottomRight 0x1BF
#define METATILE_General_TallGrass 0x00D
#define METATILE_General_TallGrass_TreeLeft 0x1C6
#define METATILE_General_TallGrass_TreeRight 0x1C7
#define METATILE_General_TallGrass_TreeUp 0x025
// gTileset_GenericBuilding
#define METATILE_GenericBuilding_Doorway_ClosedBottom 0x295
#define METATILE_GenericBuilding_Doorway_ClosedTop 0x28D
#define METATILE_GenericBuilding_TableEdge 0x2F1
#define METATILE_GenericBuilding_TrickHouse_Door_Closed 0x21B
#define METATILE_GenericBuilding_TrickHouse_Stairs_Down 0x219
// gTileset_InsideOfTruck
#define METATILE_InsideOfTruck_DoorClosedFloor_Bottom 0x21D
#define METATILE_InsideOfTruck_DoorClosedFloor_Mid 0x215
#define METATILE_InsideOfTruck_DoorClosedFloor_Top 0x20D
#define METATILE_InsideOfTruck_ExitLight_Bottom 0x218
#define METATILE_InsideOfTruck_ExitLight_Mid 0x210
#define METATILE_InsideOfTruck_ExitLight_Top 0x208
// gTileset_Lavaridge
#define METATILE_Lavaridge_AshGrass 0x207
#define METATILE_Lavaridge_LavaField 0x271
#define METATILE_Lavaridge_NormalGrass 0x206
// gTileset_Lilycove
#define METATILE_Lilycove_AquaHideout_Entrance_BottomLeft 0x2B0
#define METATILE_Lilycove_AquaHideout_Entrance_BottomMid 0x2B1
#define METATILE_Lilycove_AquaHideout_Entrance_BottomRight 0x2B2
#define METATILE_Lilycove_AquaHideout_Entrance_TopLeft 0x2A8
#define METATILE_Lilycove_AquaHideout_Entrance_TopMid 0x2A9
#define METATILE_Lilycove_AquaHideout_Entrance_TopRight 0x2AA
#define METATILE_Lilycove_Wailmer0 0x290
#define METATILE_Lilycove_Wailmer0_Alt 0x298
#define METATILE_Lilycove_Wailmer1 0x291
#define METATILE_Lilycove_Wailmer1_Alt 0x299
#define METATILE_Lilycove_Wailmer2 0x2A0
#define METATILE_Lilycove_Wailmer3 0x2A1
// gTileset_LilycoveMuseum
#define METATILE_LilycoveMuseum_Painting0_Left 0x25A
#define METATILE_LilycoveMuseum_Painting0_Right 0x25B
#define METATILE_LilycoveMuseum_Painting1_Left 0x25C
#define METATILE_LilycoveMuseum_Painting1_Right 0x25D
#define METATILE_LilycoveMuseum_Painting2_Left 0x25E
#define METATILE_LilycoveMuseum_Painting2_Right 0x25F
#define METATILE_LilycoveMuseum_Painting3_Left 0x260
#define METATILE_LilycoveMuseum_Painting3_Right 0x261
#define METATILE_LilycoveMuseum_Painting4_Left 0x262
#define METATILE_LilycoveMuseum_Painting4_Right 0x263
// gTileset_MauvilleGym
#define METATILE_MauvilleGym_FloorTile 0x21A
#define METATILE_MauvilleGym_GreenBeamH1_Off 0x230
#define METATILE_MauvilleGym_GreenBeamH1_On 0x220
#define METATILE_MauvilleGym_GreenBeamH2_Off 0x231
#define METATILE_MauvilleGym_GreenBeamH2_On 0x221
#define METATILE_MauvilleGym_GreenBeamH3_Off 0x238
#define METATILE_MauvilleGym_GreenBeamH3_On 0x228
#define METATILE_MauvilleGym_GreenBeamH4_Off 0x239
#define METATILE_MauvilleGym_GreenBeamH4_On 0x229
#define METATILE_MauvilleGym_GreenBeamV1_On 0x240
#define METATILE_MauvilleGym_GreenBeamV2_On 0x248
#define METATILE_MauvilleGym_PoleBottom_Off 0x243
#define METATILE_MauvilleGym_PoleBottom_On 0x242
#define METATILE_MauvilleGym_PoleTop_Off 0x251
#define METATILE_MauvilleGym_PoleTop_On 0x250
#define METATILE_MauvilleGym_PressedSwitch 0x206
#define METATILE_MauvilleGym_RaisedSwitch 0x205
#define METATILE_MauvilleGym_RedBeamH1_Off 0x232
#define METATILE_MauvilleGym_RedBeamH1_On 0x222
#define METATILE_MauvilleGym_RedBeamH2_Off 0x233
#define METATILE_MauvilleGym_RedBeamH2_On 0x223
#define METATILE_MauvilleGym_RedBeamH3_Off 0x23A
#define METATILE_MauvilleGym_RedBeamH3_On 0x22A
#define METATILE_MauvilleGym_RedBeamH4_Off 0x23B
#define METATILE_MauvilleGym_RedBeamH4_On 0x22B
#define METATILE_MauvilleGym_RedBeamV1_On 0x241
#define METATILE_MauvilleGym_RedBeamV2_On 0x249
// gTileset_MossdeepGym
#define METATILE_MossdeepGym_RedArrow_Down 0x205
#define METATILE_MossdeepGym_RedArrow_Left 0x20C
#define METATILE_MossdeepGym_RedArrow_Right 0x204
#define METATILE_MossdeepGym_RedArrow_Up 0x20D
#define METATILE_MossdeepGym_Switch_Down 0x239
#define METATILE_MossdeepGym_Switch_Up 0x238
// gTileset_Pacifidlog
#define METATILE_Pacifidlog_FloatingLogs_Horizontal0 0x250
#define METATILE_Pacifidlog_FloatingLogs_Horizontal1 0x251
#define METATILE_Pacifidlog_FloatingLogs_Vertical0 0x258
#define METATILE_Pacifidlog_FloatingLogs_Vertical1 0x260
#define METATILE_Pacifidlog_HalfSubmergedLogs_Horizontal0 0x252
#define METATILE_Pacifidlog_HalfSubmergedLogs_Horizontal1 0x253
#define METATILE_Pacifidlog_HalfSubmergedLogs_Vertical0 0x259
#define METATILE_Pacifidlog_HalfSubmergedLogs_Vertical1 0x261
#define METATILE_Pacifidlog_SubmergedLogs_Horizontal0 0x254
#define METATILE_Pacifidlog_SubmergedLogs_Horizontal1 0x255
#define METATILE_Pacifidlog_SubmergedLogs_Vertical0 0x25A
#define METATILE_Pacifidlog_SubmergedLogs_Vertical1 0x262
// gTileset_PetalburgGym
#define METATILE_PetalburgGym_RoomEntrance_Left 0x210
#define METATILE_PetalburgGym_RoomEntrance_Right 0x211
#define METATILE_PetalburgGym_SlidingDoor_Frame0 0x218
#define METATILE_PetalburgGym_SlidingDoor_Frame1 0x219
#define METATILE_PetalburgGym_SlidingDoor_Frame2 0x21A
#define METATILE_PetalburgGym_SlidingDoor_Frame3 0x21B
#define METATILE_PetalburgGym_SlidingDoor_Frame4 0x21C
// gTileset_Sootopolis
#define METATILE_Sootopolis_Door_Closed 0x248
#define METATILE_Sootopolis_GymDoor_Closed 0x250
#define METATILE_Sootopolis_RoughWater 0x290
// gTileset_SootopolisGym
#define METATILE_SootopolisGym_Ice_Cracked 0x20E
#define METATILE_SootopolisGym_Ice_Broken 0x206
#define METATILE_SootopolisGym_Stairs 0x207
// gTileset_Underwater
#define METATILE_Underwater_RockWall 0x21E
#define METATILE_Underwater_FloorShadow 0x228
#define METATILE_PetalburgGym_RoomEntrance_Left 0x210
#define METATILE_PetalburgGym_RoomEntrance_Right 0x211
#define METATILE_PetalburgGym_SlidingDoor_Frame0 0x218
#define METATILE_PetalburgGym_SlidingDoor_Frame1 0x219
#define METATILE_PetalburgGym_SlidingDoor_Frame2 0x21A
#define METATILE_PetalburgGym_SlidingDoor_Frame3 0x21B
#define METATILE_PetalburgGym_SlidingDoor_Frame4 0x21C
// gTileset_PokemonCenter
#define METATILE_PokemonCenter_Floor_Plain_Alt 0x202
#define METATILE_PokemonCenter_CounterBarrier 0x25D
#define METATILE_PokemonCenter_Escalator1F_Tile0_Frame0 0x280
#define METATILE_PokemonCenter_Escalator1F_Tile0_Frame1 0x282
#define METATILE_PokemonCenter_Escalator1F_Tile0_Frame2 0x284
#define METATILE_PokemonCenter_Escalator1F_Tile1_Frame0 0x281
#define METATILE_PokemonCenter_Escalator1F_Tile1_Frame1 0x283
#define METATILE_PokemonCenter_Escalator1F_Tile1_Frame2 0x285
#define METATILE_PokemonCenter_Escalator1F_Tile2_Frame0 0x288
#define METATILE_PokemonCenter_Escalator1F_Tile2_Frame1 0x28A
#define METATILE_PokemonCenter_Escalator1F_Tile2_Frame2 0x28C
#define METATILE_PokemonCenter_Escalator1F_Tile3_Frame0 0x289
#define METATILE_PokemonCenter_Escalator1F_Tile3_Frame1 0x28B
#define METATILE_PokemonCenter_Escalator1F_Tile3_Frame2 0x28D
#define METATILE_PokemonCenter_Escalator2F_Tile0_Frame0 0x2A0
#define METATILE_PokemonCenter_Escalator2F_Tile0_Frame1 0x2A2
#define METATILE_PokemonCenter_Escalator2F_Tile0_Frame2 0x2A4
#define METATILE_PokemonCenter_Escalator2F_Tile1_Frame0 0x2A1
#define METATILE_PokemonCenter_Escalator2F_Tile1_Frame1 0x2A3
#define METATILE_PokemonCenter_Escalator2F_Tile1_Frame2 0x2A5
#define METATILE_PokemonCenter_Escalator2F_Tile2_Frame0 0x2A8
#define METATILE_PokemonCenter_Escalator2F_Tile2_Frame1 0x2AA
#define METATILE_PokemonCenter_Escalator2F_Tile2_Frame2 0x2AC
#define METATILE_PokemonCenter_CounterBarrier 0x25D
#define METATILE_PokemonCenter_Escalator1F_Tile0_Frame0 0x280
#define METATILE_PokemonCenter_Escalator1F_Tile0_Frame1 0x282
#define METATILE_PokemonCenter_Escalator1F_Tile0_Frame2 0x284
#define METATILE_PokemonCenter_Escalator1F_Tile1_Frame0 0x281
#define METATILE_PokemonCenter_Escalator1F_Tile1_Frame1 0x283
#define METATILE_PokemonCenter_Escalator1F_Tile1_Frame2 0x285
#define METATILE_PokemonCenter_Escalator1F_Tile2_Frame0 0x288
#define METATILE_PokemonCenter_Escalator1F_Tile2_Frame1 0x28A
#define METATILE_PokemonCenter_Escalator1F_Tile2_Frame2 0x28C
#define METATILE_PokemonCenter_Escalator1F_Tile3_Frame0 0x289
#define METATILE_PokemonCenter_Escalator1F_Tile3_Frame1 0x28B
#define METATILE_PokemonCenter_Escalator1F_Tile3_Frame2 0x28D
#define METATILE_PokemonCenter_Escalator2F_Tile0_Frame0 0x2A0
#define METATILE_PokemonCenter_Escalator2F_Tile0_Frame1 0x2A2
#define METATILE_PokemonCenter_Escalator2F_Tile0_Frame2 0x2A4
#define METATILE_PokemonCenter_Escalator2F_Tile1_Frame0 0x2A1
#define METATILE_PokemonCenter_Escalator2F_Tile1_Frame1 0x2A3
#define METATILE_PokemonCenter_Escalator2F_Tile1_Frame2 0x2A5
#define METATILE_PokemonCenter_Escalator2F_Tile2_Frame0 0x2A8
#define METATILE_PokemonCenter_Escalator2F_Tile2_Frame1 0x2AA
#define METATILE_PokemonCenter_Escalator2F_Tile2_Frame2 0x2AC
#define METATILE_PokemonCenter_Floor_Plain_Alt 0x202
// gTileset_Shop
#define METATILE_Shop_Laptop1_Flash 0x258
#define METATILE_Shop_Laptop1_Normal 0x29D
#define METATILE_Shop_Laptop2_Flash 0x260
#define METATILE_Shop_Laptop2_Normal 0x2A5
// gTileset_Sootopolis
#define METATILE_Sootopolis_Door_Closed 0x248
#define METATILE_Sootopolis_GymDoor_Closed 0x250
#define METATILE_Sootopolis_RoughWater 0x290
// gTileset_SootopolisGym
#define METATILE_SootopolisGym_Ice_Broken 0x206
#define METATILE_SootopolisGym_Ice_Cracked 0x20E
#define METATILE_SootopolisGym_Stairs 0x207
// gTileset_TrickHousePuzzle
#define METATILE_TrickHousePuzzle_Arrow_RedOnBlack_Down 0x263
#define METATILE_TrickHousePuzzle_Arrow_RedOnBlack_Left 0x261
#define METATILE_TrickHousePuzzle_Arrow_RedOnBlack_Left_Alt 0x27B
#define METATILE_TrickHousePuzzle_Arrow_RedOnBlack_Right 0x260
#define METATILE_TrickHousePuzzle_Arrow_RedOnBlack_Right_Alt 0x27C
#define METATILE_TrickHousePuzzle_Arrow_RedOnBlack_Up 0x262
#define METATILE_TrickHousePuzzle_BlueDoorH_Closed_Tile0 0x23B
#define METATILE_TrickHousePuzzle_BlueDoorH_Closed_Tile1 0x23C
#define METATILE_TrickHousePuzzle_BlueDoorH_Closed_Tile2 0x243
#define METATILE_TrickHousePuzzle_BlueDoorH_Closed_Tile3 0x244
#define METATILE_TrickHousePuzzle_BlueDoorH_Open_Tile0 0x24B
#define METATILE_TrickHousePuzzle_BlueDoorH_Open_Tile1 0x24C
#define METATILE_TrickHousePuzzle_BlueDoorH_Open_Tile2 0x253
#define METATILE_TrickHousePuzzle_BlueDoorH_Open_Tile3 0x254
#define METATILE_TrickHousePuzzle_BlueDoorV_Open0 0x23D
#define METATILE_TrickHousePuzzle_BlueDoorV_Open1 0x245
#define METATILE_TrickHousePuzzle_BlueDoorV_Retracted 0x24D
#define METATILE_TrickHousePuzzle_Button_Pressed 0x259
#define METATILE_TrickHousePuzzle_Button_Up 0x258
#define METATILE_TrickHousePuzzle_Door_Shuttered 0x26A
#define METATILE_TrickHousePuzzle_Floor_ShadowTop 0x255
#define METATILE_TrickHousePuzzle_Floor_ShadowTop_Alt 0x252
#define METATILE_TrickHousePuzzle_Lever_Off 0x23E
#define METATILE_TrickHousePuzzle_Lever_On 0x23F
#define METATILE_TrickHousePuzzle_RedDoorH_Closed_Tile0 0x238
#define METATILE_TrickHousePuzzle_RedDoorH_Closed_Tile1 0x239
#define METATILE_TrickHousePuzzle_RedDoorH_Closed_Tile2 0x240
#define METATILE_TrickHousePuzzle_RedDoorH_Closed_Tile3 0x241
#define METATILE_TrickHousePuzzle_RedDoorH_Open_Tile0 0x248
#define METATILE_TrickHousePuzzle_RedDoorH_Open_Tile1 0x249
#define METATILE_TrickHousePuzzle_RedDoorH_Open_Tile2 0x250
#define METATILE_TrickHousePuzzle_RedDoorH_Open_Tile3 0x251
#define METATILE_TrickHousePuzzle_RedDoorV_Open0 0x23A
#define METATILE_TrickHousePuzzle_RedDoorV_Open1 0x242
#define METATILE_TrickHousePuzzle_RedDoorV_Retracted 0x24A
#define METATILE_TrickHousePuzzle_Stairs_Down 0x20B
// gTileset_Underwater
#define METATILE_Underwater_FloorShadow 0x228
#define METATILE_Underwater_RockWall 0x21E
#endif // GUARD_METATILE_LABELS_H

View File

@ -378,7 +378,7 @@ u8 AddCameraObject(u8);
void CameraObjectReset1(void);
const u8 *GetObjectEventScriptPointerByObjectEventId(u8);
u8 ObjectEventGetBerryTreeId(u8);
struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8, u8, u8);
const struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8, u8, u8);
void OverrideTemplateCoordsForObjectEvent(struct ObjectEvent *pObject);
void OverrideMovementTypeForObjectEvent(struct ObjectEvent *, u8);
void TryOverrideTemplateCoordsForObjectEvent(u8, u8, u8);

View File

@ -29,7 +29,7 @@ int ProcessPlayerFieldInput(struct FieldInput *pStruct);
const u8 *GetInteractedLinkPlayerScript(struct MapPosition *, u8, u8);
void ClearPoisonStepCounter(void);
void RestartWildEncounterImmunitySteps(void);
u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *);
const u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *);
const u8 *GetObjectEventScriptPointerPlayerFacing(void);
u8 TrySetDiveWarp(void);
bool8 dive_warp(struct MapPosition*, u16);

View File

@ -2,7 +2,7 @@
#define GUARD_FIELDMAP2_H
#include "event_object_movement.h"
#define NUM_TILES_IN_PRIMARY 512
#define NUM_TILES_IN_PRIMARY 512 // NOTE: CopyTilesetToVram assumes the number of primary and secondary tiles is the same
#define NUM_TILES_TOTAL 1024
#define NUM_METATILES_IN_PRIMARY 512
#define NUM_METATILES_TOTAL 1024
@ -10,43 +10,41 @@
#define NUM_PALS_TOTAL 12
#define MAX_MAP_DATA_SIZE 0x2800
extern struct BackupMapLayout gBackupMapLayout;
struct MapHeader *mapconnection_get_mapheader(struct MapConnection *connection);
int GetMapBorderIdAt(int x, int y);
int CanCameraMoveInDirection(int direction);
u16 GetBehaviorByMetatileId(u16 metatile);
void MapGridSetMetatileEntryAt(int, int, u16);
#define NUM_TILES_PER_METATILE 8
void not_trainer_hill_battle_pyramid(void);
void sub_8055FC0(void);
void mapheader_copy_mapdata_with_padding(struct MapHeader *mapHeader);
void map_copy_with_padding(u16 *map, u16 width, u16 height);
void sub_80560AC(struct MapHeader *);
void fillSouthConnection(struct MapHeader *, struct MapHeader *, s32);
void fillNorthConnection(struct MapHeader *, struct MapHeader *, s32);
void fillWestConnection(struct MapHeader *, struct MapHeader *, s32);
void fillEastConnection(struct MapHeader *, struct MapHeader *, s32);
u8 MapGridGetZCoordAt(int s, int y);
u8 MapGridIsImpassableAt(int, int);
u32 MapGridGetMetatileIdAt(int, int);
u32 MapGridGetMetatileBehaviorAt(int x, int y); // return: (u8|u16|int) args: (int|s16|s32)
u8 MapGridGetMetatileLayerTypeAt(int, int);
void MapGridSetMetatileIdAt(int, int, u16);
u16 GetBehaviorByMetatileId(u16 metatile);
void save_serialize_map(void);
void sub_8056670();
bool8 CameraMove(int, int);
struct MapConnection *sub_8056A64(u8 direction, int x, int y);
bool8 sub_8056ABC(u8 direction, int x, int y, struct MapConnection *connection);
bool8 sub_8056B20(int x, int src_width, int dest_width, int offset);
struct MapConnection *sub_8056BA0(s16 x, s16 y); // fieldmap.c
void sub_8056C50(u16, u16);
void sav1_camera_get_focus_coords(u16 *x, u16 *y);
void GetCameraCoords(u16*, u16*);
void sub_8056D28(struct MapLayout *pData);
void sub_8056D38(struct MapLayout *pData);
void apply_map_tileset2_palette(struct MapLayout *pData);
void copy_map_tileset1_tileset2_to_vram(/*TODO: arg types*/);
void apply_map_tileset1_tileset2_palette(/*TODO: arg types*/);
// Map coordinates are offset by 7 when using the map
// buffer because it needs to load sufficient border
// metatiles to fill the player's view (the player has
// 7 metatiles of view horizontally in either direction).
#define MAP_OFFSET 7
#define MAP_OFFSET_W (MAP_OFFSET * 2 + 1)
#define MAP_OFFSET_H (MAP_OFFSET * 2)
extern struct BackupMapLayout gBackupMapLayout;
u32 MapGridGetMetatileIdAt(int x, int y);
u32 MapGridGetMetatileBehaviorAt(int x, int y);
void MapGridSetMetatileIdAt(int x, int y, u16 metatile);
void MapGridSetMetatileEntryAt(int x, int y, u16 metatile);
void GetCameraCoords(u16 * x, u16 * y);
u8 MapGridGetCollisionAt(int x, int y);
int GetMapBorderIdAt(int x, int y);
bool32 CanCameraMoveInDirection(int direction);
u16 GetMetatileAttributesById(u16 metatile);
void GetCameraFocusCoords(u16 *x, u16 *y);
u8 MapGridGetMetatileLayerTypeAt(int x, int y);
u8 MapGridGetElevationAt(int x, int y);
bool8 CameraMove(int x, int y);
void SaveMapView(void);
void SetCameraFocusCoords(u16 x, u16 y);
void InitMap(void);
void InitMapFromSavedGame(void);
void CopyMapTilesetsToVram(struct MapLayout const *mapLayout);
void LoadMapTilesetPalettes(struct MapLayout const *mapLayout);
void LoadSecondaryTilesetPalette(struct MapLayout const *mapLayout);
void CopyPrimaryTilesetToVram(const struct MapLayout *);
void CopySecondaryTilesetToVram(const struct MapLayout *);
const struct MapHeader *const GetMapHeaderFromConnection(const struct MapConnection *connection);
const struct MapConnection *GetMapConnectionAtPos(s16 x, s16 y);
#endif

View File

@ -58,6 +58,12 @@
#define TOTAL_OBJ_TILE_COUNT 1024
#define PLTT_SIZEOF(n) ((n) * sizeof(u16))
#define PLTT_SIZE_4BPP PLTT_SIZEOF(16)
#define PLTT_SIZE_8BPP PLTT_SIZEOF(256)
#define PLTT_OFFSET_4BPP(n) ((n) * PLTT_SIZE_4BPP)
#define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10))
#define RGB_BLACK RGB(0, 0, 0)

View File

@ -693,7 +693,7 @@
#define R_BUTTON 0x0100
#define L_BUTTON 0x0200
#define KEYS_MASK 0x03FF
#define KEY_INTR_ENABLE 0x0400
#define KEY_INTR_ENABLE 0x4000
#define KEY_OR_INTR 0x0000
#define KEY_AND_INTR 0x8000
#define DPAD_ANY 0x00F0

View File

@ -1,30 +1,37 @@
#ifndef GUARD_GLOBAL_FIELDMAP_H
#define GUARD_GLOBAL_FIELDMAP_H
#define COLLISION_DIR_SOUTH 0
#define COLLISION_DIR_NORTH 1
#define COLLISION_DIR_WEST 2
#define COLLISION_DIR_EAST 3
#define COLLISION_DIR_ALL (COLLISION_DIR_NORTH | COLLISION_DIR_SOUTH | COLLISION_DIR_EAST | COLLISION_DIR_WEST)
// Masks/shifts for blocks in the map grid
// Map grid blocks consist of a 10 bit metatile id, a 2 bit collision value, and a 4 bit elevation value
// This is the data stored in each data/layouts/*/map.bin file
#define MAPGRID_METATILE_ID_MASK 0x03FF // Bits 0-9
#define MAPGRID_COLLISION_MASK 0x0C00 // Bits 10-11
#define MAPGRID_ELEVATION_MASK 0xF000 // Bits 12-15
#define MAPGRID_COLLISION_SHIFT 10
#define MAPGRID_ELEVATION_SHIFT 12
#define METATILE_COLLISION_MASK 0x0C00
#define METATILE_ID_MASK 0x03FF
#define METATILE_ID_UNDEFINED 0x03FF
#define METATILE_ELEVATION_SHIFT 0x000C
#define METATILE_COLLISION_SHIFT 0x000A
#define METATILE_ELEVATION_MASK 0xF000
// An undefined map grid block has all metatile id bits set and nothing else
#define MAPGRID_UNDEFINED MAPGRID_METATILE_ID_MASK
// Masks/shifts for metatile attributes
// Metatile attributes consist of an 8 bit behavior value, 4 unused bits, and a 4 bit layer type value
// This is the data stored in each data/tilesets/*/*/metatile_attributes.bin file
#define METATILE_ATTR_BEHAVIOR_MASK 0x00FF // Bits 0-7
#define METATILE_ATTR_LAYER_MASK 0xF000 // Bits 12-15
#define METATILE_ATTR_LAYER_SHIFT 12
enum {
METATILE_LAYER_TYPE_NORMAL, // Metatile uses middle and top bg layers
METATILE_LAYER_TYPE_COVERED, // Metatile uses bottom and middle bg layers
METATILE_LAYER_TYPE_SPLIT, // Metatile uses bottom and top bg layers
};
#define METATILE_ID(tileset, name) (METATILE_##tileset##_##name)
enum
{
CONNECTION_SOUTH = 1,
CONNECTION_NORTH,
CONNECTION_WEST,
CONNECTION_EAST,
CONNECTION_DIVE,
CONNECTION_EMERGE
};
// Rows of metatiles do not actually have a strict width.
// This constant is used for calculations for finding the next row of metatiles
// for constructing large tiles, such as the Battle Pike's curtain tile.
#define METATILE_ROW_WIDTH 8
typedef void (*TilesetCB)(void);
@ -32,10 +39,10 @@ struct Tileset
{
/*0x00*/ bool8 isCompressed;
/*0x01*/ bool8 isSecondary;
/*0x04*/ void *tiles;
/*0x08*/ void *palettes;
/*0x0c*/ void *metatiles;
/*0x10*/ void *metatileAttributes;
/*0x04*/ const u32 *tiles;
/*0x08*/ const u16 (*palettes)[16];
/*0x0c*/ const u16 *metatiles;
/*0x10*/ const u16 *metatileAttributes;
/*0x14*/ TilesetCB callback;
};
@ -43,10 +50,10 @@ struct MapLayout
{
/*0x00*/ s32 width;
/*0x04*/ s32 height;
/*0x08*/ u16 *border;
/*0x0c*/ u16 *map;
/*0x10*/ struct Tileset *primaryTileset;
/*0x14*/ struct Tileset *secondaryTileset;
/*0x08*/ const u16 *border;
/*0x0c*/ const u16 *map;
/*0x10*/ const struct Tileset *primaryTileset;
/*0x14*/ const struct Tileset *secondaryTileset;
};
struct BackupMapLayout
@ -60,7 +67,7 @@ struct ObjectEventTemplate
{
/*0x00*/ u8 localId;
/*0x01*/ u8 graphicsId;
/*0x02*/ u8 unk2;
/*0x02*/ u8 kind; // Always OBJ_KIND_NORMAL in Ruby/Sapphire.
/*0x04*/ s16 x;
/*0x06*/ s16 y;
/*0x08*/ u8 elevation;
@ -69,7 +76,7 @@ struct ObjectEventTemplate
u8 movementRangeY:4;
/*0x0C*/ u16 trainerType;
/*0x0E*/ u16 trainerRange_berryTreeId;
/*0x10*/ u8 *script;
/*0x10*/ const u8 *script;
/*0x14*/ u16 flagId;
};
@ -88,8 +95,7 @@ struct CoordEvent
u8 elevation;
u16 trigger;
u16 index;
u8 filler_A[0x2];
u8 *script;
const u8 *script;
};
struct BgEvent
@ -98,7 +104,7 @@ struct BgEvent
u8 elevation;
u8 kind; // The "kind" field determines how to access bgUnion union below.
union {
u8 *script;
const u8 *script;
struct {
u16 item;
u16 hiddenItemId;
@ -114,10 +120,10 @@ struct MapEvents
u8 coordEventCount;
u8 bgEventCount;
struct ObjectEventTemplate *objectEvents;
struct WarpEvent *warps;
struct CoordEvent *coordEvents;
struct BgEvent *bgEvents;
const struct ObjectEventTemplate *objectEvents;
const struct WarpEvent *warps;
const struct CoordEvent *coordEvents;
const struct BgEvent *bgEvents;
};
struct MapConnection
@ -131,15 +137,15 @@ struct MapConnection
struct MapConnections
{
s32 count;
struct MapConnection *connections;
const struct MapConnection *connections;
};
struct MapHeader
{
/* 0x00 */ struct MapLayout *mapLayout;
/* 0x04 */ struct MapEvents *events;
/* 0x08 */ u8 *mapScripts;
/* 0x0C */ struct MapConnections *connections;
/* 0x00 */ const struct MapLayout *mapLayout;
/* 0x04 */ const struct MapEvents *events;
/* 0x08 */ const u8 *mapScripts;
/* 0x0C */ const struct MapConnections *connections;
/* 0x10 */ u16 music;
/* 0x12 */ u16 mapLayoutId;
/* 0x14 */ u8 regionMapSectionId;

View File

@ -13,7 +13,7 @@ void ItemUseOnFieldCB_Itemfinder(u8);
void ItemUseOutOfBattle_Berry(u8);
void RunItemfinderResults(u8);
void ExitItemfinder(u8);
bool8 ItemfinderCheckForHiddenItems(struct MapEvents *, u8);
bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *, u8);
void sub_80C9720(u8);
void sub_80C9838(u8, s16, s16);
u8 GetPlayerDirectionTowardsHiddenItem(s16, s16);

View File

@ -1,83 +1,126 @@
.macro map map_id
@ Most of the macros in this file are for arranging map event data, and are output by mapjson using data from each map's JSON file.
@ Takes a MAP constant and outputs the map group and map number as separate bytes
.macro map map_id:req
.byte \map_id >> 8 @ map group
.byte \map_id & 0xFF @ map num
.endm
.macro map_script type, address
@ Defines a map script. 'type' is any MAP_SCRIPT_* constant (see include/constants/map_scripts.h)
.macro map_script type:req, script:req
.byte \type
.4byte \address
.4byte \script
.endm
.macro map_script_2 word1, word2, address
.2byte \word1
.2byte \word2
.4byte \address
@ Defines an entry in a map script table (for either ON_WARP_INTO_MAP_TABLE or ON_FRAME_TABLE)
.macro map_script_2 var:req, compare:req, script:req
.2byte \var
.2byte \compare
.4byte \script
.endm
.macro object_event index, gfx, replacement, x, y, elevation, movement_type, x_radius, y_radius, trainer_type, sight_radius_tree_etc, script, event_flag
.byte \index, \gfx, \replacement, 0
.2byte \x
.2byte \y
.byte \elevation, \movement_type, ((\y_radius << 4) | \x_radius), 0
.2byte \trainer_type, \sight_radius_tree_etc
@ Defines an object event template for map data, to be used by a normal object. Mirrors the struct layout of ObjectEventTemplate in include/global.fieldmap.h
.macro object_event index:req, gfx:req, x:req, y:req, elevation:req, movement_type:req, x_radius:req, y_radius:req, trainer_type:req, sight_radius_tree_etc:req, script:req, event_flag:req
.byte \index
.byte \gfx
.byte OBJ_KIND_NORMAL
.space 1 @ Padding
.2byte \x, \y
.byte \elevation
.byte \movement_type
.byte ((\y_radius << 4) | \x_radius)
.space 1 @ Padding
.2byte \trainer_type
.2byte \sight_radius_tree_etc
.4byte \script
.2byte \event_flag
.2byte 0
.space 2 @ Padding
inc _num_npcs
.endm
.macro warp_def x, y, elevation, warp, map_id
@ Defines an object event template for map data, to be used by a clone object. Mirrors the struct layout of ObjectEventTemplate in include/global.fieldmap.h
@ NOTE: The handling for this type of event does not exist in Ruby/Sapphire by default; it is exclusive to FRLG.
.macro clone_event index:req, gfx:req, x:req, y:req, target_local_id:req, target_map_id:req
.byte \index
.byte \gfx
.byte OBJ_KIND_CLONE
.space 1 @ Padding
.2byte \x, \y
.byte \elevation, \warp
.byte \target_local_id
.space 3 @ Padding
.2byte \target_map_id & 0xFF @ map num
.2byte \target_map_id >> 8 @ map group
.space 8 @ Padding
inc _num_npcs
.endm
@ Defines a warp event for map data. Mirrors the struct layout of WarpEvent in include/global.fieldmap.h
.macro warp_def x:req, y:req, elevation:req, warpId:req, map_id:req
.2byte \x, \y
.byte \elevation
.byte \warpId
.byte \map_id & 0xFF @ map num
.byte \map_id >> 8 @ map group
inc _num_warps
.endm
.macro coord_event x, y, elevation, trigger, index, script
@ Defines a coord event for map data. Mirrors the struct layout of CoordEvent in include/global.fieldmap.h
.macro coord_event x:req, y:req, elevation:req, var:req, varValue:req, script:req
.2byte \x, \y
.byte \elevation, 0
.2byte \trigger, \index, 0
.byte \elevation
.space 1 @ Padding
.2byte \var
.2byte \varValue
.space 2 @ Padding
.4byte \script
inc _num_traps
.endm
.macro coord_weather_event x, y, elevation, weather
.2byte \x, \y
.byte \elevation, 0
.2byte \weather
.2byte 0, 0
.4byte 0
inc _num_traps
@ Defines a weather coord event for map data. Any coord event is treated as a weather coord event if its script is NULL
.macro coord_weather_event x:req, y:req, elevation:req, weather:req
coord_event \x, \y, \elevation, \weather, 0, NULL
.endm
.macro bg_event x, y, elevation, kind, arg6, arg7, arg8
@ Defines a generic background event for map data. Mirrors the struct layout of BgEvent in include/global.fieldmap.h
@ 'kind' is any BG_EVENT_* constant (see include/constants/event_bg.h).
@ 'arg6' and 'arg7' are used differently depending on the bg event type. See macros below
.macro bg_event x:req, y:req, elevation:req, kind:req, arg6:req, arg7
.2byte \x, \y
.byte \elevation, \kind
.2byte 0
.if \kind < 5
.4byte \arg6
.byte \elevation
.byte \kind
.space 2 @ Padding
.if \kind != BG_EVENT_HIDDEN_ITEM
.4byte \arg6
.else
.2byte \arg6
.byte \arg7, \arg8
.2byte \arg6
.2byte \arg7
.endif
inc _num_signs
.endm
.macro bg_hidden_item_event x, y, height, item, flag
bg_event \x, \y, \height, 7, \item, ((\flag) - FLAG_HIDDEN_ITEMS_START), 0
@ Defines a background sign event for map data. 'facing_dir' is any of the BG_EVENT_PLAYER_FACING_* constants (see include/constants/event_bg.h)
.macro bg_sign_event x:req, y:req, elevation:req, facing_dir:req, script:req
bg_event \x, \y, \elevation, \facing_dir, \script
.endm
.macro bg_secret_base_event x, y, height, secret_base_id
bg_event \x, \y, \height, 8, \secret_base_id, 0, 0
.endm
@ Defines a background hidden item event for map data
.macro bg_hidden_item_event x:req, y:req, elevation:req, item:req, flag:req
bg_event \x, \y, \elevation, BG_EVENT_HIDDEN_ITEM, \item, ((\flag) - FLAG_HIDDEN_ITEMS_START)
.endm
.macro map_events npcs, warps, traps, signs
@ Defines a background secret base event for map data
.macro bg_secret_base_event x:req, y:req, elevation:req, secret_base_id:req
bg_event \x, \y, \elevation, BG_EVENT_SECRET_BASE, \secret_base_id
.endm
@ Defines the table of event data for a map. Mirrors the struct layout of MapEvents in include/global.fieldmap.h
.macro map_events npcs:req, warps:req, traps:req, signs:req
.byte _num_npcs, _num_warps, _num_traps, _num_signs
.4byte \npcs, \warps, \traps, \signs
reset_map_events
.endm
@ Resets the event counters used to track how many events a map has. Run when the events table is created by map_events
.macro reset_map_events
.set _num_npcs, 0
.set _num_warps, 0
@ -85,19 +128,24 @@
.set _num_signs, 0
.endm
@ Initialize the event counters for the first map
reset_map_events
.equiv connection_down, 1
.equiv connection_up, 2
.equiv connection_left, 3
.equiv connection_right, 4
.equiv connection_dive, 5
.equiv connection_emerge, 6
@ Directions for connecting maps
@ The map.json files will only have e.g. "down" as direction data, and this will be appended to "connection_" by the connection macro
.equiv connection_down, CONNECTION_SOUTH
.equiv connection_up, CONNECTION_NORTH
.equiv connection_left, CONNECTION_WEST
.equiv connection_right, CONNECTION_EAST
.equiv connection_dive, CONNECTION_DIVE
.equiv connection_emerge, CONNECTION_EMERGE
.macro connection direction, offset, map, filler
.4byte connection_\direction
@ Defines a map connection. Mirrors the struct layout of MapConnection in include/global.fieldmap.h
.macro connection direction:req, offset:req, map:req
.byte connection_\direction
.space 3 @ Padding
.4byte \offset
map \map
.space 2
.space 2 @ Padding
.endm

View File

@ -69,7 +69,7 @@ void gpu_sync_bg_hide();
// GetMapConnection
bool8 SetDiveWarpEmerge(u16 x, u16 y);
bool8 SetDiveWarpDive(u16 x, u16 y);
void sub_80538F0(u8 mapGroup, u8 mapNum);
void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum);
// sub_8053994
void ResetInitialPlayerAvatarState(void);
void StoreInitialPlayerAvatarState(void);
@ -177,7 +177,7 @@ u16 sub_805559C(void);
void sub_80555B0(int linkPlayerId, int a2, struct UnkStruct_8054FF8 *a3);
bool32 sub_8055618(struct UnkStruct_8054FF8 *);
bool32 sub_8055630(struct UnkStruct_8054FF8 *);
u8 *sub_8055648(struct UnkStruct_8054FF8 *);
const u8 *sub_8055648(struct UnkStruct_8054FF8 *);
bool32 sub_8055660(struct UnkStruct_8054FF8 *);
const u8 *sub_805568C(struct UnkStruct_8054FF8 *);
void sub_80557E8(void);

View File

@ -8,6 +8,17 @@
#define FADE_COLOR_WHITE (RGB(31, 31, 31) | 0x8000)
#define PALETTES_BG 0x0000FFFF
#define PALETTES_OBJECTS 0xFFFF0000
#define PALETTES_ALL (PALETTES_BG | PALETTES_OBJECTS)
#define PLTT_ID(n) ((n) * 16)
#define BG_PLTT_OFFSET 0x000
#define OBJ_PLTT_OFFSET 0x100
#define BG_PLTT_ID(n) (BG_PLTT_OFFSET + PLTT_ID(n))
#define OBJ_PLTT_ID(n) (OBJ_PLTT_OFFSET + PLTT_ID(n))
#define OBJ_PLTT_ID2(n) (PLTT_ID((n) + 16))
enum
{
FAST_FADE_IN_FROM_WHITE,

View File

@ -139,6 +139,7 @@ struct BoxPokemon
/*0x13*/ u8 isBadEgg:1;
u8 hasSpecies:1;
u8 isEgg:1;
u8 blockBoxRS:1; // Unused, but Pokémon Box Ruby & Sapphire will refuse to deposit a Pokémon with this flag set
/*0x14*/ u8 otName[OT_NAME_LENGTH];
/*0x1B*/ u8 markings;
/*0x1C*/ u16 checksum;

View File

@ -8,11 +8,11 @@ void ResetSecretBases(void);
void SetCurrentSecretBaseVar(void);
void CheckPlayerHasSecretBase(void);
void SetOpenedSecretBaseMetatile(void);
void sub_80BB970(struct MapEvents *events);
void SetOccupiedSecretBaseEntranceMetatiles(const struct MapEvents *events);
u8 sub_80BBB24(void);
void sub_80BBCCC(u8 flagIn);
void SetCurrentSecretBaseFromPosition(struct MapPosition *, struct MapEvents *);
void sub_80BC038(struct MapPosition *, struct MapEvents *);
void InitSecretBaseAppearance(u8 flagIn);
void SetCurrentSecretBaseFromPosition(struct MapPosition *, const struct MapEvents *);
void sub_80BC038(struct MapPosition *, const struct MapEvents *);
u8 sub_80BC050();
u8 *GetSecretBaseMapName(u8 *dest);
void SetPlayerSecretBaseRecordMixingParty();

View File

@ -1,124 +1,7 @@
#ifndef GUARD_TEXT_H
#define GUARD_TEXT_H
#define CHAR_SPACE 0x00
#define CHAR_LV 0x34
#define CHAR_SONG_WORD_SEPARATOR 0x37 // separates words in the bard song. Not sure if it's used for anything else
#define CHAR_0 0xA1
#define CHAR_EXCL_MARK 0xAB
#define CHAR_QUESTION_MARK 0xAC
#define CHAR_PERIOD 0xAD
#define CHAR_HYPHEN 0xAE
#define CHAR_ELLIPSIS 0xB0
#define CHAR_DBL_QUOT_LEFT 0xB1
#define CHAR_DBL_QUOT_RIGHT 0xB2
#define CHAR_SGL_QUOT_LEFT 0xB3
#define CHAR_SGL_QUOT_RIGHT 0xB4
#define CHAR_MALE 0xB5
#define CHAR_FEMALE 0xB6
#define CHAR_CURRENCY 0xB7
#define CHAR_COMMA 0xB8
#define CHAR_MULT_SIGN 0xB9
#define CHAR_SLASH 0xBA
#define CHAR_A 0xBB
#define CHAR_B 0xBC
#define CHAR_C 0xBD
#define CHAR_D 0xBE
#define CHAR_E 0xBF
#define CHAR_F 0xC0
#define CHAR_G 0xC1
#define CHAR_H 0xC2
#define CHAR_I 0xC3
#define CHAR_J 0xC4
#define CHAR_K 0xC5
#define CHAR_L 0xC6
#define CHAR_M 0xC7
#define CHAR_N 0xC8
#define CHAR_O 0xC9
#define CHAR_P 0xCA
#define CHAR_Q 0xCB
#define CHAR_R 0xCC
#define CHAR_S 0xCD
#define CHAR_T 0xCE
#define CHAR_U 0xCF
#define CHAR_V 0xD0
#define CHAR_W 0xD1
#define CHAR_X 0xD2
#define CHAR_Y 0xD3
#define CHAR_Z 0xD4
#define CHAR_a 0xD5
#define CHAR_b 0xD6
#define CHAR_c 0xD7
#define CHAR_d 0xD8
#define CHAR_e 0xD9
#define CHAR_f 0xDA
#define CHAR_g 0xDB
#define CHAR_h 0xDC
#define CHAR_i 0xDD
#define CHAR_j 0xDE
#define CHAR_k 0xDF
#define CHAR_l 0xE0
#define CHAR_m 0xE1
#define CHAR_n 0xE2
#define CHAR_o 0xE3
#define CHAR_p 0xE4
#define CHAR_q 0xE5
#define CHAR_r 0xE6
#define CHAR_s 0xE7
#define CHAR_t 0xE8
#define CHAR_u 0xE9
#define CHAR_v 0xEA
#define CHAR_w 0xEB
#define CHAR_x 0xEC
#define CHAR_y 0xED
#define CHAR_z 0xEE
#define CHAR_COLON 0xF0
#define CHAR_PROMPT_SCROLL 0xFA // waits for button press and scrolls dialog
#define CHAR_PROMPT_CLEAR 0xFB // waits for button press and clears dialog
#define EXT_CTRL_CODE_BEGIN 0xFC // extended control code
#define PLACEHOLDER_BEGIN 0xFD // string placeholder
#define CHAR_NEWLINE 0xFE
#define EOS 0xFF // end of string
#define TEXT_COLOR_TRANSPARENT 0x00
#define TEXT_COLOR_DARK_GREY 0x01
#define TEXT_COLOR_RED 0x02
#define TEXT_COLOR_GREEN 0x03
#define TEXT_COLOR_BLUE 0x04
#define TEXT_COLOR_YELLOW 0x05
#define TEXT_COLOR_CYAN 0x06
#define TEXT_COLOR_MAGENTA 0x07
#define TEXT_COLOR_LIGHT_GREY 0x08
#define TEXT_COLOR_BLACK 0x09
#define TEXT_COLOR_BLACK2 0x0A
#define TEXT_COLOR_SILVER 0x0B
#define TEXT_COLOR_WHITE 0x0C
#define TEXT_COLOR_SKY_BLUE 0x0D
#define TEXT_COLOR_LIGHT_BLUE 0x0E
#define TEXT_COLOR_WHITE2 0x0F
#define EXT_CTRL_CODE_COLOR 0x01
#define EXT_CTRL_CODE_HIGHLIGHT 0x02
#define EXT_CTRL_CODE_SHADOW 0x03
#define EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW 0x04
#define EXT_CTRL_CODE_PALETTE 0x05
#define EXT_CTRL_CODE_SIZE 0x06
#define EXT_CTRL_CODE_RESET_SIZE 0x07
#define EXT_CTRL_CODE_PAUSE 0x08
#define EXT_CTRL_CODE_PAUSE_UNTIL_PRESS 0x09
#define EXT_CTRL_CODE_WAIT_SE 0x0A
#define EXT_CTRL_CODE_PLAY_BGM 0x0B
#define EXT_CTRL_CODE_ESCAPE 0x0C
#define EXT_CTRL_CODE_SHIFT_TEXT 0x0D // nop
#define EXT_CTRL_CODE_SHIFT_DOWN 0x0E
#define EXT_CTRL_CODE_FILL_WINDOW 0x0F
#define EXT_CTRL_CODE_PLAY_SE 0x10
#define EXT_CTRL_CODE_CLEAR 0x11
#define EXT_CTRL_CODE_SKIP 0x12
#define EXT_CTRL_CODE_CLEAR_TO 0x13
#define EXT_CTRL_CODE_MIN_LETTER_SPACING 0x14
#define EXT_CTRL_CODE_JPN 0x15
#define EXT_CTRL_CODE_ENG 0x16
#include "characters.h"
struct WindowTemplate
{

22
make_tools.mk Normal file
View File

@ -0,0 +1,22 @@
# This controls building executables in the `tools` folder.
# Can be invoked through the `Makefile` or standalone.
MAKEFLAGS += --no-print-directory
# Inclusive list. If you don't want a tool to be built, don't add it here.
TOOLS_DIR := tools
TOOL_NAMES := aif2pcm bin2c gbafix gbagfx jsonproc mapjson mid2agb preproc ramscrgen rsfont scaninc
TOOLDIRS := $(TOOL_NAMES:%=$(TOOLS_DIR)/%)
# Tool making doesnt require a pokeruby dependency scan.
RULES_NO_SCAN += tools check-tools clean-tools $(TOOLDIRS)
.PHONY: $(RULES_NO_SCAN)
tools: $(TOOLDIRS)
$(TOOLDIRS):
@$(MAKE) -C $@
clean-tools:
@$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);)

View File

@ -1,31 +1,32 @@
# Map JSON data
MAPS_DIR = data/maps
LAYOUTS_DIR = data/layouts
# Inputs
MAPS_DIR = $(DATA_ASM_SUBDIR)/maps
LAYOUTS_DIR = $(DATA_ASM_SUBDIR)/layouts
MAP_DIRS := $(dir $(wildcard $(MAPS_DIR)/*/))
# Outputs
MAPS_OUTDIR := $(MAPS_DIR)
LAYOUTS_OUTDIR := $(LAYOUTS_DIR)
INCLUDECONSTS_OUTDIR := include/constants
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_groups.h
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/layouts.h
MAP_DIRS := $(dir $(wildcard $(MAPS_DIR)/*/map.json))
MAP_CONNECTIONS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/connections.inc,$(MAP_DIRS))
MAP_EVENTS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/events.inc,$(MAP_DIRS))
MAP_HEADERS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/header.inc,$(MAP_DIRS))
$(BUILD_DIR)/data/maps.o: data/maps.s $(LAYOUTS_DIR)/layouts.inc $(LAYOUTS_DIR)/layouts_table.inc $(MAPS_DIR)/headers.inc $(MAPS_DIR)/groups.inc $(MAPS_DIR)/connections.inc $(MAP_CONNECTIONS) $(MAP_HEADERS)
$(PREPROC) $< charmap.txt | $(CPP) -I include | $(AS) $(ASFLAGS) -o $@
$(PREPROC) $< charmap.txt | $(CPP) -I include -nostdinc -undef -Wno-unicode - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@
$(BUILD_DIR)/data/map_events.o: data/map_events.s $(MAPS_DIR)/events.inc $(MAP_EVENTS)
$(PREPROC) $< charmap.txt | $(CPP) -I include | $(AS) $(ASFLAGS) -o $@
$(PREPROC) $< charmap.txt | $(CPP) -I include -nostdinc -undef -Wno-unicode - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@
$(MAPS_DIR)/%/header.inc: $(MAPS_DIR)/%/map.json
$(MAPJSON) map ruby $< $(LAYOUTS_DIR)/layouts.json
$(MAPS_DIR)/%/events.inc: $(MAPS_DIR)/%/header.inc ;
$(MAPS_DIR)/%/connections.inc: $(MAPS_DIR)/%/events.inc ;
$(MAPS_OUTDIR)/%/header.inc $(MAPS_OUTDIR)/%/events.inc $(MAPS_OUTDIR)/%/connections.inc: $(MAPS_DIR)/%/map.json
$(MAPJSON) map ruby $< $(LAYOUTS_DIR)/layouts.json $(@D)
$(MAPS_DIR)/groups.inc: $(MAPS_DIR)/map_groups.json
$(MAPJSON) groups ruby $<
$(MAPS_DIR)/connections.inc: $(MAPS_DIR)/groups.inc ;
$(MAPS_DIR)/events.inc: $(MAPS_DIR)/connections.inc ;
$(MAPS_DIR)/headers.inc: $(MAPS_DIR)/events.inc ;
include/constants/map_groups.h: $(MAPS_DIR)/headers.inc ;
$(MAPS_OUTDIR)/connections.inc $(MAPS_OUTDIR)/groups.inc $(MAPS_OUTDIR)/events.inc $(MAPS_OUTDIR)/headers.inc $(INCLUDECONSTS_OUTDIR)/map_groups.h: $(MAPS_DIR)/map_groups.json
$(MAPJSON) groups ruby $< $(MAPS_OUTDIR) $(INCLUDECONSTS_OUTDIR)
$(LAYOUTS_DIR)/layouts.inc: $(LAYOUTS_DIR)/layouts.json
$(MAPJSON) layouts ruby $<
$(LAYOUTS_DIR)/layouts_table.inc: $(LAYOUTS_DIR)/layouts.inc ;
include/constants/layouts.h: $(LAYOUTS_DIR)/layouts_table.inc ;
$(LAYOUTS_OUTDIR)/layouts.inc $(LAYOUTS_OUTDIR)/layouts_table.inc $(INCLUDECONSTS_OUTDIR)/layouts.h: $(LAYOUTS_DIR)/layouts.json
$(MAPJSON) layouts ruby $< $(LAYOUTS_OUTDIR) $(INCLUDECONSTS_OUTDIR)

View File

@ -1689,7 +1689,7 @@ void LinkOpponentHandlecmd48(void)
ewram17810[gActiveBattler].unk1_1 = 0;
}
}
gUnknown_02024E68[gActiveBattler] = sub_8044804(
gUnknown_02024E68[gActiveBattler] = CreatePartyStatusSummarySprites(
gActiveBattler,
(struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4],
gBattleBufferA[gActiveBattler][1],

View File

@ -1620,7 +1620,7 @@ void LinkPartnerHandlecmd48(void)
}
ewram17810[gActiveBattler].unk0_0 = 1;
gUnknown_02024E68[gActiveBattler] = sub_8044804(
gUnknown_02024E68[gActiveBattler] = CreatePartyStatusSummarySprites(
gActiveBattler,
(struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4],
gBattleBufferA[gActiveBattler][1],

View File

@ -1838,7 +1838,7 @@ void OpponentHandlecmd48(void)
ewram17810[gActiveBattler].unk1_1 = 0;
}
}
gUnknown_02024E68[gActiveBattler] = sub_8044804(
gUnknown_02024E68[gActiveBattler] = CreatePartyStatusSummarySprites(
gActiveBattler,
(struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4],
gBattleBufferA[gActiveBattler][1],

View File

@ -2967,7 +2967,7 @@ void PlayerHandlecmd48(void)
else
{
ewram17810[gActiveBattler].unk0_0 = 1;
gUnknown_02024E68[gActiveBattler] = sub_8044804(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]);
gUnknown_02024E68[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]);
ewram17810[gActiveBattler].unk5 = 0;
if (gBattleBufferA[gActiveBattler][2] != 0)
ewram17810[gActiveBattler].unk5 = 0x5D;

View File

@ -1539,7 +1539,7 @@ void WallyHandlecmd48(void)
else
{
ewram17810[gActiveBattler].unk0_0 = 1;
gUnknown_02024E68[gActiveBattler] = sub_8044804(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]);
gUnknown_02024E68[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]);
WallyBufferExecCompleted();
}
}

View File

@ -1073,8 +1073,7 @@ void sub_804454C(void)
}
}
#ifdef NONMATCHING
u8 sub_8044804(u8 a, const struct HpAndStatus *b, u8 c, u8 d)
u8 CreatePartyStatusSummarySprites(u8 a, const struct HpAndStatus *b, u8 c, u8 d)
{
u8 r7;
s16 x;
@ -1082,7 +1081,7 @@ u8 sub_8044804(u8 a, const struct HpAndStatus *b, u8 c, u8 d)
s16 r8;
s16 r5;
int i;
int i, j;
u8 sp[6];
s8 sp14;
u8 sp18;
@ -1125,8 +1124,7 @@ u8 sub_8044804(u8 a, const struct HpAndStatus *b, u8 c, u8 d)
}
//_08044884
sp14 = 0;
for (i = 0; i < 6; i++) //_080448A0
for (i = 0, sp14 = 0; i < 6; i++) //_080448A0
{
if (b[i].hp != 0xFFFF)
sp14++;
@ -1169,14 +1167,14 @@ u8 sub_8044804(u8 a, const struct HpAndStatus *b, u8 c, u8 d)
if (r7 == 0)
{
gSprites[sp[i]].x += 10 * i + 24;
gSprites[sp[i]].data[1] = i * 7 + 10;
gSprites[sp[i]].data[1] = 7 * i + 10;
gSprites[sp[i]].x2 = 120;
}
//_08044A18
else
{
gSprites[sp[i]].x -= 10 * (5 - i) + 24;
gSprites[sp[i]].data[1] = (6 - i) * 7 + 10;
gSprites[sp[i]].data[1] = 7 * (6 - i) + 10;
gSprites[sp[i]].x2 = -120;
}
//_08044A56
@ -1192,7 +1190,7 @@ u8 sub_8044804(u8 a, const struct HpAndStatus *b, u8 c, u8 d)
if (b[i].hp == 0xFFFF)
{
//_08044AE6
gSprites[sp[i]].oam.tileNum += 1;
gSprites[sp[i]].oam.tileNum++;
gSprites[sp[i]].data[7] = 1;
// to _08044B52
}
@ -1212,7 +1210,7 @@ u8 sub_8044804(u8 a, const struct HpAndStatus *b, u8 c, u8 d)
if (i >= sp14)
{
//_08044AE6
gSprites[sp[i]].oam.tileNum += 1;
gSprites[sp[i]].oam.tileNum++;
gSprites[sp[i]].data[7] = 1;
// to _08044B52
}
@ -1233,42 +1231,43 @@ u8 sub_8044804(u8 a, const struct HpAndStatus *b, u8 c, u8 d)
else
{
// Mismatch occurrs in this loop initialization
j = 5;
for (i = 0; i < 6; i++)
{
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
if (b[i].hp == 0xFFFF)
{
gSprites[sp[5 - i]].oam.tileNum += 1;
gSprites[sp[5 - i]].data[7] = 1;
gSprites[sp[j]].oam.tileNum++;
gSprites[sp[j]].data[7] = 1;
}
else if (b[i].hp == 0)
{
gSprites[sp[5 - i]].oam.tileNum += 3;
gSprites[sp[j]].oam.tileNum += 3;
}
else if (b[i].status != 0)
{
gSprites[sp[5 - i]].oam.tileNum += 2;
gSprites[sp[j]].oam.tileNum += 2;
}
j--;
}
else
{
if (i >= sp14)
{
gSprites[sp[5 - i]].oam.tileNum += 1;
gSprites[sp[5 - i]].data[7] = 1;
gSprites[sp[j]].oam.tileNum++;
gSprites[sp[j]].data[7] = 1;
}
else if (b[i].hp == 0)
{
gSprites[sp[5 - i]].oam.tileNum += 3;
gSprites[sp[j]].oam.tileNum += 3;
}
else if (b[i].status != 0)
{
gSprites[sp[5 - i]].oam.tileNum += 2;
gSprites[sp[j]].oam.tileNum += 2;
}
j--;
}
// This corrects the initialization order, but messes up the counter update order
asm(""::"r"(&b[i]));
}
}
//_08044C38
@ -1281,599 +1280,6 @@ u8 sub_8044804(u8 a, const struct HpAndStatus *b, u8 c, u8 d)
PlaySE12WithPanning(SE_BALL_TRAY_ENTER, 0);
return taskId;
}
#else
NAKED
u8 sub_8044804(u8 a, const struct HpAndStatus *b, u8 c, u8 d)
{
asm(".syntax unified\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x28\n\
str r1, [sp, 0xC]\n\
lsls r0, 24\n\
lsrs r0, 24\n\
str r0, [sp, 0x8]\n\
lsls r2, 24\n\
lsrs r2, 24\n\
adds r4, r2, 0\n\
lsls r3, 24\n\
lsrs r3, 24\n\
str r3, [sp, 0x10]\n\
cmp r4, 0\n\
beq _08044834\n\
bl GetBattlerPosition\n\
lsls r0, 24\n\
lsrs r0, 24\n\
cmp r0, 0x3\n\
beq _08044878\n\
_08044834:\n\
ldr r0, [sp, 0x8]\n\
bl GetBattlerSide\n\
lsls r0, 24\n\
cmp r0, 0\n\
bne _08044854\n\
movs r7, 0\n\
movs r1, 0x88\n\
movs r2, 0x60\n\
movs r0, 0x64\n\
mov r8, r0\n\
ldr r5, _08044850 @ =0x0000fffb\n\
b _08044884\n\
.align 2, 0\n\
_08044850: .4byte 0x0000fffb\n\
_08044854:\n\
movs r7, 0x1\n\
cmp r4, 0\n\
beq _08044864\n\
bl IsDoubleBattle\n\
lsls r0, 24\n\
cmp r0, 0\n\
bne _0804486A\n\
_08044864:\n\
movs r1, 0x68\n\
movs r2, 0x28\n\
b _0804486E\n\
_0804486A:\n\
movs r1, 0x68\n\
movs r2, 0x10\n\
_0804486E:\n\
ldr r3, _08044874 @ =0x0000ff9c\n\
mov r8, r3\n\
b _08044882\n\
.align 2, 0\n\
_08044874: .4byte 0x0000ff9c\n\
_08044878:\n\
movs r7, 0x1\n\
movs r1, 0x68\n\
movs r2, 0x28\n\
ldr r5, _08044930 @ =0x0000ff9c\n\
mov r8, r5\n\
_08044882:\n\
movs r5, 0x5\n\
_08044884:\n\
movs r6, 0\n\
str r6, [sp, 0x14]\n\
lsls r4, r7, 3\n\
ldr r0, _08044934 @ =gUnknown_0820A754\n\
mov r10, r0\n\
lsls r3, r7, 1\n\
mov r9, r3\n\
lsls r1, 16\n\
str r1, [sp, 0x20]\n\
lsls r2, 16\n\
str r2, [sp, 0x24]\n\
ldr r2, _08044938 @ =0x0000ffff\n\
ldr r1, [sp, 0xC]\n\
movs r6, 0x5\n\
_080448A0:\n\
ldrh r0, [r1]\n\
cmp r0, r2\n\
beq _080448B4\n\
ldr r3, [sp, 0x14]\n\
lsls r0, r3, 24\n\
movs r3, 0x80\n\
lsls r3, 17\n\
adds r0, r3\n\
lsrs r0, 24\n\
str r0, [sp, 0x14]\n\
_080448B4:\n\
adds r1, 0x8\n\
subs r6, 0x1\n\
cmp r6, 0\n\
bge _080448A0\n\
mov r6, r10\n\
adds r0, r4, r6\n\
bl LoadCompressedObjectPic\n\
ldr r0, _0804493C @ =gUnknown_0820A784\n\
adds r0, r4, r0\n\
bl LoadSpriteSheet\n\
ldr r0, _08044940 @ =gUnknown_0820A764\n\
adds r0, r4, r0\n\
bl LoadSpritePalette\n\
ldr r0, _08044944 @ =gUnknown_0820A774\n\
adds r0, r4, r0\n\
bl LoadSpritePalette\n\
mov r1, r9\n\
adds r0, r1, r7\n\
lsls r0, 3\n\
ldr r1, _08044948 @ =gSpriteTemplate_820A7A4\n\
adds r0, r1\n\
ldr r2, [sp, 0x20]\n\
asrs r1, r2, 16\n\
ldr r3, [sp, 0x24]\n\
asrs r2, r3, 16\n\
movs r3, 0xA\n\
bl CreateSprite\n\
lsls r0, 24\n\
lsrs r0, 24\n\
str r0, [sp, 0x18]\n\
lsls r0, 4\n\
ldr r6, [sp, 0x18]\n\
adds r0, r6\n\
lsls r0, 2\n\
ldr r1, _0804494C @ =gSprites\n\
adds r4, r0, r1\n\
ldr r1, _08044950 @ =gSubspriteTables_820A6E4\n\
adds r0, r4, 0\n\
bl SetSubspriteTables\n\
mov r0, r8\n\
strh r0, [r4, 0x24]\n\
strh r5, [r4, 0x2E]\n\
cmp r7, 0\n\
beq _08044954\n\
ldrh r0, [r4, 0x20]\n\
subs r0, 0x60\n\
strh r0, [r4, 0x20]\n\
ldrb r1, [r4, 0x3]\n\
movs r0, 0x3F\n\
negs r0, r0\n\
ands r0, r1\n\
movs r1, 0x10\n\
orrs r0, r1\n\
strb r0, [r4, 0x3]\n\
b _0804495A\n\
.align 2, 0\n\
_08044930: .4byte 0x0000ff9c\n\
_08044934: .4byte gUnknown_0820A754\n\
_08044938: .4byte 0x0000ffff\n\
_0804493C: .4byte gUnknown_0820A784\n\
_08044940: .4byte gUnknown_0820A764\n\
_08044944: .4byte gUnknown_0820A774\n\
_08044948: .4byte gSpriteTemplate_820A7A4\n\
_0804494C: .4byte gSprites\n\
_08044950: .4byte gSubspriteTables_820A6E4\n\
_08044954:\n\
ldrh r0, [r4, 0x20]\n\
adds r0, 0x60\n\
strh r0, [r4, 0x20]\n\
_0804495A:\n\
movs r6, 0\n\
ldr r1, _08044A04 @ =gSprites\n\
mov r10, r1\n\
mov r4, sp\n\
mov r2, r9\n\
adds r0, r2, r7\n\
lsls r0, 3\n\
str r0, [sp, 0x1C]\n\
movs r3, 0xA\n\
mov r9, r3\n\
mov r8, r6\n\
_08044970:\n\
ldr r0, _08044A08 @ =gSpriteTemplate_820A7D4\n\
ldr r5, [sp, 0x24]\n\
ldr r1, _08044A0C @ =0xfffc0000\n\
adds r2, r5, r1\n\
ldr r3, [sp, 0x1C]\n\
adds r0, r3, r0\n\
ldr r5, [sp, 0x20]\n\
asrs r1, r5, 16\n\
asrs r2, 16\n\
movs r3, 0x9\n\
bl CreateSpriteAtEnd\n\
strb r0, [r4]\n\
ldr r0, [sp, 0x10]\n\
cmp r0, 0\n\
bne _080449A0\n\
ldrb r0, [r4]\n\
lsls r1, r0, 4\n\
adds r1, r0\n\
lsls r1, 2\n\
ldr r2, _08044A10 @ =gSprites + 0x1C\n\
adds r1, r2\n\
ldr r0, _08044A14 @ =sub_8045180\n\
str r0, [r1]\n\
_080449A0:\n\
ldr r5, _08044A04 @ =gSprites\n\
cmp r7, 0\n\
bne _080449BE\n\
ldrb r1, [r4]\n\
lsls r0, r1, 4\n\
adds r0, r1\n\
lsls r0, 2\n\
add r0, r10\n\
strh r7, [r0, 0x24]\n\
ldrb r1, [r4]\n\
lsls r0, r1, 4\n\
adds r0, r1\n\
lsls r0, 2\n\
add r0, r10\n\
strh r7, [r0, 0x26]\n\
_080449BE:\n\
ldrb r1, [r4]\n\
lsls r0, r1, 4\n\
adds r0, r1\n\
lsls r0, 2\n\
adds r0, r5\n\
movs r1, 0\n\
mov r3, sp\n\
ldrh r3, [r3, 0x18]\n\
strh r3, [r0, 0x2E]\n\
cmp r7, 0\n\
bne _08044A18\n\
ldrb r0, [r4]\n\
lsls r1, r0, 4\n\
adds r1, r0\n\
lsls r1, 2\n\
adds r1, r5\n\
ldrh r0, [r1, 0x20]\n\
adds r0, 0x18\n\
add r0, r8\n\
strh r0, [r1, 0x20]\n\
ldrb r1, [r4]\n\
lsls r0, r1, 4\n\
adds r0, r1\n\
lsls r0, 2\n\
adds r0, r5\n\
mov r1, r9\n\
strh r1, [r0, 0x30]\n\
ldrb r1, [r4]\n\
lsls r0, r1, 4\n\
adds r0, r1\n\
lsls r0, 2\n\
adds r0, r5\n\
movs r1, 0x78\n\
b _08044A56\n\
.align 2, 0\n\
_08044A04: .4byte gSprites\n\
_08044A08: .4byte gSpriteTemplate_820A7D4\n\
_08044A0C: .4byte 0xfffc0000\n\
_08044A10: .4byte gSprites + 0x1C\n\
_08044A14: .4byte sub_8045180\n\
_08044A18:\n\
ldrb r0, [r4]\n\
lsls r2, r0, 4\n\
adds r2, r0\n\
lsls r2, 2\n\
adds r2, r5\n\
ldrh r3, [r2, 0x20]\n\
subs r3, 0x18\n\
movs r1, 0x5\n\
subs r1, r6\n\
lsls r0, r1, 2\n\
adds r0, r1\n\
lsls r0, 1\n\
subs r3, r0\n\
strh r3, [r2, 0x20]\n\
ldrb r0, [r4]\n\
lsls r2, r0, 4\n\
adds r2, r0\n\
lsls r2, 2\n\
adds r2, r5\n\
movs r1, 0x6\n\
subs r1, r6\n\
lsls r0, r1, 3\n\
subs r0, r1\n\
adds r0, 0xA\n\
strh r0, [r2, 0x30]\n\
ldrb r1, [r4]\n\
lsls r0, r1, 4\n\
adds r0, r1\n\
lsls r0, 2\n\
adds r0, r5\n\
ldr r1, _08044AC4 @ =0x0000ff88\n\
_08044A56:\n\
strh r1, [r0, 0x24]\n\
ldrb r1, [r4]\n\
lsls r0, r1, 4\n\
adds r0, r1\n\
lsls r0, 2\n\
adds r0, r5\n\
strh r7, [r0, 0x32]\n\
adds r4, 0x1\n\
movs r2, 0x7\n\
add r9, r2\n\
movs r3, 0xA\n\
add r8, r3\n\
adds r6, 0x1\n\
cmp r6, 0x5\n\
bgt _08044A76\n\
b _08044970\n\
_08044A76:\n\
ldr r0, [sp, 0x8]\n\
bl GetBattlerSide\n\
lsls r0, 24\n\
cmp r0, 0\n\
bne _08044B5E\n\
movs r6, 0\n\
ldr r5, _08044AC8 @ =gBattleTypeFlags\n\
mov r10, r5\n\
ldr r0, _08044ACC @ =0x0000ffff\n\
mov r9, r0\n\
ldr r7, _08044AD0 @ =gSprites\n\
ldr r1, _08044AD4 @ =0x000003ff\n\
mov r12, r1\n\
ldr r2, _08044AD8 @ =0xfffffc00\n\
mov r8, r2\n\
mov r4, sp\n\
ldr r5, [sp, 0xC]\n\
_08044A9A:\n\
mov r3, r10\n\
ldrh r1, [r3]\n\
movs r0, 0x40\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _08044ADC\n\
ldrh r0, [r5]\n\
cmp r0, r9\n\
beq _08044AE6\n\
cmp r0, 0\n\
bne _08044B2E\n\
ldrb r0, [r4]\n\
lsls r2, r0, 4\n\
adds r2, r0\n\
lsls r2, 2\n\
adds r2, r7\n\
ldrh r3, [r2, 0x4]\n\
lsls r1, r3, 22\n\
lsrs r1, 22\n\
adds r1, 0x3\n\
b _08044B46\n\
.align 2, 0\n\
_08044AC4: .4byte 0x0000ff88\n\
_08044AC8: .4byte gBattleTypeFlags\n\
_08044ACC: .4byte 0x0000ffff\n\
_08044AD0: .4byte gSprites\n\
_08044AD4: .4byte 0x000003ff\n\
_08044AD8: .4byte 0xfffffc00\n\
_08044ADC:\n\
ldr r1, [sp, 0x14]\n\
lsls r0, r1, 24\n\
asrs r0, 24\n\
cmp r6, r0\n\
blt _08044B14\n\
_08044AE6:\n\
ldrb r0, [r4]\n\
lsls r2, r0, 4\n\
adds r2, r0\n\
lsls r2, 2\n\
adds r2, r7\n\
ldrh r3, [r2, 0x4]\n\
lsls r1, r3, 22\n\
lsrs r1, 22\n\
adds r1, 0x1\n\
mov r0, r12\n\
ands r1, r0\n\
mov r0, r8\n\
ands r0, r3\n\
orrs r0, r1\n\
strh r0, [r2, 0x4]\n\
ldrb r1, [r4]\n\
lsls r0, r1, 4\n\
adds r0, r1\n\
lsls r0, 2\n\
adds r0, r7\n\
movs r1, 0x1\n\
strh r1, [r0, 0x3C]\n\
b _08044B52\n\
_08044B14:\n\
ldrh r0, [r5]\n\
cmp r0, 0\n\
bne _08044B2E\n\
ldrb r0, [r4]\n\
lsls r2, r0, 4\n\
adds r2, r0\n\
lsls r2, 2\n\
adds r2, r7\n\
ldrh r3, [r2, 0x4]\n\
lsls r1, r3, 22\n\
lsrs r1, 22\n\
adds r1, 0x3\n\
b _08044B46\n\
_08044B2E:\n\
ldr r0, [r5, 0x4]\n\
cmp r0, 0\n\
beq _08044B52\n\
ldrb r0, [r4]\n\
lsls r2, r0, 4\n\
adds r2, r0\n\
lsls r2, 2\n\
adds r2, r7\n\
ldrh r3, [r2, 0x4]\n\
lsls r1, r3, 22\n\
lsrs r1, 22\n\
adds r1, 0x2\n\
_08044B46:\n\
mov r0, r12\n\
ands r1, r0\n\
mov r0, r8\n\
ands r0, r3\n\
orrs r0, r1\n\
strh r0, [r2, 0x4]\n\
_08044B52:\n\
adds r4, 0x1\n\
adds r5, 0x8\n\
adds r6, 0x1\n\
cmp r6, 0x5\n\
ble _08044A9A\n\
b _08044C38\n\
_08044B5E:\n\
movs r6, 0\n\
ldr r1, _08044BA4 @ =gBattleTypeFlags\n\
mov r10, r1\n\
ldr r2, _08044BA8 @ =0x0000ffff\n\
mov r9, r2\n\
ldr r7, _08044BAC @ =gSprites\n\
ldr r3, _08044BB0 @ =0x000003ff\n\
mov r12, r3\n\
ldr r5, _08044BB4 @ =0xfffffc00\n\
mov r8, r5\n\
ldr r5, [sp, 0xC]\n\
mov r4, sp\n\
adds r4, 0x5\n\
_08044B78:\n\
mov r0, r10\n\
ldrh r1, [r0]\n\
movs r0, 0x40\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _08044BB8\n\
ldrh r0, [r5]\n\
cmp r0, r9\n\
beq _08044BC2\n\
cmp r0, 0\n\
bne _08044C0A\n\
ldrb r0, [r4]\n\
lsls r2, r0, 4\n\
adds r2, r0\n\
lsls r2, 2\n\
adds r2, r7\n\
ldrh r3, [r2, 0x4]\n\
lsls r1, r3, 22\n\
lsrs r1, 22\n\
adds r1, 0x3\n\
b _08044C22\n\
.align 2, 0\n\
_08044BA4: .4byte gBattleTypeFlags\n\
_08044BA8: .4byte 0x0000ffff\n\
_08044BAC: .4byte gSprites\n\
_08044BB0: .4byte 0x000003ff\n\
_08044BB4: .4byte 0xfffffc00\n\
_08044BB8:\n\
ldr r1, [sp, 0x14]\n\
lsls r0, r1, 24\n\
asrs r0, 24\n\
cmp r6, r0\n\
blt _08044BF0\n\
_08044BC2:\n\
ldrb r0, [r4]\n\
lsls r2, r0, 4\n\
adds r2, r0\n\
lsls r2, 2\n\
adds r2, r7\n\
ldrh r3, [r2, 0x4]\n\
lsls r1, r3, 22\n\
lsrs r1, 22\n\
adds r1, 0x1\n\
mov r0, r12\n\
ands r1, r0\n\
mov r0, r8\n\
ands r0, r3\n\
orrs r0, r1\n\
strh r0, [r2, 0x4]\n\
ldrb r1, [r4]\n\
lsls r0, r1, 4\n\
adds r0, r1\n\
lsls r0, 2\n\
adds r0, r7\n\
movs r1, 0x1\n\
strh r1, [r0, 0x3C]\n\
b _08044C2E\n\
_08044BF0:\n\
ldrh r0, [r5]\n\
cmp r0, 0\n\
bne _08044C0A\n\
ldrb r0, [r4]\n\
lsls r2, r0, 4\n\
adds r2, r0\n\
lsls r2, 2\n\
adds r2, r7\n\
ldrh r3, [r2, 0x4]\n\
lsls r1, r3, 22\n\
lsrs r1, 22\n\
adds r1, 0x3\n\
b _08044C22\n\
_08044C0A:\n\
ldr r0, [r5, 0x4]\n\
cmp r0, 0\n\
beq _08044C2E\n\
ldrb r0, [r4]\n\
lsls r2, r0, 4\n\
adds r2, r0\n\
lsls r2, 2\n\
adds r2, r7\n\
ldrh r3, [r2, 0x4]\n\
lsls r1, r3, 22\n\
lsrs r1, 22\n\
adds r1, 0x2\n\
_08044C22:\n\
mov r0, r12\n\
ands r1, r0\n\
mov r0, r8\n\
ands r0, r3\n\
orrs r0, r1\n\
strh r0, [r2, 0x4]\n\
_08044C2E:\n\
subs r4, 0x1\n\
adds r5, 0x8\n\
adds r6, 0x1\n\
cmp r6, 0x5\n\
ble _08044B78\n\
_08044C38:\n\
ldr r0, _08044C98 @ =TaskDummy\n\
movs r1, 0x5\n\
bl CreateTask\n\
lsls r0, 24\n\
lsrs r4, r0, 24\n\
ldr r2, _08044C9C @ =gTasks\n\
lsls r3, r4, 2\n\
adds r1, r3, r4\n\
lsls r1, 3\n\
adds r0, r1, r2\n\
mov r5, sp\n\
ldrh r5, [r5, 0x8]\n\
strh r5, [r0, 0x8]\n\
mov r6, sp\n\
ldrh r6, [r6, 0x18]\n\
strh r6, [r0, 0xA]\n\
movs r6, 0\n\
adds r0, r2, 0\n\
adds r0, 0xE\n\
adds r1, r0\n\
_08044C62:\n\
mov r5, sp\n\
adds r0, r5, r6\n\
ldrb r0, [r0]\n\
strh r0, [r1]\n\
adds r1, 0x2\n\
adds r6, 0x1\n\
cmp r6, 0x5\n\
ble _08044C62\n\
adds r0, r3, r4\n\
lsls r0, 3\n\
adds r0, r2\n\
ldrh r6, [r5, 0x10]\n\
strh r6, [r0, 0x1C]\n\
movs r0, 0x72\n\
movs r1, 0\n\
bl PlaySE12WithPanning\n\
adds r0, r4, 0\n\
add sp, 0x28\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r1}\n\
bx r1\n\
.align 2, 0\n\
_08044C98: .4byte TaskDummy\n\
_08044C9C: .4byte gTasks\n\
.syntax divided\n");
}
#endif
void sub_8044CA0(u8 taskId)
{

View File

@ -5659,7 +5659,7 @@ void HandleAction_NothingIsFainted(void)
gCurrentTurnActionNumber++;
gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber];
gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED
| HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_IGNORE_ON_AIR
| HITMARKER_NO_PPDEDUCT | HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_IGNORE_ON_AIR
| HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_x100000
| HITMARKER_OBEYS | HITMARKER_x10 | HITMARKER_SYNCHRONISE_EFFECT
| HITMARKER_CHARGING | HITMARKER_x4000000);
@ -5671,7 +5671,7 @@ void HandleAction_ActionFinished(void)
gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber];
SpecialStatusesClear();
gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED
| HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_IGNORE_ON_AIR
| HITMARKER_NO_PPDEDUCT | HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_IGNORE_ON_AIR
| HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_x100000
| HITMARKER_OBEYS | HITMARKER_x10 | HITMARKER_SYNCHRONISE_EFFECT
| HITMARKER_CHARGING | HITMARKER_x4000000);

View File

@ -2321,14 +2321,14 @@ void SetMoveEffect(bool8 primary, u8 certain)
gBattleStruct->scriptingActive = gBattlerAttacker;
}
if (gBattleMons[gEffectBattler].ability == ABILITY_SHIELD_DUST && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
if (gBattleMons[gEffectBattler].ability == ABILITY_SHIELD_DUST && !(gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
&& !primary && gBattleCommunication[MOVE_EFFECT_BYTE] <= 9)
{
gBattlescriptCurrInstr++;
return;
}
if (gSideStatuses[GET_BATTLER_SIDE(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
if (gSideStatuses[GET_BATTLER_SIDE(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
&& !primary && gBattleCommunication[MOVE_EFFECT_BYTE] <= 7)
{
gBattlescriptCurrInstr++;
@ -2387,10 +2387,10 @@ void SetMoveEffect(bool8 primary, u8 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_PSNPrevention;
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
{
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS;
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
gHitMarker &= ~(HITMARKER_STATUS_ABILITY_EFFECT);
}
else
{
@ -2399,7 +2399,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
return;
}
if ((IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_POISON) || IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_STEEL))
&& (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
&& (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
&& (primary == TRUE || certain == MOVE_EFFECT_CERTAIN))
{
BattleScriptPush(gBattlescriptCurrInstr + 1);
@ -2428,10 +2428,10 @@ void SetMoveEffect(bool8 primary, u8 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_BRNPrevention;
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
{
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS;
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
gHitMarker &= ~(HITMARKER_STATUS_ABILITY_EFFECT);
}
else
{
@ -2440,7 +2440,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
return;
}
if (IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_FIRE)
&& (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
&& (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
&& (primary == TRUE || certain == MOVE_EFFECT_CERTAIN))
{
BattleScriptPush(gBattlescriptCurrInstr + 1);
@ -2484,10 +2484,10 @@ void SetMoveEffect(bool8 primary, u8 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_PRLZPrevention;
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
{
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS;
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
gHitMarker &= ~(HITMARKER_STATUS_ABILITY_EFFECT);
}
else
{
@ -2512,10 +2512,10 @@ void SetMoveEffect(bool8 primary, u8 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_PSNPrevention;
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
{
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS;
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
gHitMarker &= ~(HITMARKER_STATUS_ABILITY_EFFECT);
}
else
{
@ -2524,7 +2524,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
return;
}
if ((IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_POISON) || IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_STEEL))
&& (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
&& (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
&& (primary == TRUE || certain == MOVE_EFFECT_CERTAIN))
{
BattleScriptPush(gBattlescriptCurrInstr + 1);
@ -2567,10 +2567,10 @@ void SetMoveEffect(bool8 primary, u8 certain)
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gEffectBattler].status1);
MarkBattlerForControllerExec(gActiveBattler);
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
{
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUSED_BY_ABILITY;
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
gHitMarker &= ~(HITMARKER_STATUS_ABILITY_EFFECT);
}
else
{

View File

@ -2100,7 +2100,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleCommunication[MOVE_EFFECT_BYTE] += 0x40;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
}
@ -2122,7 +2122,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleCommunication[MOVE_EFFECT_BYTE] += 0x40;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
}
@ -2139,7 +2139,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleCommunication[MOVE_EFFECT_BYTE] = 0x42;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
}
@ -2155,7 +2155,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleCommunication[MOVE_EFFECT_BYTE] = 0x42;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
}
@ -2172,7 +2172,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleCommunication[MOVE_EFFECT_BYTE] = 0x45;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
}
@ -2188,7 +2188,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleCommunication[MOVE_EFFECT_BYTE] = 0x45;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
}
@ -2205,7 +2205,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleCommunication[MOVE_EFFECT_BYTE] = 0x43;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
}
@ -2221,7 +2221,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleCommunication[MOVE_EFFECT_BYTE] = 0x43;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
}
@ -2383,7 +2383,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleStruct->scriptingActive = gBattlerTarget;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SynchronizeActivates;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
break;
@ -2398,7 +2398,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleStruct->scriptingActive = gBattlerAttacker;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SynchronizeActivates;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++;
}
break;

View File

@ -46,9 +46,9 @@ void DoBrailleDigEffect(void)
MapGridSetMetatileIdAt(16, 8, METATILE_ID(Cave, SealedChamberEntrance_TopLeft));
MapGridSetMetatileIdAt(17, 8, METATILE_ID(Cave, SealedChamberEntrance_TopMid));
MapGridSetMetatileIdAt(18, 8, METATILE_ID(Cave, SealedChamberEntrance_TopRight));
MapGridSetMetatileIdAt(16, 9, METATILE_ID(Cave, SealedChamberEntrance_BottomLeft) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(16, 9, METATILE_ID(Cave, SealedChamberEntrance_BottomLeft) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(17, 9, METATILE_ID(Cave, SealedChamberEntrance_BottomMid));
MapGridSetMetatileIdAt(18, 9, METATILE_ID(Cave, SealedChamberEntrance_BottomRight) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(18, 9, METATILE_ID(Cave, SealedChamberEntrance_BottomRight) | MAPGRID_COLLISION_MASK);
DrawWholeMapView();
PlaySE(SE_BANG);
FlagSet(FLAG_SYS_BRAILLE_DIG);
@ -89,9 +89,9 @@ void DoBrailleStrengthEffect(void)
MapGridSetMetatileIdAt(14, 26, METATILE_ID(Cave, SealedChamberEntrance_TopLeft));
MapGridSetMetatileIdAt(15, 26, METATILE_ID(Cave, SealedChamberEntrance_TopMid));
MapGridSetMetatileIdAt(16, 26, METATILE_ID(Cave, SealedChamberEntrance_TopRight));
MapGridSetMetatileIdAt(14, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomLeft) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(14, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomLeft) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(15, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomMid));
MapGridSetMetatileIdAt(16, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomRight) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(16, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomRight) | MAPGRID_COLLISION_MASK);
DrawWholeMapView();
PlaySE(SE_BANG);
FlagSet(FLAG_SYS_BRAILLE_STRENGTH);
@ -135,9 +135,9 @@ void UseFlyAncientTomb_Finish(void)
MapGridSetMetatileIdAt(14, 26, METATILE_ID(Cave, SealedChamberEntrance_TopLeft));
MapGridSetMetatileIdAt(15, 26, METATILE_ID(Cave, SealedChamberEntrance_TopMid));
MapGridSetMetatileIdAt(16, 26, METATILE_ID(Cave, SealedChamberEntrance_TopRight));
MapGridSetMetatileIdAt(14, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomLeft) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(14, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomLeft) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(15, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomMid));
MapGridSetMetatileIdAt(16, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomRight) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(16, 27, METATILE_ID(Cave, SealedChamberEntrance_BottomRight) | MAPGRID_COLLISION_MASK);
DrawWholeMapView();
PlaySE(SE_BANG);
FlagSet(FLAG_SYS_BRAILLE_FLY);

View File

@ -722,14 +722,6 @@ const u8 gBattleAnimSpriteSheet_257[] = INCBIN_U8("graphics/battle_anims/sprites
const u8 gBattleAnimSpritePalette_257[] = INCBIN_U8("graphics/battle_anims/sprites/257.gbapal.lz");
#include "graphics/pokemon.h"
const u8 gMonFrontPic_UnownExclamationMark[] = INCBIN_U8("graphics/pokemon/unown/front_exclamation_mark.4bpp.lz");
const u8 gMonBackPic_UnownExclamationMark[] = INCBIN_U8("graphics/pokemon/unown/back_exclamation_mark.4bpp.lz");
const u8 gMonIcon_UnownExclamationMark[] = INCBIN_U8("graphics/pokemon/unown/icon_exclamation_mark.4bpp");
const u8 gMonFrontPic_UnownQuestionMark[] = INCBIN_U8("graphics/pokemon/unown/front_question_mark.4bpp.lz");
const u8 gMonBackPic_UnownQuestionMark[] = INCBIN_U8("graphics/pokemon/unown/back_question_mark.4bpp.lz");
const u8 gMonIcon_UnownQuestionMark[] = INCBIN_U8("graphics/pokemon/unown/icon_question_mark.4bpp");
#include "graphics/trainers.h"
const u8 gMonIcon_QuestionMark[] = INCBIN_U8("graphics/pokemon/question_mark/icon.4bpp");

View File

@ -2395,3 +2395,9 @@ const u8 gMonIcon_UnownY[] = INCBIN_U8("graphics/pokemon/unown/icon_y.4bpp");
const u8 gMonFrontPic_UnownZ[] = INCBIN_U8("graphics/pokemon/unown/front_z.4bpp.lz");
const u8 gMonBackPic_UnownZ[] = INCBIN_U8("graphics/pokemon/unown/back_z.4bpp.lz");
const u8 gMonIcon_UnownZ[] = INCBIN_U8("graphics/pokemon/unown/icon_z.4bpp");
const u8 gMonFrontPic_UnownExclamationMark[] = INCBIN_U8("graphics/pokemon/unown/front_exclamation_mark.4bpp.lz");
const u8 gMonBackPic_UnownExclamationMark[] = INCBIN_U8("graphics/pokemon/unown/back_exclamation_mark.4bpp.lz");
const u8 gMonIcon_UnownExclamationMark[] = INCBIN_U8("graphics/pokemon/unown/icon_exclamation_mark.4bpp");
const u8 gMonFrontPic_UnownQuestionMark[] = INCBIN_U8("graphics/pokemon/unown/front_question_mark.4bpp.lz");
const u8 gMonBackPic_UnownQuestionMark[] = INCBIN_U8("graphics/pokemon/unown/back_question_mark.4bpp.lz");
const u8 gMonIcon_UnownQuestionMark[] = INCBIN_U8("graphics/pokemon/unown/icon_question_mark.4bpp");

View File

@ -842,7 +842,7 @@ void DebugMenu_8077238(void)
u16 sp14 = 0;
PlayerGetDestCoords(&x, &y);
z = MapGridGetZCoordAt(x, y);
z = MapGridGetElevationAt(x, y);
x -= 7;
y -= 7;
@ -2222,7 +2222,7 @@ void DebugMenu_80787EC(void)
ConvertIntToHexStringN(gStringVar1, gSpecialVar_Result, STR_CONV_MODE_LEADING_ZEROS, 4);
gSpecialVar_Result = MapGridGetMetatileIdAt(x, y);
ConvertIntToHexStringN(gStringVar2, gSpecialVar_Result, STR_CONV_MODE_LEADING_ZEROS, 4);
gSpecialVar_Result = MapGridGetZCoordAt(x, y);
gSpecialVar_Result = MapGridGetElevationAt(x, y);
ConvertIntToHexStringN(gStringVar3, gSpecialVar_Result, STR_CONV_MODE_LEADING_ZEROS, 4);
StringExpandPlaceholders(gStringVar4, Str_839C414);
}

View File

@ -358,7 +358,7 @@ void InitWatanabeDebugMenu(void)
{
default:
case 0:
save_serialize_map();
SaveMapView();
sub_8125E2C();
gMain.state = 1;
break;

View File

@ -2089,7 +2089,7 @@ void sub_80FF1EC(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decIdx)
for (j=0; j<decWidth; j++)
{
x = mapX + j;
behavior = GetBehaviorByMetatileId(0x200 + gDecorations[decIdx].tiles[i * decWidth + j]);
behavior = GetMetatileAttributesById(0x200 + gDecorations[decIdx].tiles[i * decWidth + j]);
if (MetatileBehavior_IsSecretBaseImpassable(behavior) == TRUE || (gDecorations[decIdx].permission != DECORPERM_PASS_FLOOR && (behavior >> 12) != 0))
collision = 0xc00; // impassable collision
else
@ -2426,7 +2426,7 @@ bool8 sub_80FFC24(u8 taskId, const struct Decoration *decoration)
{
curX = gTasks[taskId].data[0] + j;
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
layerType = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & 0xf000;
layerType = GetMetatileAttributesById(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & 0xf000;
if (!sub_80FFBDC(behaviorAt, decoration))
{
return FALSE;
@ -2451,7 +2451,7 @@ bool8 sub_80FFC24(u8 taskId, const struct Decoration *decoration)
{
curX = gTasks[taskId].data[0] + j;
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
layerType = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & 0xf000;
layerType = GetMetatileAttributesById(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & 0xf000;
if (!MetatileBehavior_IsNormal(behaviorAt) && !sub_80FFB6C(behaviorAt, layerType))
{
return FALSE;
@ -2471,7 +2471,7 @@ bool8 sub_80FFC24(u8 taskId, const struct Decoration *decoration)
{
curX = gTasks[taskId].data[0] + j;
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
layerType = GetBehaviorByMetatileId(0x200 + decoration->tiles[j]) & 0xf000;
layerType = GetMetatileAttributesById(0x200 + decoration->tiles[j]) & 0xf000;
if (!MetatileBehavior_IsNormal(behaviorAt) && !MetatileBehavior_IsSecretBaseNorthWall(behaviorAt))
{
return FALSE;

View File

@ -59,14 +59,14 @@ static void CameraObject_1(struct Sprite *);
static void CameraObject_2(struct Sprite *);
static void ObjectCB_CameraObject(struct Sprite *sprite);
static bool8 ObjectEventDoesZCoordMatch(struct ObjectEvent *, u8);
static struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8, struct ObjectEventTemplate*, u8);
static const struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8, const struct ObjectEventTemplate*, u8);
static void UpdateObjectEventSpriteSubpriorityAndVisibility(struct Sprite *);
static void InitObjectPriorityByZCoord(struct Sprite *sprite, u8 z);
static void CreateReflectionEffectSprites(void);
static u8 GetObjectEventIdByLocalIdAndMapInternal(u8, u8, u8);
static u8 GetObjectEventIdByLocalId(u8);
static void RemoveObjectEventInternal(struct ObjectEvent *);
static void MakeObjectTemplateFromObjectEventTemplate(struct ObjectEventTemplate *objEventTemplate, struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables);
static void MakeObjectTemplateFromObjectEventTemplate(const struct ObjectEventTemplate *objEventTemplate, struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables);
static void RemoveObjectEventIfOutsideView(struct ObjectEvent *objectEvent);
static void SetPlayerAvatarObjectEventIdAndObjectId(u8, u8);
static void sub_805B914(struct ObjectEvent *);
@ -1149,7 +1149,7 @@ static u8 GetObjectEventIdByLocalId(u8 localId)
return OBJECT_EVENTS_COUNT;
}
static u8 InitObjectEventStateFromTemplate(struct ObjectEventTemplate *template, u8 mapNum, u8 mapGroup)
static u8 InitObjectEventStateFromTemplate(const struct ObjectEventTemplate *template, u8 mapNum, u8 mapGroup)
{
struct ObjectEvent *objectEvent;
u8 objectEventId;
@ -1280,7 +1280,7 @@ void RemoveAllObjectEventsExceptPlayer(void)
}
}
static u8 TrySetupObjectEventSprite(struct ObjectEventTemplate *objectEventTemplate, struct SpriteTemplate *spriteTemplate, u8 mapNum, u8 mapGroup, s16 cameraDeltaX, s16 cameraDeltaY)
static u8 TrySetupObjectEventSprite(const struct ObjectEventTemplate *objectEventTemplate, struct SpriteTemplate *spriteTemplate, u8 mapNum, u8 mapGroup, s16 cameraDeltaX, s16 cameraDeltaY)
{
u8 spriteId;
u8 objectEventId;
@ -1336,7 +1336,7 @@ static u8 TrySetupObjectEventSprite(struct ObjectEventTemplate *objectEventTempl
return objectEventId;
}
static u8 TrySpawnObjectEvent(struct ObjectEventTemplate *objectEventTemplate, u8 mapNum, u8 mapGroup, s16 cameraDeltaX, s16 cameraDeltaY)
static u8 TrySpawnObjectEvent(const struct ObjectEventTemplate *objectEventTemplate, u8 mapNum, u8 mapGroup, s16 cameraDeltaX, s16 cameraDeltaY)
{
u8 objectEventId;
struct SpriteTemplate spriteTemplate;
@ -1378,7 +1378,7 @@ u8 SpawnSpecialObjectEventParametrized(u8 graphicsId, u8 movementType, u8 localI
y -= 7;
objectEventTemplate.localId = localId;
objectEventTemplate.graphicsId = graphicsId;
objectEventTemplate.unk2 = 0;
objectEventTemplate.kind = OBJ_KIND_NORMAL;
objectEventTemplate.x = x;
objectEventTemplate.y = y;
objectEventTemplate.elevation = elevation;
@ -1392,7 +1392,7 @@ u8 SpawnSpecialObjectEventParametrized(u8 graphicsId, u8 movementType, u8 localI
u8 show_sprite(u8 localId, u8 mapNum, u8 mapGroup)
{
struct ObjectEventTemplate *objectEventTemplate;
const struct ObjectEventTemplate *objectEventTemplate;
s16 x;
s16 y;
@ -1424,7 +1424,7 @@ static void MakeObjectTemplateFromObjectEventGraphicsInfoWithCallbackIndex(u16 g
MakeObjectTemplateFromObjectEventGraphicsInfo(graphicsId, sMovementTypeCallbacks[movementType], spriteTemplate, subspriteTables);
}
static void MakeObjectTemplateFromObjectEventTemplate(struct ObjectEventTemplate *objEventTemplate, struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables)
static void MakeObjectTemplateFromObjectEventTemplate(const struct ObjectEventTemplate *objEventTemplate, struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables)
{
MakeObjectTemplateFromObjectEventGraphicsInfoWithCallbackIndex(objEventTemplate->graphicsId, objEventTemplate->movementType, spriteTemplate, subspriteTables);
}
@ -2256,7 +2256,7 @@ u8 ObjectEventGetBerryTreeId(u8 objectEventId)
return gObjectEvents[objectEventId].trainerRange_berryTreeId;
}
struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
const struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
{
if (gSaveBlock1.location.mapNum == mapNum && gSaveBlock1.location.mapGroup == mapGroup)
return FindObjectEventTemplateByLocalId(localId, gSaveBlock1.objectEventTemplates, gMapHeader.events->objectEventCount);
@ -2268,7 +2268,7 @@ struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8 localId, u8
}
}
static struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8 localId, struct ObjectEventTemplate *templates, u8 count)
static const struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8 localId, const struct ObjectEventTemplate *templates, u8 count)
{
u8 i;
@ -4466,7 +4466,7 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dirn)
direction = dirn;
if (IsCoordOutsideObjectEventMovementRange(objectEvent, x, y))
return 1;
else if (MapGridIsImpassableAt(x, y) || GetMapBorderIdAt(x, y) == -1 || IsMetatileDirectionallyImpassable(objectEvent, x, y, direction))
else if (MapGridGetCollisionAt(x, y) || GetMapBorderIdAt(x, y) == -1 || IsMetatileDirectionallyImpassable(objectEvent, x, y, direction))
return 2;
else if (objectEvent->trackedByCamera && !CanCameraMoveInDirection(direction))
return 2;
@ -4483,7 +4483,7 @@ u8 GetCollisionFlagsAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u8 d
if (IsCoordOutsideObjectEventMovementRange(objectEvent, x, y))
flags |= 1;
if (MapGridIsImpassableAt(x, y) || GetMapBorderIdAt(x, y) == -1 || IsMetatileDirectionallyImpassable(objectEvent, x, y, direction) || (objectEvent->trackedByCamera && !CanCameraMoveInDirection(direction)))
if (MapGridGetCollisionAt(x, y) || GetMapBorderIdAt(x, y) == -1 || IsMetatileDirectionallyImpassable(objectEvent, x, y, direction) || (objectEvent->trackedByCamera && !CanCameraMoveInDirection(direction)))
flags |= 2;
if (IsZCoordMismatchAt(objectEvent->currentElevation, x, y))
flags |= 4;
@ -7532,7 +7532,7 @@ bool8 IsZCoordMismatchAt(u8 z, s16 x, s16 y)
if (z == 0)
return FALSE;
mapZ = MapGridGetZCoordAt(x, y);
mapZ = MapGridGetElevationAt(x, y);
if (mapZ == 0 || mapZ == 0xF)
return FALSE;
@ -7585,8 +7585,8 @@ u8 ZCoordToPriority(u8 z)
void ObjectEventUpdateZCoord(struct ObjectEvent *objEvent)
{
u8 z = MapGridGetZCoordAt(objEvent->currentCoords.x, objEvent->currentCoords.y);
u8 z2 = MapGridGetZCoordAt(objEvent->previousCoords.x, objEvent->previousCoords.y);
u8 z = MapGridGetElevationAt(objEvent->currentCoords.x, objEvent->currentCoords.y);
u8 z2 = MapGridGetElevationAt(objEvent->previousCoords.x, objEvent->previousCoords.y);
if (z == 0xF || z2 == 0xF)
return;

View File

@ -28,15 +28,15 @@ struct FieldCamera gFieldCamera;
u16 gTotalCameraPixelOffsetY;
u16 gTotalCameraPixelOffsetX;
static void RedrawMapSliceNorth(struct FieldCameraOffset*, struct MapLayout*);
static void RedrawMapSliceSouth(struct FieldCameraOffset*, struct MapLayout*);
static void RedrawMapSliceEast(struct FieldCameraOffset*, struct MapLayout*);
static void RedrawMapSliceWest(struct FieldCameraOffset*, struct MapLayout*);
static void RedrawMapSliceNorth(struct FieldCameraOffset*, const struct MapLayout*);
static void RedrawMapSliceSouth(struct FieldCameraOffset*, const struct MapLayout*);
static void RedrawMapSliceEast(struct FieldCameraOffset*, const struct MapLayout*);
static void RedrawMapSliceWest(struct FieldCameraOffset*, const struct MapLayout*);
static s32 MapPosToBgTilemapOffset(struct FieldCameraOffset*, s32, s32);
static void DrawWholeMapViewInternal(int x, int y, struct MapLayout*);
static void DrawMetatileAt(struct MapLayout*, u16, int, int);
static void DrawMetatile(s32, u16*, u16);
static void DrawWholeMapViewInternal(int x, int y, const struct MapLayout*);
static void DrawMetatileAt(const struct MapLayout*, u16, int, int);
static void DrawMetatile(s32, const u16*, u16);
static void CameraPanningCB_PanAhead(void);
static void move_tilemap_camera_to_upper_left_corner_(struct FieldCameraOffset *cameraOffset)
@ -100,7 +100,7 @@ void DrawWholeMapView(void)
sFieldCameraOffset.copyBGToVRAM = TRUE;
}
static void DrawWholeMapViewInternal(int x, int y, struct MapLayout *mapLayout)
static void DrawWholeMapViewInternal(int x, int y, const struct MapLayout *mapLayout)
{
u8 i;
u8 j;
@ -125,7 +125,7 @@ static void DrawWholeMapViewInternal(int x, int y, struct MapLayout *mapLayout)
static void RedrawMapSlicesForCameraUpdate(struct FieldCameraOffset *cameraOffset, int x, int y)
{
struct MapLayout *mapLayout = gMapHeader.mapLayout;
const struct MapLayout *mapLayout = gMapHeader.mapLayout;
if (x > 0)
RedrawMapSliceWest(cameraOffset, mapLayout);
@ -138,7 +138,7 @@ static void RedrawMapSlicesForCameraUpdate(struct FieldCameraOffset *cameraOffse
cameraOffset->copyBGToVRAM = TRUE;
}
static void RedrawMapSliceNorth(struct FieldCameraOffset *cameraOffset, struct MapLayout *mapLayout)
static void RedrawMapSliceNorth(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout)
{
u8 i;
u8 temp;
@ -157,7 +157,7 @@ static void RedrawMapSliceNorth(struct FieldCameraOffset *cameraOffset, struct M
}
}
static void RedrawMapSliceSouth(struct FieldCameraOffset *cameraOffset, struct MapLayout *mapLayout)
static void RedrawMapSliceSouth(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout)
{
u8 i;
u8 temp;
@ -172,7 +172,7 @@ static void RedrawMapSliceSouth(struct FieldCameraOffset *cameraOffset, struct M
}
}
static void RedrawMapSliceEast(struct FieldCameraOffset *cameraOffset, struct MapLayout *mapLayout)
static void RedrawMapSliceEast(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout)
{
u8 i;
u8 temp;
@ -187,7 +187,7 @@ static void RedrawMapSliceEast(struct FieldCameraOffset *cameraOffset, struct Ma
}
}
static void RedrawMapSliceWest(struct FieldCameraOffset *cameraOffset, struct MapLayout *mapLayout)
static void RedrawMapSliceWest(struct FieldCameraOffset *cameraOffset, const struct MapLayout *mapLayout)
{
u8 i;
u8 temp;
@ -226,9 +226,9 @@ void DrawDoorMetatileAt(int x, int y, u16 *arr)
}
}
static void DrawMetatileAt(struct MapLayout *mapLayout, u16 offset, int x, int y)
static void DrawMetatileAt(const struct MapLayout *mapLayout, u16 offset, int x, int y)
{
u16 *metatiles;
const u16 *metatiles;
u16 metatileId = MapGridGetMetatileIdAt(x, y);
if (metatileId > NUM_METATILES_TOTAL)
@ -247,7 +247,7 @@ static void DrawMetatileAt(struct MapLayout *mapLayout, u16 offset, int x, int y
DrawMetatile(MapGridGetMetatileLayerTypeAt(x, y), metatiles + metatileId * 8, offset);
}
static void DrawMetatile(s32 metatileLayerType, u16 *metatiles, u16 offset)
static void DrawMetatile(s32 metatileLayerType, const u16 *metatiles, u16 offset)
{
switch (metatileLayerType)
{

View File

@ -88,9 +88,9 @@ static u16 GetPlayerCurMetatileBehavior(int);
static bool8 TryStartInteractionScript(struct MapPosition*, u16, u8);
static const u8 *GetInteractionScript(struct MapPosition*, u8, u8);
static const u8 *GetInteractedObjectEventScript(struct MapPosition *, u8, u8);
static u8 *GetInteractedBackgroundEventScript(struct MapPosition *, u8, u8);
static u8 *GetInteractedMetatileScript(struct MapPosition *, u8, u8);
static u8 *GetInteractedWaterScript(struct MapPosition *, u8, u8);
static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *, u8, u8);
static const u8 *GetInteractedMetatileScript(struct MapPosition *, u8, u8);
static const u8 *GetInteractedWaterScript(struct MapPosition *, u8, u8);
static bool32 TrySetupDiveDownScript(void);
static bool32 TrySetupDiveEmergeScript(void);
static bool8 TryStartStepBasedScript(struct MapPosition *, u16, u16);
@ -104,8 +104,8 @@ static s8 GetWarpEventAtMapPosition(struct MapHeader *, struct MapPosition *);
static void sub_8068C30(struct MapHeader *, s8, struct MapPosition *);
static bool8 map_warp_consider_2_to_inside(struct MapPosition *, u16, u8);
static s8 GetWarpEventAtPosition(struct MapHeader *, u16, u16, u8);
static u8 *GetCoordEventScriptAtPosition(struct MapHeader *, u16, u16, u8);
static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *, u16, u16, u8);
static const u8 *GetCoordEventScriptAtPosition(struct MapHeader *, u16, u16, u8);
static const struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *, u16, u16, u8);
static bool8 TryStartCoordEventScript(struct MapPosition *);
static bool8 TryStartWarpEventScript(struct MapPosition *, u16);
static bool8 TryStartCrackedFloorHoleScript(u16);
@ -295,7 +295,7 @@ static void GetInFrontOfPlayerPosition(struct MapPosition *position)
GetXYCoordsOneStepInFrontOfPlayer(&position->x, &position->y);
PlayerGetDestCoords(&x, &y);
if (MapGridGetZCoordAt(x, y) != 0)
if (MapGridGetElevationAt(x, y) != 0)
position->height = PlayerGetZCoord();
else
position->height = 0;
@ -398,9 +398,9 @@ static const u8 *GetInteractedObjectEventScript(struct MapPosition *position, u8
return script;
}
static u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 metatileBehavior, u8 direction)
static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 metatileBehavior, u8 direction)
{
struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height);
const struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height);
if (bgEvent == NULL)
return NULL;
@ -449,7 +449,7 @@ static u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 m
return bgEvent->bgUnion.script;
}
static u8 *GetInteractedMetatileScript(struct MapPosition *position, u8 metatileBehavior, u8 direction)
static const u8 *GetInteractedMetatileScript(struct MapPosition *position, u8 metatileBehavior, u8 direction)
{
s8 height;
@ -485,7 +485,7 @@ static u8 *GetInteractedMetatileScript(struct MapPosition *position, u8 metatile
return EventScript_Blueprint;
height = position->height;
if (height == MapGridGetZCoordAt(position->x, position->y))
if (height == MapGridGetElevationAt(position->x, position->y))
{
if (MetatileBehavior_IsSecretBasePC(metatileBehavior) == TRUE)
return SecretBase_EventScript_PC;
@ -500,7 +500,7 @@ static u8 *GetInteractedMetatileScript(struct MapPosition *position, u8 metatile
return NULL;
}
static u8 *GetInteractedWaterScript(struct MapPosition *unused1, u8 metatileBehavior, u8 direction)
static const u8 *GetInteractedWaterScript(struct MapPosition *unused1, u8 metatileBehavior, u8 direction)
{
if (FlagGet(FLAG_BADGE05_GET) == TRUE && PartyHasMonWithSurf() == TRUE && IsPlayerFacingSurfableFishableWater() == TRUE)
return EventScript_UseSurf;
@ -552,7 +552,7 @@ static bool8 TryStartStepBasedScript(struct MapPosition *position, u16 metatileB
bool8 TryStartCoordEventScript(struct MapPosition *position)
{
u8 *script = GetCoordEventScriptAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height);
const u8 *script = GetCoordEventScriptAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height);
if (script == NULL)
return FALSE;
@ -764,7 +764,7 @@ static s8 GetWarpEventAtMapPosition(struct MapHeader *mapHeader, struct MapPosit
static void sub_8068C30(struct MapHeader *unused, s8 warpEventId, struct MapPosition *position)
{
struct WarpEvent *warpEvent = &gMapHeader.events->warps[warpEventId];
const struct WarpEvent *warpEvent = &gMapHeader.events->warps[warpEventId];
if (warpEvent->mapNum == MAP_NUM(DYNAMIC))
{
@ -811,7 +811,7 @@ static bool8 map_warp_consider_2_to_inside(struct MapPosition *position, u16 met
static s8 GetWarpEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
{
s32 i;
struct WarpEvent *warpEvent = mapHeader->events->warps;
const struct WarpEvent *warpEvent = mapHeader->events->warps;
u8 warpCount = mapHeader->events->warpCount;
for (i = 0; i < warpCount; i++, warpEvent++)
@ -825,7 +825,7 @@ static s8 GetWarpEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 e
return -1;
}
static u8 *TryRunCoordEventScript(struct CoordEvent *coordEvent)
static const u8 *TryRunCoordEventScript(const struct CoordEvent *coordEvent)
{
if (coordEvent != NULL)
{
@ -845,10 +845,10 @@ static u8 *TryRunCoordEventScript(struct CoordEvent *coordEvent)
return NULL;
}
static u8 *GetCoordEventScriptAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
static const u8 *GetCoordEventScriptAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
{
s32 i;
struct CoordEvent *coordEvents = mapHeader->events->coordEvents;
const struct CoordEvent *coordEvents = mapHeader->events->coordEvents;
u8 coordEventCount = mapHeader->events->coordEventCount;
for (i = 0; i < coordEventCount; i++)
@ -857,7 +857,7 @@ static u8 *GetCoordEventScriptAtPosition(struct MapHeader *mapHeader, u16 x, u16
{
if (coordEvents[i].elevation == elevation || coordEvents[i].elevation == 0)
{
u8 *script = TryRunCoordEventScript(&coordEvents[i]);
const u8 *script = TryRunCoordEventScript(&coordEvents[i]);
if (script != NULL)
return script;
}
@ -866,15 +866,15 @@ static u8 *GetCoordEventScriptAtPosition(struct MapHeader *mapHeader, u16 x, u16
return NULL;
}
u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position)
const u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position)
{
return GetCoordEventScriptAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height);
}
static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
static const struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
{
u8 i;
struct BgEvent *bgEvents = mapHeader->events->bgEvents;
const struct BgEvent *bgEvents = mapHeader->events->bgEvents;
u8 bgEventCount = mapHeader->events->bgEventCount;
for (i = 0; i < bgEventCount; i++)

View File

@ -1024,7 +1024,7 @@ static void sub_812800C(struct ObjectEvent *objectEvent, struct Sprite *sprite)
for (i = DIR_SOUTH; i <= DIR_EAST; i++, x = sprite->data[6], y = sprite->data[7])
{
MoveCoords(i, &x, &y);
if (MapGridGetZCoordAt(x, y) == 3)
if (MapGridGetElevationAt(x, y) == 3)
{
sprite->data[5] ++;
break;

View File

@ -616,7 +616,7 @@ u8 CheckForObjectEventCollision(struct ObjectEvent *a, s16 x, s16 y, u8 directio
static bool8 sub_8058EF0(s16 x, s16 y, u8 direction)
{
if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
&& MapGridGetZCoordAt(x, y) == 3
&& MapGridGetElevationAt(x, y) == 3
&& GetObjectEventIdByXYZ(x, y, 3) == 16)
{
sub_805A20C(direction);

View File

@ -430,10 +430,10 @@ void MauvilleGymSpecial2(void)
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH2_On));
break;
case METATILE_ID(MauvilleGym, GreenBeamH3_Off):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH3_On) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH3_On) | MAPGRID_COLLISION_MASK);
break;
case METATILE_ID(MauvilleGym, GreenBeamH4_Off):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH4_On) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamH4_On) | MAPGRID_COLLISION_MASK);
break;
case METATILE_ID(MauvilleGym, RedBeamH1_On):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH1_Off));
@ -454,41 +454,41 @@ void MauvilleGymSpecial2(void)
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH2_On));
break;
case METATILE_ID(MauvilleGym, RedBeamH3_Off):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH3_On) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH3_On) | MAPGRID_COLLISION_MASK);
break;
case METATILE_ID(MauvilleGym, RedBeamH4_Off):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH4_On) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH4_On) | MAPGRID_COLLISION_MASK);
break;
case METATILE_ID(MauvilleGym, GreenBeamV1_On):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleBottom_On) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleBottom_On) | MAPGRID_COLLISION_MASK);
break;
case METATILE_ID(MauvilleGym, GreenBeamV2_On):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, FloorTile));
break;
case METATILE_ID(MauvilleGym, RedBeamV1_On):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleBottom_Off) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleBottom_Off) | MAPGRID_COLLISION_MASK);
break;
case METATILE_ID(MauvilleGym, RedBeamV2_On):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, FloorTile));
break;
case METATILE_ID(MauvilleGym, PoleBottom_On):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamV1_On) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamV1_On) | MAPGRID_COLLISION_MASK);
break;
case METATILE_ID(MauvilleGym, FloorTile):
if (MapGridGetMetatileIdAt(x, y - 1) == METATILE_ID(MauvilleGym, GreenBeamV1_On))
{
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamV2_On) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, GreenBeamV2_On) | MAPGRID_COLLISION_MASK);
}
else
{
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamV2_On) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamV2_On) | MAPGRID_COLLISION_MASK);
}
break;
case METATILE_ID(MauvilleGym, PoleBottom_Off):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamV1_On) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamV1_On) | MAPGRID_COLLISION_MASK);
break;
case METATILE_ID(MauvilleGym, PoleTop_Off):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleTop_On) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleTop_On) | MAPGRID_COLLISION_MASK);
break;
case METATILE_ID(MauvilleGym, PoleTop_On):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleTop_Off));
@ -538,10 +538,10 @@ void MauvilleGymSpecial3(void)
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, RedBeamH4_Off));
break;
case METATILE_ID(MauvilleGym, GreenBeamV1_On):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleBottom_On) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleBottom_On) | MAPGRID_COLLISION_MASK);
break;
case METATILE_ID(MauvilleGym, RedBeamV1_On):
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleBottom_Off) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, METATILE_ID(MauvilleGym, PoleBottom_Off) | MAPGRID_COLLISION_MASK);
break;
case METATILE_ID(MauvilleGym, GreenBeamV2_On):
case METATILE_ID(MauvilleGym, RedBeamV2_On):
@ -913,7 +913,7 @@ static void PCTurnOffEffect(void)
{
tileId = METATILE_ID(BrendansMaysHouse, MayPC_Off);
}
MapGridSetMetatileIdAt(gSaveBlock1.pos.x + dx + 7, gSaveBlock1.pos.y + dy + 7, tileId | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(gSaveBlock1.pos.x + dx + 7, gSaveBlock1.pos.y + dy + 7, tileId | MAPGRID_COLLISION_MASK);
DrawWholeMapView();
}
@ -949,13 +949,13 @@ static void LotteryCornerComputerEffect(struct Task *task)
task->data[3] = 0;
if (task->data[4] != 0)
{
MapGridSetMetatileIdAt(18, 8, METATILE_ID(Shop, Laptop1_Normal) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(18, 9, METATILE_ID(Shop, Laptop2_Normal) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(18, 8, METATILE_ID(Shop, Laptop1_Normal) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(18, 9, METATILE_ID(Shop, Laptop2_Normal) | MAPGRID_COLLISION_MASK);
}
else
{
MapGridSetMetatileIdAt(18, 8, METATILE_ID(Shop, Laptop1_Flash) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(18, 9, METATILE_ID(Shop, Laptop2_Flash) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(18, 8, METATILE_ID(Shop, Laptop1_Flash) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(18, 9, METATILE_ID(Shop, Laptop2_Flash) | MAPGRID_COLLISION_MASK);
}
DrawWholeMapView();
task->data[4] ^= 1;
@ -969,8 +969,8 @@ static void LotteryCornerComputerEffect(struct Task *task)
void EndLotteryCornerComputerEffect(void)
{
MapGridSetMetatileIdAt(18, 8, METATILE_ID(Shop, Laptop1_Normal) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(18, 9, METATILE_ID(Shop, Laptop2_Normal) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(18, 8, METATILE_ID(Shop, Laptop1_Normal) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(18, 9, METATILE_ID(Shop, Laptop2_Normal) | MAPGRID_COLLISION_MASK);
DrawWholeMapView();
}
@ -1302,33 +1302,33 @@ void sub_810ED60(struct Task *task)
task->data[3] = 0;
if (task->data[4] != 0)
{
MapGridSetMetatileIdAt( 7, 7, METATILE_BattleTower_Elevator_Top0 | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 8, 7, METATILE_BattleTower_Elevator_Top1 | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 9, 7, METATILE_BattleTower_Elevator_Top1 | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(10, 7, METATILE_BattleTower_Elevator_Top2 | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 7, 8, METATILE_BattleTower_Elevator_Mid0 | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 8, 8, METATILE_BattleTower_Elevator_Mid1 | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 9, 8, METATILE_BattleTower_Elevator_Mid1 | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(10, 8, METATILE_BattleTower_Elevator_Mid2 | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 7, 9, METATILE_BattleTower_Elevator_Bottom0 | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 8, 9, METATILE_BattleTower_Elevator_Bottom1 | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 9, 9, METATILE_BattleTower_Elevator_Bottom1 | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(10, 9, METATILE_BattleTower_Elevator_Bottom2 | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 7, 7, METATILE_BattleTower_Elevator_Top0 | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 8, 7, METATILE_BattleTower_Elevator_Top1 | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 9, 7, METATILE_BattleTower_Elevator_Top1 | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(10, 7, METATILE_BattleTower_Elevator_Top2 | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 7, 8, METATILE_BattleTower_Elevator_Mid0 | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 8, 8, METATILE_BattleTower_Elevator_Mid1 | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 9, 8, METATILE_BattleTower_Elevator_Mid1 | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(10, 8, METATILE_BattleTower_Elevator_Mid2 | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 7, 9, METATILE_BattleTower_Elevator_Bottom0 | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 8, 9, METATILE_BattleTower_Elevator_Bottom1 | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 9, 9, METATILE_BattleTower_Elevator_Bottom1 | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(10, 9, METATILE_BattleTower_Elevator_Bottom2 | MAPGRID_COLLISION_MASK);
}
else
{
MapGridSetMetatileIdAt( 7, 7, (METATILE_BattleTower_Elevator_Top0 + 3) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 8, 7, (METATILE_BattleTower_Elevator_Top1 + 3) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 9, 7, (METATILE_BattleTower_Elevator_Top1 + 3) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(10, 7, (METATILE_BattleTower_Elevator_Top2 + 3) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 7, 8, (METATILE_BattleTower_Elevator_Mid0 + 3) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 8, 8, (METATILE_BattleTower_Elevator_Mid1 + 3) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 9, 8, (METATILE_BattleTower_Elevator_Mid1 + 3) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(10, 8, (METATILE_BattleTower_Elevator_Mid2 + 3) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 7, 9, (METATILE_BattleTower_Elevator_Bottom0 + 3) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 8, 9, (METATILE_BattleTower_Elevator_Bottom1 + 3) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 9, 9, (METATILE_BattleTower_Elevator_Bottom1 + 3) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(10, 9, (METATILE_BattleTower_Elevator_Bottom2 + 3) | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt( 7, 7, (METATILE_BattleTower_Elevator_Top0 + 3) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 8, 7, (METATILE_BattleTower_Elevator_Top1 + 3) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 9, 7, (METATILE_BattleTower_Elevator_Top1 + 3) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(10, 7, (METATILE_BattleTower_Elevator_Top2 + 3) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 7, 8, (METATILE_BattleTower_Elevator_Mid0 + 3) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 8, 8, (METATILE_BattleTower_Elevator_Mid1 + 3) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 9, 8, (METATILE_BattleTower_Elevator_Mid1 + 3) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(10, 8, (METATILE_BattleTower_Elevator_Mid2 + 3) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 7, 9, (METATILE_BattleTower_Elevator_Bottom0 + 3) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 8, 9, (METATILE_BattleTower_Elevator_Bottom1 + 3) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt( 9, 9, (METATILE_BattleTower_Elevator_Bottom1 + 3) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(10, 9, (METATILE_BattleTower_Elevator_Bottom2 + 3) | MAPGRID_COLLISION_MASK);
}
DrawWholeMapView();
task->data[4] ^= 1;

File diff suppressed because it is too large Load Diff

View File

@ -106,7 +106,7 @@ void Debug_SetUpFieldMove_Cut(void)
for (j = 0; j < 3; j++)
{
x = j - 1 + gPlayerFacingPosition.x;
if (MapGridGetZCoordAt(x, y) == gPlayerFacingPosition.height)
if (MapGridGetElevationAt(x, y) == gPlayerFacingPosition.height)
{
metatileBehavior = MapGridGetMetatileBehaviorAt(x, y);
if (MetatileBehavior_IsPokeGrass(metatileBehavior) == TRUE
@ -147,7 +147,7 @@ bool8 SetUpFieldMove_Cut(void)
for (j = 0; j < 3; j++)
{
x = j - 1 + gPlayerFacingPosition.x;
if (MapGridGetZCoordAt(x, y) == gPlayerFacingPosition.height)
if (MapGridGetElevationAt(x, y) == gPlayerFacingPosition.height)
{
tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
if(MetatileBehavior_IsPokeGrass(tileBehavior) == TRUE
@ -219,7 +219,7 @@ bool8 FldEff_CutGrass(void)
for (j = 0; j < 3; j++)
{
x = j - 1 + gPlayerFacingPosition.x;
if (MapGridGetZCoordAt(x, y) == (s8)gPlayerFacingPosition.height)
if (MapGridGetElevationAt(x, y) == (s8)gPlayerFacingPosition.height)
{
tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
if (MetatileBehavior_IsCuttableGrass(tileBehavior) == TRUE)

View File

@ -110,13 +110,13 @@ void sub_80B4710(u8 taskId)
sub_80B45B4(taskId, sEscalatorMetatiles_1F_1, 0);
break;
case 2:
sub_80B45B4(taskId, sEscalatorMetatiles_1F_2, (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
sub_80B45B4(taskId, sEscalatorMetatiles_1F_2, MAPGRID_COLLISION_MASK);
break;
case 3:
sub_80B45B4(taskId, sEscalatorMetatiles_1F_3, 0);
break;
case 4:
sub_80B45B4(taskId, sEscalatorMetatiles_2F_0, (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
sub_80B45B4(taskId, sEscalatorMetatiles_2F_0, MAPGRID_COLLISION_MASK);
break;
case 5:
sub_80B45B4(taskId, sEscalatorMetatiles_2F_1, 0);

View File

@ -239,7 +239,7 @@ bool32 CanFish(void)
}
else
{
if (MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior) && !MapGridIsImpassableAt(x, y))
if (MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior) && MapGridGetCollisionAt(x, y) == 0)
return TRUE;
if (MetatileBehavior_IsBridge(tileBehavior) == TRUE)
return TRUE;
@ -326,7 +326,7 @@ void ExitItemfinder(u8 taskId)
DestroyTask(taskId);
}
bool8 ItemfinderCheckForHiddenItems(struct MapEvents *events, u8 taskId)
bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *events, u8 taskId)
{
int distanceX, distanceY;
u16 x, y;
@ -359,10 +359,10 @@ bool8 ItemfinderCheckForHiddenItems(struct MapEvents *events, u8 taskId)
return FALSE;
}
bool8 HiddenItemAtPos(struct MapEvents *events, s16 x, s16 y)
bool8 HiddenItemAtPos(const struct MapEvents *events, s16 x, s16 y)
{
u8 bgEventCount = events->bgEventCount;
struct BgEvent *bgEvent = events->bgEvents;
const struct BgEvent *bgEvent = events->bgEvents;
int i;
for (i = 0; i < bgEventCount; i++)
@ -378,14 +378,14 @@ bool8 HiddenItemAtPos(struct MapEvents *events, s16 x, s16 y)
return FALSE;
}
bool8 sub_80C9688(struct MapConnection *connection, int x, int y)
bool8 sub_80C9688(const struct MapConnection *connection, int x, int y)
{
struct MapHeader *mapHeader;
const struct MapHeader *mapHeader;
u16 localX, localY;
u32 localOffset;
s32 localLength;
mapHeader = mapconnection_get_mapheader(connection);
mapHeader = GetMapHeaderFromConnection(connection);
switch (connection->direction)
{
@ -441,7 +441,7 @@ void sub_80C9720(u8 taskId)
|| var2 > curY
|| curY >= height)
{
struct MapConnection *conn = sub_8056BA0(curX, curY);
const struct MapConnection *conn = GetMapConnectionAtPos(curX, curY);
if (conn && sub_80C9688(conn, curX, curY) == TRUE)
sub_80C9838(taskId, curX - x, curY - y);
}

View File

@ -352,8 +352,8 @@ void Overworld_SetObjEventTemplateMovementType(u8 localId, u8 movementType)
static void mapdata_load_assets_to_gpu_and_full_redraw(void)
{
move_tilemap_camera_to_upper_left_corner();
copy_map_tileset1_tileset2_to_vram(gMapHeader.mapLayout);
apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout);
CopyMapTilesetsToVram(gMapHeader.mapLayout);
LoadMapTilesetPalettes(gMapHeader.mapLayout);
DrawWholeMapView();
cur_mapheader_run_tileset_funcs_after_some_cpuset();
}
@ -602,7 +602,7 @@ bool8 SetDiveWarpDive(u16 x, u16 y)
return SetDiveWarp(CONNECTION_DIVE, x, y);
}
void sub_80538F0(u8 mapGroup, u8 mapNum)
void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum)
{
s32 paletteIndex;
@ -621,9 +621,9 @@ void sub_80538F0(u8 mapGroup, u8 mapNum)
SetDefaultFlashLevel();
Overworld_ClearSavedMusic();
RunOnTransitionMapScript();
not_trainer_hill_battle_pyramid();
sub_8056D38(gMapHeader.mapLayout);
apply_map_tileset2_palette(gMapHeader.mapLayout);
InitMap();
CopySecondaryTilesetToVram(gMapHeader.mapLayout);
LoadSecondaryTilesetPalette(gMapHeader.mapLayout);
for (paletteIndex = 6; paletteIndex < 12; paletteIndex++)
ApplyWeatherGammaShiftToPal(paletteIndex);
@ -661,11 +661,11 @@ void sub_8053994(u32 a1)
RunOnTransitionMapScript();
UpdateLocationHistoryForRoamer();
RoamerMoveToOtherLocationSet();
not_trainer_hill_battle_pyramid();
InitMap();
if (a1 != 1 && v3)
{
UpdateTVScreensOnMap(gBackupMapLayout.width, gBackupMapLayout.height);
sub_80BBCCC(1);
InitSecretBaseAppearance(TRUE);
}
}
@ -1476,7 +1476,7 @@ void CB2_ContinueSavedGame(void)
UnfreezeObjectEvents();
DoTimeBasedEvents();
sub_805308C();
sub_8055FC0();
InitMapFromSavedGame();
PlayTimeCounter_Start();
ScriptContext1_Init();
ScriptContext2_Disable();
@ -1570,15 +1570,15 @@ static bool32 sub_805483C(u8 *state)
(*state)++;
break;
case 6:
sub_8056D28(gMapHeader.mapLayout);
CopyPrimaryTilesetToVram(gMapHeader.mapLayout);
(*state)++;
break;
case 7:
sub_8056D38(gMapHeader.mapLayout);
CopySecondaryTilesetToVram(gMapHeader.mapLayout);
(*state)++;
break;
case 8:
apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout);
LoadMapTilesetPalettes(gMapHeader.mapLayout);
(*state)++;
break;
case 9:
@ -1636,15 +1636,15 @@ bool32 sub_805493C(u8 *state, u32 a2)
(*state)++;
break;
case 6:
sub_8056D28(gMapHeader.mapLayout);
CopyPrimaryTilesetToVram(gMapHeader.mapLayout);
(*state)++;
break;
case 7:
sub_8056D38(gMapHeader.mapLayout);
CopySecondaryTilesetToVram(gMapHeader.mapLayout);
(*state)++;
break;
case 8:
apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout);
LoadMapTilesetPalettes(gMapHeader.mapLayout);
(*state)++;
break;
case 9:
@ -1726,15 +1726,15 @@ bool32 sub_8054A9C(u8 *state)
(*state)++;
break;
case 5:
sub_8056D28(gMapHeader.mapLayout);
CopyPrimaryTilesetToVram(gMapHeader.mapLayout);
(*state)++;
break;
case 6:
sub_8056D38(gMapHeader.mapLayout);
CopySecondaryTilesetToVram(gMapHeader.mapLayout);
(*state)++;
break;
case 7:
apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout);
LoadMapTilesetPalettes(gMapHeader.mapLayout);
(*state)++;
break;
case 8:
@ -1848,7 +1848,7 @@ void mli4_mapscripts_and_other(void)
gTotalCameraPixelOffsetX = 0;
gTotalCameraPixelOffsetY = 0;
ResetObjectEvents();
sav1_camera_get_focus_coords(&x, &y);
GetCameraFocusCoords(&x, &y);
initialPlayerAvatarState = GetInitialPlayerAvatarState();
InitPlayerAvatar(x, y, initialPlayerAvatarState->direction, gSaveBlock2.playerGender);
SetPlayerAvatarTransitionFlags(initialPlayerAvatarState->transitionFlags);
@ -1883,8 +1883,8 @@ void sub_8054E7C(void)
void sub_8054E98(void)
{
u16 x, y;
sav1_camera_get_focus_coords(&x, &y);
sub_8056C50(x + gUnknown_03004860, y);
GetCameraFocusCoords(&x, &y);
SetCameraFocusCoords(x + gUnknown_03004860, y);
}
void sub_8054EC8(void)
@ -1892,7 +1892,7 @@ void sub_8054EC8(void)
u16 i;
u16 x, y;
sav1_camera_get_focus_coords(&x, &y);
GetCameraFocusCoords(&x, &y);
x -= gUnknown_03004860;
for (i = 0; i < gFieldLinkPlayerCount; i++)
@ -2312,7 +2312,7 @@ bool32 sub_8055630(struct UnkStruct_8054FF8 *a1)
return FALSE;
}
u8 *sub_8055648(struct UnkStruct_8054FF8 *a1)
const u8 *sub_8055648(struct UnkStruct_8054FF8 *a1)
{
if (a1->c != 2)
return 0;
@ -2720,7 +2720,7 @@ static u8 LinkPlayerDetectCollision(u8 selfObjEventId, u8 a2, s16 x, s16 y)
}
}
}
return MapGridIsImpassableAt(x, y);
return MapGridGetCollisionAt(x, y);
}
static void CreateLinkPlayerSprite(u8 linkPlayerId)

View File

@ -906,7 +906,7 @@ int RotatingGate_CanRotate(u8 gateId, int rotationDirection)
if (sRotatingGate_ArmLayout[shape][i * 2 + j])
{
if (MapGridIsImpassableAt(x + armPos[armIndex].deltaX, y + armPos[armIndex].deltaY) == 1)
if (MapGridGetCollisionAt(x + armPos[armIndex].deltaX, y + armPos[armIndex].deltaY) == 1)
return 0;
}
}

View File

@ -1909,7 +1909,7 @@ bool8 ScrCmd_setmetatile(struct ScriptContext *ctx)
if (!impassable)
MapGridSetMetatileIdAt(x, y, metatileId);
else
MapGridSetMetatileIdAt(x, y, metatileId | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, metatileId | MAPGRID_COLLISION_MASK);
return FALSE;
}

View File

@ -239,7 +239,7 @@ void ScriptContext2_RunNewScript(const u8 *ptr)
static u8 *mapheader_get_tagged_pointer(u8 tag)
{
u8 *mapScripts = gMapHeader.mapScripts;
const u8 *mapScripts = gMapHeader.mapScripts;
if (mapScripts == NULL)
return NULL;

View File

@ -324,7 +324,7 @@ void sub_80BB8CC(void)
VarSet(VAR_SECRET_BASE_MAP, gMapHeader.regionMapSectionId);
}
void sub_80BB970(struct MapEvents *events)
void SetOccupiedSecretBaseEntranceMetatiles(const struct MapEvents *events)
{
u16 bgevidx, idx, jdx;
s16 tile_id;
@ -450,7 +450,7 @@ bool8 CurrentMapIsSecretBase(void)
return FALSE;
}
void sub_80BBCCC(u8 flagIn)
void InitSecretBaseAppearance(u8 flagIn)
{
u16 curBaseId;
u16 x, y;
@ -546,7 +546,7 @@ void SetSecretBaseOwnerGfxId(void)
VarSet(VAR_OBJ_GFX_ID_F, sSecretBaseOwnerGfxIds[GetSecretBaseOwnerType(curBase)]);
}
void SetCurrentSecretBaseFromPosition(struct MapPosition *position, struct MapEvents *events)
void SetCurrentSecretBaseFromPosition(struct MapPosition *position, const struct MapEvents *events)
{
s16 i;
@ -561,7 +561,7 @@ void SetCurrentSecretBaseFromPosition(struct MapPosition *position, struct MapEv
}
}
void sub_80BC038(struct MapPosition *position, struct MapEvents *events)
void sub_80BC038(struct MapPosition *position, const struct MapEvents *events)
{
SetCurrentSecretBaseFromPosition(position, events);
SetCurrentSecretBaseVar();
@ -726,7 +726,7 @@ void MoveOutOfSecretBase(void)
void sub_80BC474(void)
{
u16 eventId;
struct MapEvents *mapEvents = gMapHeader.events;
const struct MapEvents *mapEvents = gMapHeader.events;
for (eventId = 0; eventId < mapEvents->bgEventCount; eventId++)
{

View File

@ -597,7 +597,7 @@ static u8 SaveCallback2(void)
static void sub_807160C(void)
{
save_serialize_map();
SaveMapView();
saveDialogCallback = SaveDialogCB_DisplayConfirmMessage;
savingComplete = FALSE;
}

View File

@ -567,7 +567,7 @@ void SetTVMetatilesOnMap(int width, int height, u16 tileId)
for (x=0; x<width; x++)
{
if (MapGridGetMetatileBehaviorAt(x, y) == 0x86)
MapGridSetMetatileIdAt(x, y, tileId | (COLLISION_DIR_ALL << METATILE_COLLISION_SHIFT));
MapGridSetMetatileIdAt(x, y, tileId | MAPGRID_COLLISION_MASK);
}
}
}

View File

@ -1,17 +1,23 @@
CC = gcc
CC ?= gcc
CFLAGS = -Wall -Wextra -Wno-switch -Werror -std=c11 -O2 -s
CFLAGS = -Wall -Wextra -Wno-switch -Werror -std=c11 -O2
LIBS = -lm
SRCS = main.c extended.c
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
.PHONY: all clean
all: aif2pcm
all: aif2pcm$(EXE)
@:
aif2pcm: $(SRCS)
aif2pcm$(EXE): $(SRCS)
$(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) $(LIBS)
clean:

View File

@ -51,8 +51,12 @@ do \
typedef struct {
unsigned long num_samples;
uint8_t *samples;
union {
uint8_t *samples8;
uint16_t *samples16;
};
uint8_t midi_note;
uint8_t sample_size;
bool has_loop;
unsigned long loop_offset;
double sample_rate;
@ -208,11 +212,11 @@ void read_aif(struct Bytes *aif, AifData *aif_data)
num_sample_frames |= (aif->data[pos++] << 8);
num_sample_frames |= (uint8_t)aif->data[pos++];
short sample_size = (aif->data[pos++] << 8);
sample_size |= (uint8_t)aif->data[pos++];
if (sample_size != 8)
aif_data->sample_size = (aif->data[pos++] << 8);
aif_data->sample_size |= (uint8_t)aif->data[pos++];
if (aif_data->sample_size != 8 && aif_data->sample_size != 16)
{
FATAL_ERROR("sampleSize (%d) in the COMM Chunk must be 8!\n", sample_size);
FATAL_ERROR("sampleSize (%d) in the COMM Chunk must be 8 or 16!\n", aif_data->sample_size);
}
double sample_rate = ieee754_read_extended((uint8_t*)(aif->data + pos));
@ -234,7 +238,7 @@ void read_aif(struct Bytes *aif, AifData *aif_data)
{
FATAL_ERROR("More than one MARK Chunk in file!\n");
}
markers = calloc(num_markers, sizeof(struct Marker));
// Read each marker.
@ -285,7 +289,7 @@ void read_aif(struct Bytes *aif, AifData *aif_data)
// Skip NoLooping sustain loop.
pos += 4;
}
// Skip release loop, we don't need it.
pos += 6;
}
@ -295,11 +299,28 @@ void read_aif(struct Bytes *aif, AifData *aif_data)
pos += 8;
unsigned long num_samples = chunk_size - 8;
uint8_t *sample_data = (uint8_t *)malloc(num_samples * sizeof(uint8_t));
memcpy(sample_data, &aif->data[pos], num_samples);
if (aif_data->sample_size == 8)
{
uint8_t *sample_data = (uint8_t *)malloc(num_samples * sizeof(uint8_t));
memcpy(sample_data, &aif->data[pos], num_samples);
aif_data->samples = sample_data;
aif_data->real_num_samples = num_samples;
aif_data->samples8 = sample_data;
aif_data->real_num_samples = num_samples;
}
else
{
uint16_t *sample_data = (uint16_t *)malloc(num_samples * sizeof(uint16_t));
uint16_t *sample_data_swapped = (uint16_t *)malloc(num_samples * sizeof(uint16_t));
memcpy(sample_data, &aif->data[pos], num_samples);
for (long unsigned i = 0; i < num_samples; i++)
{
sample_data_swapped[i] = __builtin_bswap16(sample_data[i]);
}
aif_data->samples16 = sample_data_swapped;
aif_data->real_num_samples = num_samples;
free(sample_data);
}
pos += chunk_size - 8;
}
else
@ -308,12 +329,12 @@ void read_aif(struct Bytes *aif, AifData *aif_data)
pos += chunk_size;
}
}
if (markers)
{
// Resolve loop points.
struct Marker *cur_marker = markers;
// Grab loop start point.
for (int i = 0; i < num_markers; i++, cur_marker++)
{
@ -351,6 +372,12 @@ const int gDeltaEncodingTable[] = {
-64, -49, -36, -25, -16, -9, -4, -1,
};
#define POSITIVE_DELTAS_START 0
#define POSITIVE_DELTAS_END 8
#define NEGATIVE_DELTAS_START 8
#define NEGATIVE_DELTAS_END 16
struct Bytes *delta_decompress(struct Bytes *delta, unsigned int expected_length)
{
struct Bytes *pcm = malloc(sizeof(struct Bytes));
@ -418,15 +445,32 @@ struct Bytes *delta_decompress(struct Bytes *delta, unsigned int expected_length
return pcm;
}
#define U8_TO_S8(value) ((value) < 128 ? (value) : (value) - 256)
#define ABS(value) ((value) >= 0 ? (value) : -(value))
int get_delta_index(uint8_t sample, uint8_t prev_sample)
{
int best_error = INT_MAX;
int best_index = -1;
int delta_table_start_index;
int delta_table_end_index;
int sample_signed = U8_TO_S8(sample);
int prev_sample_signed = U8_TO_S8(prev_sample);
for (int i = 0; i < 16; i++)
// if we're going up (or equal), only choose positive deltas
if (prev_sample_signed <= sample_signed) {
delta_table_start_index = POSITIVE_DELTAS_START;
delta_table_end_index = POSITIVE_DELTAS_END;
} else {
delta_table_start_index = NEGATIVE_DELTAS_START;
delta_table_end_index = NEGATIVE_DELTAS_END;
}
for (int i = delta_table_start_index; i < delta_table_end_index; i++)
{
uint8_t new_sample = prev_sample + gDeltaEncodingTable[i];
int error = sample > new_sample ? sample - new_sample : new_sample - sample;
int new_sample_signed = U8_TO_S8(new_sample);
int error = ABS(new_sample_signed - sample_signed);
if (error < best_error)
{
@ -527,9 +571,22 @@ do { \
void aif2pcm(const char *aif_filename, const char *pcm_filename, bool compress)
{
struct Bytes *aif = read_bytearray(aif_filename);
AifData aif_data = {0,0,0,0,0,0,0};
AifData aif_data = {0};
read_aif(aif, &aif_data);
// Convert 16-bit to 8-bit if necessary
if (aif_data.sample_size == 16)
{
aif_data.real_num_samples /= 2;
uint8_t *converted_samples = malloc(aif_data.real_num_samples * sizeof(uint8_t));
for (unsigned long i = 0; i < aif_data.real_num_samples; i++)
{
converted_samples[i] = aif_data.samples16[i] >> 8;
}
free(aif_data.samples16);
aif_data.samples8 = converted_samples;
}
int header_size = 0x10;
struct Bytes *pcm;
struct Bytes output = {0,0};
@ -537,7 +594,7 @@ void aif2pcm(const char *aif_filename, const char *pcm_filename, bool compress)
if (compress)
{
struct Bytes *input = malloc(sizeof(struct Bytes));
input->data = aif_data.samples;
input->data = aif_data.samples8;
input->length = aif_data.real_num_samples;
pcm = delta_compress(input);
free(input);
@ -545,7 +602,7 @@ void aif2pcm(const char *aif_filename, const char *pcm_filename, bool compress)
else
{
pcm = malloc(sizeof(struct Bytes));
pcm->data = aif_data.samples;
pcm->data = aif_data.samples8;
pcm->length = aif_data.real_num_samples;
}
output.length = header_size + pcm->length;
@ -568,7 +625,7 @@ void aif2pcm(const char *aif_filename, const char *pcm_filename, bool compress)
free(aif);
free(pcm);
free(output.data);
free(aif_data.samples);
free(aif_data.samples8);
}
// Reads a .pcm file containing an array of 8-bit samples and produces an .aif file.
@ -608,8 +665,8 @@ void pcm2aif(const char *pcm_filename, const char *aif_filename, uint32_t base_n
pcm->data += 0x10;
}
aif_data->samples = malloc(pcm->length);
memcpy(aif_data->samples, pcm->data, pcm->length);
aif_data->samples8 = malloc(pcm->length);
memcpy(aif_data->samples8, pcm->data, pcm->length);
struct Bytes *aif = malloc(sizeof(struct Bytes));
aif->length = 54 + 60 + pcm->length;
@ -796,14 +853,14 @@ void pcm2aif(const char *pcm_filename, const char *aif_filename, uint32_t base_n
// Sound Data Chunk soundData
for (unsigned int i = 0; i < aif_data->loop_offset; i++)
{
aif->data[pos++] = aif_data->samples[i];
aif->data[pos++] = aif_data->samples8[i];
}
int j = 0;
for (unsigned int i = aif_data->loop_offset; i < pcm->length; i++)
{
int pcm_index = aif_data->loop_offset + (j++ % (pcm->length - aif_data->loop_offset));
aif->data[pos++] = aif_data->samples[pcm_index];
aif->data[pos++] = aif_data->samples8[pcm_index];
}
aif->length = pos;

View File

@ -1,15 +1,21 @@
CC = gcc
CC ?= gcc
CFLAGS = -Wall -Wextra -Werror -std=c11 -O2 -s
CFLAGS = -Wall -Wextra -Werror -std=c11 -O2
.PHONY: all clean
SRCS = bin2c.c
all: bin2c
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
all: bin2c$(EXE)
@:
bin2c: $(SRCS)
bin2c$(EXE): $(SRCS)
$(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS)
clean:

View File

@ -1,13 +1,18 @@
CC = gcc
CC ?= gcc
.PHONY: all clean
SRCS = gbafix.c
.PHONY: all clean
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
all: gbafix
all: gbafix$(EXE)
@:
gbafix: $(SRCS)
gbafix$(EXE): $(SRCS)
$(CC) $(SRCS) -o $@ $(LDFLAGS)
clean:

View File

@ -33,6 +33,7 @@
History
-------
v1.07 - added support for ELF input, (PikalaxALT)
v1.06 - added output silencing, (Sierraffinity)
v1.05 - added debug offset argument, (Sierraffinity)
v1.04 - converted to plain C, (WinterMute)
@ -50,7 +51,7 @@
#include <stdint.h>
#include "elf.h"
#define VER "1.06"
#define VER "1.07"
#define ARGV argv[arg]
#define VALUE (ARGV+2)
#define NUMBER strtoul(VALUE, NULL, 0)
@ -138,6 +139,7 @@ int main(int argc, char *argv[])
char *argfile = 0;
FILE *infile;
int silent = 0;
int schedule_pad = 0;
int size,bit;
@ -172,28 +174,27 @@ int main(int argc, char *argv[])
return -1;
}
uint32_t sh_offset = 0;
// read file
infile = fopen(argfile, "r+b");
if (!infile) { fprintf(stderr, "Error opening input file!\n"); return -1; }
fseek(infile, 0, SEEK_SET);
fseek(infile, sh_offset, SEEK_SET);
fread(&header, sizeof(header), 1, infile);
// elf check
uint32_t sh_offset = 0;
Elf32_Shdr secHeader;
if (memcmp(&header, ELFMAG, 4) == 0) {
Elf32_Ehdr *elfHeader = (Elf32_Ehdr *)&header;
fseek(infile, elfHeader->e_shoff, SEEK_SET);
int i;
for (i = 0; i < elfHeader->e_shnum; i++) {
Elf32_Shdr secHeader;
fread(&secHeader, sizeof(Elf32_Shdr), 1, infile);
if (secHeader.sh_type == SHT_PROGBITS && secHeader.sh_addr == elfHeader->e_entry) {
fseek(infile, secHeader.sh_offset, SEEK_SET);
sh_offset = secHeader.sh_offset;
break;
}
if (secHeader.sh_type == SHT_PROGBITS && secHeader.sh_addr == elfHeader->e_entry) break;
}
if (i == elfHeader->e_shnum) { fprintf(stderr, "Error finding entry point!\n"); return 1; }
fseek(infile, secHeader.sh_offset, SEEK_SET);
sh_offset = secHeader.sh_offset;
fread(&header, sizeof(header), 1, infile);
}
@ -205,21 +206,13 @@ int main(int argc, char *argv[])
// parse command line
for (arg=1; arg<argc; arg++)
{
if ((ARGV[0] == '-'))
if (ARGV[0] == '-')
{
switch (ARGV[1])
{
case 'p': // pad
{
fseek(infile, 0, SEEK_END);
size = ftell(infile);
for (bit=31; bit>=0; bit--) if (size & (1<<bit)) break;
if (size != (1<<bit))
{
int todo = (1<<(bit+1)) - size;
while (todo--) fputc(0xFF, infile);
}
fseek(infile, 0, SEEK_SET);
schedule_pad = 1;
break;
}
@ -299,6 +292,21 @@ int main(int argc, char *argv[])
header.complement = HeaderComplement();
//header.checksum = checksum_without_header + HeaderChecksum();
if (schedule_pad) {
if (sh_offset != 0) {
fprintf(stderr, "Warning: Cannot safely pad an ELF\n");
} else {
fseek(infile, 0, SEEK_END);
size = ftell(infile);
for (bit=31; bit>=0; bit--) if (size & (1<<bit)) break;
if (size != (1<<bit))
{
int todo = (1<<(bit+1)) - size;
while (todo--) fputc(0xFF, infile);
}
}
}
fseek(infile, sh_offset, SEEK_SET);
fwrite(&header, sizeof(header), 1, infile);
fclose(infile);

View File

@ -1,20 +1,28 @@
CC = gcc
CC ?= gcc
CFLAGS = -Wall -Wextra -Werror -Wno-sign-compare -std=c11 -O2 -DPNG_SKIP_SETJMP_CHECK
CFLAGS = -Wall -Wextra -Werror -Wno-sign-compare -std=c11 -O3 -flto -DPNG_SKIP_SETJMP_CHECK
CFLAGS += $(shell pkg-config --cflags libpng)
LIBS = -lpng -lz
LDFLAGS += $(shell pkg-config --libs-only-L libpng)
SRCS = main.c convert_png.c gfx.c jasc_pal.c lz.c rl.c util.c font.c huff.c
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
.PHONY: all clean
all: gbagfx
all: gbagfx$(EXE)
@:
gbagfx-debug: $(SRCS) convert_png.h gfx.h global.h jasc_pal.h lz.h rl.h util.h font.h
gbagfx-debug$(EXE): $(SRCS) convert_png.h gfx.h global.h jasc_pal.h lz.h rl.h util.h font.h
$(CC) $(CFLAGS) -DDEBUG $(SRCS) -o $@ $(LDFLAGS) $(LIBS)
gbagfx: $(SRCS) convert_png.h gfx.h global.h jasc_pal.h lz.h rl.h util.h font.h
gbagfx$(EXE): $(SRCS) convert_png.h gfx.h global.h jasc_pal.h lz.h rl.h util.h font.h
$(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) $(LIBS)
clean:

View File

@ -62,10 +62,7 @@ static unsigned char *ConvertBitDepth(unsigned char *src, int srcBitDepth, int d
for (j = 8 - srcBitDepth; j >= 0; j -= srcBitDepth)
{
unsigned char pixel = (srcByte >> j) % (1 << srcBitDepth);
if (pixel >= (1 << destBitDepth))
FATAL_ERROR("Image exceeds the maximum color value for a %ibpp image.\n", destBitDepth);
unsigned char pixel = ((srcByte >> j) % (1 << srcBitDepth)) % (1 << destBitDepth);
*dest |= pixel << destBit;
destBit -= destBitDepth;
if (destBit < 0)
@ -125,7 +122,7 @@ void ReadPng(char *path, struct Image *image)
free(row_pointers);
fclose(fp);
if (bit_depth != image->bitDepth)
if (bit_depth != image->bitDepth && image->tilemap.data.affine == NULL)
{
unsigned char *src = image->pixels;
@ -133,7 +130,6 @@ void ReadPng(char *path, struct Image *image)
FATAL_ERROR("Bit depth of image must be 1, 2, 4, or 8.\n");
image->pixels = ConvertBitDepth(image->pixels, bit_depth, image->bitDepth, image->width * image->height);
free(src);
image->bitDepth = bit_depth;
}
}

View File

@ -4,6 +4,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "global.h"
#include "gfx.h"
#include "util.h"
@ -203,26 +204,188 @@ static void ConvertToTiles8Bpp(unsigned char *src, unsigned char *dest, int numT
}
}
void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors)
// For untiled, plain images
static void CopyPlainPixels(unsigned char *src, unsigned char *dest, int size, int dataWidth, bool invertColors)
{
int tileSize = bitDepth * 8;
if (dataWidth == 0) return;
for (int i = 0; i < size; i += dataWidth) {
for (int j = dataWidth; j > 0; j--) {
unsigned char pixels = src[i + j - 1];
*dest++ = invertColors ? ~pixels : pixels;
}
}
}
static void DecodeAffineTilemap(unsigned char *input, unsigned char *output, unsigned char *tilemap, int tileSize, int numTiles)
{
for (int i = 0; i < numTiles; i++)
{
memcpy(&output[i * tileSize], &input[tilemap[i] * tileSize], tileSize);
}
}
#define REVERSE_BIT_ORDER(x) ({ \
((((x) >> 7) & 1) << 0) \
| ((((x) >> 6) & 1) << 1) \
| ((((x) >> 5) & 1) << 2) \
| ((((x) >> 4) & 1) << 3) \
| ((((x) >> 3) & 1) << 4) \
| ((((x) >> 2) & 1) << 5) \
| ((((x) >> 1) & 1) << 6) \
| ((((x) >> 0) & 1) << 7); \
})
#define SWAP_BYTES(a, b) ({ \
unsigned char tmp = *(a); \
*(a) = *(b); \
*(b) = tmp; \
})
#define NSWAP(x) ({ (((x) >> 4) & 0xF) | (((x) << 4) & 0xF0); })
#define SWAP_NYBBLES(a, b) ({ \
unsigned char tmp = NSWAP(*(a)); \
*(a) = NSWAP(*(b)); \
*(b) = tmp; \
})
static void VflipTile(unsigned char * tile, int bitDepth)
{
int i;
switch (bitDepth)
{
case 1:
SWAP_BYTES(&tile[0], &tile[7]);
SWAP_BYTES(&tile[1], &tile[6]);
SWAP_BYTES(&tile[2], &tile[5]);
SWAP_BYTES(&tile[3], &tile[4]);
break;
case 4:
for (i = 0; i < 4; i++)
{
SWAP_BYTES(&tile[i + 0], &tile[i + 28]);
SWAP_BYTES(&tile[i + 4], &tile[i + 24]);
SWAP_BYTES(&tile[i + 8], &tile[i + 20]);
SWAP_BYTES(&tile[i + 12], &tile[i + 16]);
}
break;
case 8:
for (i = 0; i < 8; i++)
{
SWAP_BYTES(&tile[i + 0], &tile[i + 56]);
SWAP_BYTES(&tile[i + 8], &tile[i + 48]);
SWAP_BYTES(&tile[i + 16], &tile[i + 40]);
SWAP_BYTES(&tile[i + 24], &tile[i + 32]);
}
break;
}
}
static void HflipTile(unsigned char * tile, int bitDepth)
{
int i;
switch (bitDepth)
{
case 1:
for (i = 0; i < 8; i++)
tile[i] = REVERSE_BIT_ORDER(tile[i]);
break;
case 4:
for (i = 0; i < 8; i++)
{
SWAP_NYBBLES(&tile[4 * i + 0], &tile[4 * i + 3]);
SWAP_NYBBLES(&tile[4 * i + 1], &tile[4 * i + 2]);
}
break;
case 8:
for (i = 0; i < 8; i++)
{
SWAP_BYTES(&tile[8 * i + 0], &tile[8 * i + 7]);
SWAP_BYTES(&tile[8 * i + 1], &tile[8 * i + 6]);
SWAP_BYTES(&tile[8 * i + 2], &tile[8 * i + 5]);
SWAP_BYTES(&tile[8 * i + 3], &tile[8 * i + 4]);
}
break;
}
}
static void DecodeNonAffineTilemap(unsigned char *input, unsigned char *output, struct NonAffineTile *tilemap, int tileSize, int outTileSize, int bitDepth, int numTiles)
{
unsigned char * in_tile;
unsigned char * out_tile = output;
int effectiveBitDepth = tileSize == outTileSize ? bitDepth : 8;
for (int i = 0; i < numTiles; i++)
{
in_tile = &input[tilemap[i].index * tileSize];
if (tileSize == outTileSize)
memcpy(out_tile, in_tile, tileSize);
else
{
for (int j = 0; j < 64; j++)
{
int shift = (j & 1) * 4;
out_tile[j] = (in_tile[j / 2] & (0xF << shift)) >> shift;
}
}
if (tilemap[i].hflip)
HflipTile(out_tile, effectiveBitDepth);
if (tilemap[i].vflip)
VflipTile(out_tile, effectiveBitDepth);
if (bitDepth == 4 && effectiveBitDepth == 8)
{
for (int j = 0; j < 64; j++)
{
out_tile[j] &= 0xF;
out_tile[j] |= (15 - tilemap[i].palno) << 4;
}
}
out_tile += outTileSize;
}
}
static unsigned char *DecodeTilemap(unsigned char *tiles, struct Tilemap *tilemap, int *numTiles_p, bool isAffine, int tileSize, int outTileSize, int bitDepth)
{
int mapTileSize = isAffine ? 1 : 2;
int numTiles = tilemap->size / mapTileSize;
unsigned char *decoded = calloc(numTiles, outTileSize);
if (isAffine)
DecodeAffineTilemap(tiles, decoded, tilemap->data.affine, tileSize, numTiles);
else
DecodeNonAffineTilemap(tiles, decoded, tilemap->data.non_affine, tileSize, outTileSize, bitDepth, numTiles);
free(tiles);
*numTiles_p = numTiles;
return decoded;
}
void ReadTileImage(char *path, int tilesWidth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors)
{
int tileSize = image->bitDepth * 8;
int fileSize;
unsigned char *buffer = ReadWholeFile(path, &fileSize);
int numTiles = fileSize / tileSize;
if (image->tilemap.data.affine != NULL)
{
int outTileSize = (image->bitDepth == 4 && image->palette.numColors > 16) ? 64 : tileSize;
buffer = DecodeTilemap(buffer, &image->tilemap, &numTiles, image->isAffine, tileSize, outTileSize, image->bitDepth);
if (outTileSize == 64)
{
tileSize = 64;
image->bitDepth = 8;
}
}
int tilesHeight = (numTiles + tilesWidth - 1) / tilesWidth;
if (tilesWidth % metatileWidth != 0)
FATAL_ERROR("The width in tiles (%d) isn't a multiple of the specified metatile width (%d)", tilesWidth, metatileWidth);
FATAL_ERROR("The width in tiles (%d) isn't a multiple of the specified metatile width (%d)\n", tilesWidth, metatileWidth);
if (tilesHeight % metatileHeight != 0)
FATAL_ERROR("The height in tiles (%d) isn't a multiple of the specified metatile height (%d)", tilesHeight, metatileHeight);
FATAL_ERROR("The height in tiles (%d) isn't a multiple of the specified metatile height (%d)\n", tilesHeight, metatileHeight);
image->width = tilesWidth * 8;
image->height = tilesHeight * 8;
image->bitDepth = bitDepth;
image->pixels = calloc(tilesWidth * tilesHeight, tileSize);
if (image->pixels == NULL)
@ -230,7 +393,7 @@ void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int
int metatilesWide = tilesWidth / metatileWidth;
switch (bitDepth) {
switch (image->bitDepth) {
case 1:
ConvertFromTiles1Bpp(buffer, image->pixels, numTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
break;
@ -245,9 +408,9 @@ void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int
free(buffer);
}
void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors)
void WriteTileImage(char *path, enum NumTilesMode numTilesMode, int numTiles, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors)
{
int tileSize = bitDepth * 8;
int tileSize = image->bitDepth * 8;
if (image->width % 8 != 0)
FATAL_ERROR("The width in pixels (%d) isn't a multiple of 8.\n", image->width);
@ -259,10 +422,10 @@ void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int m
int tilesHeight = image->height / 8;
if (tilesWidth % metatileWidth != 0)
FATAL_ERROR("The width in tiles (%d) isn't a multiple of the specified metatile width (%d)", tilesWidth, metatileWidth);
FATAL_ERROR("The width in tiles (%d) isn't a multiple of the specified metatile width (%d)\n", tilesWidth, metatileWidth);
if (tilesHeight % metatileHeight != 0)
FATAL_ERROR("The height in tiles (%d) isn't a multiple of the specified metatile height (%d)", tilesHeight, metatileHeight);
FATAL_ERROR("The height in tiles (%d) isn't a multiple of the specified metatile height (%d)\n", tilesHeight, metatileHeight);
int maxNumTiles = tilesWidth * tilesHeight;
@ -272,25 +435,96 @@ void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int m
FATAL_ERROR("The specified number of tiles (%d) is greater than the maximum possible value (%d).\n", numTiles, maxNumTiles);
int bufferSize = numTiles * tileSize;
unsigned char *buffer = malloc(bufferSize);
int maxBufferSize = maxNumTiles * tileSize;
unsigned char *buffer = malloc(maxBufferSize);
if (buffer == NULL)
FATAL_ERROR("Failed to allocate memory for pixels.\n");
int metatilesWide = tilesWidth / metatileWidth;
switch (bitDepth) {
switch (image->bitDepth) {
case 1:
ConvertToTiles1Bpp(image->pixels, buffer, numTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
ConvertToTiles1Bpp(image->pixels, buffer, maxNumTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
break;
case 4:
ConvertToTiles4Bpp(image->pixels, buffer, numTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
ConvertToTiles4Bpp(image->pixels, buffer, maxNumTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
break;
case 8:
ConvertToTiles8Bpp(image->pixels, buffer, numTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
ConvertToTiles8Bpp(image->pixels, buffer, maxNumTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
break;
}
bool zeroPadded = true;
for (int i = bufferSize; i < maxBufferSize && zeroPadded; i++) {
if (buffer[i] != 0)
{
switch (numTilesMode)
{
case NUM_TILES_IGNORE:
break;
case NUM_TILES_WARN:
fprintf(stderr, "Ignoring -num_tiles %d because tile %d contains non-transparent pixels.\n", numTiles, 1 + i / tileSize);
zeroPadded = false;
break;
case NUM_TILES_ERROR:
FATAL_ERROR("Tile %d contains non-transparent pixels.\n", 1 + i / tileSize);
break;
}
}
}
WriteWholeFile(path, buffer, zeroPadded ? bufferSize : maxBufferSize);
free(buffer);
}
void ReadPlainImage(char *path, int dataWidth, struct Image *image, bool invertColors)
{
int fileSize;
unsigned char *buffer = ReadWholeFile(path, &fileSize);
if (fileSize % dataWidth != 0)
FATAL_ERROR("The image data size (%d) isn't a multiple of the specified data width %d.\n", fileSize, dataWidth);
// png scanlines have wasted bits if they do not align to byte boundaries.
// pngs misaligned in this way are not currently handled.
int pixelsPerByte = 8 / image->bitDepth;
if (image->width % pixelsPerByte != 0)
FATAL_ERROR("The width in pixels (%d) isn't a multiple of %d.\n", image->width, pixelsPerByte);
int numPixels = fileSize * pixelsPerByte;
image->height = (numPixels + image->width - 1) / image->width;
image->pixels = calloc(image->width * image->height * image->bitDepth / 8, 1);
if (image->pixels == NULL)
FATAL_ERROR("Failed to allocate memory for pixels.\n");
CopyPlainPixels(buffer, image->pixels, fileSize, dataWidth, invertColors);
free(buffer);
}
void WritePlainImage(char *path, int dataWidth, struct Image *image, bool invertColors)
{
int bufferSize = image->width * image->height * image->bitDepth / 8;
if (bufferSize % dataWidth != 0)
FATAL_ERROR("The image data size (%d) isn't a multiple of the specified data width %d.\n", bufferSize, dataWidth);
// png scanlines have wasted bits if they do not align to byte boundaries.
// pngs misaligned in this way are not currently handled.
int pixelsPerByte = 8 / image->bitDepth;
if (image->width % pixelsPerByte != 0)
FATAL_ERROR("The width in pixels (%d) isn't a multiple of %d.\n", image->width, pixelsPerByte);
unsigned char *buffer = malloc(bufferSize);
if (buffer == NULL)
FATAL_ERROR("Failed to allocate memory for pixels.\n");
CopyPlainPixels(image->pixels, buffer, bufferSize, dataWidth, invertColors);
WriteWholeFile(path, buffer, bufferSize);
free(buffer);
@ -298,6 +532,11 @@ void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int m
void FreeImage(struct Image *image)
{
if (image->tilemap.data.affine != NULL)
{
free(image->tilemap.data.affine);
image->tilemap.data.affine = NULL;
}
free(image->pixels);
image->pixels = NULL;
}
@ -318,6 +557,12 @@ void ReadGbaPalette(char *path, struct Palette *palette)
palette->colors[i].green = UPCONVERT_BIT_DEPTH(GET_GBA_PAL_GREEN(paletteEntry));
palette->colors[i].blue = UPCONVERT_BIT_DEPTH(GET_GBA_PAL_BLUE(paletteEntry));
}
// png can only accept 16 or 256 colors, so fill the remainder with black
if (palette->numColors > 16)
{
memset(&palette->colors[palette->numColors], 0, (256 - palette->numColors) * sizeof(struct Color));
palette->numColors = 256;
}
free(data);
}

View File

@ -17,6 +17,21 @@ struct Palette {
int numColors;
};
struct NonAffineTile {
unsigned short index:10;
unsigned short hflip:1;
unsigned short vflip:1;
unsigned short palno:4;
} __attribute__((packed));
struct Tilemap {
union {
struct NonAffineTile *non_affine;
unsigned char *affine;
} data;
int size;
};
struct Image {
int width;
int height;
@ -25,10 +40,20 @@ struct Image {
bool hasPalette;
struct Palette palette;
bool hasTransparency;
struct Tilemap tilemap;
bool isAffine;
};
void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors);
void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors);
enum NumTilesMode {
NUM_TILES_IGNORE,
NUM_TILES_WARN,
NUM_TILES_ERROR,
};
void ReadTileImage(char *path, int tilesWidth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors);
void WriteTileImage(char *path, enum NumTilesMode numTilesMode, int numTiles, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors);
void ReadPlainImage(char *path, int dataWidth, struct Image *image, bool invertColors);
void WritePlainImage(char *path, int dataWidth, struct Image *image, bool invertColors);
void FreeImage(struct Image *image);
void ReadGbaPalette(char *path, struct Palette *palette);
void WriteGbaPalette(char *path, struct Palette *palette);

View File

@ -6,21 +6,21 @@
#include "global.h"
#include "huff.h"
static int cmp_tree(const void * a0, const void * b0) {
static int cmp_tree(const void *a0, const void *b0) {
return ((struct HuffData *)a0)->value - ((struct HuffData *)b0)->value;
}
typedef int (*cmpfun)(const void *, const void *);
int msort_r(void * data, size_t count, size_t size, cmpfun cmp, void * buffer) {
int msort_r(void *data, size_t count, size_t size, cmpfun cmp, void *buffer) {
/*
* Out-of-place mergesort (stable sort)
* Returns 1 on success, 0 on failure
*/
void * leftPtr;
void * rightPtr;
void * leftEnd;
void * rightEnd;
void *leftPtr;
void *rightPtr;
void *leftEnd;
void *rightEnd;
int i;
switch (count) {
@ -85,8 +85,8 @@ int msort_r(void * data, size_t count, size_t size, cmpfun cmp, void * buffer) {
return 1;
}
int msort(void * data, size_t count, size_t size, cmpfun cmp) {
void * buffer = malloc(count * size);
int msort(void *data, size_t count, size_t size, cmpfun cmp) {
void *buffer = malloc(count * size);
if (buffer == NULL) return 0;
int result = msort_r(data, count, size, cmp, buffer);
free(buffer);

View File

@ -46,10 +46,14 @@ void ReadJascPaletteLine(FILE *fp, char *line)
}
if (c == '\n')
FATAL_ERROR("LF line endings aren't supported.\n");
{
line[length] = 0;
return;
}
if (c == EOF)
FATAL_ERROR("Unexpected EOF. No CRLF at end of file.\n");
FATAL_ERROR("Unexpected EOF. No LF or CRLF at end of file.\n");
if (c == 0)
FATAL_ERROR("NUL character in file.\n");

View File

@ -25,6 +25,9 @@ void ConvertGbaToPng(char *inputPath, char *outputPath, struct GbaToPngOptions *
{
struct Image image;
image.bitDepth = options->bitDepth;
image.tilemap.data.affine = NULL;
if (options->paletteFilePath != NULL)
{
char *paletteFileExtension = GetFileExtensionAfterDot(options->paletteFilePath);
@ -45,7 +48,24 @@ void ConvertGbaToPng(char *inputPath, char *outputPath, struct GbaToPngOptions *
image.hasPalette = false;
}
ReadImage(inputPath, options->width, options->bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette);
if (options->isTiled)
{
if (options->tilemapFilePath != NULL)
{
int fileSize;
image.tilemap.data.affine = ReadWholeFile(options->tilemapFilePath, &fileSize);
if (options->isAffineMap && options->bitDepth != 8)
FATAL_ERROR("affine maps are necessarily 8bpp\n");
image.isAffine = options->isAffineMap;
image.tilemap.size = fileSize;
}
ReadTileImage(inputPath, options->width, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette);
}
else
{
image.width = options->width;
ReadPlainImage(inputPath, options->dataWidth, &image, !image.hasPalette);
}
image.hasTransparency = options->hasTransparency;
@ -59,10 +79,14 @@ void ConvertPngToGba(char *inputPath, char *outputPath, struct PngToGbaOptions *
struct Image image;
image.bitDepth = options->bitDepth;
image.tilemap.data.affine = NULL; // initialize to NULL to avoid issues in FreeImage
ReadPng(inputPath, &image);
WriteImage(outputPath, options->numTiles, options->bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette);
if (options->isTiled)
WriteTileImage(outputPath, options->numTilesMode, options->numTiles, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette);
else
WritePlainImage(outputPath, options->dataWidth, &image, !image.hasPalette);
FreeImage(&image);
}
@ -77,6 +101,10 @@ void HandleGbaToPngCommand(char *inputPath, char *outputPath, int argc, char **a
options.width = 1;
options.metatileWidth = 1;
options.metatileHeight = 1;
options.tilemapFilePath = NULL;
options.isAffineMap = false;
options.isTiled = true;
options.dataWidth = 1;
for (int i = 3; i < argc; i++)
{
@ -134,6 +162,33 @@ void HandleGbaToPngCommand(char *inputPath, char *outputPath, int argc, char **a
if (options.metatileHeight < 1)
FATAL_ERROR("metatile height must be positive.\n");
}
else if (strcmp(option, "-tilemap") == 0)
{
if (i + 1 >= argc)
FATAL_ERROR("No tilemap value following \"-tilemap\".\n");
i++;
options.tilemapFilePath = argv[i];
}
else if (strcmp(option, "-affine") == 0)
{
options.isAffineMap = true;
}
else if (strcmp(option, "-plain") == 0)
{
options.isTiled = false;
}
else if (strcmp(option, "-data_width") == 0)
{
if (i + 1 >= argc)
FATAL_ERROR("No data width value following \"-data_width\".\n");
i++;
if (!ParseNumber(argv[i], NULL, 10, &options.dataWidth))
FATAL_ERROR("Failed to parse data width.\n");
if (options.dataWidth < 1)
FATAL_ERROR("Data width must be positive.\n");
}
else
{
FATAL_ERROR("Unrecognized option \"%s\".\n", option);
@ -149,12 +204,16 @@ void HandleGbaToPngCommand(char *inputPath, char *outputPath, int argc, char **a
void HandlePngToGbaCommand(char *inputPath, char *outputPath, int argc, char **argv)
{
char *outputFileExtension = GetFileExtensionAfterDot(outputPath);
int bitDepth = outputFileExtension[0] - '0';
struct PngToGbaOptions options;
options.numTilesMode = NUM_TILES_IGNORE;
options.numTiles = 0;
options.bitDepth = bitDepth;
options.bitDepth = outputFileExtension[0] - '0';
options.metatileWidth = 1;
options.metatileHeight = 1;
options.tilemapFilePath = NULL;
options.isAffineMap = false;
options.isTiled = true;
options.dataWidth = 1;
for (int i = 3; i < argc; i++)
{
@ -173,6 +232,12 @@ void HandlePngToGbaCommand(char *inputPath, char *outputPath, int argc, char **a
if (options.numTiles < 1)
FATAL_ERROR("Number of tiles must be positive.\n");
}
else if (strcmp(option, "-Wnum_tiles") == 0) {
options.numTilesMode = NUM_TILES_WARN;
}
else if (strcmp(option, "-Werror=num_tiles") == 0) {
options.numTilesMode = NUM_TILES_ERROR;
}
else if (strcmp(option, "-mwidth") == 0)
{
if (i + 1 >= argc)
@ -199,6 +264,22 @@ void HandlePngToGbaCommand(char *inputPath, char *outputPath, int argc, char **a
if (options.metatileHeight < 1)
FATAL_ERROR("metatile height must be positive.\n");
}
else if (strcmp(option, "-plain") == 0)
{
options.isTiled = false;
}
else if (strcmp(option, "-data_width") == 0)
{
if (i + 1 >= argc)
FATAL_ERROR("No data width value following \"-data_width\".\n");
i++;
if (!ParseNumber(argv[i], NULL, 10, &options.dataWidth))
FATAL_ERROR("Failed to parse data width.\n");
if (options.dataWidth < 1)
FATAL_ERROR("Data width must be positive.\n");
}
else
{
FATAL_ERROR("Unrecognized option \"%s\".\n", option);
@ -272,6 +353,7 @@ void HandleJascToGbaPaletteCommand(char *inputPath, char *outputPath, int argc,
void HandleLatinFontToPngCommand(char *inputPath, char *outputPath, int argc UNUSED, char **argv UNUSED)
{
struct Image image;
image.tilemap.data.affine = NULL; // initialize to NULL to avoid issues in FreeImage
ReadLatinFont(inputPath, &image);
WritePng(outputPath, &image);
@ -282,6 +364,7 @@ void HandleLatinFontToPngCommand(char *inputPath, char *outputPath, int argc UNU
void HandlePngToLatinFontCommand(char *inputPath, char *outputPath, int argc UNUSED, char **argv UNUSED)
{
struct Image image;
image.tilemap.data.affine = NULL; // initialize to NULL to avoid issues in FreeImage
image.bitDepth = 2;
@ -294,6 +377,7 @@ void HandlePngToLatinFontCommand(char *inputPath, char *outputPath, int argc UNU
void HandleHalfwidthJapaneseFontToPngCommand(char *inputPath, char *outputPath, int argc UNUSED, char **argv UNUSED)
{
struct Image image;
image.tilemap.data.affine = NULL; // initialize to NULL to avoid issues in FreeImage
ReadHalfwidthJapaneseFont(inputPath, &image);
WritePng(outputPath, &image);
@ -304,6 +388,7 @@ void HandleHalfwidthJapaneseFontToPngCommand(char *inputPath, char *outputPath,
void HandlePngToHalfwidthJapaneseFontCommand(char *inputPath, char *outputPath, int argc UNUSED, char **argv UNUSED)
{
struct Image image;
image.tilemap.data.affine = NULL; // initialize to NULL to avoid issues in FreeImage
image.bitDepth = 2;
@ -316,6 +401,7 @@ void HandlePngToHalfwidthJapaneseFontCommand(char *inputPath, char *outputPath,
void HandleFullwidthJapaneseFontToPngCommand(char *inputPath, char *outputPath, int argc UNUSED, char **argv UNUSED)
{
struct Image image;
image.tilemap.data.affine = NULL; // initialize to NULL to avoid issues in FreeImage
ReadFullwidthJapaneseFont(inputPath, &image);
WritePng(outputPath, &image);
@ -326,6 +412,7 @@ void HandleFullwidthJapaneseFontToPngCommand(char *inputPath, char *outputPath,
void HandlePngToFullwidthJapaneseFontCommand(char *inputPath, char *outputPath, int argc UNUSED, char **argv UNUSED)
{
struct Image image;
image.tilemap.data.affine = NULL; // initialize to NULL to avoid issues in FreeImage
image.bitDepth = 2;
@ -360,7 +447,7 @@ void HandleLZCompressCommand(char *inputPath, char *outputPath, int argc, char *
else if (strcmp(option, "-search") == 0)
{
if (i + 1 >= argc)
FATAL_ERROR("No size following \"-overflow\".\n");
FATAL_ERROR("No size following \"-search\".\n");
i++;

10
tools/gbagfx/options.h Executable file → Normal file
View File

@ -4,6 +4,7 @@
#define OPTIONS_H
#include <stdbool.h>
#include "gfx.h"
struct GbaToPngOptions {
char *paletteFilePath;
@ -12,13 +13,22 @@ struct GbaToPngOptions {
int width;
int metatileWidth;
int metatileHeight;
char *tilemapFilePath;
bool isAffineMap;
bool isTiled;
int dataWidth;
};
struct PngToGbaOptions {
int numTiles;
enum NumTilesMode numTilesMode;
int bitDepth;
int metatileWidth;
int metatileHeight;
char *tilemapFilePath;
bool isAffineMap;
bool isTiled;
int dataWidth;
};
#endif // OPTIONS_H

View File

@ -1,6 +1,6 @@
CXX := g++
CXX ?= g++
CXXFLAGS := -Wall -std=c++11 -O2
CXXFLAGS := -Wall -std=c++17 -O2
INCLUDES := -I .
@ -8,12 +8,18 @@ SRCS := jsonproc.cpp
HEADERS := jsonproc.h inja.hpp nlohmann/json.hpp
.PHONY: clean all
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
all: jsonproc
.PHONY: all clean
all: jsonproc$(EXE)
@:
jsonproc: $(SRCS) $(HEADERS)
jsonproc$(EXE): $(SRCS) $(HEADERS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SRCS) -o $@ $(LDFLAGS)
clean:

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,6 @@
// jsonproc.cpp
// jsonproc converts JSON data to an output file based on an Inja template.
// https://github.com/pantor/inja
#include "jsonproc.h"
@ -8,7 +10,7 @@
using std::string; using std::to_string;
#include <algorithm>
using std::remove_if;
using std::replace_if;
#include <inja.hpp>
using namespace inja;
@ -112,11 +114,16 @@ int main(int argc, char *argv[])
});
env.add_callback("cleanString", 1, [](Arguments& args) {
string badChars = ".'{} \n\t-_\u00e9";
string str = args.at(0)->get<string>();
str.erase(remove_if(str.begin(), str.end(), [&badChars](const char &c) {
return badChars.find(c) != std::string::npos;
}), str.end());
for (unsigned int i = 0; i < str.length(); i++) {
// This code is not Unicode aware, so UTF-8 is not easily parsable without introducing
// another library. Just filter out any non-alphanumeric characters for now.
// TODO: proper Unicode string normalization
if ((i == 0 && isdigit(str[i]))
|| !isalnum(str[i])) {
str[i] = '_';
}
}
return str;
});

File diff suppressed because it is too large Load Diff

12
tools/mapjson/Makefile Executable file → Normal file
View File

@ -1,4 +1,4 @@
CXX := g++
CXX ?= g++
CXXFLAGS := -Wall -std=c++11 -O2
@ -6,12 +6,18 @@ SRCS := json11.cpp mapjson.cpp
HEADERS := mapjson.h
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
.PHONY: all clean
all: mapjson
all: mapjson$(EXE)
@:
mapjson: $(SRCS) $(HEADERS)
mapjson$(EXE): $(SRCS) $(HEADERS)
$(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS)
clean:

17
tools/mapjson/json11.cpp Executable file → Normal file
View File

@ -33,7 +33,6 @@ using std::vector;
using std::map;
using std::make_shared;
using std::initializer_list;
using std::move;
/* Helper for representing null - just a do-nothing struct, plus comparison
* operators so the helpers in JsonValue work. We can't use nullptr_t because
@ -149,7 +148,7 @@ protected:
// Constructors
explicit Value(const T &value) : m_value(value) {}
explicit Value(T &&value) : m_value(move(value)) {}
explicit Value(T &&value) : m_value(std::move(value)) {}
// Get type tag
Json::Type type() const override {
@ -196,7 +195,7 @@ class JsonString final : public Value<Json::STRING, string> {
const string &string_value() const override { return m_value; }
public:
explicit JsonString(const string &value) : Value(value) {}
explicit JsonString(string &&value) : Value(move(value)) {}
explicit JsonString(string &&value) : Value(std::move(value)) {}
};
class JsonArray final : public Value<Json::ARRAY, Json::array> {
@ -204,7 +203,7 @@ class JsonArray final : public Value<Json::ARRAY, Json::array> {
const Json & operator[](size_t i) const override;
public:
explicit JsonArray(const Json::array &value) : Value(value) {}
explicit JsonArray(Json::array &&value) : Value(move(value)) {}
explicit JsonArray(Json::array &&value) : Value(std::move(value)) {}
};
class JsonObject final : public Value<Json::OBJECT, Json::object> {
@ -212,7 +211,7 @@ class JsonObject final : public Value<Json::OBJECT, Json::object> {
const Json & operator[](const string &key) const override;
public:
explicit JsonObject(const Json::object &value) : Value(value) {}
explicit JsonObject(Json::object &&value) : Value(move(value)) {}
explicit JsonObject(Json::object &&value) : Value(std::move(value)) {}
};
class JsonNull final : public Value<Json::NUL, NullStruct> {
@ -254,12 +253,12 @@ Json::Json(double value) : m_ptr(make_shared<JsonDouble>(value)) {
Json::Json(int value) : m_ptr(make_shared<JsonInt>(value)) {}
Json::Json(bool value) : m_ptr(value ? statics().t : statics().f) {}
Json::Json(const string &value) : m_ptr(make_shared<JsonString>(value)) {}
Json::Json(string &&value) : m_ptr(make_shared<JsonString>(move(value))) {}
Json::Json(string &&value) : m_ptr(make_shared<JsonString>(std::move(value))) {}
Json::Json(const char * value) : m_ptr(make_shared<JsonString>(value)) {}
Json::Json(const Json::array &values) : m_ptr(make_shared<JsonArray>(values)) {}
Json::Json(Json::array &&values) : m_ptr(make_shared<JsonArray>(move(values))) {}
Json::Json(Json::array &&values) : m_ptr(make_shared<JsonArray>(std::move(values))) {}
Json::Json(const Json::object &values) : m_ptr(make_shared<JsonObject>(values)) {}
Json::Json(Json::object &&values) : m_ptr(make_shared<JsonObject>(move(values))) {}
Json::Json(Json::object &&values) : m_ptr(make_shared<JsonObject>(std::move(values))) {}
/* * * * * * * * * * * * * * * * * * * *
* Accessors
@ -357,7 +356,7 @@ struct JsonParser final {
* Mark this parse as failed.
*/
Json fail(string &&msg) {
return fail(move(msg), Json());
return fail(std::move(msg), Json());
}
template <typename T>

0
tools/mapjson/json11.h Executable file → Normal file
View File

475
tools/mapjson/mapjson.cpp Executable file → Normal file
View File

@ -29,6 +29,9 @@ using json11::Json;
#include "mapjson.h"
string version;
// System directory separator
string sep;
string read_text_file(string filepath) {
ifstream in_file(filepath);
@ -60,14 +63,47 @@ void write_text_file(string filepath, string text) {
out_file.close();
}
string generate_map_header_text(Json map_data, Json layouts_data, string version) {
string map_layout_id = map_data["layout"].string_value();
string json_to_string(const Json &data, const string &field = "", bool silent = false) {
const Json value = !field.empty() ? data[field] : data;
string output = "";
switch (value.type()) {
case Json::Type::STRING:
output = value.string_value();
break;
case Json::Type::NUMBER:
output = std::to_string(value.int_value());
break;
case Json::Type::BOOL:
output = value.bool_value() ? "TRUE" : "FALSE";
break;
case Json::Type::NUL:
output = "";
break;
default:{
if (!silent) {
string s = !field.empty() ? ("Value for '" + field + "'") : "JSON field";
FATAL_ERROR("%s is unexpected type; expected string, number, or bool.\n", s.c_str());
}
}
}
if (!silent && output.empty()) {
string s = !field.empty() ? ("Value for '" + field + "'") : "JSON field";
FATAL_ERROR("%s cannot be empty.\n", s.c_str());
}
return output;
}
string generate_map_header_text(Json map_data, Json layouts_data) {
string map_layout_id = json_to_string(map_data, "layout");
vector<Json> matched;
for (auto &field : layouts_data["layouts"].array_items()) {
if (map_layout_id == field["id"].string_value())
matched.push_back(field);
for (auto &layout : layouts_data["layouts"].array_items()) {
if (map_layout_id == json_to_string(layout, "id", true))
matched.push_back(layout);
}
if (matched.size() != 1)
@ -77,43 +113,52 @@ string generate_map_header_text(Json map_data, Json layouts_data, string version
ostringstream text;
text << map_data["name"].string_value() << ":\n"
<< "\t.4byte " << layout["name"].string_value() << "\n";
string mapName = json_to_string(map_data, "name");
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/" << mapName << "/map.json\n@\n\n";
text << mapName << ":\n"
<< "\t.4byte " << json_to_string(layout, "name") << "\n";
if (map_data.object_items().find("shared_events_map") != map_data.object_items().end())
text << "\t.4byte " << map_data["shared_events_map"].string_value() << "_MapEvents\n";
text << "\t.4byte " << json_to_string(map_data, "shared_events_map") << "_MapEvents\n";
else
text << "\t.4byte " << map_data["name"].string_value() << "_MapEvents\n";
text << "\t.4byte " << mapName << "_MapEvents\n";
if (map_data.object_items().find("shared_scripts_map") != map_data.object_items().end())
text << "\t.4byte " << map_data["shared_scripts_map"].string_value() << "_MapScripts\n";
text << "\t.4byte " << json_to_string(map_data, "shared_scripts_map") << "_MapScripts\n";
else
text << "\t.4byte " << map_data["name"].string_value() << "_MapScripts\n";
text << "\t.4byte " << mapName << "_MapScripts\n";
if (map_data.object_items().find("connections") != map_data.object_items().end()
&& map_data["connections"].array_items().size() > 0)
text << "\t.4byte " << map_data["name"].string_value() << "_MapConnections\n";
&& map_data["connections"].array_items().size() > 0 && json_to_string(map_data, "connections_no_include", true) != "TRUE")
text << "\t.4byte " << mapName << "_MapConnections\n";
else
text << "\t.4byte 0x0\n";
text << "\t.4byte NULL\n";
text << "\t.2byte " << map_data["music"].string_value() << "\n"
<< "\t.2byte " << layout["id"].string_value() << "\n"
<< "\t.byte " << map_data["region_map_section"].string_value() << "\n"
<< "\t.byte " << map_data["requires_flash"].bool_value() << "\n"
<< "\t.byte " << map_data["weather"].string_value() << "\n"
<< "\t.byte " << map_data["map_type"].string_value() << "\n"
<< "\t.2byte 0\n";
text << "\t.2byte " << json_to_string(map_data, "music") << "\n"
<< "\t.2byte " << json_to_string(layout, "id") << "\n"
<< "\t.byte " << json_to_string(map_data, "region_map_section") << "\n"
<< "\t.byte " << json_to_string(map_data, "requires_flash") << "\n"
<< "\t.byte " << json_to_string(map_data, "weather") << "\n"
<< "\t.byte " << json_to_string(map_data, "map_type") << "\n";
if (version != "firered")
text << "\t.2byte 0\n";
if (version == "ruby")
text << "\t.byte " << map_data["show_map_name"].bool_value() << "\n";
else if (version == "emerald")
text << "\t.byte " << json_to_string(map_data, "show_map_name") << "\n";
else if (version == "emerald" || version == "firered")
text << "\tmap_header_flags "
<< "allow_bike=" << map_data["allow_bike"].bool_value() << ", "
<< "allow_escape_rope=" << map_data["allow_escape_rope"].bool_value() << ", "
<< "allow_run=" << map_data["allow_running"].bool_value() << ", "
<< "show_map_name=" << map_data["show_map_name"].bool_value() << "\n";
<< "allow_cycling=" << json_to_string(map_data, "allow_cycling") << ", "
<< "allow_escaping=" << json_to_string(map_data, "allow_escaping") << ", "
<< "allow_running=" << json_to_string(map_data, "allow_running") << ", "
<< "show_map_name=" << json_to_string(map_data, "show_map_name") << "\n";
text << "\t.byte " << map_data["battle_scene"].string_value() << "\n\n";
if (version == "firered")
text << "\t.byte " << json_to_string(map_data, "floor_number") << "\n";
text << "\t.byte " << json_to_string(map_data, "battle_scene") << "\n\n";
return text.str();
}
@ -124,18 +169,22 @@ string generate_map_connections_text(Json map_data) {
ostringstream text;
text << map_data["name"].string_value() << "_MapConnectionsList:\n";
string mapName = json_to_string(map_data, "name");
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/" << mapName << "/map.json\n@\n\n";
text << mapName << "_MapConnectionsList:\n";
for (auto &connection : map_data["connections"].array_items()) {
text << "\tconnection "
<< connection["direction"].string_value() << ", "
<< connection["offset"].int_value() << ", "
<< connection["map"].string_value() << "\n";
<< json_to_string(connection, "direction") << ", "
<< json_to_string(connection, "offset") << ", "
<< json_to_string(connection, "map") << "\n";
}
text << "\n" << map_data["name"].string_value() << "_MapConnections:\n"
text << "\n" << mapName << "_MapConnections:\n"
<< "\t.4byte " << map_data["connections"].array_items().size() << "\n"
<< "\t.4byte " << map_data["name"].string_value() << "_MapConnectionsList\n\n";
<< "\t.4byte " << mapName << "_MapConnectionsList\n\n";
return text.str();
}
@ -146,120 +195,159 @@ string generate_map_events_text(Json map_data) {
ostringstream text;
string mapName = json_to_string(map_data, "name");
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/" << mapName << "/map.json\n@\n\n\t.align 2\n\n";
string objects_label, warps_label, coords_label, bgs_label;
if (map_data["object_events"].array_items().size() > 0) {
objects_label = map_data["name"].string_value() + "_ObjectEvents";
objects_label = mapName + "_ObjectEvents";
text << objects_label << ":\n";
for (unsigned int i = 0; i < map_data["object_events"].array_items().size(); i++) {
auto obj_event = map_data["object_events"].array_items()[i];
text << "\tobject_event " << i + 1 << ", "
<< obj_event["graphics_id"].string_value() << ", 0, "
<< obj_event["x"].int_value() << ", "
<< obj_event["y"].int_value() << ", "
<< obj_event["elevation"].int_value() << ", "
<< obj_event["movement_type"].string_value() << ", "
<< obj_event["movement_range_x"].int_value() << ", "
<< obj_event["movement_range_y"].int_value() << ", "
<< obj_event["trainer_type"].string_value() << ", "
<< obj_event["trainer_sight_or_berry_tree_id"].string_value() << ", "
<< obj_event["script"].string_value() << ", "
<< obj_event["flag"].string_value() << "\n";
string type = json_to_string(obj_event, "type", true);
// If no type field is present, assume it's a regular object event.
if (type == "" || type == "object") {
text << "\tobject_event " << i + 1 << ", "
<< json_to_string(obj_event, "graphics_id") << ", "
<< json_to_string(obj_event, "x") << ", "
<< json_to_string(obj_event, "y") << ", "
<< json_to_string(obj_event, "elevation") << ", "
<< json_to_string(obj_event, "movement_type") << ", "
<< json_to_string(obj_event, "movement_range_x") << ", "
<< json_to_string(obj_event, "movement_range_y") << ", "
<< json_to_string(obj_event, "trainer_type") << ", "
<< json_to_string(obj_event, "trainer_sight_or_berry_tree_id") << ", "
<< json_to_string(obj_event, "script") << ", "
<< json_to_string(obj_event, "flag") << "\n";
} else if (type == "clone") {
text << "\tclone_event " << i + 1 << ", "
<< json_to_string(obj_event, "graphics_id") << ", "
<< json_to_string(obj_event, "x") << ", "
<< json_to_string(obj_event, "y") << ", "
<< json_to_string(obj_event, "target_local_id") << ", "
<< json_to_string(obj_event, "target_map") << "\n";
} else {
FATAL_ERROR("Unknown object event type '%s'. Expected 'object' or 'clone'.\n", type.c_str());
}
}
text << "\n";
} else {
objects_label = "0x0";
objects_label = "NULL";
}
if (map_data["warp_events"].array_items().size() > 0) {
warps_label = map_data["name"].string_value() + "_MapWarps";
warps_label = mapName + "_MapWarps";
text << warps_label << ":\n";
for (auto &warp_event : map_data["warp_events"].array_items()) {
text << "\twarp_def "
<< warp_event["x"].int_value() << ", "
<< warp_event["y"].int_value() << ", "
<< warp_event["elevation"].int_value() << ", "
<< warp_event["dest_warp_id"].string_value() << ", "
<< warp_event["dest_map"].string_value() << "\n";
<< json_to_string(warp_event, "x") << ", "
<< json_to_string(warp_event, "y") << ", "
<< json_to_string(warp_event, "elevation") << ", "
<< json_to_string(warp_event, "dest_warp_id") << ", "
<< json_to_string(warp_event, "dest_map") << "\n";
}
text << "\n";
} else {
warps_label = "0x0";
warps_label = "NULL";
}
if (map_data["coord_events"].array_items().size() > 0) {
coords_label = map_data["name"].string_value() + "_MapCoordEvents";
coords_label = mapName + "_MapCoordEvents";
text << coords_label << ":\n";
for (auto &coord_event : map_data["coord_events"].array_items()) {
if (coord_event["type"].string_value() == "trigger") {
string type = json_to_string(coord_event, "type");
if (type == "trigger") {
text << "\tcoord_event "
<< coord_event["x"].int_value() << ", "
<< coord_event["y"].int_value() << ", "
<< coord_event["elevation"].int_value() << ", "
<< coord_event["var"].string_value() << ", "
<< coord_event["var_value"].string_value() << ", "
<< coord_event["script"].string_value() << "\n";
<< json_to_string(coord_event, "x") << ", "
<< json_to_string(coord_event, "y") << ", "
<< json_to_string(coord_event, "elevation") << ", "
<< json_to_string(coord_event, "var") << ", "
<< json_to_string(coord_event, "var_value") << ", "
<< json_to_string(coord_event, "script") << "\n";
}
else if (coord_event["type"] == "weather") {
else if (type == "weather") {
text << "\tcoord_weather_event "
<< coord_event["x"].int_value() << ", "
<< coord_event["y"].int_value() << ", "
<< coord_event["elevation"].int_value() << ", "
<< coord_event["weather"].string_value() << "\n";
<< json_to_string(coord_event, "x") << ", "
<< json_to_string(coord_event, "y") << ", "
<< json_to_string(coord_event, "elevation") << ", "
<< json_to_string(coord_event, "weather") << "\n";
} else {
FATAL_ERROR("Unknown coord event type '%s'. Expected 'trigger' or 'weather'.\n", type.c_str());
}
}
text << "\n";
} else {
coords_label = "0x0";
coords_label = "NULL";
}
if (map_data["bg_events"].array_items().size() > 0) {
bgs_label = map_data["name"].string_value() + "_MapBGEvents";
bgs_label = mapName + "_MapBGEvents";
text << bgs_label << ":\n";
for (auto &bg_event : map_data["bg_events"].array_items()) {
if (bg_event["type"] == "sign") {
text << "\tbg_event "
<< bg_event["x"].int_value() << ", "
<< bg_event["y"].int_value() << ", "
<< bg_event["elevation"].int_value() << ", "
<< bg_event["player_facing_dir"].string_value() << ", "
<< bg_event["script"].string_value() << "\n";
string type = json_to_string(bg_event, "type");
if (type == "sign") {
text << "\tbg_sign_event "
<< json_to_string(bg_event, "x") << ", "
<< json_to_string(bg_event, "y") << ", "
<< json_to_string(bg_event, "elevation") << ", "
<< json_to_string(bg_event, "player_facing_dir") << ", "
<< json_to_string(bg_event, "script") << "\n";
}
else if (bg_event["type"] == "hidden_item") {
else if (type == "hidden_item") {
text << "\tbg_hidden_item_event "
<< bg_event["x"].int_value() << ", "
<< bg_event["y"].int_value() << ", "
<< bg_event["elevation"].int_value() << ", "
<< bg_event["item"].string_value() << ", "
<< bg_event["flag"].string_value() << "\n";
<< json_to_string(bg_event, "x") << ", "
<< json_to_string(bg_event, "y") << ", "
<< json_to_string(bg_event, "elevation") << ", "
<< json_to_string(bg_event, "item") << ", "
<< json_to_string(bg_event, "flag");
if (version == "firered") {
text << ", "
<< json_to_string(bg_event, "quantity") << ", "
<< json_to_string(bg_event, "underfoot");
}
text << "\n";
}
else if (bg_event["type"] == "secret_base") {
else if (type == "secret_base") {
text << "\tbg_secret_base_event "
<< bg_event["x"].int_value() << ", "
<< bg_event["y"].int_value() << ", "
<< bg_event["elevation"].int_value() << ", "
<< bg_event["secret_base_id"].string_value() << "\n";
<< json_to_string(bg_event, "x") << ", "
<< json_to_string(bg_event, "y") << ", "
<< json_to_string(bg_event, "elevation") << ", "
<< json_to_string(bg_event, "secret_base_id") << "\n";
} else {
FATAL_ERROR("Unknown bg event type '%s'. Expected 'sign', 'hidden_item', or 'secret_base'.\n", type.c_str());
}
}
text << "\n";
} else {
bgs_label = "0x0";
bgs_label = "NULL";
}
text << map_data["name"].string_value() << "_MapEvents::\n"
text << mapName << "_MapEvents::\n"
<< "\tmap_events " << objects_label << ", " << warps_label << ", "
<< coords_label << ", " << bgs_label << "\n\n";
return text.str();
}
string get_directory_name(string filename) {
size_t dir_pos = filename.find_last_of("/\\");
string strip_trailing_separator(string filename) {
if(filename.back() == '/' || filename.back() == '\\')
filename.pop_back();
return filename;
}
void infer_separator(string filename) {
size_t dir_pos = filename.find_last_of("/\\");
sep = filename[dir_pos];
}
string file_parent(string filename){
size_t dir_pos = filename.find_last_of("/\\");
return filename.substr(0, dir_pos + 1);
}
void process_map(string map_filepath, string layouts_filepath, string version) {
void process_map(string map_filepath, string layouts_filepath, string output_dir) {
string mapdata_err, layouts_err;
string mapdata_json_text = read_text_file(map_filepath);
@ -273,41 +361,43 @@ void process_map(string map_filepath, string layouts_filepath, string version) {
if (layouts_data == Json())
FATAL_ERROR("%s\n", layouts_err.c_str());
string header_text = generate_map_header_text(map_data, layouts_data, version);
string header_text = generate_map_header_text(map_data, layouts_data);
string events_text = generate_map_events_text(map_data);
string connections_text = generate_map_connections_text(map_data);
string files_dir = get_directory_name(map_filepath);
write_text_file(files_dir + "header.inc", header_text);
write_text_file(files_dir + "events.inc", events_text);
write_text_file(files_dir + "connections.inc", connections_text);
string out_dir = strip_trailing_separator(output_dir).append(sep);
write_text_file(out_dir + "header.inc", header_text);
write_text_file(out_dir + "events.inc", events_text);
write_text_file(out_dir + "connections.inc", connections_text);
}
string generate_groups_text(Json groups_data) {
ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n";
for (auto &key : groups_data["group_order"].array_items()) {
string group = key.string_value();
string group = json_to_string(key);
text << group << "::\n";
auto maps = groups_data[group].array_items();
for (Json &map_name : maps)
text << "\t.4byte " << map_name.string_value() << "\n";
text << "\t.4byte " << json_to_string(map_name) << "\n";
text << "\n";
}
text << "\t.align 2\n" << "gMapGroups::\n";
for (auto &group : groups_data["group_order"].array_items())
text << "\t.4byte " << group.string_value() << "\n";
text << "\t.4byte " << json_to_string(group) << "\n";
text << "\n";
return text.str();
}
string generate_connections_text(Json groups_data) {
string generate_connections_text(Json groups_data, string include_path) {
vector<Json> map_names;
for (auto &group : groups_data["group_order"].array_items())
for (auto map_name : groups_data[group.string_value()].array_items())
for (auto map_name : groups_data[json_to_string(group)].array_items())
map_names.push_back(map_name);
vector<Json> connections_include_order = groups_data["connections_include_order"].array_items();
@ -325,70 +415,81 @@ string generate_connections_text(Json groups_data) {
ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n";
for (Json map_name : map_names)
text << "\t.include \"data/maps/" << map_name.string_value() << "/connections.inc\"\n";
text << "\t.include \"" << include_path << "/" << json_to_string(map_name) << "/connections.inc\"\n";
return text.str();
}
string generate_headers_text(Json groups_data) {
string generate_headers_text(Json groups_data, string include_path) {
vector<string> map_names;
for (auto &group : groups_data["group_order"].array_items())
for (auto map_name : groups_data[group.string_value()].array_items())
map_names.push_back(map_name.string_value());
for (auto map_name : groups_data[json_to_string(group)].array_items())
map_names.push_back(json_to_string(map_name));
ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n";
for (string map_name : map_names)
text << "\t.include \"data/maps/" << map_name << "/header.inc\"\n";
text << "\t.include \"" << include_path << "/" << map_name << "/header.inc\"\n";
return text.str();
}
string generate_events_text(Json groups_data) {
string generate_events_text(Json groups_data, string include_path) {
vector<string> map_names;
for (auto &group : groups_data["group_order"].array_items())
for (auto map_name : groups_data[group.string_value()].array_items())
map_names.push_back(map_name.string_value());
for (auto map_name : groups_data[json_to_string(group)].array_items())
map_names.push_back(json_to_string(map_name));
ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from " << include_path << "/map_groups.json\n@\n\n";
for (string map_name : map_names)
text << "\t.include \"data/maps/" << map_name << "/events.inc\"\n";
text << "\t.include \"" << include_path << "/" << map_name << "/events.inc\"\n";
return text.str();
}
string generate_map_constants_text(string groups_filepath, Json groups_data) {
string file_dir = get_directory_name(groups_filepath);
char dir_separator = file_dir.back();
string file_dir = file_parent(groups_filepath) + sep;
ostringstream text;
text << "#ifndef GUARD_CONSTANTS_MAP_GROUPS_H\n"
<< "#define GUARD_CONSTANTS_MAP_GROUPS_H\n\n";
text << "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n//\n\n";
int group_num = 0;
for (auto &group : groups_data["group_order"].array_items()) {
text << "// " << group.string_value() << "\n";
vector<Json> map_ids;
string groupName = json_to_string(group);
text << "// " << groupName << "\n";
vector<string> map_ids;
size_t max_length = 0;
for (auto &map_name : groups_data[group.string_value()].array_items()) {
string header_filepath = file_dir + map_name.string_value() + dir_separator + "map.json";
for (auto &map_name : groups_data[groupName].array_items()) {
string map_filepath = file_dir + json_to_string(map_name) + sep + "map.json";
string err_str;
Json map_data = Json::parse(read_text_file(header_filepath), err_str);
map_ids.push_back(map_data["id"]);
if (map_data["id"].string_value().length() > max_length)
max_length = map_data["id"].string_value().length();
Json map_data = Json::parse(read_text_file(map_filepath), err_str);
if (map_data == Json())
FATAL_ERROR("%s: %s\n", map_filepath.c_str(), err_str.c_str());
string id = json_to_string(map_data, "id", true);
map_ids.push_back(id);
if (id.length() > max_length)
max_length = id.length();
}
int map_id_num = 0;
for (Json map_id : map_ids) {
text << "#define " << map_id.string_value() << string((max_length - map_id.string_value().length() + 1), ' ')
for (string map_id : map_ids) {
text << "#define " << map_id << string((max_length - map_id.length() + 1), ' ')
<< "(" << map_id_num++ << " | (" << group_num << " << 8))\n";
}
text << "\n";
@ -402,7 +503,11 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) {
return text.str();
}
void process_groups(string groups_filepath) {
// Output paths are directories with trailing path separators
void process_groups(string groups_filepath, string output_asm, string output_c) {
output_asm = strip_trailing_separator(output_asm); // Remove separator if existing.
output_c = strip_trailing_separator(output_c);
string err;
Json groups_data = Json::parse(read_text_file(groups_filepath), err);
@ -410,39 +515,46 @@ void process_groups(string groups_filepath) {
FATAL_ERROR("%s\n", err.c_str());
string groups_text = generate_groups_text(groups_data);
string connections_text = generate_connections_text(groups_data);
string headers_text = generate_headers_text(groups_data);
string events_text = generate_events_text(groups_data);
string connections_text = generate_connections_text(groups_data, output_asm);
string headers_text = generate_headers_text(groups_data, output_asm);
string events_text = generate_events_text(groups_data, output_asm);
string map_header_text = generate_map_constants_text(groups_filepath, groups_data);
string file_dir = get_directory_name(groups_filepath);
char s = file_dir.back();
write_text_file(file_dir + "groups.inc", groups_text);
write_text_file(file_dir + "connections.inc", connections_text);
write_text_file(file_dir + "headers.inc", headers_text);
write_text_file(file_dir + "events.inc", events_text);
write_text_file(file_dir + ".." + s + ".." + s + "include" + s + "constants" + s + "map_groups.h", map_header_text);
write_text_file(output_asm + sep + "groups.inc", groups_text);
write_text_file(output_asm + sep + "connections.inc", connections_text);
write_text_file(output_asm + sep + "headers.inc", headers_text);
write_text_file(output_asm + sep + "events.inc", events_text);
write_text_file(output_c + sep + "map_groups.h", map_header_text);
}
string generate_layout_headers_text(Json layouts_data) {
ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/layouts/layouts.json\n@\n\n";
for (auto &layout : layouts_data["layouts"].array_items()) {
string border_label = layout["name"].string_value() + "_Border";
string blockdata_label = layout["name"].string_value() + "_Blockdata";
if (layout == Json::object()) continue;
string layoutName = json_to_string(layout, "name");
string border_label = layoutName + "_Border";
string blockdata_label = layoutName + "_Blockdata";
text << border_label << "::\n"
<< "\t.incbin \"" << layout["border_filepath"].string_value() << "\"\n\n"
<< "\t.incbin \"" << json_to_string(layout, "border_filepath") << "\"\n\n"
<< blockdata_label << "::\n"
<< "\t.incbin \"" << layout["blockdata_filepath"].string_value() << "\"\n\n"
<< "\t.incbin \"" << json_to_string(layout, "blockdata_filepath") << "\"\n\n"
<< "\t.align 2\n"
<< layout["name"].string_value() << "::\n"
<< "\t.4byte " << layout["width"].int_value() << "\n"
<< "\t.4byte " << layout["height"].int_value() << "\n"
<< layoutName << "::\n"
<< "\t.4byte " << json_to_string(layout, "width") << "\n"
<< "\t.4byte " << json_to_string(layout, "height") << "\n"
<< "\t.4byte " << border_label << "\n"
<< "\t.4byte " << blockdata_label << "\n"
<< "\t.4byte " << layout["primary_tileset"].string_value() << "\n"
<< "\t.4byte " << layout["secondary_tileset"].string_value() << "\n\n";
<< "\t.4byte " << json_to_string(layout, "primary_tileset") << "\n"
<< "\t.4byte " << json_to_string(layout, "secondary_tileset") << "\n";
if (version == "firered") {
text << "\t.byte " << json_to_string(layout, "border_width") << "\n"
<< "\t.byte " << json_to_string(layout, "border_height") << "\n"
<< "\t.2byte 0\n";
}
text << "\n";
}
return text.str();
@ -451,11 +563,16 @@ string generate_layout_headers_text(Json layouts_data) {
string generate_layouts_table_text(Json layouts_data) {
ostringstream text;
text << "\t.align 2\n"
<< layouts_data["layouts_table_label"].string_value() << "::\n";
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/layouts/layouts.json\n@\n\n";
for (auto &layout : layouts_data["layouts"].array_items())
text << "\t.4byte " << layout["name"].string_value() << "\n";
text << "\t.align 2\n"
<< json_to_string(layouts_data, "layouts_table_label") << "::\n";
for (auto &layout : layouts_data["layouts"].array_items()) {
string layout_name = json_to_string(layout, "name", true);
if (layout_name.empty()) layout_name = "NULL";
text << "\t.4byte " << layout_name << "\n";
}
return text.str();
}
@ -466,16 +583,24 @@ string generate_layouts_constants_text(Json layouts_data) {
text << "#ifndef GUARD_CONSTANTS_LAYOUTS_H\n"
<< "#define GUARD_CONSTANTS_LAYOUTS_H\n\n";
int i = 0;
for (auto &layout : layouts_data["layouts"].array_items())
text << "#define " << layout["id"].string_value() << " " << ++i << "\n";
text << "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from data/layouts/layouts.json\n//\n\n";
int i = 1;
for (auto &layout : layouts_data["layouts"].array_items()) {
if (layout != Json::object())
text << "#define " << json_to_string(layout, "id") << " " << i << "\n";
i++;
}
text << "\n#endif // GUARD_CONSTANTS_LAYOUTS_H\n";
return text.str();
}
void process_layouts(string layouts_filepath) {
void process_layouts(string layouts_filepath, string output_asm, string output_c) {
output_asm = strip_trailing_separator(output_asm).append(sep);
output_c = strip_trailing_separator(output_c).append(sep);
string err;
Json layouts_data = Json::parse(read_text_file(layouts_filepath), err);
@ -486,12 +611,9 @@ void process_layouts(string layouts_filepath) {
string layouts_table_text = generate_layouts_table_text(layouts_data);
string layouts_constants_text = generate_layouts_constants_text(layouts_data);
string file_dir = get_directory_name(layouts_filepath);
char s = file_dir.back();
write_text_file(file_dir + "layouts.inc", layout_headers_text);
write_text_file(file_dir + "layouts_table.inc", layouts_table_text);
write_text_file(file_dir + ".." + s + ".." + s + "include" + s + "constants" + s + "layouts.h", layouts_constants_text);
write_text_file(output_asm + "layouts.inc", layout_headers_text);
write_text_file(output_asm + "layouts_table.inc", layouts_table_text);
write_text_file(output_c + "layouts.h", layouts_constants_text);
}
int main(int argc, char *argv[]) {
@ -499,9 +621,9 @@ int main(int argc, char *argv[]) {
FATAL_ERROR("USAGE: mapjson <mode> <game-version> [options]\n");
char *version_arg = argv[2];
string version(version_arg);
if (version != "emerald" && version != "ruby")
FATAL_ERROR("ERROR: <game-version> must be 'emerald' or 'ruby'.\n");
version = string(version_arg);
if (version != "emerald" && version != "ruby" && version != "firered")
FATAL_ERROR("ERROR: <game-version> must be 'emerald', 'firered', or 'ruby'.\n");
char *mode_arg = argv[1];
string mode(mode_arg);
@ -509,29 +631,40 @@ int main(int argc, char *argv[]) {
FATAL_ERROR("ERROR: <mode> must be 'layouts', 'map', or 'groups'.\n");
if (mode == "map") {
if (argc != 5)
FATAL_ERROR("USAGE: mapjson map <game-version> <map_file> <layouts_file>\n");
if (argc != 6)
FATAL_ERROR("USAGE: mapjson map <game-version> <map_file> <layouts_file> <output_dir>\n");
infer_separator(argv[3]);
string filepath(argv[3]);
string layouts_filepath(argv[4]);
string output_dir(argv[5]);
process_map(filepath, layouts_filepath, version);
process_map(filepath, layouts_filepath, output_dir);
}
else if (mode == "groups") {
if (argc != 4)
FATAL_ERROR("USAGE: mapjson groups <game-version> <groups_file>\n");
if (argc != 6)
FATAL_ERROR("USAGE: mapjson groups <game-version> <groups_file> <output_asm_dir> <output_c_dir>\n");
infer_separator(argv[3]);
string filepath(argv[3]);
string output_asm(argv[4]);
string output_c(argv[5]);
process_groups(filepath);
process_groups(filepath, output_asm, output_c);
}
else if (mode == "layouts") {
if (argc != 4)
FATAL_ERROR("USAGE: mapjson layouts <game-version> <layouts_file>\n");
if (argc != 6)
FATAL_ERROR("USAGE: mapjson layouts <game-version> <layouts_file> <output_asm_dir> <output_c_dir>\n");
infer_separator(argv[3]);
string filepath(argv[3]);
string output_asm(argv[4]);
string output_c(argv[5]);
process_layouts(filepath);
process_layouts(filepath, output_asm, output_c);
}
else {
FATAL_ERROR("ERROR: <mode> must be 'layouts', 'map', or 'groups'.\n");
}
return 0;

0
tools/mapjson/mapjson.h Executable file → Normal file
View File

View File

@ -1,17 +1,23 @@
CXX := g++
CXX ?= g++
CXXFLAGS := -std=c++11 -O2 -s -Wall -Wno-switch -Werror
CXXFLAGS := -std=c++11 -O2 -Wall -Wno-switch -Werror
SRCS := agb.cpp error.cpp main.cpp midi.cpp tables.cpp
HEADERS := agb.h error.h main.h midi.h tables.h
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
.PHONY: all clean
all: mid2agb
all: mid2agb$(EXE)
@:
mid2agb: $(SRCS) $(HEADERS)
mid2agb$(EXE): $(SRCS) $(HEADERS)
$(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS)
clean:

View File

@ -39,6 +39,9 @@ static bool s_noteChanged;
static bool s_velocityChanged;
static bool s_inPattern;
static int s_extendedCommand;
static int s_memaccOp;
static int s_memaccParam1;
static int s_memaccParam2;
void PrintAgbHeader()
{
@ -248,6 +251,84 @@ void PrintSeqLoopLabel(const Event& event)
ResetTrackVars();
}
void PrintMemAcc(const Event& event)
{
switch (s_memaccOp)
{
case 0x00:
PrintByte("MEMACC, mem_set, 0x%02X, %u", s_memaccParam1, event.param2);
break;
case 0x01:
PrintByte("MEMACC, mem_add, 0x%02X, %u", s_memaccParam1, event.param2);
break;
case 0x02:
PrintByte("MEMACC, mem_sub, 0x%02X, %u", s_memaccParam1, event.param2);
break;
case 0x03:
PrintByte("MEMACC, mem_mem_set, 0x%02X, 0x%02X", s_memaccParam1, event.param2);
break;
case 0x04:
PrintByte("MEMACC, mem_mem_add, 0x%02X, 0x%02X", s_memaccParam1, event.param2);
break;
case 0x05:
PrintByte("MEMACC, mem_mem_sub, 0x%02X, 0x%02X", s_memaccParam1, event.param2);
break;
// TODO: everything else
case 0x06:
break;
case 0x07:
break;
case 0x08:
break;
case 0x09:
break;
case 0x0A:
break;
case 0x0B:
break;
case 0x0C:
break;
case 0x0D:
break;
case 0x0E:
break;
case 0x0F:
break;
case 0x10:
break;
case 0x11:
break;
case 0x46:
break;
case 0x47:
break;
case 0x48:
break;
case 0x49:
break;
case 0x4A:
break;
case 0x4B:
break;
case 0x4C:
break;
case 0x4D:
break;
case 0x4E:
break;
case 0x4F:
break;
case 0x50:
break;
case 0x51:
break;
default:
break;
}
PrintWait(event.time);
}
void PrintExtendedOp(const Event& event)
{
// TODO: support for other extended commands
@ -281,16 +362,19 @@ void PrintControllerOp(const Event& event)
break;
case 0x0C:
case 0x10:
// TODO: memacc
PrintMemAcc(event);
break;
case 0x0D:
// TODO: memacc var
s_memaccOp = event.param2;
PrintWait(event.time);
break;
case 0x0E:
// TODO: memacc var
s_memaccParam1 = event.param2;
PrintWait(event.time);
break;
case 0x0F:
// TODO: memacc var
s_memaccParam2 = event.param2;
PrintWait(event.time);
break;
case 0x11:
std::fprintf(g_outputFile, "%s_%u_L%u:\n", g_asmLabel.c_str(), g_agbTrack, event.param2);
@ -335,8 +419,6 @@ void PrintAgbTrack(std::vector<Event>& events)
{
std::fprintf(g_outputFile, "\n@**************** Track %u (Midi-Chn.%u) ****************@\n\n", g_agbTrack, g_midiChan + 1);
std::fprintf(g_outputFile, "%s_%u:\n", g_asmLabel.c_str(), g_agbTrack);
PrintWait(g_initialWait);
PrintByte("KEYSH , %s_key%+d", g_asmLabel.c_str(), 0);
int wholeNoteCount = 0;
int loopEndBlockNum = 0;
@ -360,6 +442,9 @@ void PrintAgbTrack(std::vector<Event>& events)
if (!foundVolBeforeNote)
PrintByte("\tVOL , 127*%s_mvl/mxv", g_asmLabel.c_str());
PrintWait(g_initialWait);
PrintByte("KEYSH , %s_key%+d", g_asmLabel.c_str(), 0);
for (unsigned i = 0; events[i].type != EventType::EndOfTrack; i++)
{
const Event& event = events[i];

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