mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-09-07 09:15:52 -05:00
Name BgEvent struct
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
#ifndef POKEPLATINUM_STRUCT_0203A594_H
|
||||
#define POKEPLATINUM_STRUCT_0203A594_H
|
||||
|
||||
typedef struct {
|
||||
u16 unk_00;
|
||||
u16 unk_02;
|
||||
int unk_04;
|
||||
int unk_08;
|
||||
int unk_0C;
|
||||
u16 unk_10;
|
||||
u8 padding_12[2];
|
||||
} UnkStruct_0203A594;
|
||||
typedef struct BgEvent {
|
||||
u16 script;
|
||||
u16 type;
|
||||
int x;
|
||||
int z;
|
||||
int y;
|
||||
u16 playerFacingDir;
|
||||
u8 padding[2];
|
||||
} BgEvent;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_0203A594_H
|
||||
|
||||
@@ -12,7 +12,7 @@ void sub_0203A378(FieldSystem * fieldSystem, int param1);
|
||||
void sub_0203A398(FieldSystem * fieldSystem);
|
||||
void FieldSystem_LoadMapData(FieldSystem * fieldSystem, int param1);
|
||||
void sub_0203A418(FieldSystem * fieldSystem);
|
||||
const UnkStruct_0203A594 * sub_0203A440(const FieldSystem * fieldSystem);
|
||||
const BgEvent * sub_0203A440(const FieldSystem * fieldSystem);
|
||||
int sub_0203A448(const FieldSystem * fieldSystem);
|
||||
const UnkStruct_0203A55C * sub_0203A450(const FieldSystem * fieldSystem, int param1);
|
||||
int sub_0203A468(const FieldSystem * fieldSystem, int param1, int param2);
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
|
||||
#include "field/field_system_decl.h"
|
||||
#include "struct_decls/struct_02061AB4_decl.h"
|
||||
#include "struct_defs/struct_0203A594.h"
|
||||
|
||||
void sub_0203C9D4(FieldSystem * fieldSystem, MapObject ** param1);
|
||||
u8 sub_0203CA40(FieldSystem * fieldSystem, MapObject ** param1);
|
||||
u16 sub_0203CA6C(FieldSystem * fieldSystem, void * param1, int param2);
|
||||
u16 sub_0203CB80(FieldSystem * fieldSystem, void * param1, int param2);
|
||||
u16 sub_0203CA6C(FieldSystem * fieldSystem, const BgEvent * param1, int param2);
|
||||
u16 sub_0203CB80(FieldSystem * fieldSystem, const BgEvent * param1, int param2);
|
||||
u8 sub_0203CBE0(FieldSystem * fieldSystem, MapObject ** param1);
|
||||
u16 sub_0203CC14(FieldSystem * fieldSystem, void * param1, int param2);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ struct UnkStruct_0203A3E8_t {
|
||||
u32 npcCount;
|
||||
u32 unk_08;
|
||||
u32 unk_0C;
|
||||
const UnkStruct_0203A594 * unk_10;
|
||||
const BgEvent * unk_10;
|
||||
const struct UnkStruct_020619DC_t * unk_14;
|
||||
const UnkStruct_0203A55C * unk_18;
|
||||
const UnkStruct_0203A4AC * unk_1C;
|
||||
@@ -70,7 +70,7 @@ static void sub_0203A3E8 (UnkStruct_0203A3E8 * param0, int param1)
|
||||
|
||||
v0 = MapHeader_GetEventsArchiveID(param1);
|
||||
GF_ASSERT(NARC_GetMemberSizeByIndexPair(NARC_INDEX_FIELDDATA__EVENTDATA__ZONE_EVENT, v0) < sizeof(param0->unk_20));
|
||||
NARC_ReadWholeMemberByIndexPair(param0->unk_20, 32, v0);
|
||||
NARC_ReadWholeMemberByIndexPair(param0->unk_20, NARC_INDEX_FIELDDATA__EVENTDATA__ZONE_EVENT, v0);
|
||||
}
|
||||
|
||||
void sub_0203A418 (FieldSystem * fieldSystem)
|
||||
@@ -84,7 +84,7 @@ void sub_0203A418 (FieldSystem * fieldSystem)
|
||||
}
|
||||
}
|
||||
|
||||
const UnkStruct_0203A594 * sub_0203A440 (const FieldSystem * fieldSystem)
|
||||
const BgEvent * sub_0203A440 (const FieldSystem * fieldSystem)
|
||||
{
|
||||
return fieldSystem->unk_14->unk_10;
|
||||
}
|
||||
@@ -216,11 +216,11 @@ BOOL sub_0203A584 (FieldSystem * fieldSystem, u16 param1, u16 param2)
|
||||
|
||||
BOOL sub_0203A594 (FieldSystem * fieldSystem, u16 param1, u16 param2, u16 param3)
|
||||
{
|
||||
UnkStruct_0203A594 * v0 = (UnkStruct_0203A594 *)sub_0203A440(fieldSystem);
|
||||
BgEvent * v0 = sub_0203A440(fieldSystem);
|
||||
|
||||
(v0) += param1;
|
||||
v0->unk_04 = param2;
|
||||
v0->unk_08 = param3;
|
||||
v0->x = param2;
|
||||
v0->z = param3;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -233,12 +233,12 @@ static void sub_0203A5B0 (UnkStruct_0203A3E8 * param0)
|
||||
v0 += sizeof(u32);
|
||||
|
||||
if (param0->unk_00 != 0) {
|
||||
param0->unk_10 = (const UnkStruct_0203A594 *)v0;
|
||||
param0->unk_10 = (const BgEvent *)v0;
|
||||
} else {
|
||||
param0->unk_10 = NULL;
|
||||
}
|
||||
|
||||
v0 += sizeof(UnkStruct_0203A594) * param0->unk_00;
|
||||
v0 += sizeof(BgEvent) * param0->unk_00;
|
||||
param0->npcCount = *(u32 *)v0;
|
||||
v0 += sizeof(u32);
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#include "player_avatar.h"
|
||||
#include "map_object.h"
|
||||
|
||||
static u8 sub_0203CB18(FieldSystem * fieldSystem, const UnkStruct_0203A594 * param1);
|
||||
static u8 sub_0203CAEC(FieldSystem * fieldSystem, const UnkStruct_0203A594 * param1);
|
||||
static u8 sub_0203CB18(FieldSystem * fieldSystem, const BgEvent * param1);
|
||||
static u8 sub_0203CAEC(FieldSystem * fieldSystem, const BgEvent * param1);
|
||||
|
||||
static int sub_0203C954 (FieldSystem * fieldSystem, int * param1, int * param2)
|
||||
{
|
||||
@@ -96,25 +96,23 @@ u8 sub_0203CA40 (FieldSystem * fieldSystem, MapObject ** param1)
|
||||
return 0;
|
||||
}
|
||||
|
||||
u16 sub_0203CA6C (FieldSystem * fieldSystem, void * param1, int param2)
|
||||
u16 sub_0203CA6C (FieldSystem * fieldSystem, const BgEvent * param1, int param2)
|
||||
{
|
||||
const UnkStruct_0203A594 * v0;
|
||||
const BgEvent * v0 = param1;
|
||||
int v1, v2;
|
||||
int v3;
|
||||
|
||||
v0 = (const UnkStruct_0203A594 *)param1;
|
||||
|
||||
sub_0203C954(fieldSystem, &v1, &v2);
|
||||
|
||||
for (v3 = 0; v3 < param2; v3++) {
|
||||
if ((v1 == v0[v3].unk_04) && (v2 == v0[v3].unk_08)) {
|
||||
if (v0[v3].unk_02 == 2) {
|
||||
if ((v1 == v0[v3].x) && (v2 == v0[v3].z)) {
|
||||
if (v0[v3].type == 2) {
|
||||
if (sub_0203CAEC(fieldSystem, &v0[v3]) == 1) {
|
||||
return v0[v3].unk_00;
|
||||
return v0[v3].script;
|
||||
}
|
||||
} else {
|
||||
if (sub_0203CB18(fieldSystem, &v0[v3]) == 1) {
|
||||
return v0[v3].unk_00;
|
||||
return v0[v3].script;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,43 +121,43 @@ u16 sub_0203CA6C (FieldSystem * fieldSystem, void * param1, int param2)
|
||||
return 0xffff;
|
||||
}
|
||||
|
||||
static u8 sub_0203CAEC (FieldSystem * fieldSystem, const UnkStruct_0203A594 * param1)
|
||||
static u8 sub_0203CAEC (FieldSystem * fieldSystem, const BgEvent * param1)
|
||||
{
|
||||
if (param1->unk_02 != 2) {
|
||||
if (param1->type != 2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sub_0203F188(fieldSystem, sub_0203F2F4(param1->unk_00)) == 1) {
|
||||
if (sub_0203F188(fieldSystem, sub_0203F2F4(param1->script)) == 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static u8 sub_0203CB18 (FieldSystem * fieldSystem, const UnkStruct_0203A594 * param1)
|
||||
static u8 sub_0203CB18 (FieldSystem * fieldSystem, const BgEvent * param1)
|
||||
{
|
||||
if (param1->unk_10 == 4) {
|
||||
if (param1->playerFacingDir == 4) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (PlayerAvatar_GetDir(fieldSystem->playerAvatar)) {
|
||||
case 0:
|
||||
if ((param1->unk_10 == 0) || (param1->unk_10 == 6)) {
|
||||
if ((param1->playerFacingDir == 0) || (param1->playerFacingDir == 6)) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if ((param1->unk_10 == 3) || (param1->unk_10 == 6)) {
|
||||
if ((param1->playerFacingDir == 3) || (param1->playerFacingDir == 6)) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if ((param1->unk_10 == 2) || (param1->unk_10 == 5)) {
|
||||
if ((param1->playerFacingDir == 2) || (param1->playerFacingDir == 5)) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if ((param1->unk_10 == 1) || (param1->unk_10 == 5)) {
|
||||
if ((param1->playerFacingDir == 1) || (param1->playerFacingDir == 5)) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -168,9 +166,8 @@ static u8 sub_0203CB18 (FieldSystem * fieldSystem, const UnkStruct_0203A594 * pa
|
||||
return 0;
|
||||
}
|
||||
|
||||
u16 sub_0203CB80 (FieldSystem * fieldSystem, void * param1, int param2)
|
||||
u16 sub_0203CB80 (FieldSystem * fieldSystem, const BgEvent * param1, int param2)
|
||||
{
|
||||
const UnkStruct_0203A594 * v0;
|
||||
int v1, v2;
|
||||
int v3;
|
||||
|
||||
@@ -178,12 +175,12 @@ u16 sub_0203CB80 (FieldSystem * fieldSystem, void * param1, int param2)
|
||||
return 0xffff;
|
||||
}
|
||||
|
||||
v0 = (const UnkStruct_0203A594 *)param1;
|
||||
const BgEvent * v0 = param1;
|
||||
sub_0203C954(fieldSystem, &v1, &v2);
|
||||
|
||||
for (v3 = 0; v3 < param2; v3++) {
|
||||
if ((v1 == v0[v3].unk_04) && (v2 == v0[v3].unk_08) && (v0[v3].unk_02 == 1)) {
|
||||
return v0[v3].unk_00;
|
||||
if ((v1 == v0[v3].x) && (v2 == v0[v3].z) && (v0[v3].type == 1)) {
|
||||
return v0[v3].script;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -823,7 +823,7 @@ static BOOL sub_0203F404 (UnkStruct_0203EF60 * param0, u16 param1)
|
||||
UnkStruct_0203F478 * sub_0203F478 (FieldSystem * fieldSystem, int param1)
|
||||
{
|
||||
UnkStruct_0203F478 * v0;
|
||||
const UnkStruct_0203A594 * v1;
|
||||
const BgEvent * v1;
|
||||
int v2, v3, v4, v5, v6, v7;
|
||||
int v8, v9, v10, v11;
|
||||
|
||||
@@ -864,12 +864,12 @@ UnkStruct_0203F478 * sub_0203F478 (FieldSystem * fieldSystem, int param1)
|
||||
}
|
||||
|
||||
for (v4 = 0; v4 < v5; v4++) {
|
||||
if ((v1[v4].unk_02 == 2) && (sub_0203F188(fieldSystem, sub_0203F2F4(v1[v4].unk_00)) == 0)) {
|
||||
if ((v1[v4].unk_04 >= v8) && (v1[v4].unk_04 <= v9) && (v1[v4].unk_08 >= v10) && (v1[v4].unk_08 <= v11)) {
|
||||
v0[v6].unk_04 = sub_0203F3C8(v1[v4].unk_00);
|
||||
v7 = (v2 - v1[v4].unk_04);
|
||||
if ((v1[v4].type == 2) && (sub_0203F188(fieldSystem, sub_0203F2F4(v1[v4].script)) == 0)) {
|
||||
if ((v1[v4].x >= v8) && (v1[v4].x <= v9) && (v1[v4].z >= v10) && (v1[v4].z <= v11)) {
|
||||
v0[v6].unk_04 = sub_0203F3C8(v1[v4].script);
|
||||
v7 = (v2 - v1[v4].x);
|
||||
v0[v6].unk_00 = abs(7 - v7);
|
||||
v7 = (v3 - v1[v4].unk_08);
|
||||
v7 = (v3 - v1[v4].z);
|
||||
v0[v6].unk_02 = abs(7 - v7);
|
||||
v6++;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@ def parse_bg_events(bg_events: Sequence[Mapping], *args) -> bytes:
|
||||
bg_bytes.extend(j2b.parse_int(bg['x'], 4))
|
||||
bg_bytes.extend(j2b.parse_int(bg['z'], 4))
|
||||
bg_bytes.extend(j2b.parse_int(bg['y'], 4))
|
||||
bg_bytes.extend(j2b.parse_int(bg['player_facing_dir'], 4))
|
||||
bg_bytes.extend(j2b.parse_int(bg['player_facing_dir'], 2))
|
||||
bg_bytes.extend(j2b.parse_int(0, 2))
|
||||
return bg_bytes
|
||||
|
||||
def parse_object_events(obj_events: Sequence[Mapping], *args) -> bytes:
|
||||
|
||||
Reference in New Issue
Block a user