add globaldata to dungeon logic.c

This commit is contained in:
DizzyEggg
2025-03-30 23:14:46 +02:00
parent b829b761f6
commit db818c95cb
3 changed files with 47 additions and 52 deletions

View File

@@ -6,8 +6,3 @@ gUnknown_8106F7C: @ 8106F7C
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.global gUnknown_8106FA4
gUnknown_8106FA4: @ 8106FA4
.string "{color}%c%s{reset}\0"

View File

@@ -87,8 +87,8 @@ void sub_806F480(Entity *pokemon, u8 r1)
}
}
u8 sub_806F4A4(Entity *pokemon, u8 type) {
u8 sub_806F4A4(Entity *pokemon, u8 type)
{
EntityInfo *info = GetEntInfo(pokemon);
s32 index;
@@ -173,6 +173,8 @@ void sub_806F63C(Entity *param_1)
}
}
// FILE SPLIT HERE
bool8 sub_806F660(Entity *pokemon, Entity *target)
{
s32 i;
@@ -284,7 +286,6 @@ bool8 sub_806F660(Entity *pokemon, Entity *target)
return TRUE;
}
void nullsub_96(Entity *pokemon,Entity *target)
{}

View File

@@ -1,4 +1,5 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_logic.h"
#include "structs/map.h"
#include "constants/item.h"
@@ -32,54 +33,11 @@
// This file deals with things like controlling movement, walkable tiles, ai targeting, status checks and pokemon attributes.
extern const u8 gUnknown_8106FA4[];
extern void sub_80429B4(Entity *r0);
extern void ShowVisualFlags(Entity *r0);
EWRAM_DATA u8 gWalkableTileToCrossableTerrain[8] = {0};
const u8 gDirectionBitMasks_1[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gDirectionBitMasks_2[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gDirectionBitMasks_3[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gDirectionBitMasks_4[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gDirectionBitMasks_5[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gDirectionBitMasks_6[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gDirectionBitMasks_7[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gTreatmentData[3][2][2][2] = {
{
{
{TREATMENT_TREAT_AS_ALLY, TREATMENT_IGNORE},
{TREATMENT_TREAT_AS_ENEMY, TREATMENT_IGNORE}
},
{
{TREATMENT_TREAT_AS_ENEMY, TREATMENT_IGNORE},
{TREATMENT_TREAT_AS_ALLY, TREATMENT_IGNORE}
}
},
{
{
{TREATMENT_TREAT_AS_ALLY, TREATMENT_IGNORE},
{TREATMENT_TREAT_AS_ENEMY, TREATMENT_IGNORE}
},
{
{TREATMENT_IGNORE, TREATMENT_TREAT_AS_ENEMY},
{TREATMENT_IGNORE, TREATMENT_TREAT_AS_ENEMY}
}
},
{
{
{TREATMENT_IGNORE, TREATMENT_TREAT_AS_ENEMY},
{TREATMENT_IGNORE, TREATMENT_TREAT_AS_ENEMY}
},
{
{TREATMENT_TREAT_AS_ENEMY, TREATMENT_IGNORE},
{TREATMENT_TREAT_AS_ALLY, TREATMENT_IGNORE}
}
}
};
u8 GetCrossableTerrain(s16 species)
{
u8 walkableTiles = GetMovementType(species);
@@ -471,7 +429,7 @@ void SetMessageArgument_2(u8 *buffer, EntityInfo *param_2, s32 colorNum)
void sub_8070968(u8 *buffer, EntityInfo *entityInfo, s32 colorNum)
{
if (entityInfo->curseClassStatus.status == STATUS_DECOY) {
sprintfStatic(buffer, gUnknown_8106FA4, colorNum + 0x30, gUnknown_80F8974);
sprintfStatic(buffer, _("{color}%c%s{reset}"), colorNum + 0x30, gUnknown_80F8974);
}
else if (entityInfo->isNotTeamMember) {
CopyCyanMonsterNametoBuffer(buffer, entityInfo->apparentID);
@@ -681,6 +639,47 @@ bool8 CannotAttack(Entity *pokemon, bool8 skipSleep)
return TRUE;
}
static const u8 gDirectionBitMasks_1[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
static const u8 gDirectionBitMasks_2[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
static const u8 gDirectionBitMasks_3[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
static const u8 gDirectionBitMasks_4[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
static const u8 gDirectionBitMasks_5[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
static const u8 gDirectionBitMasks_6[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
static const u8 gDirectionBitMasks_7[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
static const u8 gTreatmentData[3][2][2][2] = {
{
{
{TREATMENT_TREAT_AS_ALLY, TREATMENT_IGNORE},
{TREATMENT_TREAT_AS_ENEMY, TREATMENT_IGNORE}
},
{
{TREATMENT_TREAT_AS_ENEMY, TREATMENT_IGNORE},
{TREATMENT_TREAT_AS_ALLY, TREATMENT_IGNORE}
}
},
{
{
{TREATMENT_TREAT_AS_ALLY, TREATMENT_IGNORE},
{TREATMENT_TREAT_AS_ENEMY, TREATMENT_IGNORE}
},
{
{TREATMENT_IGNORE, TREATMENT_TREAT_AS_ENEMY},
{TREATMENT_IGNORE, TREATMENT_TREAT_AS_ENEMY}
}
},
{
{
{TREATMENT_IGNORE, TREATMENT_TREAT_AS_ENEMY},
{TREATMENT_IGNORE, TREATMENT_TREAT_AS_ENEMY}
},
{
{TREATMENT_TREAT_AS_ENEMY, TREATMENT_IGNORE},
{TREATMENT_TREAT_AS_ALLY, TREATMENT_IGNORE}
}
}
};
bool8 CanMoveInDirection(Entity *pokemon, u32 direction)
{
u8 crossableTerrain = GetCrossableTerrain(GetEntInfo(pokemon)->id);