merge conflicts, review changes, daycare
This commit is contained in:
+3
-1
@@ -434,7 +434,9 @@ static u16 GetEggSpecies(u16 species)
|
||||
static s32 GetSlotToInheritNature(struct DayCare *daycare)
|
||||
{
|
||||
u32 species[DAYCARE_MON_COUNT];
|
||||
s32 i, slot = -1, dittoCount;
|
||||
s32 i;
|
||||
s32 dittoCount;
|
||||
s32 slot = -1;
|
||||
|
||||
// search for female gender
|
||||
for (i = 0; i < DAYCARE_MON_COUNT; i++)
|
||||
|
||||
+2
-2
@@ -1601,7 +1601,7 @@ void sub_81289F0(u8 taskId)
|
||||
ScriptContext1_SetupScript(EventScript_275D1F);
|
||||
}
|
||||
gSprites[sDecor_CameraSpriteObjectIdx1].pos1.y += 2;
|
||||
if (gMapHeader.regionMapSectionId == REGION_MAP_SECRET_BASE)
|
||||
if (gMapHeader.regionMapSectionId == MAPSEC_SECRET_BASE)
|
||||
{
|
||||
TV_PutSecretBaseVisitOnTheAir();
|
||||
}
|
||||
@@ -2220,7 +2220,7 @@ void sub_81298EC(u8 taskId)
|
||||
{
|
||||
StringExpandPlaceholders(gStringVar4, gText_DecorationReturnedToPC);
|
||||
DisplayItemMessageOnField(taskId, gStringVar4, sub_8129D64);
|
||||
if (gMapHeader.regionMapSectionId == REGION_MAP_SECRET_BASE)
|
||||
if (gMapHeader.regionMapSectionId == MAPSEC_SECRET_BASE)
|
||||
{
|
||||
TV_PutSecretBaseVisitOnTheAir();
|
||||
}
|
||||
|
||||
+2
-2
@@ -77,7 +77,7 @@ extern void CreateYesNoMenu(const struct WindowTemplate*, u16, u8, u8);
|
||||
extern void DoNamingScreen(u8, const u8*, u16, u8, u32, MainCallback);
|
||||
extern void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor* colors, s8 speed, u8 *str);
|
||||
extern u16 sub_80D22D0(void);
|
||||
extern u8 sub_80C7050(u8);
|
||||
extern u8 CountPartyAliveNonEggMonsExcept(u8);
|
||||
|
||||
static void Task_EggHatch(u8 taskID);
|
||||
static void CB2_EggHatch_0(void);
|
||||
@@ -890,6 +890,6 @@ u8 GetEggStepsToSubtract(void)
|
||||
u16 sub_80722E0(void)
|
||||
{
|
||||
u16 value = sub_80D22D0();
|
||||
value += sub_80C7050(6);
|
||||
value += CountPartyAliveNonEggMonsExcept(6);
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
|
||||
// Includes
|
||||
#include "global.h"
|
||||
#include "main.h"
|
||||
#include "malloc.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "bg.h"
|
||||
#include "text.h"
|
||||
#include "window.h"
|
||||
#include "text_window.h"
|
||||
#include "palette.h"
|
||||
#include "menu.h"
|
||||
#include "strings.h"
|
||||
#include "international_string_util.h"
|
||||
#include "region_map.h"
|
||||
|
||||
// Static type declarations
|
||||
|
||||
// Static RAM declarations
|
||||
|
||||
static EWRAM_DATA struct {
|
||||
MainCallback callback;
|
||||
u32 filler_004;
|
||||
struct RegionMap regionMap;
|
||||
u16 state;
|
||||
} *sFieldRegionMapHandler = NULL;
|
||||
|
||||
// Static ROM declarations
|
||||
|
||||
static void MCB2_InitRegionMapRegisters(void);
|
||||
static void VBCB_FieldUpdateRegionMap(void);
|
||||
static void MCB2_FieldUpdateRegionMap(void);
|
||||
static void FieldUpdateRegionMap(void);
|
||||
static void PrintRegionMapSecName(void);
|
||||
|
||||
// .rodata
|
||||
|
||||
static const struct BgTemplate gUnknown_085E5068[] = {
|
||||
{
|
||||
.bg = 0,
|
||||
.charBaseIndex = 0,
|
||||
.mapBaseIndex = 31,
|
||||
.screenSize = 0,
|
||||
.paletteMode = 0,
|
||||
.priority = 0,
|
||||
.baseTile = 0
|
||||
}, {
|
||||
.bg = 2,
|
||||
.charBaseIndex = 2,
|
||||
.mapBaseIndex = 28,
|
||||
.screenSize = 2,
|
||||
.paletteMode = 1,
|
||||
.priority = 2,
|
||||
.baseTile = 0
|
||||
}
|
||||
};
|
||||
|
||||
static const struct WindowTemplate gUnknown_085E5070[] = {
|
||||
{ 0, 17, 17, 12, 2, 15, 0x0001 },
|
||||
{ 0, 22, 1, 7, 2, 15, 0x0019 },
|
||||
DUMMY_WIN_TEMPLATE
|
||||
};
|
||||
|
||||
// .text
|
||||
|
||||
void sub_817018C(MainCallback callback)
|
||||
{
|
||||
SetVBlankCallback(NULL);
|
||||
sFieldRegionMapHandler = malloc(sizeof(*sFieldRegionMapHandler));
|
||||
sFieldRegionMapHandler->state = 0;
|
||||
sFieldRegionMapHandler->callback = callback;
|
||||
SetMainCallback2(MCB2_InitRegionMapRegisters);
|
||||
}
|
||||
|
||||
static void MCB2_InitRegionMapRegisters(void)
|
||||
{
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, 0);
|
||||
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG1HOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG1VOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG2HOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG2VOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG3HOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG3VOFS, 0);
|
||||
ResetSpriteData();
|
||||
FreeAllSpritePalettes();
|
||||
ResetBgsAndClearDma3BusyFlags(0);
|
||||
InitBgsFromTemplates(1, gUnknown_085E5068, 2);
|
||||
InitWindows(gUnknown_085E5070);
|
||||
DeactivateAllTextPrinters();
|
||||
sub_809882C(0, 0x27, 0xd0);
|
||||
clear_scheduled_bg_copies_to_vram();
|
||||
SetMainCallback2(MCB2_FieldUpdateRegionMap);
|
||||
SetVBlankCallback(VBCB_FieldUpdateRegionMap);
|
||||
}
|
||||
|
||||
static void VBCB_FieldUpdateRegionMap(void)
|
||||
{
|
||||
LoadOam();
|
||||
ProcessSpriteCopyRequests();
|
||||
TransferPlttBuffer();
|
||||
}
|
||||
|
||||
static void MCB2_FieldUpdateRegionMap(void)
|
||||
{
|
||||
FieldUpdateRegionMap();
|
||||
AnimateSprites();
|
||||
BuildOamBuffer();
|
||||
UpdatePaletteFade();
|
||||
do_scheduled_bg_tilemap_copies_to_vram();
|
||||
}
|
||||
|
||||
static void FieldUpdateRegionMap(void)
|
||||
{
|
||||
u8 offset;
|
||||
|
||||
switch (sFieldRegionMapHandler->state)
|
||||
{
|
||||
case 0:
|
||||
InitRegionMap(&sFieldRegionMapHandler->regionMap, 0);
|
||||
CreateRegionMapPlayerIcon(0, 0);
|
||||
CreateRegionMapCursor(1, 1);
|
||||
sFieldRegionMapHandler->state++;
|
||||
break;
|
||||
case 1:
|
||||
SetWindowBorderStyle(1, 0, 0x27, 0xd);
|
||||
offset = GetStringCenterAlignXOffset(1, gText_Hoenn, 0x38);
|
||||
PrintTextOnWindow(1, 1, gText_Hoenn, offset, 1, 0, NULL);
|
||||
schedule_bg_copy_tilemap_to_vram(0);
|
||||
SetWindowBorderStyle(0, 0, 0x27, 0xd);
|
||||
PrintRegionMapSecName();
|
||||
BeginNormalPaletteFade(-1, 0, 16, 0, 0);
|
||||
sFieldRegionMapHandler->state++;
|
||||
break;
|
||||
case 2:
|
||||
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON);
|
||||
ShowBg(0);
|
||||
ShowBg(2);
|
||||
sFieldRegionMapHandler->state++;
|
||||
break;
|
||||
case 3:
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
sFieldRegionMapHandler->state++;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
switch (sub_81230AC())
|
||||
{
|
||||
case INPUT_EVENT_MOVE_END:
|
||||
PrintRegionMapSecName();
|
||||
break;
|
||||
case INPUT_EVENT_A_BUTTON:
|
||||
case INPUT_EVENT_B_BUTTON:
|
||||
sFieldRegionMapHandler->state++;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
BeginNormalPaletteFade(-1, 0, 0, 16, 0);
|
||||
sFieldRegionMapHandler->state++;
|
||||
break;
|
||||
case 6:
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
FreeRegionMapIconResources();
|
||||
SetMainCallback2(sFieldRegionMapHandler->callback);
|
||||
if (sFieldRegionMapHandler != NULL)
|
||||
{
|
||||
free(sFieldRegionMapHandler);
|
||||
sFieldRegionMapHandler = NULL;
|
||||
}
|
||||
FreeAllWindowBuffers();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void PrintRegionMapSecName(void)
|
||||
{
|
||||
if (sFieldRegionMapHandler->regionMap.iconDrawType != MAPSECTYPE_NONE)
|
||||
{
|
||||
FillWindowPixelBuffer(0, 0x11);
|
||||
PrintTextOnWindow(0, 1, sFieldRegionMapHandler->regionMap.mapSecName, 0, 1, 0, NULL);
|
||||
schedule_bg_copy_tilemap_to_vram(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
FillWindowPixelBuffer(0, 0x11);
|
||||
CopyWindowToVram(0, 3);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
|
||||
// Includes
|
||||
#include "global.h"
|
||||
#include "map_constants.h"
|
||||
#include "heal_location.h"
|
||||
|
||||
#define HEAL_LOCATION(map, x, y) {MAP_GROUP_##map, MAP_ID_##map, x, y}
|
||||
|
||||
// Static type declarations
|
||||
|
||||
// Static RAM declarations
|
||||
|
||||
// Static ROM declarations
|
||||
|
||||
// .rodata
|
||||
|
||||
static const struct HealLocation sHealLocations[] = {
|
||||
HEAL_LOCATION(LITTLEROOT_TOWN_BRENDANS_HOUSE_2F, 4, 2),
|
||||
HEAL_LOCATION(LITTLEROOT_TOWN_MAYS_HOUSE_2F, 4, 2),
|
||||
HEAL_LOCATION(PETALBURG_CITY, 20, 17),
|
||||
HEAL_LOCATION(SLATEPORT_CITY, 19, 20),
|
||||
HEAL_LOCATION(MAUVILLE_CITY, 22, 6),
|
||||
HEAL_LOCATION(RUSTBORO_CITY, 16, 39),
|
||||
HEAL_LOCATION(FORTREE_CITY, 5, 7),
|
||||
HEAL_LOCATION(LILYCOVE_CITY, 24, 15),
|
||||
HEAL_LOCATION(MOSSDEEP_CITY, 28, 17),
|
||||
HEAL_LOCATION(SOOTOPOLIS_CITY, 43, 32),
|
||||
HEAL_LOCATION(EVER_GRANDE_CITY, 27, 49),
|
||||
HEAL_LOCATION(LITTLEROOT_TOWN, 5, 9),
|
||||
HEAL_LOCATION(LITTLEROOT_TOWN, 14, 9),
|
||||
HEAL_LOCATION(OLDALE_TOWN, 6, 17),
|
||||
HEAL_LOCATION(DEWFORD_TOWN, 2, 11),
|
||||
HEAL_LOCATION(LAVARIDGE_TOWN, 9, 7),
|
||||
HEAL_LOCATION(FALLARBOR_TOWN, 14, 8),
|
||||
HEAL_LOCATION(VERDANTURF_TOWN, 16, 4),
|
||||
HEAL_LOCATION(PACIFIDLOG_TOWN, 8, 16),
|
||||
HEAL_LOCATION(EVER_GRANDE_CITY, 18, 6),
|
||||
HEAL_LOCATION(SOUTHERN_ISLAND_EXTERIOR, 15, 20),
|
||||
HEAL_LOCATION(BATTLE_FRONTIER_OUTSIDE_EAST, 3, 52)
|
||||
};
|
||||
|
||||
#define NUM_HEAL_LOCATIONS (ARRAY_COUNT(sHealLocations))
|
||||
|
||||
// .text
|
||||
|
||||
static u32 GetHealLocationIndexFromMapGroupAndNum(u16 mapGroup, u16 mapNum)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < NUM_HEAL_LOCATIONS; i++)
|
||||
{
|
||||
if (sHealLocations[i].group == mapGroup && sHealLocations[i].map == mapNum)
|
||||
{
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct HealLocation *GetHealLocationPointerFromMapGroupAndNum(u16 mapGroup, u16 mapNum)
|
||||
{
|
||||
u32 loc;
|
||||
|
||||
loc = GetHealLocationIndexFromMapGroupAndNum(mapGroup, mapNum);
|
||||
if (loc == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &sHealLocations[loc - 1];
|
||||
}
|
||||
|
||||
const struct HealLocation *GetHealLocationPointer(u32 loc)
|
||||
{
|
||||
if (loc == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (loc > NUM_HEAL_LOCATIONS)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &sHealLocations[loc - 1];
|
||||
}
|
||||
@@ -1,15 +1,122 @@
|
||||
|
||||
// Includes
|
||||
#include "global.h"
|
||||
|
||||
// Static type declarations
|
||||
|
||||
// Static RAM declarations
|
||||
#include "pokemon_storage_system.h"
|
||||
#include "pokemon.h"
|
||||
#include "species.h"
|
||||
#include "event_data.h"
|
||||
#include "string_util.h"
|
||||
#include "text.h"
|
||||
|
||||
IWRAM_DATA u8 gUnknown_03000F78[0x188];
|
||||
|
||||
// Static ROM declarations
|
||||
u8 CountMonsInBox(u8 boxId)
|
||||
{
|
||||
u16 i, count;
|
||||
|
||||
// .rodata
|
||||
for (i = 0, count = 0; i < IN_BOX_COUNT; i++)
|
||||
{
|
||||
if (GetBoxMonDataFromAnyBox(boxId, i, MON_DATA_SPECIES) != SPECIES_NONE)
|
||||
count++;
|
||||
}
|
||||
|
||||
// .text
|
||||
return count;
|
||||
}
|
||||
|
||||
s16 GetFirstFreeBoxSpot(u8 boxId)
|
||||
{
|
||||
u16 i;
|
||||
|
||||
for (i = 0; i < IN_BOX_COUNT; i++)
|
||||
{
|
||||
if (GetBoxMonDataFromAnyBox(boxId, i, MON_DATA_SPECIES) == SPECIES_NONE)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1; // all spots are taken
|
||||
}
|
||||
|
||||
u8 CountPartyNonEggMons(void)
|
||||
{
|
||||
u16 i, count;
|
||||
|
||||
for (i = 0, count = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) != SPECIES_NONE
|
||||
&& !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
u8 CountPartyAliveNonEggMonsExcept(u8 slotToIgnore)
|
||||
{
|
||||
u16 i, count;
|
||||
|
||||
for (i = 0, count = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (i != slotToIgnore
|
||||
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) != SPECIES_NONE
|
||||
&& !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)
|
||||
&& GetMonData(&gPlayerParty[i], MON_DATA_HP) != 0)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
u16 CountPartyAliveNonEggMons_IgnoreVar0x8004Slot(void)
|
||||
{
|
||||
return CountPartyAliveNonEggMonsExcept(gSpecialVar_0x8004);
|
||||
}
|
||||
|
||||
u8 CountPartyMons(void)
|
||||
{
|
||||
u16 i, count;
|
||||
|
||||
for (i = 0, count = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) != SPECIES_NONE)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static u8 *StringCopyAndFillWithSpaces(u8 *dst, const u8 *src, u16 n)
|
||||
{
|
||||
u8 *str;
|
||||
|
||||
for (str = StringCopy(dst, src); str < dst + n; str++)
|
||||
*str = CHAR_SPACE;
|
||||
|
||||
*str = EOS;
|
||||
return str;
|
||||
}
|
||||
|
||||
/* can't match
|
||||
static void sub_80C7128(u16 *dst, u16 dstToAdd, u16 dstToMul, const u16 *src, u16 srcToAdd, u16 srcToMul, u32 size, u16 count, u16 srcBy)
|
||||
{
|
||||
u16 i;
|
||||
|
||||
size <<= 0x11;
|
||||
dst += (dstToMul * 32) + dstToAdd;
|
||||
src += (srcToMul * srcBy) + srcToAdd;
|
||||
|
||||
i = 0;
|
||||
if (i < count)
|
||||
{
|
||||
size >>= 1;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
CpuSet(src, dst, size >> 0x10);
|
||||
dst += 0x20;
|
||||
src += srcBy;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
+1949
File diff suppressed because it is too large
Load Diff
@@ -6432,10 +6432,10 @@ void DoTVShowTodaysRivalTrainer(void)
|
||||
default:
|
||||
sTVShowState = 7;
|
||||
break;
|
||||
case REGION_MAP_SECRET_BASE:
|
||||
case MAPSEC_SECRET_BASE:
|
||||
sTVShowState = 8;
|
||||
break;
|
||||
case REGION_MAP_NONE:
|
||||
case MAPSEC_DYNAMIC:
|
||||
switch (show->rivalTrainer.mapDataId)
|
||||
{
|
||||
case 0x115 ... 0x117:
|
||||
@@ -6633,7 +6633,7 @@ void DoTVShowHoennTreasureInvestigators(void)
|
||||
{
|
||||
case 0:
|
||||
StringCopy(gStringVar1, ItemId_GetItem(show->treasureInvestigators.item)->name);
|
||||
if (show->treasureInvestigators.location == REGION_MAP_NONE)
|
||||
if (show->treasureInvestigators.location == MAPSEC_DYNAMIC)
|
||||
{
|
||||
switch (show->treasureInvestigators.mapDataId)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user