Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/constants/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ layouts.h
region_map_sections.h
map_event_ids.h
heal_locations.h
wild_encounter.h
11 changes: 0 additions & 11 deletions include/constants/wild_encounter.h

This file was deleted.

4 changes: 4 additions & 0 deletions json_data_rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ $(DATA_SRC_SUBDIR)/wild_encounters.h: $(DATA_SRC_SUBDIR)/wild_encounters.json $(

$(C_BUILDDIR)/wild_encounter.o: c_dep += $(DATA_SRC_SUBDIR)/wild_encounters.h

AUTO_GEN_TARGETS += include/constants/wild_encounter.h
include/constants/wild_encounter.h: $(DATA_SRC_SUBDIR)/wild_encounters.json $(DATA_SRC_SUBDIR)/wild_encounters.constants.json.txt
$(JSONPROC) $^ $@

AUTO_GEN_TARGETS += $(DATA_SRC_SUBDIR)/region_map/region_map_entries.h
$(DATA_SRC_SUBDIR)/region_map/region_map_entries.h: $(DATA_SRC_SUBDIR)/region_map/region_map_sections.json $(DATA_SRC_SUBDIR)/region_map/region_map_sections.json.txt
$(JSONPROC) $^ $@
Expand Down
32 changes: 32 additions & 0 deletions src/data/wild_encounters.constants.json.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef GUARD_CONSTANTS_WILD_ENCOUNTER_H
#define GUARD_CONSTANTS_WILD_ENCOUNTER_H

{{ doNotModifyHeader }}

#define NUM_ALTERING_CAVE_TABLES 9

## for wild_encounter_group in wild_encounter_groups
{% if wild_encounter_group.for_maps %}
## for wild_encounter_field in wild_encounter_group.fields
{% if not existsIn(wild_encounter_field, "groups") %}
## for encounter_rate in wild_encounter_field.encounter_rates
#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_SLOT_{{ loop.index }} ({% if loop.index == 0 %}{{ encounter_rate }}{% else %}ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_SLOT_{{ subtract(loop.index, 1) }} + {{ encounter_rate }}{% endif %}){{ setVarInt(wild_encounter_field.type, loop.index) }}
## endfor
#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_TOTAL (ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_SLOT_{{ getVar(wild_encounter_field.type) }})
{% else %}
## for field_subgroup_key, field_subgroup_subarray in wild_encounter_field.groups
{{ setVar("field_name", concat(concat(upper(wild_encounter_field.type), "_"), upper(field_subgroup_key))) }}
## for field_subgroup_index in field_subgroup_subarray
#define ENCOUNTER_CHANCE_{{ getVar("field_name") }}_SLOT_{{ field_subgroup_index }} ({% if loop.index == 0 %}{{ at(wild_encounter_field.encounter_rates, field_subgroup_index) }}{% else %}ENCOUNTER_CHANCE_{{ getVar("field_name") }}_SLOT_{{ getVar("previous_slot") }} + {{ at(wild_encounter_field.encounter_rates, field_subgroup_index) }}{% endif %}){{ setVarInt(concat(wild_encounter_field.type, field_subgroup_key), field_subgroup_index) }}{{ setVarInt("previous_slot", field_subgroup_index) }}
## endfor
#define ENCOUNTER_CHANCE_{{ getVar("field_name") }}_TOTAL (ENCOUNTER_CHANCE_{{ getVar("field_name") }}_SLOT_{{ getVar(concat(wild_encounter_field.type, field_subgroup_key)) }})
#define NUM_{{ getVar("field_name") }}_ENCOUNTER_SLOTS ({{ length(field_subgroup_subarray) }})
## endfor
{% endif %}
#define NUM_{{ upper(wild_encounter_field.type) }}_ENCOUNTER_SLOTS ({{ length(wild_encounter_field.encounter_rates) }})

## endfor
{% endif %}
## endfor

#endif // GUARD_CONSTANTS_WILD_ENCOUNTER_H
Loading