summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/birch_pc.c93
-rw-r--r--src/menu.c28
-rw-r--r--src/smokescreen.c71
-rw-r--r--src/tv.c4
4 files changed, 180 insertions, 16 deletions
diff --git a/src/birch_pc.c b/src/birch_pc.c
new file mode 100644
index 000000000..0f44824f7
--- /dev/null
+++ b/src/birch_pc.c
@@ -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));
+}
diff --git a/src/menu.c b/src/menu.c
index d06f950d3..b20ab5164 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -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:
diff --git a/src/smokescreen.c b/src/smokescreen.c
new file mode 100644
index 000000000..9b37cd234
--- /dev/null
+++ b/src/smokescreen.c
@@ -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);
+ }
+}
diff --git a/src/tv.c b/src/tv.c
index fbe39fde0..b0dbc0dbc 100644
--- a/src/tv.c
+++ b/src/tv.c
@@ -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;