mirror of
https://github.com/pret/pmd-red.git
synced 2026-09-30 12:58:10 -05:00
dungeon info data moved to C
This commit is contained in:
@@ -3,45 +3,7 @@
|
||||
|
||||
|
||||
|
||||
.global gUnknown_8108EC0
|
||||
gUnknown_8108EC0: @ 8108EC0
|
||||
@ replacing .incbin "baserom.gba", 0x108EC0, 0x50
|
||||
.byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
|
||||
.byte 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x10, 0x17, 0x18, 0x19, 0x14, 0x17, 0x1c, 0x1d, 0x1e, 0x1f
|
||||
.byte 0x20, 0x21, 0x1c, 0x23, 0x24, 0x25, 0x1e, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f
|
||||
.byte 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x2d, 0x2d, 0x3b, 0x3c, 0x30, 0x3e, 0x3f
|
||||
.byte 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f
|
||||
|
||||
.global gUnknown_8108F10
|
||||
gUnknown_8108F10: @ 8108F10
|
||||
.string "{color YELLOW_D}%s{reset}\0"
|
||||
.align 2,0
|
||||
|
||||
.global gUnknown_8108F18
|
||||
gUnknown_8108F18: @ 8108F18
|
||||
.string "{color YELLOW_D}%s{reset} {color CYAN}%d{reset}F\0"
|
||||
.align 2,0
|
||||
|
||||
.global gUnknown_8108F2C
|
||||
gUnknown_8108F2C: @ 8108F2C
|
||||
.string "{color YELLOW_D}%s{reset} B{color CYAN}%d{reset}F\0"
|
||||
.align 2,0
|
||||
|
||||
.global gUnknown_8108F40
|
||||
gUnknown_8108F40: @ 8108F40
|
||||
.byte 0x00, 0x00
|
||||
|
||||
.global gUnknown_8108F42
|
||||
gUnknown_8108F42: @ 8108F42
|
||||
.byte 0x99, 0x00, 0x9c, 0x00, 0x9e, 0x00, 0xdb, 0x00
|
||||
|
||||
.global gUnknown_8108F4A
|
||||
gUnknown_8108F4A: @ 8108F4A
|
||||
.byte 0xe1, 0xe7, 0xe6, 0xe2, 0x00, 0x00
|
||||
|
||||
.global gUnknown_8108F50
|
||||
gUnknown_8108F50: @ 8108F50
|
||||
.string "No problem.\0"
|
||||
.align 2,0
|
||||
@ items.c
|
||||
.string "pksdir0\0"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "structs/str_dungeon_location.h"
|
||||
|
||||
extern const u16 *const gRandomItemsSets[];
|
||||
extern const u8 gUnknown_8108EC0[];
|
||||
|
||||
s32 GetDungeonFloorCount(u8 dungeon);
|
||||
s32 GetDungeonStartingFloor(u8 dungeon);
|
||||
|
||||
@@ -79,7 +79,6 @@ s32 CountKecleonShopItems(void);
|
||||
void InitKecleonShopItem(u8 index);
|
||||
BulkItem *GetKecleonShopItem(u8 index);
|
||||
void FillKecleonShopGaps(void);
|
||||
void SortKecleonShopInventory(void);
|
||||
void ChooseKecleonShopInventory(u8 index);
|
||||
bool8 AddKecleonShopItem(u8 itemIndex);
|
||||
u32 CountKecleonWareItems(void);
|
||||
@@ -88,8 +87,7 @@ BulkItem* GetKecleonWareItem(u8 index);
|
||||
void FillKecleonWareGaps(void);
|
||||
void SortKecleonWareInventory(void);
|
||||
void ChooseKecleonWareInventory(u8 index);
|
||||
bool8 AddKecleonWareItem(u8 itemIndex);
|
||||
void FillInventoryGaps();
|
||||
void FillInventoryGaps(void);
|
||||
bool8 AddHeldItemToInventory(BulkItem* slot);
|
||||
bool8 IsNotMoneyOrUsedTMItem(u8 id);
|
||||
bool8 IsNotSpecialItem(u8 id);
|
||||
|
||||
@@ -14,16 +14,8 @@
|
||||
#include "strings.h"
|
||||
#include "dungeon_data.h"
|
||||
|
||||
extern const char gUnknown_8108F10[];
|
||||
extern const char gUnknown_8108F18[];
|
||||
extern const char gUnknown_8108F2C[];
|
||||
extern u8 gUnknown_8108F40[];
|
||||
extern u16 gUnknown_8108F42[];
|
||||
extern u8 gUnknown_8108F4A[4];
|
||||
extern u8 gUnknown_8108F50[];
|
||||
|
||||
static void sub_8090888(u8 *param_1, u8 *param_2);
|
||||
static bool8 sub_8090820(u16 moveID);
|
||||
static void AppendWithNewLines(u8 *dst, const u8 *src);
|
||||
static bool8 TeamMonWithMove(u16 moveID);
|
||||
|
||||
static const u8 sDungeonFloorCount[] = {
|
||||
[DUNGEON_TINY_WOODS] = 4,
|
||||
@@ -2382,6 +2374,16 @@ const u16 *const gRandomItemsSets[] = {
|
||||
[RANDOM_ITEMS_SET_26 - 1] = sRandomItemsSet26,
|
||||
};
|
||||
|
||||
// Values are used for file reading(probably related to dungeon gfx), indexed by gDungeon->tileset
|
||||
const u8 gUnknown_8108EC0[] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 16, 23, 24, 25, 20, 23, 28,
|
||||
29, 30, 31, 32, 33, 28, 35, 36, 37, 30, 39, 40, 41,
|
||||
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
|
||||
55, 56, 45, 45, 59, 60, 48, 62, 63, 64, 65, 66, 67,
|
||||
68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79
|
||||
};
|
||||
|
||||
const u8 *GetDungeonName1(u8 dungeon)
|
||||
{
|
||||
return gDungeonNames[dungeon].name1;
|
||||
@@ -2475,17 +2477,16 @@ void GeneralizeMazeDungeonLoc(DungeonLocation *dst, const DungeonLocation *src)
|
||||
|
||||
void PrintYellowDungeonNametoBuffer(u8 *buffer, DungeonLocation *dungeonLocation)
|
||||
{
|
||||
sprintfStatic(buffer, gUnknown_8108F10, gDungeonNames[dungeonLocation->id].name1); // {color YELLOW_D}%s{reset} (normal floor print (no B)
|
||||
sprintfStatic(buffer, _("{color YELLOW_D}%s{reset}"), gDungeonNames[dungeonLocation->id].name1);
|
||||
}
|
||||
|
||||
void PrintDungeonLocationtoBuffer(u8 *buffer, DungeonLocation *dungeonLocation)
|
||||
{
|
||||
if(gDungeons[dungeonLocation->id].stairDirectionUp){
|
||||
sprintfStatic(buffer, gUnknown_8108F18, gDungeonNames[dungeonLocation->id].name1, dungeonLocation->floor); //_F
|
||||
if (gDungeons[dungeonLocation->id].stairDirectionUp){
|
||||
sprintfStatic(buffer, _("{color YELLOW_D}%s{reset} {color CYAN}%d{reset}F"), gDungeonNames[dungeonLocation->id].name1, dungeonLocation->floor); //_F
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintfStatic(buffer, gUnknown_8108F2C, gDungeonNames[dungeonLocation->id].name1, dungeonLocation->floor); // B _F
|
||||
else {
|
||||
sprintfStatic(buffer, _("{color YELLOW_D}%s{reset} B{color CYAN}%d{reset}F"), gDungeonNames[dungeonLocation->id].name1, dungeonLocation->floor); // B _F
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2542,12 +2543,12 @@ static inline void AddNewLine(const u8 *str, u8 *buffer, u8 *newLine)
|
||||
}
|
||||
|
||||
// I think this checks if the dungeon HM requirement is met
|
||||
u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bool32 param_5_)
|
||||
u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 requireHm_, bool32 param_5_)
|
||||
{
|
||||
s32 maxPartyMembers, i;
|
||||
|
||||
s32 speciesId = (s16) speciesId_;
|
||||
bool32 param_4 = (bool8) (param_4_);
|
||||
bool32 requireHm = (bool8) (requireHm_);
|
||||
bool32 param_5 = (bool8) (param_5_);
|
||||
|
||||
s32 numInvSlots = GetNumberOfFilledInventorySlots();
|
||||
@@ -2561,7 +2562,7 @@ u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bo
|
||||
newLine[0] = '\n';
|
||||
newLine[1] = 0;
|
||||
|
||||
strcpy(buffer,gUnknown_8108F40);
|
||||
InlineStrcpy(buffer,""); // Empty string
|
||||
sp_0xf0 = 0;
|
||||
|
||||
for (i = 0; i < NUM_MONSTERS; i++) {
|
||||
@@ -2575,7 +2576,7 @@ u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bo
|
||||
}
|
||||
|
||||
maxPartyMembers = gDungeons[dungeonIndex].maxPartyMembers;
|
||||
if (!param_4 && maxPartyMembers > 3) {
|
||||
if (!requireHm && maxPartyMembers > 3) {
|
||||
maxPartyMembers = 3;
|
||||
}
|
||||
if (counter > maxPartyMembers) {
|
||||
@@ -2586,7 +2587,7 @@ u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bo
|
||||
gFormatArgs[0] = counter - maxPartyMembers;
|
||||
AddNewLine(gText_TooManyMembersToEnterDungeon,text,newLine);
|
||||
}
|
||||
sub_8090888(buffer,text);
|
||||
AppendWithNewLines(buffer,text);
|
||||
r8 = TRUE;
|
||||
}
|
||||
|
||||
@@ -2594,7 +2595,7 @@ u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bo
|
||||
gFormatArgs[0] = gDungeons[dungeonIndex].maxItemsAllowed;
|
||||
gFormatArgs[1] = numInvSlots - gDungeons[dungeonIndex].maxItemsAllowed;
|
||||
AddNewLine((!r8) ? gText_OnlyXItemsMayBeBroughtIntoDungeon : gText_AlsoOnlyXItemsMayBeBroughtIntoDungeon, text, newLine);
|
||||
sub_8090888(buffer,text);
|
||||
AppendWithNewLines(buffer,text);
|
||||
r8 = TRUE;
|
||||
}
|
||||
|
||||
@@ -2604,7 +2605,7 @@ u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bo
|
||||
CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[0],speciesId);
|
||||
if (counter > 3) {
|
||||
AddNewLine((!r8) ? gText_ClientCouldNotJoinTooManyMembers : gText_AlsoClientCouldNotJoinTooManyMembers, text,newLine);
|
||||
sub_8090888(buffer,text);
|
||||
AppendWithNewLines(buffer,text);
|
||||
r8 = TRUE;
|
||||
}
|
||||
bodySize = GetBodySize(speciesId);
|
||||
@@ -2617,21 +2618,18 @@ u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bo
|
||||
}
|
||||
if (bodySize > 6) {
|
||||
AddNewLine((!r8) ? gText_ClientCouldNotJoinNoSpace : gText_AlsoClientCouldNotJoinNoSpace, text,newLine);
|
||||
sub_8090888(buffer,text);
|
||||
AppendWithNewLines(buffer,text);
|
||||
r8 = TRUE;
|
||||
}
|
||||
}
|
||||
if (param_4) {
|
||||
|
||||
if (requireHm) {
|
||||
s32 i;
|
||||
//u16 local_4c[4] = {0x99, 0x9C, 0x9b, 0xdb};
|
||||
//u8 local_44[4] = {0xe1, 0xe7, 0xe6, 0xe2};
|
||||
u16 local_4c[4];
|
||||
u8 local_44[4];
|
||||
memcpy(local_4c,gUnknown_8108F42,8);
|
||||
memcpy(local_44,gUnknown_8108F4A,4);
|
||||
u16 movesNeeded[4] = {MOVE_FLY, MOVE_DIVE, MOVE_WATERFALL, MOVE_SURF};
|
||||
u8 hmsNeeded[4] = {ITEM_HM_FLY, ITEM_HM_DIVE, ITEM_HM_WATERFALL, ITEM_HM_SURF};
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if ((((gDungeons[dungeonIndex].HMMask >> (i) & 1) != 0) && !sub_8090820(local_4c[i])) && GetItemPossessionCount(local_44[i]) == 0) {
|
||||
if ((((gDungeons[dungeonIndex].HMMask >> (i) & 1) != 0) && !TeamMonWithMove(movesNeeded[i])) && GetItemPossessionCount(hmsNeeded[i]) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2639,10 +2637,10 @@ u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bo
|
||||
if (i < 4) {
|
||||
struct Move move;
|
||||
|
||||
InitPokemonMove(&move,local_4c[i]);
|
||||
InitPokemonMove(&move,movesNeeded[i]);
|
||||
BufferMoveName(gFormatBuffer_Items[0],&move,0);
|
||||
AddNewLine((!r8) ? gText_MustHaveMonWithMove : gText_AlsoMustHaveMonWithMove, text,newLine);
|
||||
sub_8090888(buffer,text);
|
||||
AppendWithNewLines(buffer,text);
|
||||
r8 = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -2666,7 +2664,7 @@ u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bo
|
||||
}
|
||||
if (otherSpeciesId == NUM_MONSTERS) {
|
||||
AddNewLine((!r8) ? gText_MustHaveWaterTypeMon : gText_AlsoMustHaveWaterTypeMon, text,newLine);
|
||||
sub_8090888(buffer,text);
|
||||
AppendWithNewLines(buffer,text);
|
||||
r8 = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -2717,12 +2715,12 @@ u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bo
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
sprintfStatic(buffer,gUnknown_8108F50);
|
||||
sprintfStatic(buffer,_("No problem."));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static bool8 sub_8090820(u16 moveID)
|
||||
static bool8 TeamMonWithMove(u16 moveID)
|
||||
{
|
||||
s32 speciesId, moveIndex;
|
||||
|
||||
@@ -2740,30 +2738,30 @@ static bool8 sub_8090820(u16 moveID)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void sub_8090888(u8 *param_1, u8 *param_2)
|
||||
static void AppendWithNewLines(u8 *dst, const u8 *src)
|
||||
{
|
||||
s32 iVar3 = 0;
|
||||
s32 newLinesCount = 0;
|
||||
|
||||
while (*param_1 != '\0') {
|
||||
switch (*param_1) {
|
||||
while (*dst != '\0') {
|
||||
switch (*dst) {
|
||||
case '\n':
|
||||
iVar3++;
|
||||
newLinesCount++;
|
||||
break;
|
||||
}
|
||||
param_1++;
|
||||
dst++;
|
||||
}
|
||||
|
||||
while (iVar3 % 3) {
|
||||
*param_1++ = '\n';
|
||||
iVar3++;
|
||||
while (newLinesCount % 3) {
|
||||
*dst++ = '\n';
|
||||
newLinesCount++;
|
||||
}
|
||||
|
||||
while (*param_2 != '\0') {
|
||||
*param_1++ = *param_2;
|
||||
param_2++;
|
||||
while (*src != '\0') {
|
||||
*dst++ = *src;
|
||||
src++;
|
||||
}
|
||||
|
||||
*param_1 = '\0';
|
||||
*dst = '\0';
|
||||
}
|
||||
|
||||
u32 GetDungeonLocMissionDifficulty(DungeonLocation *dungeon)
|
||||
|
||||
@@ -11,14 +11,13 @@
|
||||
#include "dungeon_leader.h"
|
||||
#include "dungeon_map.h"
|
||||
#include "dungeon_logic.h"
|
||||
#include "dungeon_info.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "game_options.h"
|
||||
#include "random.h"
|
||||
#include "text_1.h"
|
||||
#include "code_806CD90.h"
|
||||
|
||||
extern u8 gUnknown_8108EC0[];
|
||||
|
||||
extern void sub_8042A14(DungeonPos *);
|
||||
|
||||
EWRAM_DATA OpenedFile *gDungeonPaletteFile = {0};
|
||||
|
||||
25
src/items.c
25
src/items.c
@@ -21,7 +21,6 @@ extern const char gItemParaFileName[];
|
||||
extern const char gUnknown_8109794[];
|
||||
extern const char gUnknown_81097A4[];
|
||||
extern s32 gPowersOfTen[];
|
||||
extern u8 gHighDigits[];
|
||||
extern u16 gGummiStatBoostLUT[];
|
||||
extern u32 gUnknown_81097E8[4]; // some sort of lookup table (16, 18, 20, 22)
|
||||
extern u32 gUnknown_81097F8[4]; // some sort of lookup table (17, 19, 21, 23)
|
||||
@@ -38,8 +37,8 @@ EWRAM_DATA ItemDataEntry *gItemParametersData = {NULL}; // NDS=0213BEF0
|
||||
EWRAM_DATA TeamInventory gTeamInventory = {0}; // NDS=0213BEF8
|
||||
EWRAM_INIT TeamInventory *gTeamInventoryRef = {NULL}; // NDS=020EAF98
|
||||
|
||||
extern void SortKecleonShopInventory();
|
||||
bool8 AddKecleonWareItem(u8);
|
||||
static void SortKecleonShopInventory(void);
|
||||
static bool8 AddKecleonWareItem(u8 itemIndex);
|
||||
|
||||
static void sub_8090F58(u8 *, u8 *, Item *, const unkStruct_8090F58 *);
|
||||
|
||||
@@ -407,6 +406,8 @@ static void sub_8090F58(u8* a1, u8 *a2, Item *slot, const struct unkStruct_8090F
|
||||
}
|
||||
}
|
||||
|
||||
extern u8 gHighDigits[][2];
|
||||
|
||||
// arm9.bin::020606E0
|
||||
s32 WriteHighDecimal(s32 a1, u8 *strbuf, u8 a3)
|
||||
{
|
||||
@@ -429,13 +430,13 @@ s32 WriteHighDecimal(s32 a1, u8 *strbuf, u8 a3)
|
||||
|
||||
if (div) {
|
||||
cond = 1;
|
||||
*strbuf++ = gHighDigits[2 * div];
|
||||
*strbuf++ = (gHighDigits + 1)[2 * div]; // weird staggered arrays...
|
||||
*strbuf++ = gHighDigits[div][0];
|
||||
*strbuf++ = gHighDigits[div][1];
|
||||
count++;
|
||||
}
|
||||
else if (cond) {
|
||||
*strbuf++ = gHighDigits[0];
|
||||
*strbuf++ = (gHighDigits + 1)[0]; // weird staggered arrays...
|
||||
*strbuf++ = gHighDigits[0][0];
|
||||
*strbuf++ = gHighDigits[0][1];
|
||||
count++;
|
||||
}
|
||||
else if (a3) {
|
||||
@@ -443,15 +444,15 @@ s32 WriteHighDecimal(s32 a1, u8 *strbuf, u8 a3)
|
||||
}
|
||||
}
|
||||
|
||||
*strbuf++ = gHighDigits[2 * a1];
|
||||
*strbuf = (gHighDigits + 1)[2 * a1];
|
||||
*strbuf++ = gHighDigits[a1][0];
|
||||
*strbuf = gHighDigits[a1][1];
|
||||
count += 1;
|
||||
strbuf[1] = 0; // null termination
|
||||
return count;
|
||||
}
|
||||
|
||||
// arm9.bin::02060614
|
||||
void FillInventoryGaps()
|
||||
void FillInventoryGaps(void)
|
||||
{
|
||||
// fill inventory gaps
|
||||
s32 slot_checking = 0;
|
||||
@@ -978,7 +979,7 @@ void FillKecleonShopGaps(void)
|
||||
}
|
||||
|
||||
// arm9.bin::0205F94C
|
||||
void SortKecleonShopInventory(void)
|
||||
static void SortKecleonShopInventory(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
@@ -1139,7 +1140,7 @@ void ChooseKecleonWareInventory(u8 index)
|
||||
}
|
||||
|
||||
// arm9.bin::0205F590
|
||||
bool8 AddKecleonWareItem(u8 itemIndex)
|
||||
static bool8 AddKecleonWareItem(u8 itemIndex)
|
||||
{
|
||||
BulkItem held;
|
||||
s32 i;
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
extern bool8 IsWaterDungeon(u32 r0);
|
||||
|
||||
extern const u8 gUnknown_8108EC0[];
|
||||
|
||||
static s32 sub_80ADFB8(s32 a0, s32 a1, s32 a2, s32 a3, u16 *a4, s32 a5, u8 *a6, s32 a7);
|
||||
|
||||
// This function is called when loading a transition between a dungeon and its summit, where the player can continue, save, or go back.
|
||||
|
||||
Reference in New Issue
Block a user