Dumped dungeon parameters

This commit is contained in:
AnonymousRandomPerson 2023-02-14 00:02:52 -05:00
parent b783cb9f0e
commit 97496603de
13 changed files with 1734 additions and 22 deletions

View File

@ -175,6 +175,7 @@ include dungeon_trap.mk
include data_monster.mk include data_monster.mk
include data_item.mk include data_item.mk
include data_move.mk include data_move.mk
include data_dungeon.mk
include graphics.mk include graphics.mk
$(TOOLDIRS): $(TOOLDIRS):
@ -197,6 +198,7 @@ tidy:
$(RM) -f $(MONSTER_DATA) $(RM) -f $(MONSTER_DATA)
$(RM) -f $(LEARNSET_DATA) $(RM) -f $(LEARNSET_DATA)
$(RM) -f $(LEARNSET_PTRS) $(RM) -f $(LEARNSET_PTRS)
$(RM) -f $(DUNGEON_DATA)
$(RM) -f $(DUNGEON_FLOOR) $(RM) -f $(DUNGEON_FLOOR)
$(RM) -f $(DUNGEON_POKEMON) $(RM) -f $(DUNGEON_POKEMON)
$(RM) -f $(DUNGEON_TRAP) $(RM) -f $(DUNGEON_TRAP)
@ -220,7 +222,7 @@ $(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.c
$(C_BUILDDIR)/%.d: $(C_SUBDIR)/%.c $(C_BUILDDIR)/%.d: $(C_SUBDIR)/%.c
@$(call scaninc,$(INCLUDE_PATHS)) @$(call scaninc,$(INCLUDE_PATHS))
$(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s dungeon_pokemon dungeon_floor dungeon_trap data_monster data_item data_move data_learnset data_learnset_ptrs $(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s dungeon_pokemon dungeon_floor dungeon_trap data_monster data_item data_move data_learnset data_learnset_ptrs data_dungeon
@$(CPP) -x assembler-with-cpp $(CPPFLAGS) $< -o $(DATA_ASM_BUILDDIR)/$*.i.s @$(CPP) -x assembler-with-cpp $(CPPFLAGS) $< -o $(DATA_ASM_BUILDDIR)/$*.i.s
@$(PREPROC) $(DATA_ASM_BUILDDIR)/$*.i.s charmap.txt > $(DATA_ASM_BUILDDIR)/$*.s @$(PREPROC) $(DATA_ASM_BUILDDIR)/$*.i.s charmap.txt > $(DATA_ASM_BUILDDIR)/$*.s
$(AS) $(ASFLAGS) -o $@ $(DATA_ASM_BUILDDIR)/$*.s $(AS) $(ASFLAGS) -o $@ $(DATA_ASM_BUILDDIR)/$*.s

View File

@ -1363,7 +1363,7 @@ _0803DAFE:
ldr r1, _0803DBA8 ldr r1, _0803DBA8
adds r0, r1 adds r0, r1
ldrb r0, [r0] ldrb r0, [r0]
bl GetStairDirection bl IsStairDirectionUp
lsls r0, 24 lsls r0, 24
ldr r6, _0803DBB0 ldr r6, _0803DBB0
cmp r0, 0 cmp r0, 0
@ -2196,7 +2196,7 @@ _0803E1BC:
ldr r1, _0803E1D8 ldr r1, _0803E1D8
adds r0, r4, r1 adds r0, r4, r1
ldrb r0, [r0] ldrb r0, [r0]
bl GetStairDirection bl IsStairDirectionUp
lsls r0, 24 lsls r0, 24
movs r1, 0x16 movs r1, 0x16
cmp r0, 0 cmp r0, 0
@ -5603,7 +5603,7 @@ _0803FCB0:
ldr r3, _0803FCF8 ldr r3, _0803FCF8
adds r0, r2, r3 adds r0, r2, r3
ldrb r0, [r0] ldrb r0, [r0]
bl GetStairDirection bl IsStairDirectionUp
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _0803FCFC beq _0803FCFC

View File

@ -546,7 +546,7 @@ _08042694:
ldr r1, _080426C0 ldr r1, _080426C0
adds r0, r1 adds r0, r1
ldrb r0, [r0] ldrb r0, [r0]
bl GetStairDirection bl IsStairDirectionUp
lsls r0, 24 lsls r0, 24
ldr r4, _080426C4 ldr r4, _080426C4
cmp r0, 0 cmp r0, 0

View File

@ -7423,7 +7423,7 @@ _080614C8:
ldr r3, _08061578 ldr r3, _08061578
adds r0, r1, r3 adds r0, r1, r3
ldrb r0, [r0] ldrb r0, [r0]
bl sub_8090158 bl IsDungeonUnk8
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _0806154C beq _0806154C

View File

@ -541,9 +541,8 @@ gAvoidCaptureText: @ 8109CE4
gFinalScenarioText: @ 8109CF4 gFinalScenarioText: @ 8109CF4
.incbin "baserom.gba", 0x109CF4, 0x3C .incbin "baserom.gba", 0x109CF4, 0x3C
.global gDungeons @ 8109D30
gDungeons: @ 8109D30 #include "dungeon/dungeon_data.inc"
.incbin "baserom.gba", 0x109D30, 0x620
.global gUnknown_810A350 .global gUnknown_810A350
gUnknown_810A350: @ 810A350 gUnknown_810A350: @ 810A350

View File

@ -1,3 +1,4 @@
**/pokemon_found.inc **/pokemon_found.inc
**/floor_id.inc **/floor_id.inc
trap_data.inc trap_data.inc
dungeon_data.inc

File diff suppressed because it is too large Load Diff

14
data_dungeon.mk Normal file
View File

@ -0,0 +1,14 @@
# Dungeon data
DUNGEON_DIR = $(DATA_ASM_SUBDIR)/dungeon
DUNGEON_DATA = $(DUNGEON_DIR)/dungeon_data.inc
# Headers included by tools/dungeonjson/dungeonjson.cpp:generate_dungeon_data_text
DUNGEON_DATA_INC = \
include/constants/dungeon.h \
include/constants/move_id.h
data_dungeon: $(DUNGEON_DATA);
$(DUNGEON_DATA): $(DUNGEON_DIR)/dungeon_data.json $(DUNGEON_DATA_INC)
$(DUNGEONJSON) dungeon pmd-red $<

View File

@ -8,4 +8,4 @@ DUNGEON_POKEMON := $(patsubst $(DUNGEONS_DIR)/%/,$(DUNGEONS_DIR)/%/pokemon_found
dungeon_pokemon: $(DUNGEON_POKEMON); dungeon_pokemon: $(DUNGEON_POKEMON);
$(DUNGEONS_DIR)/%/pokemon_found.inc: $(DUNGEONS_DIR)/%/pokemon_found.json $(DUNGEONS_DIR)/%/pokemon_found.inc: $(DUNGEONS_DIR)/%/pokemon_found.json
$(DUNGEONJSON) dungeon pmd-red $< $(DUNGEONJSON) dungeon_pokemon pmd-red $<

View File

@ -11,7 +11,7 @@ struct DungeonName
struct DungeonDataEntry struct DungeonDataEntry
{ {
/* 0x0 */ u8 stairDirection; /* 0x0 */ bool8 stairDirectionUp;
/* 0x1 */ bool8 leaderCanSwitch; /* 0x1 */ bool8 leaderCanSwitch;
/* 0x2 */ bool8 recruitingEnabled; /* 0x2 */ bool8 recruitingEnabled;
/* 0x3 */ s8 rescuesAllowed; /* 0x3 */ s8 rescuesAllowed;
@ -19,8 +19,8 @@ struct DungeonDataEntry
/* 0x5 */ u8 maxPartyMembers; /* 0x5 */ u8 maxPartyMembers;
/* 0x6 */ bool8 levelResetTo1; /* 0x6 */ bool8 levelResetTo1;
/* 0x7 */ bool8 moneyResetTo0; /* 0x7 */ bool8 moneyResetTo0;
/* 0x8 */ u8 unk8; /* 0x8 */ bool8 unk8;
/* 0x9 */ u8 unk9; /* 0x9 */ bool8 hasCheckpoint;
/* 0xA */ bool8 forceGameSave; // Whether to quicksave or not before entering. /* 0xA */ bool8 forceGameSave; // Whether to quicksave or not before entering.
/* 0xB */ u8 HMMask; // HM mask for dungeon entry requirements (Fly, Dive, Waterfall, Surf, Water). /* 0xB */ u8 HMMask; // HM mask for dungeon entry requirements (Fly, Dive, Waterfall, Surf, Water).
/* 0xC */ s16 turnLimit; /* 0xC */ s16 turnLimit;
@ -34,6 +34,6 @@ u32 sub_80908D8(struct DungeonLocation *dungeon);
u8 sub_8090910(struct DungeonLocation *dungeon, u32 param_2); u8 sub_8090910(struct DungeonLocation *dungeon, u32 param_2);
bool8 sub_809095C(u8 dungeon); bool8 sub_809095C(u8 dungeon);
s8 GetRescuesAllowed(u8 dungeon); s8 GetRescuesAllowed(u8 dungeon);
u8 GetUnk9(u8 dungeon); bool8 HasCheckpoint(u8 dungeon);
#endif //GUARD_DUNGEON_H #endif //GUARD_DUNGEON_H

View File

@ -25,9 +25,9 @@ const u8 *GetDungeonName2(u8 dungeon)
return gDungeonNames[dungeon].name2; return gDungeonNames[dungeon].name2;
} }
u8 GetStairDirection(u8 dungeon) bool8 IsStairDirectionUp(u8 dungeon)
{ {
return gDungeons[dungeon].stairDirection; return gDungeons[dungeon].stairDirectionUp;
} }
s16 GetTurnLimit(u8 dungeon) s16 GetTurnLimit(u8 dungeon)
@ -40,9 +40,9 @@ bool8 IsForceGameSave(u8 dungeon)
return gDungeons[dungeon].forceGameSave; return gDungeons[dungeon].forceGameSave;
} }
u8 GetUnk9(u8 dungeon) u8 HasCheckpoint(u8 dungeon)
{ {
return gDungeons[dungeon].unk9; return gDungeons[dungeon].hasCheckpoint;
} }
bool8 IsLevelResetTo1(u8 dungeon) bool8 IsLevelResetTo1(u8 dungeon)
@ -70,7 +70,7 @@ bool8 IsRecruitingEnabled(u8 dungeon)
return gDungeons[dungeon].recruitingEnabled; return gDungeons[dungeon].recruitingEnabled;
} }
u8 sub_8090158(u8 dungeon) bool8 IsDungeonUnk8(u8 dungeon)
{ {
return gDungeons[dungeon].unk8; return gDungeons[dungeon].unk8;
} }
@ -111,7 +111,7 @@ void PrintYellowDungeonNametoBuffer(u8 *buffer, struct DungeonLocation *dungeonL
void PrintDungeonLocationtoBuffer(u8 *buffer, struct DungeonLocation *dungeonLocation) void PrintDungeonLocationtoBuffer(u8 *buffer, struct DungeonLocation *dungeonLocation)
{ {
if(gDungeons[dungeonLocation->id].stairDirection != 0){ if(gDungeons[dungeonLocation->id].stairDirectionUp){
sprintfStatic(buffer, gUnknown_8108F18, gDungeonNames[dungeonLocation->id].name1, dungeonLocation->floor); //_F sprintfStatic(buffer, gUnknown_8108F18, gDungeonNames[dungeonLocation->id].name1, dungeonLocation->floor); //_F
} }
else else

View File

@ -131,7 +131,7 @@ bool8 sub_8083C88(u8 param_1)
temp = &gDungeon->unk1CE98; temp = &gDungeon->unk1CE98;
if (((GetUnk9(gDungeon->dungeonLocation.id) == 0) && if ((!HasCheckpoint(gDungeon->dungeonLocation.id) &&
((gDungeon->unk65C != 0) || (param_1 != 0))) || ((gDungeon->unk65C != 0) || (param_1 != 0))) ||
(temp->unk14 != 0x227)) { (temp->unk14 != 0x227)) {
return TRUE; return TRUE;

View File

@ -757,6 +757,32 @@ string generate_learnset_data_text(Json data) {
return text.str(); return text.str();
} }
string generate_dungeon_data_text(Json data) {
ostringstream text;
text << "@ This is auto-generated by dungeon_data.json.\n";
text << ".global gDungeons\n";
text << "gDungeons:";
for (Json data_entry : data.array_items()) {
text << read_json_bool(data_entry["stairDirectionUp"])
<< read_json_bool(data_entry["leaderCanSwitch"])
<< read_json_bool(data_entry["recruitingEnabled"])
<< read_json_int(data_entry["rescuesAllowed"], 1)
<< read_json_int(data_entry["maxItemsAllowed"], 1)
<< read_json_int(data_entry["maxPartyMembers"], 1)
<< read_json_bool(data_entry["levelResetTo1"])
<< read_json_bool(data_entry["moneyResetTo0"])
<< read_json_bool(data_entry["unk8"])
<< read_json_bool(data_entry["hasCheckpoint"])
<< read_json_bool(data_entry["forceGameSave"])
<< read_json_int(data_entry["HMMask"], 1)
<< read_json_int(data_entry["turnLimit"], 2)
<< read_json_int(data_entry["randomMovementChance"], 2);
}
text << TABLE_END;
return text.str();
}
string get_directory_name(string filename) { string get_directory_name(string filename) {
size_t dir_pos = filename.find_last_of("/\\"); size_t dir_pos = filename.find_last_of("/\\");
@ -1041,8 +1067,10 @@ int main(int argc, char *argv[]) {
process_groups(filepath); process_groups(filepath);
} else if (mode == "layouts") { } else if (mode == "layouts") {
process_layouts(filepath); process_layouts(filepath);
} else if (mode == "dungeon") { } else if (mode == "dungeon_pokemon") {
process_json(filepath, "pokemon_found.inc", generate_pokemon_table_text); process_json(filepath, "pokemon_found.inc", generate_pokemon_table_text);
} else if (mode == "dungeon") {
process_json(filepath, "dungeon_data.inc", generate_dungeon_data_text);
} else if (mode == "floor") { } else if (mode == "floor") {
process_json(filepath, "floor_id.inc", generate_floorID_table_text); process_json(filepath, "floor_id.inc", generate_floorID_table_text);
} else if (mode == "monster") { } else if (mode == "monster") {