summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-04-26 19:49:36 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2018-04-26 19:49:36 -0400
commit21415be0d3bcd5edffbd83777660af319a01e51b (patch)
treea9577e7d623cf0e98031bda7c4a5637c4d67c896 /src
parent260ec0d276221c9252b2276a50587fb708f79fcf (diff)
Fix the swiss cheese in pokedex_cry_screen
Diffstat (limited to 'src')
-rw-r--r--src/pokedex_cry_screen.c100
1 files changed, 97 insertions, 3 deletions
diff --git a/src/pokedex_cry_screen.c b/src/pokedex_cry_screen.c
index 912b9aabd..941218fb0 100644
--- a/src/pokedex_cry_screen.c
+++ b/src/pokedex_cry_screen.c
@@ -3,15 +3,27 @@
#include "palette.h"
#include "sprite.h"
#include "ewram.h"
+#include "trig.h"
struct Unk201C800 {
- u8 unk_0;
- u8 unk_1;
+ s8 unk_0;
+ s8 unk_1;
u8 unk_2;
- u8 filler_3;
u16 unk_4;
};
+struct PokedexCryScreen_201C000
+{
+ u8 unk0000[0x10];
+ u8 unk0010;
+ u8 filler_0011[0x7EF];
+ struct Unk201C800 unk0800;
+};
+
+#define ePokedexCryScreen (*(struct PokedexCryScreen_201C000 *)(gSharedMem + 0x1C000))
+
+void sub_811A6D8(s8);
+
extern u8 gUnknown_03005E98;
// data/pokedex_cry_screen.o
@@ -80,3 +92,85 @@ u8 ShowPokedexCryScreen(struct CryRelatedStruct *cry, u8 arg1) {
return returnVal;
}
+
+void DestroyCryMeterNeedleSprite(void)
+{
+ FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(gSprites[EWRAM_1C800.unk_4].oam.paletteNum));
+ DestroySprite(gSprites + EWRAM_1C800.unk_4);
+}
+
+void sub_811A534(struct Sprite * sprite)
+{
+ u16 i;
+ s8 r3;
+ s16 x;
+ s16 y;
+ struct ObjAffineSrcData sp04;
+ struct OamMatrix sp0c;
+ u8 * r0;
+
+ gSprites[EWRAM_1C800.unk_4].oam.affineMode = ST_OAM_AFFINE_NORMAL;
+ gSprites[EWRAM_1C800.unk_4].oam.affineParam = 0;
+ switch (ePokedexCryScreen.unk0010)
+ {
+ case 0:
+ EWRAM_1C800.unk_1 = 0x20;
+ if (EWRAM_1C800.unk_0 > 0)
+ {
+ if (EWRAM_1C800.unk_2 != 1)
+ EWRAM_1C800.unk_2--;
+ }
+ else
+ EWRAM_1C800.unk_2 = 5;
+ break;
+ case 2:
+ r3 = 0;
+ for (i = 0; i < 16; i++)
+ {
+ if (r3 < ePokedexCryScreen.unk0000[i])
+ r3 = ePokedexCryScreen.unk0000[i];
+ }
+ sub_811A6D8(r3 * 0xd0 / 0x100);
+ break;
+ case 6:
+ r0 = &ePokedexCryScreen.unk0000[10];
+ sub_811A6D8(*r0 * 0xd0 / 0x100);
+ break;
+ }
+ if (EWRAM_1C800.unk_0 == EWRAM_1C800.unk_1)
+ ;
+ else if (EWRAM_1C800.unk_0 < EWRAM_1C800.unk_1)
+ {
+ if ((EWRAM_1C800.unk_0 += EWRAM_1C800.unk_2) > EWRAM_1C800.unk_1)
+ {
+ EWRAM_1C800.unk_0 = EWRAM_1C800.unk_1;
+ EWRAM_1C800.unk_1 = 0;
+ }
+ }
+ else
+ {
+ if ((EWRAM_1C800.unk_0 -= EWRAM_1C800.unk_2) < EWRAM_1C800.unk_1)
+ {
+ EWRAM_1C800.unk_0 = EWRAM_1C800.unk_1;
+ EWRAM_1C800.unk_1 = 0;
+ }
+ }
+ sp04.xScale = 0x100;
+ sp04.yScale = 0x100;
+ sp04.rotation = EWRAM_1C800.unk_0 * 256;
+ ObjAffineSet(&sp04, &sp0c, 1, 2);
+ SetOamMatrix(0, sp0c.a, sp0c.b, sp0c.c, sp0c.d);
+ x = gSineTable[((EWRAM_1C800.unk_0 + 0x7F) & 0xFF)];
+ y = gSineTable[((EWRAM_1C800.unk_0 + 0x7F) & 0xFF) + 0x40];
+ sprite->pos2.x = x * 24 / 256;
+ sprite->pos2.y = y * 24 / 256;
+}
+
+void sub_811A6D8(s8 a0)
+{
+ u16 r2 = (0x20 - a0) & 0xff;
+ if (r2 > 0x20 && r2 < 0xe0)
+ r2 = 0xe0;
+ EWRAM_1C800.unk_1 = r2;
+ EWRAM_1C800.unk_2 = 5;
+}