Split switcher orb

This commit is contained in:
DizzyEggg
2025-03-31 15:04:56 +02:00
parent 0dfd2d592f
commit 9ba1272b4b
4 changed files with 83 additions and 49 deletions

View File

@@ -3,8 +3,7 @@
.align 2
@ ???
.string "pksdir0\0"
@ ???
.string "pksdir0\0"
@ ???

View File

@@ -267,6 +267,7 @@ SECTIONS {
src/drought_orb.o(.text);
src/one_room_orb.o(.text);
src/explosion.o(.text);
src/switcher_orb.o(.text);
src/code_807E1A0.o(.text);
src/weather.o(.text);
src/code_807E5AC.o(.text);
@@ -611,6 +612,7 @@ SECTIONS {
src/one_room_orb.o(.rodata);
data/pksdir_2.o(.rodata);
src/explosion.o(.rodata);
src/switcher_orb.o(.rodata);
data/data_8107010.o(.rodata);
src/dungeon_serializer.o(.rodata);
data/data_8107224.o(.rodata);

View File

@@ -31,53 +31,6 @@ extern u8 *gUnknown_80FCAC0[];
void HandleSwitcherOrb(Entity *pokemon,Entity *target)
{
DungeonPos pokemonPos;
DungeonPos targetPos;
if (AbilityIsActive(pokemon, ABILITY_SUCTION_CUPS)) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],pokemon,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCAC0); // $m0 is anchored! It won't switch places
}
else if(AbilityIsActive(target, ABILITY_SUCTION_CUPS))
{
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCAC0); // $m0 is anchored! It won't switch places
}
else
{
pokemonPos.x = pokemon->pos.x;
pokemonPos.y = pokemon->pos.y;
targetPos.x = target->pos.x;
targetPos.y = target->pos.y;
nullsub_93(&pokemonPos);
nullsub_93(&targetPos);
sub_80694C0(pokemon,targetPos.x,targetPos.y,1);
sub_80694C0(target,pokemonPos.x,pokemonPos.y,1);
sub_804535C(pokemon,NULL);
sub_804535C(target,NULL);
if (EntityIsValid(pokemon)) {
if (GetEntInfo(pokemon)->isTeamLeader) {
sub_804AC20(&pokemon->pos);
sub_807EC28(FALSE);
}
sub_806A5B8(pokemon);
sub_8075900(pokemon,gDungeon->forceMonsterHouse);
}
if (EntityIsValid(target)) {
if (GetEntInfo(target)->isTeamLeader) {
sub_804AC20(&target->pos);
sub_807EC28(FALSE);
}
sub_806A5B8(target);
sub_8075900(target,gDungeon->forceMonsterHouse);
}
}
}
void sub_807E378(void)
{

80
src/switcher_orb.c Normal file
View File

@@ -0,0 +1,80 @@
#include "global.h"
#include "globaldata.h"
#include "constants/ability.h"
#include "constants/weather.h"
#include "code_803E46C.h"
#include "dungeon_message.h"
#include "code_806CD90.h"
#include "code_807CD9C.h"
#include "structs/str_dungeon.h"
#include "code_8077274_1.h"
#include "dungeon_ai.h"
#include "run_dungeon.h"
#include "dungeon_generation.h"
#include "dungeon_logic.h"
#include "dungeon_map.h"
#include "dungeon_map_access.h"
#include "dungeon_util.h"
#include "math.h"
#include "move_effects_target.h"
#include "moves.h"
#include "move_util.h"
#include "code_8041AD0.h"
#include "code_803E668.h"
#include "weather.h"
#include "dungeon_config.h"
#include "dungeon_misc.h"
#include "dungeon_items.h"
#include "dungeon_strings.h"
extern void sub_807EC28(bool8);
extern void nullsub_93(DungeonPos *);
void HandleSwitcherOrb(Entity *pokemon,Entity *target)
{
DungeonPos pokemonPos;
DungeonPos targetPos;
if (AbilityIsActive(pokemon, ABILITY_SUCTION_CUPS)) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],pokemon,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FCAC0); // $m0 is anchored! It won't switch places
}
else if(AbilityIsActive(target, ABILITY_SUCTION_CUPS))
{
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FCAC0); // $m0 is anchored! It won't switch places
}
else
{
pokemonPos.x = pokemon->pos.x;
pokemonPos.y = pokemon->pos.y;
targetPos.x = target->pos.x;
targetPos.y = target->pos.y;
nullsub_93(&pokemonPos);
nullsub_93(&targetPos);
sub_80694C0(pokemon,targetPos.x,targetPos.y,1);
sub_80694C0(target,pokemonPos.x,pokemonPos.y,1);
sub_804535C(pokemon,NULL);
sub_804535C(target,NULL);
if (EntityIsValid(pokemon)) {
if (GetEntInfo(pokemon)->isTeamLeader) {
sub_804AC20(&pokemon->pos);
sub_807EC28(FALSE);
}
sub_806A5B8(pokemon);
sub_8075900(pokemon,gDungeon->forceMonsterHouse);
}
if (EntityIsValid(target)) {
if (GetEntInfo(target)->isTeamLeader) {
sub_804AC20(&target->pos);
sub_807EC28(FALSE);
}
sub_806A5B8(target);
sub_8075900(target,gDungeon->forceMonsterHouse);
}
}
}