From f806a9d9ed026491dceda6850980160f12c318db Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 31 Mar 2025 10:00:45 +0200 Subject: [PATCH] split code_8069E0C and code_806CD90 --- data/data_8106A4C_2.s | 20 --- ld_script.txt | 2 +- src/code_8069E0C.c | 281 +---------------------------------------- src/code_806CD90.c | 286 ++++++++++++++++++++++++++++++++++++++++++ src/dungeon_damage.c | 2 +- 5 files changed, 289 insertions(+), 302 deletions(-) delete mode 100644 data/data_8106A4C_2.s diff --git a/data/data_8106A4C_2.s b/data/data_8106A4C_2.s deleted file mode 100644 index 8482c6ab4..000000000 --- a/data/data_8106A4C_2.s +++ /dev/null @@ -1,20 +0,0 @@ - .section .rodata - -.align 2,0 - - - -@ ??? - .align 2,0 - .string "pksdir0\0" - -@ sub_806C51C - sub_806E100 - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_8106EC8 -gUnknown_8106EC8: @ 8106EC8 -.byte 0x00, 0x01, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07 -.byte 0x07, 0x07, 0x05, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x05 -.byte 0x06, 0x07, 0x07, 0x07, 0x07, 0x0b, 0x07 diff --git a/ld_script.txt b/ld_script.txt index fb3bca04f..40516e371 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -573,7 +573,7 @@ SECTIONS { src/code_8066D04.o(.rodata); src/dungeon_8067A80.o(.rodata); src/dungeon_misc.o(.rodata); - data/data_8106A4C_2.o(.rodata); + src/code_8069E0C.o(.rodata); src/code_806CD90.o(.rodata); src/dungeon_damage.o(.rodata); src/code_806FDF4.o(.rodata); diff --git a/src/code_8069E0C.c b/src/code_8069E0C.c index 858d33d5d..f19beb49c 100644 --- a/src/code_8069E0C.c +++ b/src/code_8069E0C.c @@ -1,4 +1,5 @@ #include "global.h" +#include "globaldata.h" #include "constants/ability.h" #include "constants/iq_skill.h" #include "constants/move_id.h" @@ -6,14 +7,11 @@ #include "constants/type.h" #include "constants/weather.h" #include "structs/dungeon_entity.h" -#include "structs/str_202ED28.h" #include "structs/str_806B7F8.h" #include "structs/str_dungeon.h" #include "code_800F958.h" #include "code_803E46C.h" #include "code_803E668.h" -#include "code_8041AD0.h" -#include "code_804267C.h" #include "code_805D8C8.h" #include "code_806CD90.h" #include "code_8077274_1.h" @@ -35,8 +33,6 @@ #include "pokemon.h" #include "pokemon_3.h" #include "position_util.h" -#include "random.h" -#include "sprite.h" #include "weather.h" extern void sub_8042900(Entity *r0); @@ -62,9 +58,6 @@ extern u8 GetRandomFloorItem(s32 a0); extern void DeletePokemonDungeonSprite(s32 id); extern void sub_80429E8(Entity *r0); extern s32 sub_803DA20(s32 param_1); -extern s32 gDungeonFramesCounter; -extern void sub_800F958(s32 dungeonSpriteID, DungeonPos *pos, DungeonPos *statusOffsets, u32 a3); -extern void sub_8042EC8(Entity *a0, s32 a1); extern Entity *sub_804550C(s16 a); extern Entity *sub_80453AC(s16 id); extern void sub_803F580(s32); @@ -1104,275 +1097,3 @@ s32 sub_806C4D4(s32 _species, s32 level, s32 categoryIndex) return defensiveCount; } - -extern const u8 gUnknown_8106EC8[][13]; - -static inline u16 GetUnkFlag(Entity *entity) -{ - if ((entity->axObj.axdata.flags & 0x2000)) - return 0; - else - return entity->axObj.axdata.flags >> 15; -} - -void sub_806C51C(Entity *entity) -{ - s32 x, y, y2; - bool8 var_3C; - bool8 decoySprite; - s32 var_34; - DungeonPos pos1; - DungeonPos posArray[4]; - u32 statusSprites; - bool8 r4; - u8 r7; - unkStruct_2039DB0 spriteMasks; - s32 xSprite, ySprite; - - EntityInfo *entInfo = GetEntInfo(entity); - if (gDungeon->unk181e8.cameraTarget == entity) { - decoySprite = FALSE; - } - else { - decoySprite = gDungeon->unk181e8.hallucinating; - } - - if (entInfo->curseClassStatus.status == STATUS_DECOY) { - decoySprite = TRUE; - } - - if (entity->axObj.unk43_animId2 == entity->axObj.unk42_animId1 && entity->axObj.unk45_orientation == entity->axObj.unk44_direction1 && entity->axObj.unk47 == 0) { - bool8 r2 = FALSE; - - if (!GetUnkFlag(entity)) - r2 = TRUE; - - if (r2) { - s32 r0; - s32 r3 = sub_806CEBC(entity); - entity->unk21 = 1; - if (entInfo->unkFE == 99) { - if (entity->axObj.unk43_animId2 <= 12) { - s32 r2; - if (entInfo->bideClassStatus.status == STATUS_BIDE) { - r2 = 2; - } - else if (entity->unk23 < 3) { - r2 = 0; - } - else { - r2 = 1; - } - - r0 = gUnknown_8106EC8[r2][entity->axObj.unk43_animId2]; - if (r0 == 7) { - r0 = r3; - } - } - else { - r0 = 99; - } - } - else { - r0 = entInfo->unkFE; - } - - if (r0 != 99) { - entity->axObj.unk42_animId1 = r0; - entity->axObj.unk44_direction1 = entity->axObj.unk45_orientation & DIRECTION_MASK; - entity->axObj.unk47 = 1; - if (entity->axObj.unk42_animId1 == 6 && ++entity->axObj.unk46 == 16) { - entity->axObj.unk42_animId1 = r3; - } - } - } - } - - if (entity->axObj.unk43_animId2 != entity->axObj.unk42_animId1 || entity->axObj.unk45_orientation != entity->axObj.unk44_direction1 || entity->axObj.unk47 != 0) { - s32 r7; - - entity->axObj.unk43_animId2 = entity->axObj.unk42_animId1; - entity->axObj.unk45_orientation = entity->axObj.unk44_direction1; - entity->axObj.unk47 = 0; - r7 = entity->axObj.unk40_maybeAnimTimer; - if (sub_808DA44(entInfo->apparentID, entity->axObj.unk42_animId1)) { - r7 = 0; - } - - if (!decoySprite) { - s32 rnd = Rand32Bit() & 3; - AxResInitFile(&entity->axObj.axdata, entity->axObj.spriteFile, entity->axObj.unk42_animId1, entity->axObj.unk44_direction1, r7, rnd, FALSE); - } - else { - OpenedFile *spriteData = GetSpriteData(MONSTER_DECOY); - s32 rnd = Rand32Bit() & 3; - AxResInitFile(&entity->axObj.axdata, spriteData, entity->axObj.unk42_animId1, entity->axObj.unk44_direction1, r7, rnd, FALSE); - } - - if (entity->axObj.unk42_animId1 != 6) { - entity->axObj.unk46 = 0; - } - } - - if (gDungeon->unk1356C) { - if (entity->axObj.unk43_animId2 != 7 || GetMovementType(entInfo->apparentID) == 2) { - if (entInfo->unk15C != 0) { - if (entInfo->unk160 == 0) { - if (entInfo->unk15F != 0) { - RunAxAnimationFrame(&entity->axObj.axdata); - RunAxAnimationFrame(&entity->axObj.axdata); - RunAxAnimationFrame(&entity->axObj.axdata); - } - else { - RunAxAnimationFrame(&entity->axObj.axdata); - } - } - } - else { - RunAxAnimationFrame(&entity->axObj.axdata); - } - } - } - else { - if (entInfo->frozenClassStatus.status != STATUS_FROZEN && entInfo->frozenClassStatus.status != STATUS_PETRIFIED) { - if (gDungeon->unk644.unk28 != 0 && gDungeon->unk1BDD4.unk1C05F == 0) { - RunAxAnimationFrame(&entity->axObj.axdata); - RunAxAnimationFrame(&entity->axObj.axdata); - } - else if ((entity->axObj.unk43_animId2 == 0 || entity->axObj.unk43_animId2 == 7) && GetEntInfo(entity)->speedStage > 1) { - RunAxAnimationFrame(&entity->axObj.axdata); - } - RunAxAnimationFrame(&entity->axObj.axdata); - } - } - - if (entity->pixelPos.x == entity->prevPixelPos.x && entity->pixelPos.y == entity->prevPixelPos.y) { - if (entity->unk23 < 10) { - entity->unk23++; - } - } - else { - entity->unk23 = 0; - } - - entity->prevPixelPos.x = entity->pixelPos.x; - entity->prevPixelPos.y = entity->pixelPos.y; - - x = (entity->pixelPos.x / 256) - gDungeon->unk181e8.cameraPixelPos.x; - y = (((entity->pixelPos.y - entity->unk1C.raw) - entInfo->unk174.raw) / 256) - gDungeon->unk181e8.cameraPixelPos.y; - y2 = (entity->pixelPos.y / 256) - gDungeon->unk181e8.cameraPixelPos.y; - y2 /= 2; - if (entInfo->unk156 == 0) { - y2--; - } - - if (entInfo->unk15C == 0) { - var_3C = sub_8042768(entity); - } - else { - if (entInfo->unk15D != 0) { - if (gDungeonFramesCounter & 4) { - x++; - } - else { - x--; - } - } - var_3C = (entInfo->unk15E == 0); - } - - pos1.x = entity->pixelPos.x / 256; - pos1.y = ((entity->pixelPos.y - entity->unk1C.raw) - entInfo->unk174.raw) / 256; - - sub_8005700(posArray, &entity->axObj); - sub_800F958(entInfo->unk98, &pos1, posArray, gDungeon->unk181e8.priority); - - statusSprites = EntityGetStatusSprites(entity); - UpdateDungeonPokemonSprite(entInfo->unk98, entInfo->apparentID, statusSprites, (var_3C && entInfo->unk14C)); - - sub_8042EC8(entity, y2); - if (entInfo->unk15C == 0) { - if (entInfo->unkFF == 1) { - if (entInfo->unk174.raw <= IntToF248_2(199.999).raw) { - entInfo->unk174.raw += IntToF248_2(8).raw; - if (entInfo->unk174.raw > IntToF248_2(200).raw) { - entInfo->unk174.raw = IntToF248_2(200).raw; - } - } - } - else { - entInfo->unk174.raw -= IntToF248_2(12).raw; - if (entInfo->unk174.raw < IntToF248_2(0).raw) { - entInfo->unk174.raw = IntToF248_2(0).raw; - } - } - } - - if (!var_3C) - return; - - r4 = FALSE; - r7 = sub_806CF54(entity); - - spriteMasks.unk0 = 0xF3FF; - spriteMasks.unk2 = 0xFFFF; - spriteMasks.unk4 = 0xF3FF; - spriteMasks.unk6 = 0; - spriteMasks.unk8 = 0; - spriteMasks.unkA = gDungeon->unk181e8.priority << 10; - - if (entInfo->isNotTeamMember && (entInfo->apparentID == MONSTER_DEOXYS_ATTACK || entInfo->apparentID == MONSTER_DEOXYS_DEFENSE || entInfo->apparentID == MONSTER_DEOXYS_SPEED)) { - r4 = TRUE; - } - if (entInfo->invisibleClassStatus.status == STATUS_INVISIBLE && !gDungeon->unk181e8.showInvisibleTrapsMonsters) { - r4 = TRUE; - } - if (r4) { - spriteMasks.unk6 |= 0x400; - } - - var_34 = 0; - if (!entInfo->isNotTeamMember || entInfo->curseClassStatus.status == STATUS_DECOY) { - var_34 = 1; - } - if (IsExperienceLocked(entInfo->joinedAt.id) || entInfo->monsterBehavior == 1) { - var_34 = 1; - } - - if (entInfo->unkFF != 2) { - s32 overworldPal; - - if (entInfo->frozenClassStatus.status == STATUS_PETRIFIED || entInfo->burnClassStatus.status == STATUS_PARALYSIS || entInfo->frozenClassStatus.status == STATUS_SHADOW_HOLD) { - x += gDungeonFramesCounter & 2; - } - - if (decoySprite) { - overworldPal = GetPokemonOverworldPalette(MONSTER_DECOY, FALSE); - } - else { - overworldPal = GetPokemonOverworldPalette(entInfo->apparentID, FALSE); - } - - if (entity->unk22 == 0) { - DoAxFrame_800558C(&entity->axObj.axdata, x, y, y2, overworldPal, &spriteMasks); - } - else if (entity->unk22 == 1 && (gDungeonFramesCounter & 1)) { - DoAxFrame_800558C(&entity->axObj.axdata, x, y, y2, overworldPal, &spriteMasks); - } - } - - entInfo->pixelPos.x = (entity->pixelPos.x / 256) + entity->axObj.axdata.sub1.shadow.x; - entInfo->pixelPos.y = (entity->pixelPos.y / 256) + entity->axObj.axdata.sub1.shadow.y; - - xSprite = entInfo->pixelPos.x - gDungeon->unk181e8.cameraPixelPos.x; - ySprite = entInfo->pixelPos.y - gDungeon->unk181e8.cameraPixelPos.y; - if (xSprite >= -32 && ySprite >= -32 && xSprite <= 271 && ySprite <= 191 && r7 != 6 && entity->unk22 == 0) { - struct unkStruct_202ED28 *spriteStructPtr = &gUnknown_202ED28[var_34][r7]; - if (entInfo->unk156 != 0) { - SpriteSetX(&spriteStructPtr->sprite, xSprite + spriteStructPtr->pos.x); - SpriteSetY(&spriteStructPtr->sprite, ySprite + spriteStructPtr->pos.y); - - AddSprite(&spriteStructPtr->sprite, 0, NULL, NULL); - } - } -} diff --git a/src/code_806CD90.c b/src/code_806CD90.c index b1933d6c7..482a921b1 100644 --- a/src/code_806CD90.c +++ b/src/code_806CD90.c @@ -1,4 +1,5 @@ #include "global.h" +#include "globaldata.h" #include "constants/direction.h" #include "constants/status.h" #include "constants/ability.h" @@ -29,9 +30,294 @@ #include "sprite.h" #include "status.h" #include "text_util.h" +#include "sprite.h" +#include "random.h" +#include "code_800F958.h" +#include "structs/str_202ED28.h" + +const u8 gUnknown_8106EC8[][13] = { + {0, 1, 7, 7, 7, 5, 6, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 5, 6, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 5, 6, 7, 7, 7, 7, 11, 7}, +}; const u8 gUnknown_8106EEF[] = {0x03, 0x04, 0x05, 0x00, 0x00, 0x70, 0x6b, 0x73, 0x64, 0x69, 0x72, 0x30, 0x00 }; +extern s32 gDungeonFramesCounter; + +extern void sub_8042EC8(Entity *a0, s32 a1); +extern void sub_800F958(s32 dungeonSpriteID, DungeonPos *pos, DungeonPos *statusOffsets, u32 a3); + +static inline u16 GetUnkFlag(Entity *entity) +{ + if ((entity->axObj.axdata.flags & 0x2000)) + return 0; + else + return entity->axObj.axdata.flags >> 15; +} + +void sub_806C51C(Entity *entity) +{ + s32 x, y, y2; + bool8 var_3C; + bool8 decoySprite; + s32 var_34; + DungeonPos pos1; + DungeonPos posArray[4]; + u32 statusSprites; + bool8 r4; + u8 r7; + unkStruct_2039DB0 spriteMasks; + s32 xSprite, ySprite; + + EntityInfo *entInfo = GetEntInfo(entity); + if (gDungeon->unk181e8.cameraTarget == entity) { + decoySprite = FALSE; + } + else { + decoySprite = gDungeon->unk181e8.hallucinating; + } + + if (entInfo->curseClassStatus.status == STATUS_DECOY) { + decoySprite = TRUE; + } + + if (entity->axObj.unk43_animId2 == entity->axObj.unk42_animId1 && entity->axObj.unk45_orientation == entity->axObj.unk44_direction1 && entity->axObj.unk47 == 0) { + bool8 r2 = FALSE; + + if (!GetUnkFlag(entity)) + r2 = TRUE; + + if (r2) { + s32 r0; + s32 r3 = sub_806CEBC(entity); + entity->unk21 = 1; + if (entInfo->unkFE == 99) { + if (entity->axObj.unk43_animId2 <= 12) { + s32 r2; + if (entInfo->bideClassStatus.status == STATUS_BIDE) { + r2 = 2; + } + else if (entity->unk23 < 3) { + r2 = 0; + } + else { + r2 = 1; + } + + r0 = gUnknown_8106EC8[r2][entity->axObj.unk43_animId2]; + if (r0 == 7) { + r0 = r3; + } + } + else { + r0 = 99; + } + } + else { + r0 = entInfo->unkFE; + } + + if (r0 != 99) { + entity->axObj.unk42_animId1 = r0; + entity->axObj.unk44_direction1 = entity->axObj.unk45_orientation & DIRECTION_MASK; + entity->axObj.unk47 = 1; + if (entity->axObj.unk42_animId1 == 6 && ++entity->axObj.unk46 == 16) { + entity->axObj.unk42_animId1 = r3; + } + } + } + } + + if (entity->axObj.unk43_animId2 != entity->axObj.unk42_animId1 || entity->axObj.unk45_orientation != entity->axObj.unk44_direction1 || entity->axObj.unk47 != 0) { + s32 r7; + + entity->axObj.unk43_animId2 = entity->axObj.unk42_animId1; + entity->axObj.unk45_orientation = entity->axObj.unk44_direction1; + entity->axObj.unk47 = 0; + r7 = entity->axObj.unk40_maybeAnimTimer; + if (sub_808DA44(entInfo->apparentID, entity->axObj.unk42_animId1)) { + r7 = 0; + } + + if (!decoySprite) { + s32 rnd = Rand32Bit() & 3; + AxResInitFile(&entity->axObj.axdata, entity->axObj.spriteFile, entity->axObj.unk42_animId1, entity->axObj.unk44_direction1, r7, rnd, FALSE); + } + else { + OpenedFile *spriteData = GetSpriteData(MONSTER_DECOY); + s32 rnd = Rand32Bit() & 3; + AxResInitFile(&entity->axObj.axdata, spriteData, entity->axObj.unk42_animId1, entity->axObj.unk44_direction1, r7, rnd, FALSE); + } + + if (entity->axObj.unk42_animId1 != 6) { + entity->axObj.unk46 = 0; + } + } + + if (gDungeon->unk1356C) { + if (entity->axObj.unk43_animId2 != 7 || GetMovementType(entInfo->apparentID) == 2) { + if (entInfo->unk15C != 0) { + if (entInfo->unk160 == 0) { + if (entInfo->unk15F != 0) { + RunAxAnimationFrame(&entity->axObj.axdata); + RunAxAnimationFrame(&entity->axObj.axdata); + RunAxAnimationFrame(&entity->axObj.axdata); + } + else { + RunAxAnimationFrame(&entity->axObj.axdata); + } + } + } + else { + RunAxAnimationFrame(&entity->axObj.axdata); + } + } + } + else { + if (entInfo->frozenClassStatus.status != STATUS_FROZEN && entInfo->frozenClassStatus.status != STATUS_PETRIFIED) { + if (gDungeon->unk644.unk28 != 0 && gDungeon->unk1BDD4.unk1C05F == 0) { + RunAxAnimationFrame(&entity->axObj.axdata); + RunAxAnimationFrame(&entity->axObj.axdata); + } + else if ((entity->axObj.unk43_animId2 == 0 || entity->axObj.unk43_animId2 == 7) && GetEntInfo(entity)->speedStage > 1) { + RunAxAnimationFrame(&entity->axObj.axdata); + } + RunAxAnimationFrame(&entity->axObj.axdata); + } + } + + if (entity->pixelPos.x == entity->prevPixelPos.x && entity->pixelPos.y == entity->prevPixelPos.y) { + if (entity->unk23 < 10) { + entity->unk23++; + } + } + else { + entity->unk23 = 0; + } + + entity->prevPixelPos.x = entity->pixelPos.x; + entity->prevPixelPos.y = entity->pixelPos.y; + + x = (entity->pixelPos.x / 256) - gDungeon->unk181e8.cameraPixelPos.x; + y = (((entity->pixelPos.y - entity->unk1C.raw) - entInfo->unk174.raw) / 256) - gDungeon->unk181e8.cameraPixelPos.y; + y2 = (entity->pixelPos.y / 256) - gDungeon->unk181e8.cameraPixelPos.y; + y2 /= 2; + if (entInfo->unk156 == 0) { + y2--; + } + + if (entInfo->unk15C == 0) { + var_3C = sub_8042768(entity); + } + else { + if (entInfo->unk15D != 0) { + if (gDungeonFramesCounter & 4) { + x++; + } + else { + x--; + } + } + var_3C = (entInfo->unk15E == 0); + } + + pos1.x = entity->pixelPos.x / 256; + pos1.y = ((entity->pixelPos.y - entity->unk1C.raw) - entInfo->unk174.raw) / 256; + + sub_8005700(posArray, &entity->axObj); + sub_800F958(entInfo->unk98, &pos1, posArray, gDungeon->unk181e8.priority); + + statusSprites = EntityGetStatusSprites(entity); + UpdateDungeonPokemonSprite(entInfo->unk98, entInfo->apparentID, statusSprites, (var_3C && entInfo->unk14C)); + + sub_8042EC8(entity, y2); + if (entInfo->unk15C == 0) { + if (entInfo->unkFF == 1) { + if (entInfo->unk174.raw <= IntToF248_2(199.999).raw) { + entInfo->unk174.raw += IntToF248_2(8).raw; + if (entInfo->unk174.raw > IntToF248_2(200).raw) { + entInfo->unk174.raw = IntToF248_2(200).raw; + } + } + } + else { + entInfo->unk174.raw -= IntToF248_2(12).raw; + if (entInfo->unk174.raw < IntToF248_2(0).raw) { + entInfo->unk174.raw = IntToF248_2(0).raw; + } + } + } + + if (!var_3C) + return; + + r4 = FALSE; + r7 = sub_806CF54(entity); + + spriteMasks.unk0 = 0xF3FF; + spriteMasks.unk2 = 0xFFFF; + spriteMasks.unk4 = 0xF3FF; + spriteMasks.unk6 = 0; + spriteMasks.unk8 = 0; + spriteMasks.unkA = gDungeon->unk181e8.priority << 10; + + if (entInfo->isNotTeamMember && (entInfo->apparentID == MONSTER_DEOXYS_ATTACK || entInfo->apparentID == MONSTER_DEOXYS_DEFENSE || entInfo->apparentID == MONSTER_DEOXYS_SPEED)) { + r4 = TRUE; + } + if (entInfo->invisibleClassStatus.status == STATUS_INVISIBLE && !gDungeon->unk181e8.showInvisibleTrapsMonsters) { + r4 = TRUE; + } + if (r4) { + spriteMasks.unk6 |= 0x400; + } + + var_34 = 0; + if (!entInfo->isNotTeamMember || entInfo->curseClassStatus.status == STATUS_DECOY) { + var_34 = 1; + } + if (IsExperienceLocked(entInfo->joinedAt.id) || entInfo->monsterBehavior == 1) { + var_34 = 1; + } + + if (entInfo->unkFF != 2) { + s32 overworldPal; + + if (entInfo->frozenClassStatus.status == STATUS_PETRIFIED || entInfo->burnClassStatus.status == STATUS_PARALYSIS || entInfo->frozenClassStatus.status == STATUS_SHADOW_HOLD) { + x += gDungeonFramesCounter & 2; + } + + if (decoySprite) { + overworldPal = GetPokemonOverworldPalette(MONSTER_DECOY, FALSE); + } + else { + overworldPal = GetPokemonOverworldPalette(entInfo->apparentID, FALSE); + } + + if (entity->unk22 == 0) { + DoAxFrame_800558C(&entity->axObj.axdata, x, y, y2, overworldPal, &spriteMasks); + } + else if (entity->unk22 == 1 && (gDungeonFramesCounter & 1)) { + DoAxFrame_800558C(&entity->axObj.axdata, x, y, y2, overworldPal, &spriteMasks); + } + } + + entInfo->pixelPos.x = (entity->pixelPos.x / 256) + entity->axObj.axdata.sub1.shadow.x; + entInfo->pixelPos.y = (entity->pixelPos.y / 256) + entity->axObj.axdata.sub1.shadow.y; + + xSprite = entInfo->pixelPos.x - gDungeon->unk181e8.cameraPixelPos.x; + ySprite = entInfo->pixelPos.y - gDungeon->unk181e8.cameraPixelPos.y; + if (xSprite >= -32 && ySprite >= -32 && xSprite <= 271 && ySprite <= 191 && r7 != 6 && entity->unk22 == 0) { + struct unkStruct_202ED28 *spriteStructPtr = &gUnknown_202ED28[var_34][r7]; + if (entInfo->unk156 != 0) { + SpriteSetX(&spriteStructPtr->sprite, xSprite + spriteStructPtr->pos.x); + SpriteSetY(&spriteStructPtr->sprite, ySprite + spriteStructPtr->pos.y); + + AddSprite(&spriteStructPtr->sprite, 0, NULL, NULL); + } + } +} + void sub_806CC10(void) { EntityInfo *entityInfo; diff --git a/src/dungeon_damage.c b/src/dungeon_damage.c index 49ecb1418..ec29ea568 100644 --- a/src/dungeon_damage.c +++ b/src/dungeon_damage.c @@ -54,7 +54,6 @@ extern void sub_8071D4C(Entity *pokemon, Entity *target, s32 exp); extern void sub_8042148(Entity *pokemon); extern void sub_8042A24(Entity *r0); extern void sub_806A390(Entity *r0); -extern void sub_806F63C(Entity *r0); extern void sub_8078084(Entity * pokemon); extern void sub_800DBBC(void); extern void sub_80464C8(Entity *, DungeonPos *, Item *); @@ -91,6 +90,7 @@ extern const s16 gUnknown_810AC62; static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struct DamageStruct *r5, bool32 isFalseSwipe, bool32 giveExp, s16 arg4_, s32 arg8); void DealDamageToEntity(Entity *entity, s32 dmg, s32 r6, s32 r4); +void sub_806F63C(Entity *param_1); static const u32 gUnknown_8106EFC[] = { 0, 0 }; static const s48_16 gUnknown_8106F04 = { 0x0, 0x10000 };