mirror of
https://github.com/pret/pmd-red.git
synced 2026-04-22 06:58:07 -05:00
Decomped CanSee()
This commit is contained in:
parent
b458476078
commit
da8fcb2ac8
5133
asm/code_80450F8.s
5133
asm/code_80450F8.s
File diff suppressed because it is too large
Load Diff
5078
asm/code_8045A00.s
Normal file
5078
asm/code_8045A00.s
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -272,10 +272,10 @@ struct DungeonEntity
|
|||
|
||||
enum EntityType
|
||||
{
|
||||
ENTITY_NONE = 0,
|
||||
ENTITY_POKEMON = 1,
|
||||
ENTITY_TRAP = 2,
|
||||
ENTITY_ITEM = 3
|
||||
ENTITY_NONE,
|
||||
ENTITY_POKEMON,
|
||||
ENTITY_TRAP,
|
||||
ENTITY_ITEM
|
||||
};
|
||||
|
||||
enum MovementFlag
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "dungeon_entity.h"
|
||||
|
||||
// 0x71884
|
||||
bool8 CanSeeInvisible(struct DungeonEntity *pokemon);
|
||||
// 0x718AC
|
||||
bool8 HasTactic(struct DungeonEntity *pokemon, u8 tactic);
|
||||
// 0x718D8
|
||||
|
|
|
|||
9
include/dungeon_visibility.h
Normal file
9
include/dungeon_visibility.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef GUARD_DUNGEON_VISIBILITY_H
|
||||
#define GUARD_DUNGEON_VISIBILITY_H
|
||||
|
||||
#include "dungeon_entity.h"
|
||||
|
||||
// 0x45990
|
||||
bool8 CanSee(struct DungeonEntity *entity, struct DungeonEntity *targetEntity);
|
||||
|
||||
#endif
|
||||
|
|
@ -190,6 +190,8 @@ SECTIONS {
|
|||
asm/code_804ACA0.o(.text);
|
||||
src/dungeon_util.o(.text);
|
||||
asm/code_80450F8.o(.text);
|
||||
src/dungeon_visibility.o(.text);
|
||||
asm/code_8045A00.o(.text);
|
||||
src/code_8048480.o(.text);
|
||||
asm/code_8048480.o(.text);
|
||||
src/code_80521D0.o(.text);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_entity.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "friend_area.h"
|
||||
#include "map.h"
|
||||
#include "pokemon.h"
|
||||
|
|
@ -95,7 +96,6 @@ extern void sub_8042B0C(struct DungeonEntity *);
|
|||
extern void SetFacingDirection(struct DungeonEntity *, u32);
|
||||
extern void DisplayDungeonDialogue(u32 *);
|
||||
extern void sub_803E708(u32, u32);
|
||||
extern u8 EntityExists(struct DungeonEntity *);
|
||||
extern u8 HasRecruitedMon(u32);
|
||||
extern u8 sub_806FD18(struct DungeonEntity *);
|
||||
extern u8 sub_8083E74(u32);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include "dungeon_random.h"
|
||||
#include "dungeon_random_1.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "dungeon_visibility.h"
|
||||
#include "item.h"
|
||||
#include "team_inventory.h"
|
||||
|
||||
|
|
@ -33,7 +34,6 @@ extern struct MapTile* GetMapTileAtPosition(s16, s16);
|
|||
extern u32 EvaluateItem(struct DungeonEntity*, struct ItemSlot*, u8);
|
||||
extern bool8 ToolboxEnabled(struct DungeonEntityData*);
|
||||
extern void sub_8077274(struct DungeonEntity *, struct DungeonEntity *);
|
||||
extern bool8 CanSee(struct DungeonEntity*, struct DungeonEntity*);
|
||||
extern void TargetThrownItem(struct DungeonEntity*, struct DungeonEntity*, struct ItemSlot*, u8, bool8);
|
||||
|
||||
extern s32 gNumPotentialTargets;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "dungeon_random.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "dungeon_util_1.h"
|
||||
#include "dungeon_visibility.h"
|
||||
#include "map.h"
|
||||
#include "pokemon.h"
|
||||
|
||||
|
|
@ -25,7 +26,6 @@ extern void SendImmobilizeEndMessage(struct DungeonEntity*, struct DungeonEntity
|
|||
extern void SetMessageArgument(char[], struct DungeonEntity*, u32);
|
||||
extern void SendMessage(struct DungeonEntity*, char*);
|
||||
extern bool8 HasStatusAffectingActions(struct DungeonEntity*);
|
||||
extern bool8 CanSee(struct DungeonEntity*, struct DungeonEntity*);
|
||||
extern void ResetAction(u16*);
|
||||
extern void SetWalkAction(u16*, s16);
|
||||
extern void DecideAttack(struct DungeonEntity*);
|
||||
|
|
|
|||
35
src/dungeon_visibility.c
Normal file
35
src/dungeon_visibility.c
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#include "global.h"
|
||||
#include "dungeon_visibility.h"
|
||||
|
||||
#include "constants/status.h"
|
||||
#include "dungeon_pokemon_attributes_1.h"
|
||||
#include "dungeon_util.h"
|
||||
|
||||
extern bool8 InSameRoom_2(struct Position*, struct Position*);
|
||||
|
||||
bool8 CanSee(struct DungeonEntity *entity, struct DungeonEntity *targetEntity)
|
||||
{
|
||||
if (!EntityExists(entity) || !EntityExists(targetEntity) || !targetEntity->visible)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (targetEntity->entityType == ENTITY_POKEMON)
|
||||
{
|
||||
if (entity->entityType == ENTITY_POKEMON)
|
||||
{
|
||||
if (!CanSeeInvisible(entity) && targetEntity->entityData->transformStatus == TRANSFORM_STATUS_INVISIBLE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (entity->entityData->eyesightStatus == EYESIGHT_STATUS_BLINKER)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (targetEntity->entityData->transformStatus == TRANSFORM_STATUS_INVISIBLE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return InSameRoom_2(&entity->posWorld, &targetEntity->posWorld);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user