merge overworld with master

This commit is contained in:
DizzyEggg
2018-02-14 01:12:17 +01:00
46 changed files with 2827 additions and 7155 deletions

View File

@@ -49,6 +49,8 @@ struct TrainerBattleParameter
u8 ptrType;
};
extern void (*gFieldCallback)(void);
extern bool8 InBattlePyramid(void);
extern bool8 InBattlePike(void);
extern bool32 InTrainerHill(void);

93
src/birch_pc.c Normal file
View File

@@ -0,0 +1,93 @@
#include "global.h"
#include "event_data.h"
#include "field_message_box.h"
#include "pokedex.h"
#include "constants/species.h"
#include "strings.h"
extern u16 gSpecialVar_0x8004;
extern u16 gSpecialVar_0x8005;
extern u16 gSpecialVar_0x8006;
bool16 ScriptGetPokedexInfo(void)
{
if (gSpecialVar_0x8004 == 0) // is national dex not present?
{
gSpecialVar_0x8005 = GetHoennPokedexCount(0);
gSpecialVar_0x8006 = GetHoennPokedexCount(1);
}
else
{
gSpecialVar_0x8005 = GetNationalPokedexCount(0);
gSpecialVar_0x8006 = GetNationalPokedexCount(1);
}
return IsNationalPokedexEnabled();
}
// This shows your Hoenn Pokedex rating and not your National Dex.
const u8 *GetPokedexRatingText(u16 count)
{
if (count < 10)
return gBirchDexRatingText_LessThan10;
if (count < 20)
return gBirchDexRatingText_LessThan20;
if (count < 30)
return gBirchDexRatingText_LessThan30;
if (count < 40)
return gBirchDexRatingText_LessThan40;
if (count < 50)
return gBirchDexRatingText_LessThan50;
if (count < 60)
return gBirchDexRatingText_LessThan60;
if (count < 70)
return gBirchDexRatingText_LessThan70;
if (count < 80)
return gBirchDexRatingText_LessThan80;
if (count < 90)
return gBirchDexRatingText_LessThan90;
if (count < 100)
return gBirchDexRatingText_LessThan100;
if (count < 110)
return gBirchDexRatingText_LessThan110;
if (count < 120)
return gBirchDexRatingText_LessThan120;
if (count < 130)
return gBirchDexRatingText_LessThan130;
if (count < 140)
return gBirchDexRatingText_LessThan140;
if (count < 150)
return gBirchDexRatingText_LessThan150;
if (count < 160)
return gBirchDexRatingText_LessThan160;
if (count < 170)
return gBirchDexRatingText_LessThan170;
if (count < 180)
return gBirchDexRatingText_LessThan180;
if (count < 190)
return gBirchDexRatingText_LessThan190;
if (count < 200)
return gBirchDexRatingText_LessThan200;
if (count == 200)
{
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1)
|| GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // Jirachi or Deoxys is not counted towards the dex completion. If either of these flags are enabled, it means the actual count is less than 200.
return gBirchDexRatingText_LessThan200;
return gBirchDexRatingText_DexCompleted;
}
if (count == 201)
{
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1)
&& GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // If both of these flags are enabled, it means the actual count is less than 200.
return gBirchDexRatingText_LessThan200;
return gBirchDexRatingText_DexCompleted;
}
if (count == 202)
return gBirchDexRatingText_DexCompleted; // Hoenn dex is considered complete, even though the hoenn dex count is 210.
return gBirchDexRatingText_LessThan10;
}
void ShowPokedexRatingMessage(void)
{
ShowFieldMessage(GetPokedexRatingText(gSpecialVar_0x8004));
}

View File

@@ -38,6 +38,8 @@
#include "decoration.h"
#include "graphics.h"
extern void (*gFieldCallback)(void);
// Static type declarations
#define OVERWORLD_PLACE_DECOR_SELECTOR_PAL_TAG 0xbe5

2448
src/item_menu.c Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
#include "global.h"
#include "item_use.h"
#include "battle.h"
#include "main.h"
#include "berry.h"
#include "bike.h"
#include "coins.h"
@@ -90,6 +91,7 @@ extern u8* sub_806CF78(u16);
extern void sub_81B89F0(void);
extern u8 GetItemEffectType(u16);
extern struct MapConnection *sub_8088A8C(s16, s16);
extern void (*gFieldCallback)(void);
void MapPostLoadHook_UseItem(void);
void sub_80AF6D4(void);
@@ -113,13 +115,13 @@ void sub_80FE024(u8 taskId);
void sub_80FE124(u8 taskId);
void sub_80FE164(u8 taskId);
void DisplayItemMessage(u8 taskId, u8 a, u8* str, void(*callback)(u8 taskId));
void DisplayItemMessage(u8 taskId, u8 a, const u8* str, void(*callback)(u8 taskId));
void DisplayItemMessageInBattlePyramid(u8 taskId, u8* str, void(*callback)(u8 taskId));
void DisplayItemMessageOnField(u8 taskId, u8* str, void(*callback)(u8 taskId));
void sub_81C6714(u8 taskId);
void CleanUpAfterFailingToUseRegisteredKeyItemOnField(u8 taskId);
void StartFishing(u8 a);
bool8 ItemfinderCheckForHiddenItems(struct MapEvents *, u8);
bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *, u8);
u8 sub_80FD9B0(s16 a, s16 b);
void sub_80FDA24(u8 a);
void sub_80FD8E0(u8 taskId, s16 x, s16 y);
@@ -363,7 +365,7 @@ void sub_80FD5CC(u8 taskId)
DestroyTask(taskId);
}
bool8 ItemfinderCheckForHiddenItems(struct MapEvents *events, u8 taskId)
bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *events, u8 taskId)
{
int distanceX, distanceY;
s16 x, y, i, newDistanceX, newDistanceY;
@@ -390,7 +392,7 @@ bool8 ItemfinderCheckForHiddenItems(struct MapEvents *events, u8 taskId)
return FALSE;
}
bool8 sub_80FD6D4(struct MapEvents *events, s16 x, s16 y)
bool8 sub_80FD6D4(const struct MapEvents *events, s16 x, s16 y)
{
u8 bgEventCount = events->bgEventCount;
struct BgEvent *bgEvent = events->bgEvents;

View File

@@ -63,7 +63,7 @@ static EWRAM_DATA void *gUnknown_0203CDAC[0x20] = {NULL};
const u16 gUnknown_0860F074[] = INCBIN_U16("graphics/interface/860F074.gbapal");
static const u8 gUnknown_0860F094[] = { 8, 4, 1 };
static const struct WindowTemplate gUnknown_0860F098[] =
static const struct WindowTemplate gUnknown_0860F098[] =
{
{ 0x00, 0x02, 0x0F, 0x1B, 0x04, 0x0F, 0x194 },
DUMMY_WIN_TEMPLATE
@@ -76,7 +76,7 @@ static const struct WindowTemplate gUnknown_0860F0A8 =
const u16 gUnknown_0860F0B0[] = INCBIN_U16("graphics/interface/860F0B0.gbapal");
const u8 gUnknown_0860F0D0[] = { 15, 1, 2 };
const struct SomeUnkStruct_60F0D4 gUnknown_0860F0D4[] =
const struct SomeUnkStruct_60F0D4 gUnknown_0860F0D4[] =
{
{ 12, 12, 0x00 },
{ 32, 12, 0x20 },
@@ -151,7 +151,7 @@ u16 sub_8197224(void)
u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 fgColor, u8 bgColor, u8 shadowColor)
{
struct TextSubPrinter printer;
printer.current_text_offset = str;
printer.windowId = windowId;
printer.fontId = fontId;
@@ -165,9 +165,9 @@ u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 speed,
printer.fgColor = fgColor;
printer.bgColor = bgColor;
printer.shadowColor = shadowColor;
gTextFlags.flag_1 = 0;
return AddTextPrinter(&printer, speed, callback);
return AddTextPrinter(&printer, speed, callback);
}
void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress)
@@ -234,7 +234,7 @@ void sub_819746C(u8 windowId, bool8 copyToVram)
void DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
{
int i;
FillBgTilemapBufferRect(bg,
STD_WINDOW_BASE_TILE_NUM + 0,
tilemapLeft - 1,
@@ -256,7 +256,7 @@ void DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height
1,
1,
STD_WINDOW_PALETTE_NUM);
for (i = tilemapTop; i < tilemapTop + height; i++)
{
FillBgTilemapBufferRect(bg,
@@ -274,7 +274,7 @@ void DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height
1,
STD_WINDOW_PALETTE_NUM);
}
FillBgTilemapBufferRect(bg,
STD_WINDOW_BASE_TILE_NUM + 6,
tilemapLeft - 1,
@@ -1941,7 +1941,7 @@ void box_print(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 spee
printer.fgColor = color[1];
printer.bgColor = color[0];
printer.shadowColor = color[2];
AddTextPrinter(&printer, speed, NULL);
}
@@ -1962,7 +1962,7 @@ void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 left, u8 top, u8 le
printer.fgColor = color[1];
printer.bgColor = color[0];
printer.shadowColor = color[2];
AddTextPrinter(&printer, speed, NULL);
}
@@ -2373,14 +2373,14 @@ void sub_819A344(u8 a0, u8 *a1, u8 a2)
s32 flagCount;
u8 *endOfString;
u8 *string = a1;
*(string++) = EXT_CTRL_CODE_BEGIN;
*(string++) = EXT_CTRL_CODE_COLOR;
*(string++) = a2;
*(string++) = EXT_CTRL_CODE_BEGIN;
*(string++) = EXT_CTRL_CODE_SHADOW;
*(string++) = a2 + 1;
switch (a0)
{
case 0:
@@ -2388,9 +2388,9 @@ void sub_819A344(u8 a0, u8 *a1, u8 a2)
break;
case 1:
if (IsNationalPokedexEnabled())
string = ConvertIntToDecimalStringN(string, pokedex_count(1), 0, 3);
string = ConvertIntToDecimalStringN(string, GetNationalPokedexCount(1), 0, 3);
else
string = ConvertIntToDecimalStringN(string, sub_80C0844(1), 0, 3);
string = ConvertIntToDecimalStringN(string, GetHoennPokedexCount(1), 0, 3);
*string = EOS;
break;
case 2:

View File

@@ -3,6 +3,7 @@
#include "global.h"
#include "constants/decorations.h"
#include "malloc.h"
#include "main.h"
#include "task.h"
#include "palette.h"
#include "list_menu.h"
@@ -39,6 +40,10 @@
#include "tv.h"
#include "secret_base.h"
extern void (*gFieldCallback)(void);
extern void mapldr_default(void);
// Static type declarations
struct SecretBaseListMenuBuffer {
@@ -244,7 +249,7 @@ void sub_80E8C98(void)
void sub_80E8CB0(s16 *xPtr, s16 *yPtr, u16 tile)
{
struct MapData *mapData;
const struct MapData *mapData;
s16 x;
s16 y;
@@ -773,7 +778,7 @@ void sub_80E9AD0(void)
u16 i;
u16 j;
s16 tile;
struct MapEvents *events;
const struct MapEvents *events;
events = gMapHeader.events;
for (i = 0; i < events->bgEventCount; i ++)

71
src/smokescreen.c Normal file
View File

@@ -0,0 +1,71 @@
#include "global.h"
#include "data2.h"
#include "decompress.h"
#include "sprite.h"
#include "util.h"
static void sub_8075370(struct Sprite *);
u8 sub_807521C(s16 x, s16 y, u8 a3)
{
u8 mainSpriteId;
u8 spriteId1, spriteId2, spriteId3, spriteId4;
struct Sprite *mainSprite;
if (GetSpriteTileStartByTag(gUnknown_0831C620.tag) == 0xFFFF)
{
LoadCompressedObjectPicUsingHeap(&gUnknown_0831C620);
LoadCompressedObjectPaletteUsingHeap(&gUnknown_0831C628);
}
mainSpriteId = CreateInvisibleSpriteWithCallback(sub_8075370);
mainSprite = &gSprites[mainSpriteId];
mainSprite->data[1] = a3;
spriteId1 = CreateSprite(&gUnknown_0831C688, x - 16, y - 16, 2);
gSprites[spriteId1].data[0] = mainSpriteId;
mainSprite->data[0]++;
AnimateSprite(&gSprites[spriteId1]);
spriteId2 = CreateSprite(&gUnknown_0831C688, x, y - 16, 2);
gSprites[spriteId2].data[0] = mainSpriteId;
mainSprite->data[0]++;
StartSpriteAnim(&gSprites[spriteId2], 1);
AnimateSprite(&gSprites[spriteId2]);
spriteId3 = CreateSprite(&gUnknown_0831C688, x - 16, y, 2);
gSprites[spriteId3].data[0] = mainSpriteId;
mainSprite->data[0]++;
StartSpriteAnim(&gSprites[spriteId3], 2);
AnimateSprite(&gSprites[spriteId3]);
spriteId4 = CreateSprite(&gUnknown_0831C688, x, y, 2);
gSprites[spriteId4].data[0] = mainSpriteId;
mainSprite->data[0]++;
StartSpriteAnim(&gSprites[spriteId4], 3);
AnimateSprite(&gSprites[spriteId4]);
return mainSpriteId;
}
static void sub_8075370(struct Sprite *sprite)
{
if (!sprite->data[0])
{
FreeSpriteTilesByTag(gUnknown_0831C620.tag);
FreeSpritePaletteByTag(gUnknown_0831C628.tag);
if (!sprite->data[1])
DestroySprite(sprite);
else
sprite->callback = SpriteCallbackDummy;
}
}
void sub_80753B4(struct Sprite *sprite)
{
if (sprite->animEnded)
{
gSprites[sprite->data[0]].data[0]--;
DestroySprite(sprite);
}
}

View File

@@ -1957,11 +1957,11 @@ void sub_80EDB44(void)
show->rivalTrainer.badgeCount = nBadges;
if (IsNationalPokedexEnabled())
{
show->rivalTrainer.dexCount = pokedex_count(0x01);
show->rivalTrainer.dexCount = GetNationalPokedexCount(0x01);
}
else
{
show->rivalTrainer.dexCount = sub_80C0844(0x01);
show->rivalTrainer.dexCount = GetHoennPokedexCount(0x01);
}
show->rivalTrainer.location = gMapHeader.regionMapSectionId;
show->rivalTrainer.mapDataId = gMapHeader.mapDataId;