mirror of
https://github.com/pret/pmd-red.git
synced 2026-09-11 18:45:55 -05:00
split dungeon item action
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
#include "constants/status.h"
|
||||
.section .rodata
|
||||
|
||||
.align 2,0
|
||||
.string "pksdir0"
|
||||
.align 2,0
|
||||
.string "pksdir0"
|
||||
@@ -209,7 +209,8 @@ SECTIONS {
|
||||
src/dungeon_util.o(.text);
|
||||
src/dungeon_items.o(.text);
|
||||
asm/code_8046CE4.o(.text);
|
||||
src/code_8048480.o(.text);
|
||||
src/code_8046CE4.o(.text);
|
||||
src/dungeon_item_action.o(.text);
|
||||
src/dungeon_ai_item_weight.o(.text);
|
||||
src/dungeon_map_access.o(.text);
|
||||
src/dungeon_generation.o(.text);
|
||||
@@ -546,7 +547,8 @@ SECTIONS {
|
||||
data/pksdir_1.o(.rodata);
|
||||
src/dungeon_util.o(.text);
|
||||
src/dungeon_items.o(.rodata);
|
||||
data/data_80F59C8_7.o(.rodata);
|
||||
src/code_8046CE4.o(.rodata);
|
||||
src/dungeon_item_action.o(.rodata);
|
||||
src/dungeon_ai_item_weight.o(.rodata);
|
||||
src/dungeon_map_access.o(.rodata);
|
||||
src/dungeon_generation.o(.rodata);
|
||||
|
||||
39
src/code_8046CE4.c
Normal file
39
src/code_8046CE4.c
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "global.h"
|
||||
#include "globaldata.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "dungeon_items.h"
|
||||
#include "dungeon_config.h"
|
||||
#include "structs/dungeon_entity.h"
|
||||
|
||||
// Decompile code_8046CE4.s from bottom instead of top and put functions before sub_8047930
|
||||
|
||||
bool8 sub_8047930(Entity *pokemon, Entity *target)
|
||||
{
|
||||
bool8 flag;
|
||||
|
||||
if (((GetEntInfo(target)->shopkeeper == TRUE) ||
|
||||
(GetEntInfo(target)->monsterBehavior == BEHAVIOR_DIGLETT)) || (GetEntInfo(target)->monsterBehavior == BEHAVIOR_RESCUE_TARGET)) {
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
if(DungeonRandInt(100) < gUnknownDungeonChance)
|
||||
flag = TRUE;
|
||||
else
|
||||
flag = FALSE;
|
||||
if (GetEntityType(pokemon) == ENTITY_MONSTER) {
|
||||
if (HasHeldItem(pokemon, ITEM_WHIFF_SPECS)) {
|
||||
flag = FALSE;
|
||||
}
|
||||
else {
|
||||
if (HasHeldItem(pokemon, ITEM_LOCKON_SPECS)) {
|
||||
flag = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((GetEntityType(target) == ENTITY_MONSTER) && (HasHeldItem(target, ITEM_DODGE_SCARF))) {
|
||||
flag = FALSE;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "globaldata.h"
|
||||
#include "code_803E668.h"
|
||||
#include "code_8041AD0.h"
|
||||
#include "dungeon_message.h"
|
||||
@@ -129,36 +130,6 @@ extern void sub_80464C8(Entity *, DungeonPos *, Item *);
|
||||
extern void sub_806A6E8(Entity *);
|
||||
extern void sub_8042390(Entity *, Item *);
|
||||
|
||||
bool8 sub_8047930(Entity *pokemon, Entity *target)
|
||||
{
|
||||
bool8 flag;
|
||||
|
||||
if (((GetEntInfo(target)->shopkeeper == TRUE) ||
|
||||
(GetEntInfo(target)->monsterBehavior == BEHAVIOR_DIGLETT)) || (GetEntInfo(target)->monsterBehavior == BEHAVIOR_RESCUE_TARGET)) {
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
if(DungeonRandInt(100) < gUnknownDungeonChance)
|
||||
flag = TRUE;
|
||||
else
|
||||
flag = FALSE;
|
||||
if (GetEntityType(pokemon) == ENTITY_MONSTER) {
|
||||
if (HasHeldItem(pokemon, ITEM_WHIFF_SPECS)) {
|
||||
flag = FALSE;
|
||||
}
|
||||
else {
|
||||
if (HasHeldItem(pokemon, ITEM_LOCKON_SPECS)) {
|
||||
flag = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((GetEntityType(target) == ENTITY_MONSTER) && (HasHeldItem(target, ITEM_DODGE_SCARF))) {
|
||||
flag = FALSE;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
void sub_80479B8(char param_1, char param_2, u8 param_3, Entity *pokemon, Entity *target, Item *item)
|
||||
{
|
||||
EntityInfo *info;
|
||||
Reference in New Issue
Block a user