Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document BDHC file loading #362

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/constants/bdhc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef POKEPLATINUM_CONSTANTS_BDHC_H
#define POKEPLATINUM_CONSTANTS_BDHC_H

#define BDHC_BUFFER_SIZE 0x9000

#define BDHC_MAGIC_LENGTH 4

#endif // POKEPLATINUM_CONSTANTS_BDHC_H
35 changes: 35 additions & 0 deletions include/overlay005/bdhc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef POKEPLATINUM_OV5_BDHC_H
#define POKEPLATINUM_OV5_BDHC_H

#include <nitro/fx/fx.h>

typedef struct BDHCPlate {
u16 firstPointIndex;
u16 secondPointIndex;
u16 normalIndex;
u16 heightIndex;
} BDHCPlate;

typedef struct BDHCPoint {
fx32 x;
fx32 y;
} BDHCPoint;

typedef struct BDHCStrip {
fx32 lowerBound;
u16 accessListElementCount;
u16 accessListStartIndex;
} BDHCStrip;

typedef struct BDHC {
BDHCPlate *plates;
fx32 *heights;
BDHCStrip *strips;
u16 *accessList;
BDHCPoint *points;
VecFx32 *slopes;
BOOL loaded;
int stripsSize;
} BDHC;

#endif // POKEPLATINUM_OV5_BDHC_H
18 changes: 18 additions & 0 deletions include/overlay005/bdhc_loader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef POKEPLATINUM_OV5_BDHC_LOADER_H
#define POKEPLATINUM_OV5_BDHC_LOADER_H

#include "overlay005/bdhc.h"

#include "narc.h"
#include "sys_task_manager.h"

void BDHCLoader_Load(NARC *narc, const int bdhcSize, BDHC *bdhc, u8 *buffer);
SysTask *BDHCLoader_StartTask(NARC *landDataNARC, const int param1, BDHC *bdhc, int *param3, u8 **buffer, int *param5);
void BDHCLoader_ForceExitTask(SysTask *sysTask);
void BDHCLoader_MarkBDHCNotLoaded(BDHC *bdhc);

BDHC *BDHC_New(void);
void BDHC_Free(BDHC *bdhc);
void BDHC_Reset(BDHC *bdhc);

#endif // POKEPLATINUM_OV5_BDHC_LOADER_H
4 changes: 2 additions & 2 deletions include/overlay005/ov5_021E779C.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#include <nitro/fx/fx.h>

#include "field/field_system_decl.h"
#include "overlay005/bdhc.h"
#include "overlay005/funcptr_ov5_021E9630.h"
#include "overlay005/struct_ov5_021D3CAC_decl.h"
#include "overlay005/struct_ov5_021D5894.h"
#include "overlay005/struct_ov5_021E1608_decl.h"
#include "overlay005/struct_ov5_021E8F60_decl.h"
#include "overlay005/struct_ov5_021EF13C_decl.h"
#include "overlay005/struct_ov5_021EF76C_decl.h"

#include "map_matrix.h"
Expand All @@ -33,7 +33,7 @@ u8 ov5_021E935C(const u32 param0, const int param1);
u8 ov5_021E9390(const int param0, const u8 param1, const UnkStruct_ov5_021E8F60 *param2);
int ov5_021E9560(const UnkStruct_ov5_021E8F60 *param0, const u8 param1);
BOOL ov5_021E9580(const UnkStruct_ov5_021E8F60 *param0, const int param1, const int param2, u8 *param3);
const UnkStruct_ov5_021EF13C *ov5_021E9610(const UnkStruct_ov5_021E8F60 *param0, const u8 param1);
const BDHC *ov5_021E9610(const UnkStruct_ov5_021E8F60 *param0, const u8 param1);
u16 const *ov5_021E9624(const UnkStruct_ov5_021E8F60 *param0, const u8 param1);
void ov5_021E9630(UnkStruct_ov5_021E8F60 *param0, UnkFuncPtr_ov5_021E9630 param1, void *param2);
NARC *ov5_021E9828(UnkStruct_ov5_021E8F60 *param0);
Expand Down
4 changes: 2 additions & 2 deletions include/overlay005/ov5_021EEC68.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef POKEPLATINUM_OV5_021EEC68_H
#define POKEPLATINUM_OV5_021EEC68_H

#include "overlay005/struct_ov5_021EF13C_decl.h"
#include "overlay005/bdhc.h"

BOOL ov5_021EED9C(const fx32 param0, const fx32 param1, const fx32 param2, const UnkStruct_ov5_021EF13C *param3, fx32 *param4);
BOOL ov5_021EED9C(const fx32 param0, const fx32 param1, const fx32 param2, const BDHC *param3, fx32 *param4);

#endif // POKEPLATINUM_OV5_021EEC68_H
17 changes: 0 additions & 17 deletions include/overlay005/ov5_021EEF34.h

This file was deleted.

9 changes: 0 additions & 9 deletions include/overlay005/struct_ov5_021EEC68.h

This file was deleted.

10 changes: 0 additions & 10 deletions include/overlay005/struct_ov5_021EED38.h

This file was deleted.

21 changes: 0 additions & 21 deletions include/overlay005/struct_ov5_021EF13C.h

This file was deleted.

6 changes: 0 additions & 6 deletions include/overlay005/struct_ov5_021EF13C_decl.h

This file was deleted.

11 changes: 0 additions & 11 deletions include/overlay005/struct_ov5_021EF13C_sub1.h

This file was deleted.

2 changes: 1 addition & 1 deletion platinum.us/main.lsf
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ Overlay overlay5
Object main.nef.p/src_overlay005_ov5_021EE7D4.c.o
Object main.nef.p/src_overlay005_ov5_021EEAC8.c.o
Object main.nef.p/src_overlay005_ov5_021EEC68.c.o
Object main.nef.p/src_overlay005_ov5_021EEF34.c.o
Object main.nef.p/src_overlay005_bdhc_loader.c.o
Object main.nef.p/src_overlay005_ov5_021EF250.c.o
Object main.nef.p/src_overlay005_hblank_system.c.o
Object main.nef.p/src_overlay005_ov5_021EF4BC.c.o
Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ pokeplatinum_c = files(
'overlay005/ov5_021EE7D4.c',
'overlay005/ov5_021EEAC8.c',
'overlay005/ov5_021EEC68.c',
'overlay005/ov5_021EEF34.c',
'overlay005/bdhc_loader.c',
'overlay005/ov5_021EF250.c',
'overlay005/hblank_system.c',
'overlay005/ov5_021EF4BC.c',
Expand Down
Loading