Merge pull request #123 from AnonymousRandomPerson/master

Dumped dungeon parameters
This commit is contained in:
Cheng Hann Gan
2023-02-14 11:54:09 -05:00
committed by GitHub
22 changed files with 1786 additions and 74 deletions

View File

@@ -175,6 +175,7 @@ include dungeon_trap.mk
include data_monster.mk
include data_item.mk
include data_move.mk
include data_dungeon.mk
include graphics.mk
$(TOOLDIRS):
@@ -197,6 +198,7 @@ tidy:
$(RM) -f $(MONSTER_DATA)
$(RM) -f $(LEARNSET_DATA)
$(RM) -f $(LEARNSET_PTRS)
$(RM) -f $(DUNGEON_DATA)
$(RM) -f $(DUNGEON_FLOOR)
$(RM) -f $(DUNGEON_POKEMON)
$(RM) -f $(DUNGEON_TRAP)
@@ -220,7 +222,7 @@ $(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.c
$(C_BUILDDIR)/%.d: $(C_SUBDIR)/%.c
@$(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
@$(PREPROC) $(DATA_ASM_BUILDDIR)/$*.i.s charmap.txt > $(DATA_ASM_BUILDDIR)/$*.s
$(AS) $(ASFLAGS) -o $@ $(DATA_ASM_BUILDDIR)/$*.s

View File

@@ -870,7 +870,7 @@ _08000D36:
cmp r4, 0x63
beq _08000D70
adds r0, r4, 0
bl GetSaveBeforeEntering
bl IsForceGameSave
lsls r0, 24
cmp r0, 0
beq _08000D70
@@ -961,7 +961,7 @@ _08000E00:
b _08000E1E
_08000E0C:
adds r0, r6, 0
bl GetSaveBeforeEntering
bl IsForceGameSave
lsls r0, 24
cmp r0, 0
bne _08000E1E

View File

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

View File

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

View File

@@ -636,7 +636,7 @@ _08042FB6:
str r0, [r2]
str r1, [r2, 0x4]
ldrb r0, [r5, 0x4]
bl GetUnkC
bl GetTurnLimit
ldr r1, [r4]
ldr r5, _08043124
adds r2, r1, r5
@@ -646,7 +646,7 @@ _08042FB6:
strb r7, [r1]
mov r1, r8
ldrb r0, [r1, 0x4]
bl GetUnk3
bl GetRescuesAllowed
ldr r1, [r4]
ldr r2, _0804312C
adds r1, r2
@@ -896,7 +896,7 @@ _08043230:
ldr r5, _080432BC
adds r0, r5
ldrb r0, [r0]
bl GetLevelCondition
bl IsLevelResetTo1
lsls r0, 24
mov r4, r8
adds r4, 0x1C
@@ -1256,7 +1256,7 @@ _08043544:
ldr r1, _080435C4
adds r0, r1
ldrb r0, [r0]
bl GetUnkC
bl GetTurnLimit
ldr r2, [r5]
ldr r3, _080435C8
adds r1, r2, r3
@@ -2665,7 +2665,7 @@ sub_8044124:
ldr r1, _080441B0
adds r0, r1
ldrb r0, [r0]
bl GetMaxItemCount
bl GetMaxItemsAllowed
cmp r0, 0
bne _08044182
movs r3, 0
@@ -2714,7 +2714,7 @@ _08044182:
ldr r2, _080441B0
adds r0, r2
ldrb r0, [r0]
bl GetMoneyCondition
bl IsMoneyResetTo0
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0

View File

@@ -7423,7 +7423,7 @@ _080614C8:
ldr r3, _08061578
adds r0, r1, r3
ldrb r0, [r0]
bl sub_8090158
bl IsDungeonUnk8
lsls r0, 24
cmp r0, 0
beq _0806154C
@@ -16768,7 +16768,7 @@ sub_8065FB4:
ldr r1, _08065FE8
adds r0, r1
ldrb r0, [r0]
bl GetRecruitable
bl IsRecruitingEnabled
lsls r0, 24
cmp r0, 0
bne _08065FF0
@@ -21916,7 +21916,7 @@ _08068922:
ldr r1, _08068A6C
adds r0, r1
ldrb r0, [r0]
bl GetLevelCondition
bl IsLevelResetTo1
lsls r0, 24
cmp r0, 0
beq _08068A06
@@ -22333,7 +22333,7 @@ _08068C96:
ldr r1, _08068CD8
adds r0, r1
ldrb r0, [r0]
bl GetLevelCondition
bl IsLevelResetTo1
lsls r0, 24
cmp r0, 0
beq _08068CDC
@@ -23050,7 +23050,7 @@ _08069228:
ldr r1, _080692D4
adds r0, r1
ldrb r0, [r0]
bl GetLevelCondition
bl IsLevelResetTo1
lsls r0, 24
cmp r0, 0
bne _0806926E
@@ -23249,7 +23249,7 @@ _080693CC:
ldr r1, _080694B0
adds r0, r1
ldrb r0, [r0]
bl GetLevelCondition
bl IsLevelResetTo1
lsls r0, 24
cmp r0, 0
bne _0806940E

View File

@@ -2030,7 +2030,7 @@ _0806E040:
ldr r1, _0806E0C0
adds r0, r1
ldrb r0, [r0]
bl GetDungeonUnk1
bl CanLeaderSwitch
lsls r0, 24
cmp r0, 0
beq _0806E066

View File

@@ -1510,7 +1510,7 @@ _0806F6F0:
ldr r2, _0806F834
adds r0, r3, r2
ldrb r0, [r0]
bl GetRecruitable
bl IsRecruitingEnabled
lsls r0, 24
cmp r0, 0
bne _0806F702

View File

@@ -224,7 +224,7 @@ _08071CDC:
ldr r2, _08071D28
adds r0, r2
ldrb r0, [r0]
bl sub_8090168
bl GetRandomMovementChance
lsls r0, 16
asrs r0, 16
cmp r4, r0

View File

@@ -120,7 +120,7 @@ _08095BEE:
bl sub_803C37C
_08095C10:
ldrb r0, [r4, 0x4]
bl GetMaxItemCount
bl GetMaxItemsAllowed
adds r1, r0, 0
cmp r1, 0
bne _08095C28

View File

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

View File

@@ -1,3 +1,4 @@
**/pokemon_found.inc
**/floor_id.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);
$(DUNGEONS_DIR)/%/pokemon_found.inc: $(DUNGEONS_DIR)/%/pokemon_found.json
$(DUNGEONJSON) dungeon pmd-red $<
$(DUNGEONJSON) dungeon_pokemon pmd-red $<

View File

@@ -11,20 +11,20 @@ struct DungeonName
struct DungeonDataEntry
{
u8 stairDirection;
u8 unk1;
bool8 isRecruitable;
s8 unk3;
u8 maxItemCount;
u8 maxPartySize;
u8 levelCondition;
u8 moneyCondition;
u8 unk8;
u8 unk9;
bool8 saveBeforeEntering; //whether to quicksave or not before entering
u8 unkB; // Apparently is a HM mask (Fly, Dive, Waterfall, Surf, Water)
s16 timer;
s16 unkE;
/* 0x0 */ bool8 stairDirectionUp;
/* 0x1 */ bool8 leaderCanSwitch;
/* 0x2 */ bool8 recruitingEnabled;
/* 0x3 */ s8 rescuesAllowed;
/* 0x4 */ u8 maxItemsAllowed;
/* 0x5 */ u8 maxPartyMembers;
/* 0x6 */ bool8 levelResetTo1;
/* 0x7 */ bool8 moneyResetTo0;
/* 0x8 */ bool8 unk8;
/* 0x9 */ bool8 hasCheckpoint;
/* 0xA */ bool8 forceGameSave; // Whether to quicksave or not before entering.
/* 0xB */ u8 HMMask; // HM mask for dungeon entry requirements (Fly, Dive, Waterfall, Surf, Water).
/* 0xC */ s16 turnLimit;
/* 0xE */ s16 randomMovementChance; // The chance that a wild Pokémon's moveRandomly flag will be set when spawning, causing them to move randomly inside a room instead of exploring rooms.
};
extern struct DungeonDataEntry gDungeons[];
@@ -33,7 +33,7 @@ const u8 *GetDungeonName1(u8 dungeon);
u32 sub_80908D8(struct DungeonLocation *dungeon);
u8 sub_8090910(struct DungeonLocation *dungeon, u32 param_2);
bool8 sub_809095C(u8 dungeon);
s8 GetUnk3(u8 dungeon);
u8 GetUnk9(u8 dungeon);
s8 GetRescuesAllowed(u8 dungeon);
bool8 HasCheckpoint(u8 dungeon);
#endif //GUARD_DUNGEON_H

View File

@@ -185,8 +185,8 @@ struct EntityInfo
/* 0x10D */ u8 speedDownCounters[NUM_SPEED_COUNTERS];
/* 0x112 */ u8 stockpileStage;
u8 fill113;
// When non-zero, an AI Pokémon will move in a random direction every turn.
// Unclear where this is set in-game; it is not set by statuses (e.g., confusion) or mission clients.
// When non-zero, an AI Pokémon will move in a random direction every turn when it is a room.
// There is a chance of this flag being set when a wild Pokémon spawns. The chance depends on the dungeon's randomMovementChance.
/* 0x114 */ u32 moveRandomly;
/* 0x118 */ struct Move moves[MAX_MON_MOVES];
/* 0x138 */ u8 struggleMoveFlags;

View File

@@ -205,7 +205,7 @@ void sub_809542C(struct unkStruct_809542C *param_1)
PrintPokeNameToBuffer(buffer, GetPlayerPokemonStruct());
CopyStringtoBuffer(gUnknown_203B480->playerName, buffer);
gUnknown_203B480->unk24 = sub_8011C34();
gUnknown_203B480->unk2C = GetUnk3(gUnknown_203B480->dungeon.id);
gUnknown_203B480->unk2C = GetRescuesAllowed(gUnknown_203B480->dungeon.id);
}
void sub_8095494(struct unkStruct_809542C *param_1, u8 index)

View File

@@ -17,7 +17,7 @@ extern bool8 IsInvalidItemReward(u8);
extern u8 sub_803C1D0(struct DungeonLocation *, u8);
extern bool8 IsNotMoneyOrUsedTMItem(u8);
extern u8 xxx_bit_lut_lookup_8091E50(u8 ,u8 );
extern u32 GetMaxItemCount(u8);
extern u32 GetMaxItemsAllowed(u8);
extern bool8 sub_803C0DC(s16);
extern void ResetMailboxSlot(u8);
extern void ResetPelipperBoardSlot(u8);
@@ -90,7 +90,7 @@ bool8 ValidateWonderMail(struct WonderMail *data)
return FALSE;
else
{
if(data->missionType == WONDER_MAIL_MISSION_TYPE_DELIVER_ITEM && GetMaxItemCount(data->dungeon.id) == 0)
if(data->missionType == WONDER_MAIL_MISSION_TYPE_DELIVER_ITEM && GetMaxItemsAllowed(data->dungeon.id) == 0)
return FALSE;
if(data->unk2 > 9)

View File

@@ -25,59 +25,59 @@ const u8 *GetDungeonName2(u8 dungeon)
return gDungeonNames[dungeon].name2;
}
u8 GetStairDirection(u8 dungeon)
bool8 IsStairDirectionUp(u8 dungeon)
{
return gDungeons[dungeon].stairDirection;
return gDungeons[dungeon].stairDirectionUp;
}
s16 GetUnkC(u8 dungeon)
s16 GetTurnLimit(u8 dungeon)
{
return gDungeons[dungeon].timer;
return gDungeons[dungeon].turnLimit;
}
bool8 GetSaveBeforeEntering(u8 dungeon)
bool8 IsForceGameSave(u8 dungeon)
{
return gDungeons[dungeon].saveBeforeEntering;
return gDungeons[dungeon].forceGameSave;
}
u8 GetUnk9(u8 dungeon)
u8 HasCheckpoint(u8 dungeon)
{
return gDungeons[dungeon].unk9;
return gDungeons[dungeon].hasCheckpoint;
}
u8 GetLevelCondition(u8 dungeon)
bool8 IsLevelResetTo1(u8 dungeon)
{
return gDungeons[dungeon].levelCondition;
return gDungeons[dungeon].levelResetTo1;
}
u8 GetMaxItemCount(u8 dungeon)
u8 GetMaxItemsAllowed(u8 dungeon)
{
return gDungeons[dungeon].maxItemCount;
return gDungeons[dungeon].maxItemsAllowed;
}
u8 GetMoneyCondition(u8 dungeon)
bool8 IsMoneyResetTo0(u8 dungeon)
{
return gDungeons[dungeon].moneyCondition;
return gDungeons[dungeon].moneyResetTo0;
}
s8 GetUnk3(u8 dungeon)
s8 GetRescuesAllowed(u8 dungeon)
{
return gDungeons[dungeon].unk3;
return gDungeons[dungeon].rescuesAllowed;
}
bool8 GetRecruitable(u8 dungeon)
bool8 IsRecruitingEnabled(u8 dungeon)
{
return gDungeons[dungeon].isRecruitable;
return gDungeons[dungeon].recruitingEnabled;
}
u8 sub_8090158(u8 dungeon)
bool8 IsDungeonUnk8(u8 dungeon)
{
return gDungeons[dungeon].unk8;
}
s16 sub_8090168(u8 dungeon)
s16 GetRandomMovementChance(u8 dungeon)
{
return gDungeons[dungeon].unkE;
return gDungeons[dungeon].randomMovementChance;
}
bool8 sub_809017C(struct DungeonLocation* a1) {
@@ -111,7 +111,7 @@ void PrintYellowDungeonNametoBuffer(u8 *buffer, struct DungeonLocation *dungeonL
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
}
else
@@ -159,7 +159,7 @@ void RestoreDungeonLocation(struct unkStruct_8094924* r0, struct DungeonLocation
RestoreIntegerBits(r0, &r1->floor, 0x7);
}
u8 GetDungeonUnk1(u8 dungeon)
bool8 CanLeaderSwitch(u8 dungeon)
{
return gDungeons[dungeon].unk1;
return gDungeons[dungeon].leaderCanSwitch;
}

View File

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

View File

@@ -757,6 +757,32 @@ string generate_learnset_data_text(Json data) {
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) {
size_t dir_pos = filename.find_last_of("/\\");
@@ -1041,8 +1067,10 @@ int main(int argc, char *argv[]) {
process_groups(filepath);
} else if (mode == "layouts") {
process_layouts(filepath);
} else if (mode == "dungeon") {
} else if (mode == "dungeon_pokemon") {
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") {
process_json(filepath, "floor_id.inc", generate_floorID_table_text);
} else if (mode == "monster") {