NO3&NP3&RWRP CreateEntityWhenIn duplicates (#190)

There are numerous duplicates of the `CreateEntityWhenInVerticalRange`
and `CreateEntityWhenInHorizontalRange` functions. This pull request
matches the duplicates identified in overlays NO3, NP3, and RWRP:

- NO3  - `func_801C3500` - Renamed to `CreateEntityWhenInVerticalRange`
- NO3 - `func_801C3618` - Renamed to `CreateEntityWhenInHorizontalRange`
- NP3  - `func_801BAD70` - Renamed to `CreateEntityWhenInVerticalRange`
- NP3 - `func_801BAE88` - Renamed to `CreateEntityWhenInHorizontalRange`
- RWRP - `func_8018BE1C` - Renamed to `CreateEntityWhenInVerticalRange`
- RWRP - `func_8018BF34` - Renamed to
`CreateEntityWhenInHorizontalRange`
This commit is contained in:
SestrenExsis 2023-04-15 06:08:23 -07:00 committed by GitHub
parent a5292eac71
commit 7c51a5f6ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 230 additions and 7 deletions

View File

@ -16,6 +16,8 @@ Random = 0x801C184C;
Update = 0x801C187C;
EntityNumericDamage = 0x801C2D98;
CreateEntityFromLayout = 0x801C343C;
CreateEntityWhenInVerticalRange = 0x801C3500;
CreateEntityWhenInHorizontalRange = 0x801C3618;
InitRoomEntities = 0x801C3C98;
CreateEntityFromCurrentEntity = 0x801C3EC4;
CreateEntityFromEntity = 0x801C3F38;

View File

@ -30,6 +30,8 @@ Random = 0x801B90BC;
Update = 0x801B90EC;
EntityNumericDamage = 0x801BA608;
CreateEntityFromLayout = 0x801BACAC;
CreateEntityWhenInVerticalRange = 0x801BAD70;
CreateEntityWhenInHorizontalRange = 0x801BAE88;
InitRoomEntities = 0x801BB508;
CreateEntityFromCurrentEntity = 0x801BB734;
CreateEntityFromEntity = 0x801BB7A8;

View File

@ -2,3 +2,5 @@ g_SpriteBanks = 0x80180040;
g_Rooms = 0x801811AC;
Update = 0x8018A198;
func_801951F0 = 0x801951F0;
CreateEntityWhenInVerticalRange = 0x8018BE1C;
CreateEntityWhenInHorizontalRange = 0x8018BF34;

View File

@ -409,9 +409,81 @@ void CreateEntityFromLayout(Entity* entity, LayoutObject* initDesc) {
entity->unk68 = (initDesc->objectId >> 0xA) & 7;
}
INCLUDE_ASM("asm/us/st/no3/nonmatchings/3E134", func_801C3500);
void CreateEntityWhenInVerticalRange(LayoutObject* layoutObj) {
s16 yClose;
s16 yFar;
s16 posY;
Entity* entity;
INCLUDE_ASM("asm/us/st/no3/nonmatchings/3E134", func_801C3618);
posY = g_Camera.posY.i.hi;
yClose = posY - 0x40;
yFar = posY + 0x120;
if (yClose < 0) {
yClose = 0;
}
posY = layoutObj->posY;
if (posY < yClose) {
return;
}
if (yFar < posY) {
return;
}
switch (layoutObj->objectId & 0xE000) {
case 0x0:
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
if (entity->objectId == 0) {
CreateEntityFromLayout(entity, layoutObj);
}
break;
case 0x8000:
break;
case 0xA000:
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
CreateEntityFromLayout(entity, layoutObj);
break;
}
}
void CreateEntityWhenInHorizontalRange(LayoutObject* layoutObj) {
s16 xClose;
s16 xFar;
s16 posX;
Entity* entity;
posX = g_Camera.posX.i.hi;
xClose = posX - 0x40;
xFar = posX + 0x140;
if (xClose < 0) {
xClose = 0;
}
posX = layoutObj->posX;
if (posX < xClose) {
return;
}
if (xFar < posX) {
return;
}
switch (layoutObj->objectId & 0xE000) {
case 0x0:
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
if (entity->objectId == 0) {
CreateEntityFromLayout(entity, layoutObj);
}
break;
case 0x8000:
break;
case 0xA000:
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
CreateEntityFromLayout(entity, layoutObj);
break;
}
}
void func_801C3730(s16 arg0) {
while (true) {

View File

@ -1229,9 +1229,81 @@ void CreateEntityFromLayout(Entity* entity, LayoutObject* initDesc) {
entity->unk68 = (initDesc->objectId >> 0xA) & 7;
}
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3246C", func_801BAD70);
void CreateEntityWhenInVerticalRange(LayoutObject* layoutObj) {
s16 yClose;
s16 yFar;
s16 posY;
Entity* entity;
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3246C", func_801BAE88);
posY = g_Camera.posY.i.hi;
yClose = posY - 0x40;
yFar = posY + 0x120;
if (yClose < 0) {
yClose = 0;
}
posY = layoutObj->posY;
if (posY < yClose) {
return;
}
if (yFar < posY) {
return;
}
switch (layoutObj->objectId & 0xE000) {
case 0x0:
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
if (entity->objectId == 0) {
CreateEntityFromLayout(entity, layoutObj);
}
break;
case 0x8000:
break;
case 0xA000:
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
CreateEntityFromLayout(entity, layoutObj);
break;
}
}
void CreateEntityWhenInHorizontalRange(LayoutObject* layoutObj) {
s16 xClose;
s16 xFar;
s16 posX;
Entity* entity;
posX = g_Camera.posX.i.hi;
xClose = posX - 0x40;
xFar = posX + 0x140;
if (xClose < 0) {
xClose = 0;
}
posX = layoutObj->posX;
if (posX < xClose) {
return;
}
if (xFar < posX) {
return;
}
switch (layoutObj->objectId & 0xE000) {
case 0x0:
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
if (entity->objectId == 0) {
CreateEntityFromLayout(entity, layoutObj);
}
break;
case 0x8000:
break;
case 0xA000:
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
CreateEntityFromLayout(entity, layoutObj);
break;
}
}
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3246C", func_801BAFA0);

View File

@ -84,4 +84,4 @@ extern s32 D_8018268C;
extern s32 D_801826A4;
extern PfnEntityUpdate PfnEntityUpdates[];
LayoutObject* D_801D276C;
extern u16 D_801D33F4[];
extern u16 D_801D33F4[];

View File

@ -28,9 +28,81 @@ INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/8DF0", func_8018B6B4);
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/8DF0", func_8018BD58);
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/8DF0", func_8018BE1C);
void CreateEntityWhenInVerticalRange(LayoutObject* layoutObj) {
s16 yClose;
s16 yFar;
s16 posY;
Entity* entity;
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/8DF0", func_8018BF34);
posY = g_Camera.posY.i.hi;
yClose = posY - 0x40;
yFar = posY + 0x120;
if (yClose < 0) {
yClose = 0;
}
posY = layoutObj->posY;
if (posY < yClose) {
return;
}
if (yFar < posY) {
return;
}
switch (layoutObj->objectId & 0xE000) {
case 0x0:
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
if (entity->objectId == 0) {
func_8018BD58(entity, layoutObj);
}
break;
case 0x8000:
break;
case 0xA000:
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
func_8018BD58(entity, layoutObj);
break;
}
}
void CreateEntityWhenInHorizontalRange(LayoutObject* layoutObj) {
s16 xClose;
s16 xFar;
s16 posX;
Entity* entity;
posX = g_Camera.posX.i.hi;
xClose = posX - 0x40;
xFar = posX + 0x140;
if (xClose < 0) {
xClose = 0;
}
posX = layoutObj->posX;
if (posX < xClose) {
return;
}
if (xFar < posX) {
return;
}
switch (layoutObj->objectId & 0xE000) {
case 0x0:
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
if (entity->objectId == 0) {
func_8018BD58(entity, layoutObj);
}
break;
case 0x8000:
break;
case 0xA000:
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
func_8018BD58(entity, layoutObj);
break;
}
}
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/8DF0", func_8018C04C);

View File

@ -10,4 +10,5 @@ extern s16 D_80180A94[];
extern ObjInit2 D_80181134[];
extern LayoutObject* D_80195A30;
extern LayoutObject* D_80195A34;
void func_8018BD58(Entity*, LayoutObject*);
#endif