mirror of
https://github.com/pret/pmd-red.git
synced 2026-08-28 19:55:09 -05:00
Clean code_806CD90 and code_805D8C8
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
#ifndef GUARD_CODE_805D8C8_H
|
||||
#define GUARD_CODE_805D8C8_H
|
||||
|
||||
#include "sprite.h"
|
||||
#include "file_system.h"
|
||||
|
||||
void CloseAllSpriteFiles(void);
|
||||
|
||||
void sub_8068768(void);
|
||||
void sub_80687AC(void);
|
||||
extern struct OpenedFile *sub_80687D0(s16);
|
||||
/*struct OpenedFile *sub_80687D0(s16 species)
|
||||
{
|
||||
s32 species32 = species;
|
||||
return gDungeon->sprites[species32];
|
||||
}*/
|
||||
void sub_8068838(s16, bool32);
|
||||
|
||||
#endif // GUARD_CODE_805D8C8_H
|
||||
22
include/code_806CD90.h
Normal file
22
include/code_806CD90.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef GUARD_CODE_806CD90_H
|
||||
#define GUARD_CODE_806CD90_H
|
||||
|
||||
#include "dungeon_entity.h"
|
||||
|
||||
void sub_806CC10(void);
|
||||
void sub_806CC70(void);
|
||||
void sub_806CCB4(struct Entity *, u8);
|
||||
void sub_806CD90(void);
|
||||
void sub_806CDD4(struct Entity *, u8, u32);
|
||||
void sub_806CDFC(struct Entity *, u8, u32);
|
||||
void sub_806CE34(struct Entity *, u32);
|
||||
void sub_806CE68(struct Entity *, u32);
|
||||
void sub_806CE94(struct Entity *, u32);
|
||||
u8 sub_806CEBC(struct Entity *);
|
||||
void sub_806CEFC(struct Entity *, u32);
|
||||
void sub_806CF18(struct Entity *);
|
||||
u8 sub_806CF54(struct Entity *);
|
||||
void sub_806CF60(void);
|
||||
u32 sub_806CF98(struct Entity *);
|
||||
|
||||
#endif // GUARD_CODE_806CD90_H
|
||||
6
include/pokemon_mid.h
Normal file
6
include/pokemon_mid.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef GUARD_POKEMON_MID_H
|
||||
#define GUARD_POKEMON_MID_H
|
||||
|
||||
bool8 sub_808DA44(s32, u32);
|
||||
|
||||
#endif // GUARD_POKEMON_MID_H
|
||||
@@ -35,8 +35,8 @@ static const u8 sFill1[] = "pksdir0";
|
||||
// ???
|
||||
extern u32 gUnknown_202DE30;
|
||||
|
||||
static void sub_8032084();
|
||||
static void DisplayAdventureLog();
|
||||
static void sub_8032084();
|
||||
|
||||
bool8 CreateAdventureLogScreen(u32 kind)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "constants/direction.h"
|
||||
#include "constants/status.h"
|
||||
#include "constants/type.h"
|
||||
@@ -34,7 +35,6 @@ extern void sub_803ED30(u8, struct Entity *pokemon, u8, u8);
|
||||
extern void sub_804151C(struct Entity *pokemon, u32 r1, u8 r2);
|
||||
extern void sub_80416E0(struct Entity *pokemon, u32, u32);
|
||||
extern u8 sub_8042768(struct Entity *pokemon);
|
||||
extern void sub_806CDD4(struct Entity *pokemon, u8, u32);
|
||||
extern u32 sub_806F62C(u32);
|
||||
extern void PlaySoundEffect(u32);
|
||||
extern u8 sub_803F428(struct Position *pos);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "constants/bg_music.h"
|
||||
#include "constants/direction.h"
|
||||
#include "constants/friend_area.h"
|
||||
@@ -324,9 +325,7 @@ extern void sub_8086598(void);
|
||||
extern void SpriteLookAroundEffect(struct Entity *);
|
||||
extern void SpriteShockEffect(struct Entity *);
|
||||
extern void PlaySoundEffect(u32);
|
||||
extern void sub_806CDD4(struct Entity *, u32, u32);
|
||||
extern void sub_80869E4(struct Entity *, u32, u32, u32);
|
||||
extern void sub_806CE68(struct Entity *, u32);
|
||||
extern void IncreaseEntityPixelPos(struct Entity *, u32, u32);
|
||||
extern void sub_8042B0C(struct Entity *);
|
||||
extern void DisplayDungeonDialogue(u32 *);
|
||||
@@ -443,7 +442,6 @@ extern u8 sub_8086AE4(u32);
|
||||
|
||||
extern void sub_8072008(struct Entity *, struct Entity *, s16, u32, u32);
|
||||
extern void sub_80869E4(struct Entity *, u32, u32, u32);
|
||||
extern void sub_806CDD4(struct Entity *, u32, u32);
|
||||
extern void sub_8085374();
|
||||
|
||||
extern void sub_8086848(u32 ,u32);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "constants/ability.h"
|
||||
#include "constants/move_id.h"
|
||||
#include "constants/status.h"
|
||||
@@ -97,7 +98,6 @@ extern s16 gUnknown_80F501A[];
|
||||
extern u32 sub_8055864(struct Entity *pokemon, struct Entity *target, struct Move *param_3, s32 param_4, s32 param_5);
|
||||
extern void sub_80943A0(void*, s32);
|
||||
extern s16 sub_8057600(struct Move*, u32);
|
||||
extern void sub_806CDD4(struct Entity *, u32, u32);
|
||||
extern u8 sub_8044B28(void);
|
||||
extern u8 sub_803F428(struct Position *pos);
|
||||
extern void IncreaseEntityPixelPos(struct Entity *, u32, u32);
|
||||
|
||||
@@ -1,90 +1,93 @@
|
||||
#include "global.h"
|
||||
#include "file_system.h"
|
||||
#include "code_805D8C8.h"
|
||||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_util.h"
|
||||
|
||||
extern struct FileArchive gMonsterFileArchive;
|
||||
extern u8 gUnknown_8106EA0[]; // ax%03d
|
||||
extern int sprintf(char *, const char *, ...);
|
||||
void sub_8068838(s16, bool32);
|
||||
void sub_80688B0(void);
|
||||
void sub_8068884(void);
|
||||
// monster_sbin.s
|
||||
extern const struct FileArchive gMonsterFileArchive;
|
||||
// data_8106A4C.s
|
||||
extern const u8 gUnknown_8106EA0[]; // ax%03d
|
||||
|
||||
// ???
|
||||
extern s32 sprintf(char *, const char *, ...);
|
||||
|
||||
static void sub_8068884(void);
|
||||
static void sub_80688B0(void);
|
||||
|
||||
void sub_8068768(void)
|
||||
{
|
||||
struct Entity *entity;
|
||||
int index;
|
||||
s32 i;
|
||||
|
||||
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
|
||||
{
|
||||
entity = gDungeon->allPokemon[index];
|
||||
if ((entity != NULL) && EntityExists(entity)) {
|
||||
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
|
||||
entity = gDungeon->allPokemon[i];
|
||||
|
||||
if (entity != NULL && EntityExists(entity))
|
||||
sub_8068838(entity->info->apparentID, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80687AC(void)
|
||||
{
|
||||
gDungeon->unk37F0 = 0x400;
|
||||
gDungeon->unk37F4 = 0xA;
|
||||
gDungeon->unk37F4 = 10;
|
||||
}
|
||||
|
||||
struct OpenedFile *sub_80687D0(s16 _id)
|
||||
struct OpenedFile *sub_80687D0(s16 species)
|
||||
{
|
||||
s32 id = _id;
|
||||
return gDungeon->sprites[id];
|
||||
s32 species32 = species;
|
||||
return gDungeon->sprites[species32];
|
||||
}
|
||||
|
||||
// 85.94 matching (Seth)
|
||||
// https://decomp.me/scratch/CI98Y
|
||||
// https://decomp.me/scratch/CI98Y
|
||||
//
|
||||
#ifdef NONMATCING
|
||||
void sub_80687EC(s32 _id)
|
||||
#ifdef NONMATCHING
|
||||
static void sub_80687EC(s32 _id)
|
||||
{
|
||||
u8 name [12];
|
||||
s16 id = _id;
|
||||
u8 name [12];
|
||||
s16 id = _id;
|
||||
|
||||
if (gDungeon->sprites[id] == NULL) {
|
||||
sprintf(name,gUnknown_8106EA0);
|
||||
gDungeon->sprites[id] = OpenFileAndGetFileDataPtr(name,&gMonsterFileArchive);
|
||||
}
|
||||
if (gDungeon->sprites[id] == NULL) {
|
||||
sprintf(name, gUnknown_8106EA0);
|
||||
gDungeon->sprites[id] = OpenFileAndGetFileDataPtr(name, &gMonsterFileArchive);
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_80687EC(s32 _id)
|
||||
static void sub_80687EC(s32 _id)
|
||||
{
|
||||
asm_unified(
|
||||
"\tpush {r4,r5,lr}\n"
|
||||
"\tsub sp, 0xC\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tasrs r2, r0, 16\n"
|
||||
"\tldr r5, _08068828\n"
|
||||
"\tldr r0, [r5]\n"
|
||||
"\tlsls r4, r2, 2\n"
|
||||
"\tldr r1, _0806882C\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tadds r0, r4\n"
|
||||
"\tldr r0, [r0]\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbne _08068820\n"
|
||||
"\tldr r1, _08068830\n"
|
||||
"\tmov r0, sp\n"
|
||||
"\tbl sprintf\n"
|
||||
"\tldr r1, _08068834\n"
|
||||
"\tmov r0, sp\n"
|
||||
"\tbl OpenFileAndGetFileDataPtr\n"
|
||||
"\tldr r1, [r5]\n"
|
||||
"\tldr r2, _0806882C\n"
|
||||
"\tadds r1, r2\n"
|
||||
"\tadds r1, r4\n"
|
||||
"\tstr r0, [r1]\n"
|
||||
"\tpush {r4,r5,lr}\n"
|
||||
"\tsub sp, 0xC\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tasrs r2, r0, 16\n"
|
||||
"\tldr r5, _08068828\n"
|
||||
"\tldr r0, [r5]\n"
|
||||
"\tlsls r4, r2, 2\n"
|
||||
"\tldr r1, _0806882C\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tadds r0, r4\n"
|
||||
"\tldr r0, [r0]\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbne _08068820\n"
|
||||
"\tldr r1, _08068830\n"
|
||||
"\tmov r0, sp\n"
|
||||
"\tbl sprintf\n"
|
||||
"\tldr r1, _08068834\n"
|
||||
"\tmov r0, sp\n"
|
||||
"\tbl OpenFileAndGetFileDataPtr\n"
|
||||
"\tldr r1, [r5]\n"
|
||||
"\tldr r2, _0806882C\n"
|
||||
"\tadds r1, r2\n"
|
||||
"\tadds r1, r4\n"
|
||||
"\tstr r0, [r1]\n"
|
||||
"_08068820:\n"
|
||||
"\tadd sp, 0xC\n"
|
||||
"\tpop {r4,r5}\n"
|
||||
"\tpop {r0}\n"
|
||||
"\tbx r0\n"
|
||||
"\t.align 2, 0\n"
|
||||
"\tadd sp, 0xC\n"
|
||||
"\tpop {r4,r5}\n"
|
||||
"\tpop {r0}\n"
|
||||
"\tbx r0\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_08068828: .4byte gDungeon\n"
|
||||
"_0806882C: .4byte 0x00017b44\n"
|
||||
"_08068830: .4byte gUnknown_8106EA0\n"
|
||||
@@ -92,25 +95,24 @@ void sub_80687EC(s32 _id)
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_8068838(s16 id, bool32 _param_2)
|
||||
void sub_8068838(s16 id, bool32 a1)
|
||||
{
|
||||
s32 id_s32 = id;
|
||||
bool8 param_2 = _param_2;
|
||||
bool8 param_2 = a1;
|
||||
|
||||
|
||||
if ((param_2 == 0) &&
|
||||
((id_s32 == MONSTER_DEOXYS_NORMAL) || (id_s32 == MONSTER_DEOXYS_ATTACK) || (id_s32 == MONSTER_DEOXYS_DEFENSE) || (id_s32 == MONSTER_DEOXYS_SPEED))) {
|
||||
if (param_2 == 0 &&
|
||||
(id_s32 == MONSTER_DEOXYS_NORMAL || id_s32 == MONSTER_DEOXYS_ATTACK || id_s32 == MONSTER_DEOXYS_DEFENSE || id_s32 == MONSTER_DEOXYS_SPEED)) {
|
||||
sub_80688B0();
|
||||
}
|
||||
else {
|
||||
sub_80687EC(id_s32);
|
||||
if ((u16)(id_s32 - MONSTER_CASTFORM) < 4) {
|
||||
// >= MONSTER_CASTFORM && <= MONSTER_CASTFORM_RAINY
|
||||
if ((u16)(id_s32 - MONSTER_CASTFORM) < 4)
|
||||
sub_8068884();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8068884(void)
|
||||
static void sub_8068884(void)
|
||||
{
|
||||
sub_80687EC(MONSTER_CASTFORM);
|
||||
sub_80687EC(MONSTER_CASTFORM_SNOWY);
|
||||
@@ -118,22 +120,19 @@ void sub_8068884(void)
|
||||
sub_80687EC(MONSTER_CASTFORM_RAINY);
|
||||
}
|
||||
|
||||
void sub_80688B0(void)
|
||||
static void sub_80688B0(void)
|
||||
{
|
||||
sub_80687EC(gDungeon->unk3800);
|
||||
}
|
||||
|
||||
void CloseAllSpriteFiles(void)
|
||||
{
|
||||
s32 index;
|
||||
s32 i;
|
||||
|
||||
for(index = 0; index < 0x1A8; index++)
|
||||
{
|
||||
if (gDungeon->sprites[index] != NULL) {
|
||||
CloseFile(gDungeon->sprites[index]);
|
||||
gDungeon->sprites[index] = NULL;
|
||||
for (i = 0; i <= MONSTER_MAX; i++) {
|
||||
if (gDungeon->sprites[i] != NULL) {
|
||||
CloseFile(gDungeon->sprites[i]);
|
||||
gDungeon->sprites[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,58 +1,57 @@
|
||||
#include "global.h"
|
||||
#include "code_805D8C8.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "constants/direction.h"
|
||||
#include "constants/status.h"
|
||||
#include "dungeon_entity.h"
|
||||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "pokemon.h"
|
||||
#include "pokemon_mid.h"
|
||||
#include "random.h"
|
||||
#include "sprite.h"
|
||||
#include "tile_types.h"
|
||||
|
||||
extern u8 sub_806CEBC(struct Entity *);
|
||||
extern void sub_806CCB4(struct Entity *, u8);
|
||||
extern void sub_803E46C(u32);
|
||||
extern bool8 sub_808DA44(s32 a1_, u32 a2_);
|
||||
extern u32 sub_806CF98(struct Entity *);
|
||||
extern struct OpenedFile *sub_80687D0(s16);
|
||||
void sub_806CDD4(struct Entity *, u8, u32);
|
||||
|
||||
// data_8106A4C.s
|
||||
extern const u8 gUnknown_8106EEF[];
|
||||
extern const u8 gDungeonWaterType[];
|
||||
|
||||
// code_803D110.s
|
||||
extern void sub_803E46C(u32);
|
||||
|
||||
void sub_806CC10(void)
|
||||
{
|
||||
struct EntityInfo *entityInfo;
|
||||
struct Entity *entity;
|
||||
s32 index;
|
||||
|
||||
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
|
||||
{
|
||||
entity = gDungeon->allPokemon[index];
|
||||
if (EntityExists(entity)) {
|
||||
entityInfo = entity->info;
|
||||
struct EntityInfo *entityInfo;
|
||||
struct Entity *entity;
|
||||
s32 i;
|
||||
|
||||
if ((entityInfo->unk166 != 0) && (entityInfo->unk166--, (entityInfo->unk166 & 1) == 0)) {
|
||||
sub_806CDD4(entity,0, (entityInfo->action.direction - 1) & 7);
|
||||
}
|
||||
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
|
||||
entity = gDungeon->allPokemon[i];
|
||||
|
||||
if (EntityExists(entity)) {
|
||||
entityInfo = entity->info;
|
||||
|
||||
if (entityInfo->unk166 != 0) {
|
||||
entityInfo->unk166--;
|
||||
if ((entityInfo->unk166 & 1) == 0) // If value is even:
|
||||
sub_806CDD4(entity, 0, (entityInfo->action.direction - 1) & 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_806CC70(void)
|
||||
{
|
||||
s32 index;
|
||||
s32 i;
|
||||
struct Entity *entity;
|
||||
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
|
||||
{
|
||||
entity = gDungeon->allPokemon[index];
|
||||
if(EntityExists(entity))
|
||||
|
||||
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
|
||||
entity = gDungeon->allPokemon[i];
|
||||
|
||||
if (EntityExists(entity))
|
||||
sub_806CCB4(entity, sub_806CEBC(entity));
|
||||
}
|
||||
}
|
||||
|
||||
void sub_806CCB4(struct Entity *entity, u8 param_2)
|
||||
void sub_806CCB4(struct Entity *entity, u8 a1)
|
||||
{
|
||||
s32 sVar1;
|
||||
bool8 flag;
|
||||
@@ -64,8 +63,8 @@ void sub_806CCB4(struct Entity *entity, u8 param_2)
|
||||
if (entity == gDungeon->cameraTarget)
|
||||
flag = FALSE;
|
||||
|
||||
entity->unk6B = param_2;
|
||||
entity->unk6A = param_2;
|
||||
entity->unk6B = a1;
|
||||
entity->unk6A = a1;
|
||||
entity->direction2 = info->action.direction;
|
||||
entity->direction = info->action.direction;
|
||||
entity->unk6F = 0;
|
||||
@@ -81,51 +80,42 @@ void sub_806CCB4(struct Entity *entity, u8 param_2)
|
||||
|
||||
void sub_806CD90(void)
|
||||
{
|
||||
s32 index;
|
||||
s32 i;
|
||||
struct Entity *entity;
|
||||
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
|
||||
{
|
||||
entity = gDungeon->allPokemon[index];
|
||||
if(EntityExists(entity))
|
||||
|
||||
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
|
||||
entity = gDungeon->allPokemon[i];
|
||||
|
||||
if (EntityExists(entity))
|
||||
sub_806CCB4(entity, sub_806CEBC(entity));
|
||||
}
|
||||
}
|
||||
|
||||
void sub_806CDD4(struct Entity *entity, u8 r1, u32 r2)
|
||||
void sub_806CDD4(struct Entity *entity, u8 a1, u32 a2)
|
||||
{
|
||||
if(GetEntityType(entity) == ENTITY_MONSTER)
|
||||
{
|
||||
entity->unk6A = r1;
|
||||
if(r2 < NUM_DIRECTIONS) entity->direction = r2;
|
||||
if (GetEntityType(entity) == ENTITY_MONSTER) {
|
||||
entity->unk6A = a1;
|
||||
|
||||
if (a2 < NUM_DIRECTIONS)
|
||||
entity->direction = a2;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_806CDFC(struct Entity *entity, u8 r1, u32 r2)
|
||||
void sub_806CDFC(struct Entity *entity, u8 a1, u32 a2)
|
||||
{
|
||||
if(GetEntityType(entity) == ENTITY_MONSTER)
|
||||
{
|
||||
if(entity->unk6B == r1)
|
||||
{
|
||||
if(entity->direction2 == r2)
|
||||
return;
|
||||
else
|
||||
goto change_dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
change_dir:
|
||||
sub_806CDD4(entity, r1, r2);
|
||||
}
|
||||
if (GetEntityType(entity) == ENTITY_MONSTER) {
|
||||
if (entity->unk6B == a1 && entity->direction2 == a2)
|
||||
return;
|
||||
sub_806CDD4(entity, a1, a2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_806CE34(struct Entity *entity, u32 newDir)
|
||||
{
|
||||
if(GetEntityType(entity) == ENTITY_MONSTER)
|
||||
{
|
||||
if (GetEntityType(entity) == ENTITY_MONSTER) {
|
||||
entity->unk6A = sub_806CEBC(entity);
|
||||
if(newDir < NUM_DIRECTIONS)
|
||||
{
|
||||
|
||||
if (newDir < NUM_DIRECTIONS) {
|
||||
entity->info->action.direction = newDir & DIRECTION_MASK;
|
||||
entity->direction = newDir & DIRECTION_MASK;
|
||||
}
|
||||
@@ -134,72 +124,67 @@ void sub_806CE34(struct Entity *entity, u32 newDir)
|
||||
|
||||
void sub_806CE68(struct Entity *entity, u32 newDir)
|
||||
{
|
||||
if(GetEntityType(entity) == ENTITY_MONSTER)
|
||||
{
|
||||
if (GetEntityType(entity) == ENTITY_MONSTER) {
|
||||
entity->unk6A = sub_806CEBC(entity);
|
||||
if(newDir < NUM_DIRECTIONS)
|
||||
{
|
||||
|
||||
if (newDir < NUM_DIRECTIONS)
|
||||
entity->direction = newDir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_806CE94(struct Entity *entity, u32 newDir)
|
||||
{
|
||||
if(GetEntityType(entity) == ENTITY_MONSTER)
|
||||
{
|
||||
if (GetEntityType(entity) == ENTITY_MONSTER) {
|
||||
entity->unk6A = 6;
|
||||
if(newDir < NUM_DIRECTIONS)
|
||||
{
|
||||
|
||||
if (newDir < NUM_DIRECTIONS)
|
||||
entity->direction = newDir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u8 sub_806CEBC(struct Entity *entity)
|
||||
{
|
||||
u8 sleep;
|
||||
struct EntityInfo * entityInfo1;
|
||||
struct EntityInfo * entityInfo2;
|
||||
u8 sleep;
|
||||
struct EntityInfo *entityInfo1;
|
||||
struct EntityInfo *entityInfo2;
|
||||
|
||||
// NOTE: copy needed to match
|
||||
entityInfo1 = entity->info;
|
||||
entityInfo2 = entity->info;
|
||||
sleep = entityInfo1->sleep;
|
||||
// NOTE: copy needed to match
|
||||
entityInfo1 = entity->info;
|
||||
entityInfo2 = entity->info;
|
||||
sleep = entityInfo1->sleep;
|
||||
|
||||
if ((sleep == STATUS_SLEEP) || (sleep == STATUS_NAPPING) || (sleep == STATUS_NIGHTMARE)) {
|
||||
if ((entityInfo2->apparentID != MONSTER_SUDOWOODO) || (entityInfo2->sleepTurns != 0x7f)) {
|
||||
return 5;
|
||||
if (sleep == STATUS_SLEEP || sleep == STATUS_NAPPING || sleep == STATUS_NIGHTMARE) {
|
||||
if (entityInfo2->apparentID != MONSTER_SUDOWOODO || entityInfo2->sleepTurns != 0x7F)
|
||||
return 5;
|
||||
else
|
||||
return 7;
|
||||
}
|
||||
else
|
||||
return 7;
|
||||
}
|
||||
else if (entityInfo2->chargingStatus == STATUS_BIDE) {
|
||||
return 0xB;
|
||||
}
|
||||
return 0x7;
|
||||
if (entityInfo2->chargingStatus == STATUS_BIDE)
|
||||
return 11;
|
||||
return 7;
|
||||
}
|
||||
|
||||
void sub_806CEFC(struct Entity *entity, u32 newDir)
|
||||
{
|
||||
entity->info->action.direction = newDir & DIRECTION_MASK;
|
||||
sub_806CE68(entity, (newDir & DIRECTION_MASK));
|
||||
entity->info->action.direction = newDir & DIRECTION_MASK;
|
||||
sub_806CE68(entity, newDir & DIRECTION_MASK);
|
||||
}
|
||||
|
||||
void sub_806CF18(struct Entity *entity)
|
||||
{
|
||||
s32 index;
|
||||
struct EntityInfo *entityInfo;
|
||||
s32 i;
|
||||
struct EntityInfo *entityInfo;
|
||||
|
||||
if (EntityExists(entity)) {
|
||||
if (!EntityExists(entity))
|
||||
return;
|
||||
|
||||
entityInfo = entity->info;
|
||||
for (index = 0; index < 100; index++) {
|
||||
sub_803E46C(0x21);
|
||||
if (!sub_808DA44(entityInfo->apparentID, entity->unk6B)) {
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < 100; i++) {
|
||||
sub_803E46C(33);
|
||||
|
||||
if (!sub_808DA44(entityInfo->apparentID, entity->unk6B))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u8 sub_806CF54(struct Entity *entity)
|
||||
@@ -209,39 +194,39 @@ u8 sub_806CF54(struct Entity *entity)
|
||||
|
||||
void sub_806CF60(void)
|
||||
{
|
||||
struct Entity *entity;
|
||||
s32 index;
|
||||
struct Entity *entity;
|
||||
s32 i;
|
||||
|
||||
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
|
||||
{
|
||||
entity = gDungeon->allPokemon[index];
|
||||
if (EntityExists(entity)) {
|
||||
sub_806CF98(entity);
|
||||
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
|
||||
entity = gDungeon->allPokemon[i];
|
||||
|
||||
if (EntityExists(entity))
|
||||
sub_806CF98(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_806CF98(struct Entity *entity)
|
||||
{
|
||||
struct Tile *mapTile;
|
||||
u32 uVar3;
|
||||
u16 terrainType;
|
||||
struct EntityInfo *entityInfo;
|
||||
struct Tile *mapTile;
|
||||
u32 uVar3;
|
||||
u16 terrainType;
|
||||
struct EntityInfo *entityInfo;
|
||||
|
||||
mapTile = GetTileAtEntitySafe(entity);
|
||||
terrainType = mapTile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
|
||||
entityInfo = entity->info;
|
||||
uVar3 = GetShadowSize(entityInfo->apparentID);
|
||||
if (terrainType == (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) {
|
||||
return 6;
|
||||
}
|
||||
if (terrainType == TERRAIN_TYPE_NORMAL) {
|
||||
if (IsWaterTileset()) {
|
||||
uVar3 = gUnknown_8106EEF[uVar3];
|
||||
mapTile = GetTileAtEntitySafe(entity);
|
||||
terrainType = mapTile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
|
||||
entityInfo = entity->info;
|
||||
uVar3 = GetShadowSize(entityInfo->apparentID);
|
||||
|
||||
if (terrainType == (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY))
|
||||
return 6;
|
||||
|
||||
if (terrainType == TERRAIN_TYPE_NORMAL) {
|
||||
if (IsWaterTileset())
|
||||
uVar3 = gUnknown_8106EEF[uVar3];
|
||||
}
|
||||
}
|
||||
else if ((terrainType == TERRAIN_TYPE_SECONDARY) && (gDungeonWaterType[gDungeon->tileset] != DUNGEON_WATER_TYPE_LAVA))
|
||||
uVar3 = gUnknown_8106EEF[uVar3];
|
||||
entityInfo->unk204 = uVar3;
|
||||
return uVar3;
|
||||
else if (terrainType == TERRAIN_TYPE_SECONDARY && gDungeonWaterType[gDungeon->tileset] != DUNGEON_WATER_TYPE_LAVA)
|
||||
uVar3 = gUnknown_8106EEF[uVar3];
|
||||
|
||||
entityInfo->unk204 = uVar3;
|
||||
return uVar3;
|
||||
}
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
#include "global.h"
|
||||
#include "code_80521D0.h"
|
||||
#include "code_805D8C8.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "code_8077274_1.h"
|
||||
#include "code_808417C.h"
|
||||
#include "constants/ability.h"
|
||||
#include "constants/item.h"
|
||||
#include "constants/status.h"
|
||||
#include "constants/type.h"
|
||||
#include "dungeon_entity.h"
|
||||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_items.h"
|
||||
#include "dungeon_movement.h"
|
||||
#include "dungeon_pokemon_attributes.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_items.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "code_80521D0.h"
|
||||
#include "code_8077274_1.h"
|
||||
#include "code_808417C.h"
|
||||
#include "moves.h"
|
||||
#include "move_effects_target.h"
|
||||
#include "pokemon.h"
|
||||
#include "status_checks_1.h"
|
||||
#include "code_805D8C8.h"
|
||||
|
||||
extern u8 gAvailablePokemonNames[0x58];
|
||||
extern u8 gUnknown_202DFE8[0x58];
|
||||
@@ -166,18 +167,14 @@ extern u8 *gUnknown_80FBF84[];
|
||||
extern void sub_8049ED4();
|
||||
extern void sub_8040A84();
|
||||
extern void sub_803E46C(u32);
|
||||
extern u8 sub_806CEBC(struct Entity *);
|
||||
extern void sub_806CCB4(struct Entity *, u8);
|
||||
extern void SetMessageArgument(u8 *buffer, struct Entity *r1, u32);
|
||||
extern void sub_80522F4(struct Entity *pokemon, struct Entity *r1, const char[]);
|
||||
extern void EntityUpdateStatusSprites(struct Entity *);
|
||||
extern void sub_8042A74(struct Entity *r0);
|
||||
extern void sub_807EC28(bool8);
|
||||
extern s32 sub_8069F54(struct Entity *param_1, s16 param_2);
|
||||
extern struct OpenedFile *sub_80687D0(s16);
|
||||
extern void sub_806A898(struct Entity *, u32, u32);
|
||||
extern void HealTargetHP(struct Entity *pokemon, struct Entity *r1, s16, s16, u32);
|
||||
extern void sub_806CE68(struct Entity *, s32);
|
||||
extern void sub_806F324(struct Entity *, s16, u32, u32);
|
||||
extern void sub_806BFC0(struct EntityInfo *, u32);
|
||||
extern void sub_80420C8(struct Entity *r0);
|
||||
@@ -212,7 +209,6 @@ extern void nullsub_86(struct Entity *);
|
||||
extern void sub_8041E0C(struct Entity *);
|
||||
extern void sub_8041DD8(struct Entity *r0, s32 r1); // NOTE: is s16 in another file
|
||||
extern s32 sub_803D870(void *, u32);
|
||||
extern void sub_806CF98(struct Entity *);
|
||||
extern bool8 sub_806AA0C(s32, u32);
|
||||
u32 ExtractSpeciesIndex(struct PokemonStruct **r0); // TODO: look more into this and fix it.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "constants/direction.h"
|
||||
#include "dungeon_entity.h"
|
||||
#include "dungeon_global_data.h"
|
||||
@@ -40,8 +41,6 @@ extern s32 GetCameraYPos(void);
|
||||
extern void sub_803F878(u32, u32);
|
||||
extern void sub_8086384(struct Entity *entity);
|
||||
extern void IncreaseEntityPixelPos(struct Entity *, u32, u32);
|
||||
extern void sub_806CE68(struct Entity *, u32);
|
||||
extern void sub_806CDD4(struct Entity *, u8, u32);
|
||||
extern void sub_804535C(struct Entity *, struct Position32 *);
|
||||
extern void sub_8086A54(struct Entity *);
|
||||
extern void sub_8086A3C(struct Entity *);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "constants/monster.h"
|
||||
#include "global.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "constants/bg_music.h"
|
||||
#include "constants/direction.h"
|
||||
#include "dungeon_entity.h"
|
||||
@@ -18,7 +19,6 @@ extern void sub_8085374();
|
||||
extern void sub_80855E4(void *);
|
||||
extern void sub_8068FE0(struct Entity *, u32, u32);
|
||||
extern void DisplayDungeonDialogue(u8 *);
|
||||
extern void sub_806CDD4(struct Entity *, u32, u32);
|
||||
extern void sub_80869E4(struct Entity *, u32, u32, u32);
|
||||
extern void sub_803E708(u32, u32);
|
||||
extern void sub_8086448(void);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "dungeon_ai_attack.h"
|
||||
|
||||
#include "constants/direction.h"
|
||||
|
||||
@@ -25,7 +25,6 @@ extern struct OpenedFile *gUnknown_202F18C;
|
||||
extern struct OpenedFile *gDungeonPaletteFile;
|
||||
extern struct unkStruct_202EE8C gUnknown_202EE8C[32];
|
||||
extern u8 gWalkableTileToCrossableTerrain[8];
|
||||
extern const u8 gDungeonWaterType[];
|
||||
extern u8 sub_8043CE4(u32);
|
||||
|
||||
extern int sprintf(char *, const char *, ...);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "dungeon_util_1.h"
|
||||
|
||||
#include "constants/direction.h"
|
||||
@@ -10,7 +11,6 @@
|
||||
|
||||
extern const u8 gUnknown_8107358[25];
|
||||
|
||||
extern void sub_806CE68(struct Entity *, u32);
|
||||
extern void sub_804535C(struct Entity *, u32);
|
||||
extern s32 GetCameraXPos(void);
|
||||
extern s32 GetCameraYPos(void);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "global.h"
|
||||
|
||||
|
||||
#include "code_806CD90.h"
|
||||
#include "constants/ability.h"
|
||||
#include "constants/dungeon_action.h"
|
||||
#include "constants/direction.h"
|
||||
@@ -69,7 +68,6 @@ extern u8 *gUnknown_80FB564[];
|
||||
extern u8 *gUnknown_80FB548[];
|
||||
extern u8 *gUnknown_80FCE84[];
|
||||
extern u8 *gUnknown_80FCE5C[];
|
||||
extern const u8 gDungeonWaterType[];
|
||||
extern u8 *gUnknown_80FD524[];
|
||||
extern s16 gUnknown_80F4E34[];
|
||||
extern u8 *gUnknown_80FCEDC[];
|
||||
@@ -135,7 +133,6 @@ extern void sub_8076CB4(s32);
|
||||
extern void sub_8041F08(struct Entity *);
|
||||
extern void sub_8041C7C(struct Entity *);
|
||||
extern void sub_8041C6C(struct Entity *);
|
||||
extern void sub_806CE94(struct Entity *, u32);
|
||||
extern void sub_8041C34(struct Entity *);
|
||||
extern void sub_8041EF8(struct Entity *);
|
||||
extern void sub_8041EE8(struct Entity *);
|
||||
@@ -146,7 +143,6 @@ extern void SetMessageArgument(char[], struct Entity*, u32);
|
||||
extern void SetMessageArgument_2(char[], struct EntityInfo*, u32);
|
||||
extern void sub_8041AF4(struct Entity *);
|
||||
extern void sub_80522F4(struct Entity *r1, struct Entity *r2, u8 *);
|
||||
extern void sub_806CE68(struct Entity *, s32);
|
||||
extern void nullsub_91(struct Entity *);
|
||||
extern void nullsub_90(struct Entity *);
|
||||
extern void nullsub_72(struct Entity *);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "pokemon.h"
|
||||
#include "pokemon_3.h"
|
||||
#include "pokemon_mid.h"
|
||||
#include "file_system.h"
|
||||
#include "item.h"
|
||||
#include "moves.h"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "status.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "constants/ability.h"
|
||||
#include "constants/status.h"
|
||||
#include "constants/type.h"
|
||||
@@ -125,10 +126,8 @@ extern void sub_8041D5C(struct Entity *);
|
||||
extern void RaiseAttackStageTarget(struct Entity *, struct Entity *, u32, u32);
|
||||
extern void RaiseDefenseStageTarget(struct Entity *, struct Entity *, u32, u32);
|
||||
extern void sub_8041D48(struct Entity *);
|
||||
extern u8 sub_806CEBC(struct Entity *);
|
||||
extern void sub_8041D38(struct Entity * pokemon);
|
||||
extern void sub_803E46C(u32);
|
||||
extern void sub_806CCB4(struct Entity *, u8);
|
||||
extern u8 sub_8043D10(void);
|
||||
extern void sub_8041CDC(struct Entity *pokemon);
|
||||
extern void sub_8041CEC(struct Entity *pokemon);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "status_actions.h"
|
||||
|
||||
#include "code_806CD90.h"
|
||||
#include "code_80521D0.h"
|
||||
#include "code_8077274_1.h"
|
||||
#include "code_808417C.h"
|
||||
@@ -45,7 +45,6 @@ extern void sub_8042A64(struct Position *);
|
||||
extern void sub_8040A84(void);
|
||||
extern void sub_8049ED4(void);
|
||||
extern void sub_80498A8(s32, s32);
|
||||
extern void sub_806CF60();
|
||||
extern void sub_8042A54(struct Position *);
|
||||
extern void sub_8049BB0(s32, s32);
|
||||
extern s16 sub_8057600(struct Move*, u32);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "tile_types.h"
|
||||
|
||||
#include "code_806CD90.h"
|
||||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_map_access.h"
|
||||
#include "dungeon_util.h"
|
||||
@@ -87,7 +87,6 @@ const u8 gDungeonWaterType[] = {
|
||||
extern void sub_80498A8(s32, s32);
|
||||
extern void sub_80402AC(s32, s32);
|
||||
extern void sub_8049BB0(s32, s32);
|
||||
extern u32 sub_806CF98(struct Entity *);
|
||||
void sub_8042A14(struct Position *);
|
||||
extern void sub_8049ED4(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user