Convert wild encounter data to JSON
This commit is contained in:
parent
483648e372
commit
0babaa8c07
7 changed files with 12277 additions and 4574 deletions
8
Makefile
8
Makefile
|
@ -23,6 +23,7 @@ MAP = $(ROM:.gba=.map)
|
||||||
|
|
||||||
C_SUBDIR = src
|
C_SUBDIR = src
|
||||||
ASM_SUBDIR = asm
|
ASM_SUBDIR = asm
|
||||||
|
DATA_SRC_SUBDIR = src/data
|
||||||
DATA_ASM_SUBDIR = data
|
DATA_ASM_SUBDIR = data
|
||||||
SONG_SUBDIR = sound/songs
|
SONG_SUBDIR = sound/songs
|
||||||
MID_SUBDIR = sound/songs/midi
|
MID_SUBDIR = sound/songs/midi
|
||||||
|
@ -53,6 +54,7 @@ PREPROC := tools/preproc/preproc$(EXE)
|
||||||
RAMSCRGEN := tools/ramscrgen/ramscrgen$(EXE)
|
RAMSCRGEN := tools/ramscrgen/ramscrgen$(EXE)
|
||||||
FIX := tools/gbafix/gbafix$(EXE)
|
FIX := tools/gbafix/gbafix$(EXE)
|
||||||
MAPJSON := tools/mapjson/mapjson$(EXE)
|
MAPJSON := tools/mapjson/mapjson$(EXE)
|
||||||
|
JSONPROC := tools/jsonproc/jsonproc$(EXE)
|
||||||
|
|
||||||
# Clear the default suffixes
|
# Clear the default suffixes
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
@ -86,6 +88,8 @@ OBJS_REL := $(patsubst $(OBJ_DIR)/%,%,$(OBJS))
|
||||||
|
|
||||||
SUBDIRS := $(sort $(dir $(OBJS)))
|
SUBDIRS := $(sort $(dir $(OBJS)))
|
||||||
|
|
||||||
|
AUTO_GEN_TARGETS :=
|
||||||
|
|
||||||
$(shell mkdir -p $(SUBDIRS))
|
$(shell mkdir -p $(SUBDIRS))
|
||||||
|
|
||||||
rom: $(ROM)
|
rom: $(ROM)
|
||||||
|
@ -101,6 +105,7 @@ clean: tidy
|
||||||
rm -f $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc
|
rm -f $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc
|
||||||
rm -f $(DATA_ASM_SUBDIR)/maps/connections.inc $(DATA_ASM_SUBDIR)/maps/events.inc $(DATA_ASM_SUBDIR)/maps/groups.inc $(DATA_ASM_SUBDIR)/maps/headers.inc
|
rm -f $(DATA_ASM_SUBDIR)/maps/connections.inc $(DATA_ASM_SUBDIR)/maps/events.inc $(DATA_ASM_SUBDIR)/maps/groups.inc $(DATA_ASM_SUBDIR)/maps/headers.inc
|
||||||
find $(DATA_ASM_SUBDIR)/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} +
|
find $(DATA_ASM_SUBDIR)/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} +
|
||||||
|
rm -f $(AUTO_GEN_TARGETS)
|
||||||
|
|
||||||
tidy:
|
tidy:
|
||||||
rm -f $(ROM) $(ELF) $(MAP)
|
rm -f $(ROM) $(ELF) $(MAP)
|
||||||
|
@ -109,6 +114,7 @@ tidy:
|
||||||
include graphics_file_rules.mk
|
include graphics_file_rules.mk
|
||||||
include map_data_rules.mk
|
include map_data_rules.mk
|
||||||
include spritesheet_rules.mk
|
include spritesheet_rules.mk
|
||||||
|
include json_data_rules.mk
|
||||||
include songs.mk
|
include songs.mk
|
||||||
|
|
||||||
%.s: ;
|
%.s: ;
|
||||||
|
@ -150,7 +156,7 @@ ifeq ($(DINFO),1)
|
||||||
override CFLAGS += -g
|
override CFLAGS += -g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(C_BUILDDIR)/%.o : $(C_SUBDIR)/%.c $$(c_dep)
|
$(C_BUILDDIR)/%.o : $(C_SUBDIR)/%.c $$(c_dep) $(AUTO_GEN_TARGETS)
|
||||||
@$(CPP) $(CPPFLAGS) $< -o $(C_BUILDDIR)/$*.i
|
@$(CPP) $(CPPFLAGS) $< -o $(C_BUILDDIR)/$*.i
|
||||||
@$(PREPROC) $(C_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(C_BUILDDIR)/$*.s
|
@$(PREPROC) $(C_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(C_BUILDDIR)/$*.s
|
||||||
@echo -e ".text\n\t.align\t2, 0\n" >> $(C_BUILDDIR)/$*.s
|
@echo -e ".text\n\t.align\t2, 0\n" >> $(C_BUILDDIR)/$*.s
|
||||||
|
|
6
json_data_rules.mk
Executable file
6
json_data_rules.mk
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
# JSON files are run through jsonproc, which is a tool that converts JSON data to an output file
|
||||||
|
# based on an Inja template. https://github.com/pantor/inja
|
||||||
|
|
||||||
|
AUTO_GEN_TARGETS += $(DATA_SRC_SUBDIR)/wild_encounters.h
|
||||||
|
$(DATA_SRC_SUBDIR)/wild_encounters.h: $(DATA_SRC_SUBDIR)/wild_encounters.json $(DATA_SRC_SUBDIR)/wild_encounters.json.txt
|
||||||
|
$(JSONPROC) $^ $@
|
1
src/data/.gitignore
vendored
Executable file
1
src/data/.gitignore
vendored
Executable file
|
@ -0,0 +1 @@
|
||||||
|
wild_encounters.h
|
File diff suppressed because it is too large
Load diff
12186
src/data/wild_encounters.json
Executable file
12186
src/data/wild_encounters.json
Executable file
File diff suppressed because it is too large
Load diff
67
src/data/wild_encounters.json.txt
Executable file
67
src/data/wild_encounters.json.txt
Executable file
|
@ -0,0 +1,67 @@
|
||||||
|
{{ doNotModifyHeader }}
|
||||||
|
## for wild_encounter_group in wild_encounter_groups
|
||||||
|
## for encounter in wild_encounter_group.encounters
|
||||||
|
{% if existsIn(encounter, "land_mons") %}
|
||||||
|
const struct WildPokemon {{ encounter.base_label }}_LandMons[] =
|
||||||
|
{
|
||||||
|
## for wild_mon in encounter.land_mons.mons
|
||||||
|
{ {{ wild_mon.min_level }}, {{ wild_mon.max_level }}, {{ wild_mon.species }} },
|
||||||
|
## endfor
|
||||||
|
};
|
||||||
|
|
||||||
|
const struct WildPokemonInfo {{ encounter.base_label }}_LandMonsInfo = { {{encounter.land_mons.encounter_rate}}, {{ encounter.base_label }}_LandMons };
|
||||||
|
{% endif %}
|
||||||
|
{% if existsIn(encounter, "water_mons") %}
|
||||||
|
const struct WildPokemon {{ encounter.base_label }}_WaterMons[] =
|
||||||
|
{
|
||||||
|
## for wild_mon in encounter.water_mons.mons
|
||||||
|
{ {{ wild_mon.min_level }}, {{ wild_mon.max_level }}, {{ wild_mon.species }} },
|
||||||
|
## endfor
|
||||||
|
};
|
||||||
|
|
||||||
|
const struct WildPokemonInfo {{ encounter.base_label }}_WaterMonsInfo = { {{encounter.water_mons.encounter_rate}}, {{ encounter.base_label }}_WaterMons };
|
||||||
|
{% endif %}
|
||||||
|
{% if existsIn(encounter, "rock_smash_mons") %}
|
||||||
|
const struct WildPokemon {{ encounter.base_label }}_RockSmashMons[] =
|
||||||
|
{
|
||||||
|
## for wild_mon in encounter.rock_smash_mons.mons
|
||||||
|
{ {{ wild_mon.min_level }}, {{ wild_mon.max_level }}, {{ wild_mon.species }} },
|
||||||
|
## endfor
|
||||||
|
};
|
||||||
|
|
||||||
|
const struct WildPokemonInfo {{ encounter.base_label }}_RockSmashMonsInfo = { {{encounter.rock_smash_mons.encounter_rate}}, {{ encounter.base_label }}_RockSmashMons };
|
||||||
|
{% endif %}
|
||||||
|
{% if existsIn(encounter, "fishing_mons") %}
|
||||||
|
const struct WildPokemon {{ encounter.base_label }}_FishingMons[] =
|
||||||
|
{
|
||||||
|
## for wild_mon in encounter.fishing_mons.mons
|
||||||
|
{ {{ wild_mon.min_level }}, {{ wild_mon.max_level }}, {{ wild_mon.species }} },
|
||||||
|
## endfor
|
||||||
|
};
|
||||||
|
|
||||||
|
const struct WildPokemonInfo {{ encounter.base_label }}_FishingMonsInfo = { {{encounter.fishing_mons.encounter_rate}}, {{ encounter.base_label }}_FishingMons };
|
||||||
|
{% endif %}
|
||||||
|
## endfor
|
||||||
|
|
||||||
|
const struct WildPokemonHeader {{ wild_encounter_group.label }}[] =
|
||||||
|
{
|
||||||
|
## for encounter in wild_encounter_group.encounters
|
||||||
|
{
|
||||||
|
.mapGroup = {% if wild_encounter_group.for_maps %}MAP_GROUP({{ removePrefix(encounter.map, "MAP_") }}){% else %}0{% endif %},
|
||||||
|
.mapNum = {% if wild_encounter_group.for_maps %}MAP_NUM({{ removePrefix(encounter.map, "MAP_") }}){% else %}{{ loop.index1 }}{% endif %},
|
||||||
|
.landMonsInfo = {% if existsIn(encounter, "land_mons") %}&{{ encounter.base_label }}_LandMonsInfo{% else %}NULL{% endif %},
|
||||||
|
.waterMonsInfo = {% if existsIn(encounter, "water_mons") %}&{{ encounter.base_label }}_WaterMonsInfo{% else %}NULL{% endif %},
|
||||||
|
.rockSmashMonsInfo = {% if existsIn(encounter, "rock_smash_mons") %}&{{ encounter.base_label }}_RockSmashMonsInfo{% else %}NULL{% endif %},
|
||||||
|
.fishingMonsInfo = {% if existsIn(encounter, "fishing_mons") %}&{{ encounter.base_label }}_FishingMonsInfo{% else %}NULL{% endif %},
|
||||||
|
},
|
||||||
|
## endfor
|
||||||
|
{
|
||||||
|
.mapGroup = MAP_GROUP(UNDEFINED),
|
||||||
|
.mapNum = MAP_NUM(UNDEFINED),
|
||||||
|
.landMonsInfo = NULL,
|
||||||
|
.waterMonsInfo = NULL,
|
||||||
|
.rockSmashMonsInfo = NULL,
|
||||||
|
.fishingMonsInfo = NULL,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
## endfor
|
|
@ -42,6 +42,16 @@ EWRAM_DATA static u32 sFeebasRngValue = 0;
|
||||||
|
|
||||||
#include "data/wild_encounters.h"
|
#include "data/wild_encounters.h"
|
||||||
|
|
||||||
|
//Special Feebas-related data.
|
||||||
|
const struct WildPokemon gWildFeebasRoute119Data = {20, 25, SPECIES_FEEBAS};
|
||||||
|
|
||||||
|
const u16 gRoute119WaterTileData[] =
|
||||||
|
{
|
||||||
|
0, 0x2D, 0,
|
||||||
|
0x2E, 0x5B, 0x83,
|
||||||
|
0x5C, 0x8B, 0x12A,
|
||||||
|
};
|
||||||
|
|
||||||
// code
|
// code
|
||||||
void DisableWildEncounters(bool8 disabled)
|
void DisableWildEncounters(bool8 disabled)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue