mirror of
https://github.com/pret/pmd-red.git
synced 2026-08-22 00:34:40 -05:00
merge dungeon range and code_808333C
This commit is contained in:
@@ -275,7 +275,6 @@ SECTIONS {
|
||||
src/trap.o(.text);
|
||||
src/dungeon_serializer.o(.text);
|
||||
src/dungeon_range.o(.text);
|
||||
src/code_808333C.o(.text);
|
||||
src/dungeon_leader.o(.text);
|
||||
asm/code_8083654.o(.text);
|
||||
src/dungeon_music.o(.text);
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "structs/str_dungeon.h"
|
||||
#include "structs/str_202ED28.h"
|
||||
#include "sprite.h"
|
||||
|
||||
bool8 sub_8083568(s32 inX, s32 inY, u8 index)
|
||||
{
|
||||
s32 x = inX - gDungeon->unk181e8.cameraPixelPos.x;
|
||||
s32 y = inY - gDungeon->unk181e8.cameraPixelPos.y;
|
||||
|
||||
if (x >= -16 && y >= -16 && x <= 255 && y <= 175)
|
||||
{
|
||||
SpriteSetX(&gUnknown_202ED28[0][index].sprite, x + gUnknown_202ED28[0][index].pos.x);
|
||||
SpriteSetY(&gUnknown_202ED28[0][index].sprite, y + gUnknown_202ED28[0][index].pos.y);
|
||||
|
||||
AddSprite(&gUnknown_202ED28[0][index].sprite, 0, NULL, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
#include "global.h"
|
||||
#include "dungeon_range.h"
|
||||
|
||||
#include "sprite.h"
|
||||
#include "structs/str_dungeon.h"
|
||||
#include "dungeon_map_access.h"
|
||||
#include "structs/map.h"
|
||||
#include "structs/str_202ED28.h"
|
||||
|
||||
|
||||
bool8 IsPositionActuallyInSight(DungeonPos *pos1, DungeonPos *pos2)
|
||||
{
|
||||
@@ -137,33 +139,17 @@ bool8 IsTargetTwoTilesAway(DungeonPos *pos1, DungeonPos *pos2)
|
||||
s32 x2;
|
||||
s32 y2;
|
||||
|
||||
diff = pos1->x - pos2->x;
|
||||
if (diff < 0)
|
||||
{
|
||||
diff = -diff;
|
||||
}
|
||||
diff = abs(pos1->x - pos2->x);
|
||||
if (diff < 2)
|
||||
{
|
||||
diff = pos1->y - pos2->y;
|
||||
if (diff < 0)
|
||||
{
|
||||
diff = -diff;
|
||||
}
|
||||
diff = abs(pos1->y - pos2->y);
|
||||
if (diff < 2)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
xDiff = pos1->x - pos2->x;
|
||||
if (xDiff < 0)
|
||||
{
|
||||
xDiff = -xDiff;
|
||||
}
|
||||
yDiff = pos1->y - pos2->y;
|
||||
if (yDiff < 0)
|
||||
{
|
||||
yDiff = -yDiff;
|
||||
}
|
||||
xDiff = abs(pos1->x - pos2->x);
|
||||
yDiff = abs(pos1->y - pos2->y);
|
||||
if (yDiff < xDiff)
|
||||
{
|
||||
yDiff = xDiff;
|
||||
@@ -229,3 +215,22 @@ bool8 IsTargetTwoTilesAway(DungeonPos *pos1, DungeonPos *pos2)
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_8083568(s32 inX, s32 inY, u8 index)
|
||||
{
|
||||
s32 x = inX - gDungeon->unk181e8.cameraPixelPos.x;
|
||||
s32 y = inY - gDungeon->unk181e8.cameraPixelPos.y;
|
||||
|
||||
if (x >= -16 && y >= -16 && x <= 255 && y <= 175)
|
||||
{
|
||||
SpriteSetX(&gUnknown_202ED28[0][index].sprite, x + gUnknown_202ED28[0][index].pos.x);
|
||||
SpriteSetY(&gUnknown_202ED28[0][index].sprite, y + gUnknown_202ED28[0][index].pos.y);
|
||||
|
||||
AddSprite(&gUnknown_202ED28[0][index].sprite, 0, NULL, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user