some renames

This commit is contained in:
DizzyEggg
2025-06-06 18:13:18 +02:00
parent a443314d48
commit bf077a679a
8 changed files with 174 additions and 158 deletions
+15 -12
View File
@@ -1,5 +1,6 @@
#include "global.h"
#include "globaldata.h"
#include "ground_bg.h"
#include "ground_map.h"
#include "text_1.h"
#include "memory.h"
@@ -13,11 +14,13 @@
#include "unk_dungeon_load.h"
#include "constants/dungeon.h"
// This file most likely deals with map loading and writing to VRAM. It even has a custom decompression function.
extern const struct unkStruct_81188F0 gUnknown_81188F0[10];
extern const FileArchive gGroundFileArchive;
void sub_80A456C(GroundBg *groundBg, s32 id, const PixelPos *srcPos);
static void sub_80A2DD4(GroundBg *groundBg);
static void CloseOpenedFiles(GroundBg *groundBg);
void sub_80A3BB0(GroundBg *groundBg, s32 a0);
static void sub_80A3EB0(SubStruct_488 *map488);
static const u8 *sub_80A3908(u16 **dstArray, const void *src_, SubStruct_52C *a2, SubStruct_448 *a3);
@@ -38,7 +41,7 @@ extern void sub_809971C(u16 a0, const void *a1, int a2);
static const PixelPos sPositionZero = {0, 0};
void sub_80A2B40(GroundBg *groundBg, const SubStruct_52C *a1)
void GroundBg_Init(GroundBg *groundBg, const SubStruct_52C *a1)
{
SubStruct_0 *unk0Ptr;
s32 id, unk0Id, unk3E0Id;
@@ -109,11 +112,11 @@ void sub_80A2B40(GroundBg *groundBg, const SubStruct_52C *a1)
}
}
void sub_80A2D00(GroundBg *groundBg)
void GroundBg_FreeAll(GroundBg *groundBg)
{
s32 i;
sub_80A2DD4(groundBg);
CloseOpenedFiles(groundBg);
TRY_FREE_AND_SET_NULL(groundBg->unk544);
FREE_AND_SET_NULL(groundBg->unk548);
@@ -139,7 +142,7 @@ void sub_80A2D88(GroundBg *groundBg)
}
}
void sub_80A2DD4(GroundBg *groundBg)
static void CloseOpenedFiles(GroundBg *groundBg)
{
s32 i;
@@ -161,7 +164,7 @@ void sub_80A2E64(GroundBg *groundBg)
SubStruct_0 *unk0Ptr;
s32 unk0Id, unk3E0Id;
sub_80A2DD4(groundBg);
CloseOpenedFiles(groundBg);
groundBg->unk444 = -1;
groundBg->unk528 = 0;
groundBg->unk448.unk0 = 0;
@@ -240,7 +243,7 @@ void sub_80A2FBC(GroundBg *groundBg, s32 a1_)
return;
}
sub_80A2DD4(groundBg);
CloseOpenedFiles(groundBg);
groundBg->unk444 = a1;
dataPtr = &gUnknown_81188F0[a1];
groundBg->unk430 = OpenFileAndGetFileDataPtr(dataPtr->text1, &gGroundFileArchive);
@@ -421,7 +424,7 @@ void sub_80A3440(GroundBg *groundBg, s32 a1_, DungeonLocation *dungLoc, s32 a3)
}
sub_80A2FBC(groundBg, a1);
sub_80A2DD4(groundBg);
CloseOpenedFiles(groundBg);
groundBg->unk444 = a1;
dataPtr = &gUnknown_81188F0[a1];
groundBg->unk430 = OpenFileAndGetFileDataPtr(dataPtr->text1, &gGroundFileArchive);
@@ -601,7 +604,7 @@ static void _UncompressCell(void *dst_, u16 *a1, const void *src_, SubStruct_52C
}
// Tilemap decompression algorhitm?
static const u8 *sub_80A3908(u16 **dstArray, const void *src_, SubStruct_52C *a2, SubStruct_448 *a3)
static const u8 *sub_80A3908(u16 **dstArray, const void *src_, SubStruct_52C *a2, SubStruct_448 *mapPtr_448)
{
s32 i, j, k, l;
const u8 *src = src_;
@@ -609,10 +612,10 @@ static const u8 *sub_80A3908(u16 **dstArray, const void *src_, SubStruct_52C *a2
for (i = 0; i < a2->unkC; i++) {
u16 *dst = dstArray[i];
for (j = 0; j < a3->unk5; j++) {
for (j = 0; j < mapPtr_448->unk5; j++) {
k = 0;
if (j == 0) {
while (k < a3->unk4) {
while (k < mapPtr_448->unk4) {
s32 val = *src++;
if (val > 191) {
for (l = 191; l < val; l++) {
@@ -641,7 +644,7 @@ static const u8 *sub_80A3908(u16 **dstArray, const void *src_, SubStruct_52C *a2
}
else {
u16 *ptrVal = dst - 64;
while (k < a3->unk4) {
while (k < mapPtr_448->unk4) {
s32 val = *src++;
if (val > 191) {
for (l = 191; l < val; l++) {
+2 -2
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "debug.h"
#include "event_flag.h"
#include "ground_bg.h"
#include "ground_main.h"
#include "ground_map.h"
#include "ground_map_2.h"
@@ -31,7 +32,6 @@ extern bool8 GroundScriptNotify(void *, s32);
extern const CallbackData gGroundScriptNullCallbacks;
extern const DebugLocation gUnknown_8117538[];
extern void sub_80A2D00(GroundBg *);
extern void sub_80A2D68(GroundBg *);
extern void sub_80A2D88(GroundBg *);
@@ -60,7 +60,7 @@ void GroundMap_Reset(void)
ActionResetScriptData((Action *)gGroundMapAction, gUnknown_8117538);
if (gGroundMapDungeon_3001B70 != NULL) {
sub_80A2D00(gGroundMapDungeon_3001B70);
GroundBg_FreeAll(gGroundMapDungeon_3001B70);
MemoryFree(gGroundMapDungeon_3001B70);
gGroundMapDungeon_3001B70 = NULL;
}
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "ground_bg.h"
#include "ground_map.h"
#include "ground_map_2.h"
#include "ground_script.h"
+4 -5
View File
@@ -2,6 +2,7 @@
#include "code_800558C.h"
#include "debug.h"
#include "event_flag.h"
#include "ground_bg.h"
#include "ground_map.h"
#include "ground_map_2.h"
#include "memory.h"
@@ -9,14 +10,12 @@
IWRAM_INIT unkStruct_3001B74 *gUnknown_3001B74 = {NULL};
IWRAM_INIT GroundBg *gUnknown_3001B78 = {NULL};
extern const u8 gUnknown_8117784[];
extern const SubStruct_52C gUnknown_8117784;
extern const s16 gUnknown_811E5F4[][2];
extern const u8 gGroundWeatherSelect[];
extern const s32 gUnknown_81177BC[];
extern void sub_80A3BB0(GroundBg *, u32);
extern void sub_80A2D00(GroundBg *);
extern void sub_80A2B40(GroundBg *, const u8 *);
extern void sub_80A2FBC(GroundBg *, u32);
extern void sub_80A49E8(GroundBg *);
extern void sub_80A456C(GroundBg *, u32, const s32 *);
@@ -56,14 +55,14 @@ void sub_80A5EDC(u8 param_1)
gUnknown_3001B74->unk2 = param_1;
if (gUnknown_3001B78 != NULL) {
sub_80A2D00(gUnknown_3001B78);
GroundBg_FreeAll(gUnknown_3001B78);
MemoryFree(gUnknown_3001B78);
gUnknown_3001B78 = NULL;
}
if (param_1) {
gUnknown_3001B78 = MemoryAlloc(sizeof(GroundBg), 6);
sub_80A2B40(gUnknown_3001B78, gUnknown_8117784);
GroundBg_Init(gUnknown_3001B78, &gUnknown_8117784);
sub_80A2FBC(gUnknown_3001B78, -1);
}
}