Merge pull request #433 from SethBarberee/ground_map_1
Some checks are pending
GithubCI / build (push) Waiting to run

Ground map 1
This commit is contained in:
AnonymousRandomPerson 2025-08-24 16:03:30 -04:00 committed by GitHub
commit e1a7ae9347
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 1332 additions and 1579 deletions

File diff suppressed because it is too large Load Diff

View File

@ -6,9 +6,20 @@
void GroundBg_Init(GroundBg *groundBg, const SubStruct_52C *a1);
void GroundBg_FreeAll(GroundBg *groundBg);
void sub_80A2D68(GroundBg *groundBg);
void sub_80A2D88(GroundBg *groundBg);
void sub_80A2FBC(GroundBg *groundBg, s32 mapFileId_);
void sub_80A3440(GroundBg *groundBg, s32 mapFileId_, const DungeonLocation *dungLoc, s32 a3);
void sub_80A3B80(GroundBg *groundBg, u8 a1, u8 a2);
void sub_80A3BB0(GroundBg *groundBg, s32 a0_);
void sub_80A4558(GroundBg *groundBg, s32 id, PixelPos *dstPos);
void sub_80A456C(GroundBg *groundBg, s32 id, const PixelPos *srcPos);
void sub_80A4580(GroundBg *groundBg, s32 id, PixelPos *pixPos);
void sub_80A4608(GroundBg *groundBg, PixelPos *dstPos);
u16 sub_80A4720(GroundBg *groundBg, s32 id, PixelPos *pixPos);
void sub_80A4740(GroundBg *groundBg, s32 id, PixelPos *pixPos, u32 dstVal);
void sub_80A4764(GroundBg *groundBg);
void sub_80A49E8(GroundBg *groundBg);
void GetDungeonBounds(GroundBg *groundBg, PixelPos *dstPos1, PixelPos *dstPos2);
#endif // GUARD_GROUND_BG_H

View File

@ -1,11 +1,22 @@
#ifndef GUARD_GROUND_MAP_H
#define GUARD_GROUND_MAP_H
#include "structs/str_position.h"
void GroundMap_Reset(void);
void AllocGroundMapAction(void);
void FreeGroundMapAction(void);
void sub_80A4B38(void);
void sub_80A4B54(void);
void sub_80A56C0(PixelPos *pos);
s16 GetAdjustedGroundMap(s32 mapId);
s16 GetGroundMapID(void);
void GroundMap_ExecuteEnter(s16);
void GroundMap_ExecuteEvent(s16 scriptIndex, u32);
void GroundMap_ExecuteStation(s32 _map, s32 _group, s32 _sector, bool32 _setScriptState);
bool8 GroundMapNotifyAll(s16);
bool8 sub_80A4D48(s16 index);
void GroundMap_Action(void);
#endif // GUARD_GROUND_MAP_H

View File

@ -1,14 +1,31 @@
#ifndef GUARD_GROUND_MAP_1_H
#define GUARD_GROUND_MAP_1_H
void GroundMap_ExecuteEnter(s16);
void GroundMap_ExecuteEvent(s16 scriptIndex, u32);
void GroundMap_ExecuteStation(s32 _map, s32 _group, s32 _sector, bool32 _setScriptState);
// size: 0x24
#include "structs/str_position.h"
bool8 GroundMapNotifyAll(s16);
bool8 sub_80A4D48(s16 index);
typedef struct unkStruct_3001B74
{
s16 unk0;
u8 unk2;
s32 unk4;
s32 unk8;
PixelPos unkC;
u32 unk14;
u32 unk18;
u32 unk1C;
u32 unk20;
} unkStruct_3001B74;
// ground_map_1.s
extern s16 sub_80A5728(void);
void GroundWeather_Select(s16);
void nullsub_121(void);
void nullsub_122(void);
void nullsub_123(void);
void sub_80A5E70(void);
void sub_80A5E8C(u8);
void sub_80A5EBC(void);
void sub_80A5EDC(u8);
void sub_80A60D8(void);
#endif // GUARD_GROUND_MAP_1_H

View File

@ -1,30 +0,0 @@
#ifndef GUARD_GROUND_MAP_2_H
#define GUARD_GROUND_MAP_2_H
// size: 0x24
typedef struct unkStruct_3001B74
{
s16 unk0;
u8 unk2;
s32 unk4;
s32 unk8;
s32 unkC;
s32 unk10;
u32 unk14;
u32 unk18;
u32 unk1C;
u32 unk20;
} unkStruct_3001B74;
void GroundWeather_Select(s16);
void nullsub_121(void);
void nullsub_122(void);
void nullsub_123(void);
void sub_80A5E70(void);
void sub_80A5E8C(u8);
void sub_80A5EBC(void);
void sub_80A5EDC(u8);
void sub_80A60D8(void);
#endif // GUARD_GROUND_MAP_2_H

View File

@ -0,0 +1,9 @@
#ifndef INCLUDE_GROUND_SCRIPT_FILE_H
#define INCLUDE_GROUND_SCRIPT_FILE_H
void sub_80A7744(void);
void sub_80A7754(void);
bool8 ChangeScriptFile(s16 a0);
const struct GroundScriptHeader *GetGroundScript(s16 mapId, const DebugLocation *unused);
#endif /* INCLUDE_GROUND_SCRIPT_FILE_H */

View File

@ -117,8 +117,7 @@ typedef struct GroundMapAction
/* 0x00 */ Action action;
/* 0xE4 */ s16 groundMapId;
u16 fillE6;
u32 unkE8;
u32 unkEC;
PixelPos unkE8;
s32 unkF0;
s32 unkF4;
PixelPos unkF8;

View File

@ -45,7 +45,8 @@ SECTIONS {
.text :
ALIGN(4)
{
asm/crt0.o(.text);
src/rom_header.o(.text);
src/crt0.o(.text);
src/code_80001DC.o(.text);
src/arm_funcs.o(.text);
src/main_loops.o(.text);
@ -345,9 +346,7 @@ SECTIONS {
src/ground_place.o(.text);
src/ground_bg.o(.text);
src/ground_map.o(.text);
asm/ground_map_1.o(.text);
src/ground_map_1.o(.text);
src/ground_map_2.o(.text);
src/ground_sprite.o(.text);
src/ground_sprite_data.o(.text);
src/ground_sprite_monster.o(.text);

View File

@ -39,7 +39,8 @@ SECTIONS {
.text :
ALIGN(4)
{
asm/crt0.o(.text);
src/rom_header.o(.text);
src/crt0.o(.text);
src/code_80001DC.o(.text);
src/main_loops.o(.text);
src/*.o(.text*);

View File

@ -16,7 +16,7 @@
#include "friend_list_menu.h"
#include "ground_lives.h"
#include "ground_main.h"
#include "ground_map_1.h"
#include "ground_map.h"
#include "input.h"
#include "iq_skill_menu.h"
#include "memory.h"
@ -82,7 +82,7 @@ bool8 sub_801D014(Pokemon *a0)
else
sUnknown_203B250->index = NUM_MONSTERS;
sUnknown_203B250->currFriendAreaLocation = MapIdToFriendAreaId(sub_80A5728());
sUnknown_203B250->currFriendAreaLocation = MapIdToFriendAreaId(GetGroundMapID());
sUnknown_203B250->unk8 = 0;
sUnknown_203B250->unk9 = 0;
sUnknown_203B250->unkC = GetPlayerPokemonStruct();

View File

@ -2,18 +2,10 @@
.syntax unified
.global Start
.text
.arm
Start: @ 8000000
b Init
#include "rom_header.inc"
.arm
.align 2, 0
.global Init
Init: @ 80000C0

View File

@ -10,7 +10,7 @@
#include "text_2.h"
#include "text_3.h"
#include "ground_map.h"
#include "ground_map_2.h"
#include "ground_map_1.h"
#include "palette_util.h"
#include "string_format.h"
#include "sprite.h"

View File

@ -14,7 +14,7 @@
#include "rescue_team_info.h"
#include "input.h"
#include "memory.h"
#include "ground_map_1.h"
#include "ground_map.h"
#include "constants/input.h"
extern bool8 sub_808D750(s32 index_);
@ -95,7 +95,7 @@ bool8 FriendList_Init(u32 r5, u32 windowId, DungeonPos *pos, u32 r10)
}
if (sFriendList->unk0 == 4) {
sFriendList->unk354 = MapIdToFriendAreaId(sub_80A5728());
sFriendList->unk354 = MapIdToFriendAreaId(GetGroundMapID());
}
else {
sFriendList->unk354 = 0;

View File

@ -12,7 +12,7 @@
#include "common_strings.h"
#include "event_flag.h"
#include "friend_list_menu.h"
#include "ground_map_1.h"
#include "ground_map.h"
#include "input.h"
#include "iq_skill_menu.h"
#include "items.h"
@ -62,7 +62,7 @@ bool8 CreateFriendListMenu(s32 param_1)
gUnknown_203B2B4 = MemoryAlloc(sizeof(unkStruct_203B2B4),8);
gUnknown_203B2B4->menuAction1 = 0;
gUnknown_203B2B4->unk0 = param_1;
gUnknown_203B2B4->unkC = MapIdToFriendAreaId(sub_80A5728());
gUnknown_203B2B4->unkC = MapIdToFriendAreaId(GetGroundMapID());
gUnknown_203B2B4->unkD = 0;
if (gUnknown_203B2B4->unk0 == 2) {
SetFriendListMenuState(0);

View File

@ -18,7 +18,6 @@
extern const FileArchive gGroundFileArchive;
void sub_80A456C(GroundBg *groundBg, s32 id, const PixelPos *srcPos);
static void CloseOpenedFiles(GroundBg *groundBg);
static void sub_80A3EB0(SubStruct_488 *map488);
static const u8 *sub_80A3908(u16 **dstArray, const void *src_, SubStruct_52C *a2, SubStruct_448 *a3);

View File

@ -13,12 +13,14 @@
#include "debug.h"
#include "event_flag.h"
#include "ground_main.h"
#include "ground_map_2.h"
#include "ground_map.h"
#include "ground_map_1.h"
#include "play_time.h"
#include "pokemon.h"
#include "text_util.h"
#include "ground_map_conversion_table.h"
#include "ground_lives_helper.h"
#include "ground_script_file.h"
#include "script_item.h"
#include "unk_ds_only_feature.h"
#include "textbox.h"
@ -68,24 +70,20 @@ extern bool8 sub_809AFAC(void);
extern bool8 sub_80048BC(void);
extern u8 sub_80023E4(u32);
extern bool8 sub_8099B94(void);
extern void FreeGroundMapAction(void);
extern void FreeGroundLives(void);
extern void FreeGroundObjects(void);
extern void FreeGroundEffects(void);
extern void FreeGroundEvents(void);
extern void sub_80A658C(void);
extern void sub_809D508(void);
extern void sub_80A7754(void);
extern void nullsub_119(void);
extern void sub_8099768(void);
extern void nullsub_103(void);
extern void sub_8099648(void);
extern void sub_809975C(void);
extern void sub_809D0AC(void);
extern void sub_80A7744(void);
extern void sub_809D490(void);
extern void sub_80A62F0(void);
extern void AllocGroundMapAction(void);
extern void AllocGroundEvents(void);
extern void AllocGroundLives(void);
extern void AllocGroundObjects(void);
@ -109,7 +107,6 @@ extern void sub_80A5E70(void);
extern void sub_809B638(void);
extern void sub_80A73EC(void);
extern void sub_8099750(void);
extern void GroundMap_Reset(void);
extern void sub_809D0BC(void);
extern void DeleteGroundEvents(void);
extern void DeleteGroundLives(void);
@ -121,9 +118,7 @@ extern void xxx_call_update_bg_sound_input(void);
extern void sub_80A6E68(void);
extern void sub_80060EC(void);
extern void sub_809977C(void);
extern void GroundMap_ExecuteEvent(s32, u32);
extern void UpdateFadeInTile(s32);
extern void GroundMap_Action(void);
extern void sub_8098C58(void);
extern void sub_8001D88(void);
extern u32 GroundMainGameCancelRequest(u32 r0);

File diff suppressed because it is too large Load Diff

View File

@ -1,200 +1,223 @@
#include "global.h"
#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 "ground_script.h"
#include "ground_map_1.h"
#include "memory.h"
extern GroundMapAction *gGroundMapAction;
extern DebugLocation gUnknown_8117770;
IWRAM_INIT unkStruct_3001B74 *gUnknown_3001B74 = {NULL};
IWRAM_INIT GroundBg *gUnknown_3001B78 = {NULL};
extern s16 HandleAction(Action *action, DebugLocation *debug);
extern void sub_80A4740(void *, s32, s32 *, u32);
extern u32 sub_80A4720(void *, s32, s32 *);
extern u8 sub_80A46C0(GroundBg *, u32, s32, s32);
extern u8 sub_80A4660(GroundBg *, u32, s32, s32);
extern const SubStruct_52C gUnknown_8117784;
extern const s16 gUnknown_811E5F4[][2];
extern const u8 gGroundWeatherSelect[];
extern const PixelPos gUnknown_81177BC;
u8 sub_80A5934(s32 param_1, s32 param_2, s32 param_3)
static void sub_80A62D0(void);
void sub_80A5E70(void)
{
u32 param_1_u32 = (u8)param_1;
return sub_80A4660(gGroundMapDungeon_3001B70, param_1_u32, param_2, param_3);
if (gGroundMapDungeon_3001B70 != NULL)
sub_80A49E8(gGroundMapDungeon_3001B70);
sub_80A62D0();
}
u8 sub_80A595C(s32 param_1, s32 param_2, s32 param_3)
void sub_80A5E8C(u8 param_1)
{
u32 param_1_u32 = (u8)param_1;
return sub_80A46C0(gGroundMapDungeon_3001B70, param_1_u32, param_2, param_3);
gUnknown_3001B74 = MemoryAlloc(sizeof(unkStruct_3001B74), 6);
gUnknown_3001B74->unk0 = -1;
gUnknown_3001B74->unk2 = 0;
sub_80A5EDC(param_1);
}
u16 sub_80A5984(s32 param_1, s32 *param_2)
void sub_80A5EBC(void)
{
return sub_80A4720(gGroundMapDungeon_3001B70, param_1, param_2);
sub_80A5EDC(0);
MemoryFree(gUnknown_3001B74);
gUnknown_3001B74 = NULL;
}
void sub_80A59A0(s32 param_1, s32 *param_2, u32 param_3)
void sub_80A5EDC(u8 param_1)
{
u32 param_3_u32 = (u16)param_3;
sub_80A4740(gGroundMapDungeon_3001B70, param_1, param_2, param_3_u32);
}
SetScriptVarValue(NULL, WEATHER_KIND, -1);
gUnknown_3001B74->unk0 = -1;
gUnknown_3001B74->unk2 = param_1;
void GroundMap_Action(void)
{
nullsub_123();
HandleAction((Action *)gGroundMapAction, &gUnknown_8117770);
}
extern u8 sub_809D248(PixelPos *r0);
extern void sub_80A4580(GroundBg *, u32, PixelPos *);
extern void sub_80A456C(GroundBg *, u32, const PixelPos *);
extern void sub_80A4764(GroundBg *);
extern GroundMapAction *gGroundMapAction;
void sub_80A59DC(void)
{
if (gGroundMapDungeon_3001B70 != NULL) {
PixelPos pixPos;
if (sub_809D248(&pixPos) == 0) {
pixPos.x = 0;
pixPos.y = 0;
}
switch (gGroundMapAction->groundMapId) {
case 0xA2:
case 0xA3:
case 0xDF: {
PixelPos pixPos2;
gGroundMapAction->unkF4 += 2;
gGroundMapAction->unkF8.y += gGroundMapAction->unkF4 / 4;
gGroundMapAction->unkF4 &= 3;
sub_80A4580(gGroundMapDungeon_3001B70, 0, &gGroundMapAction->unkF8);
pixPos2 = (PixelPos) { pixPos.x, pixPos.y + gGroundMapAction->unkF8.y };
sub_80A4580(gGroundMapDungeon_3001B70, 0, &pixPos2);
sub_80A456C(gGroundMapDungeon_3001B70, 0, &pixPos2);
pixPos2.x = pixPos.x;
pixPos2.y = pixPos.y - gGroundMapAction->unkF8.y;
sub_80A4580(gGroundMapDungeon_3001B70, 1, &pixPos2);
sub_80A456C(gGroundMapDungeon_3001B70, 1, &pixPos2);
break;
}
case 0xA8:
case 0xAA: {
PixelPos pixPos2;
gGroundMapAction->unkF0 += gGroundMapAction->unkE8;
gGroundMapAction->unkF8.x += gGroundMapAction->unkF0 / 8;
gGroundMapAction->unkF0 %= 8;
sub_80A4580(gGroundMapDungeon_3001B70, 0, &gGroundMapAction->unkF8);
pixPos2 = (PixelPos) { pixPos.x + gGroundMapAction->unkF8.x, pixPos.y };
sub_80A4580(gGroundMapDungeon_3001B70, 0, &pixPos2);
sub_80A456C(gGroundMapDungeon_3001B70, 0, &pixPos2);
break;
}
case 0xAE: {
PixelPos pixPos2;
gGroundMapAction->unkF0 += gGroundMapAction->unkE8;
gGroundMapAction->unkF8.x += gGroundMapAction->unkF0 / 8;
gGroundMapAction->unkF0 %= 8;
sub_80A4580(gGroundMapDungeon_3001B70, 0, &gGroundMapAction->unkF8);
pixPos2 = (PixelPos) { pixPos.x + gGroundMapAction->unkF8.x, pixPos.y };
sub_80A4580(gGroundMapDungeon_3001B70, 0, &pixPos2);
sub_80A456C(gGroundMapDungeon_3001B70, 0, &pixPos2);
sub_80A456C(gGroundMapDungeon_3001B70, 1, &pixPos2);
break;
}
case 0xAB: {
PixelPos pixPos2 = pixPos;
sub_80A4580(gGroundMapDungeon_3001B70, 0, &pixPos2);
sub_80A456C(gGroundMapDungeon_3001B70, 0, &pixPos2);
break;
}
case 0xAF: {
PixelPos pixPos2;
sub_80A456C(gGroundMapDungeon_3001B70, 0, &pixPos);
gGroundMapAction->unkF0 += gGroundMapAction->unkE8;
gGroundMapAction->unkF4 += gGroundMapAction->unkEC;
gGroundMapAction->unkF8.x += gGroundMapAction->unkF0 / 8;
gGroundMapAction->unkF8.y += gGroundMapAction->unkF4 / 8;
gGroundMapAction->unkF0 %= 8;
gGroundMapAction->unkF4 %= 8;
sub_80A4580(gGroundMapDungeon_3001B70, 0, &gGroundMapAction->unkF8);
pixPos2 = (PixelPos) { pixPos.x + gGroundMapAction->unkF8.x, pixPos.y + gGroundMapAction->unkF8.y};
sub_80A4580(gGroundMapDungeon_3001B70, 1, &pixPos2);
sub_80A456C(gGroundMapDungeon_3001B70, 1, &pixPos2);
break;
}
case 0xB0: {
PixelPos pixPos2;
gGroundMapAction->unkF0 += gGroundMapAction->unkE8;
gGroundMapAction->unkF4 += gGroundMapAction->unkEC;
gGroundMapAction->unkF8.x += gGroundMapAction->unkF0 / 8;
gGroundMapAction->unkF8.y += gGroundMapAction->unkF4 / 8;
gGroundMapAction->unkF0 %= 8;
gGroundMapAction->unkF4 %= 8;
sub_80A4580(gGroundMapDungeon_3001B70, 0, &gGroundMapAction->unkF8);
pixPos2 = (PixelPos) { pixPos.x + gGroundMapAction->unkF8.x, pixPos.y + gGroundMapAction->unkF8.y};
sub_80A4580(gGroundMapDungeon_3001B70, 0, &pixPos2);
sub_80A456C(gGroundMapDungeon_3001B70, 0, &pixPos2);
break;
}
case 0xBA: {
PixelPos pixPos2;
sub_80A456C(gGroundMapDungeon_3001B70, 1, &pixPos);
gGroundMapAction->unkF0++;
gGroundMapAction->unkF8.x += gGroundMapAction->unkF0 / 4;
gGroundMapAction->unkF0 &= 3;
sub_80A4580(gGroundMapDungeon_3001B70, 1, &gGroundMapAction->unkF8);
pixPos2 = (PixelPos) { pixPos.x + gGroundMapAction->unkF8.x, pixPos.y};
sub_80A4580(gGroundMapDungeon_3001B70, 0, &pixPos2);
sub_80A456C(gGroundMapDungeon_3001B70, 0, &pixPos2);
break;
}
case 4: {
PixelPos pixPos2;
sub_80A456C(gGroundMapDungeon_3001B70, 0, &pixPos);
gGroundMapAction->unkF0++;
gGroundMapAction->unkF8.x += gGroundMapAction->unkF0 / 8;
gGroundMapAction->unkF0 &= 7;
sub_80A4580(gGroundMapDungeon_3001B70, 1, &gGroundMapAction->unkF8);
pixPos2 = (PixelPos) { pixPos.x + gGroundMapAction->unkF8.x, pixPos.y};
sub_80A4580(gGroundMapDungeon_3001B70, 1, &pixPos2);
sub_80A456C(gGroundMapDungeon_3001B70, 1, &pixPos2);
break;
}
case 0xE0: {
PixelPos pixPos2;
sub_80A456C(gGroundMapDungeon_3001B70, 0, &pixPos);
gGroundMapAction->unkF0++;
gGroundMapAction->unkF8.x += gGroundMapAction->unkF0 / 8;
gGroundMapAction->unkF0 &= 7;
sub_80A4580(gGroundMapDungeon_3001B70, 1, &gGroundMapAction->unkF8);
pixPos2 = (PixelPos) { gGroundMapAction->unkF8.x, pixPos.y};
sub_80A456C(gGroundMapDungeon_3001B70, 1, &pixPos2);
break;
}
case 0xA1: {
PixelPos pixPos2;
sub_80A456C(gGroundMapDungeon_3001B70, 0, &pixPos);
pixPos2 = (PixelPos) {0, 0};
sub_80A456C(gGroundMapDungeon_3001B70, 1, &pixPos2);
break;
}
default:
sub_80A456C(gGroundMapDungeon_3001B70, 0, &pixPos);
break;
}
sub_80A4764(gGroundMapDungeon_3001B70);
if (gUnknown_3001B78 != NULL) {
GroundBg_FreeAll(gUnknown_3001B78);
MemoryFree(gUnknown_3001B78);
gUnknown_3001B78 = NULL;
}
sub_80A60D8();
if (param_1) {
gUnknown_3001B78 = MemoryAlloc(sizeof(GroundBg), 6);
GroundBg_Init(gUnknown_3001B78, &gUnknown_8117784);
sub_80A2FBC(gUnknown_3001B78, -1);
}
}
void nullsub_121(void)
{}
void nullsub_122(void)
{}
void GroundWeather_Select(s16 param_1)
{
s32 iVar2;
s32 iVar3;
const s16 *pVar1;
iVar2 = param_1;
iVar3 = iVar2;
Log(0, gGroundWeatherSelect, iVar2, gUnknown_3001B74->unk2);
SetScriptVarValue(NULL, WEATHER_KIND, iVar2);
gUnknown_3001B74->unk0 = iVar2;
if (gUnknown_3001B74->unk2 == 0)
return;
if (iVar2 == -1) {
sub_80A2FBC(gUnknown_3001B78, -1);
return;
}
pVar1 = gUnknown_811E5F4[iVar3];
sub_80A2FBC(gUnknown_3001B78, pVar1[1]);
gUnknown_3001B74->unk4 = 0;
gUnknown_3001B74->unk8 = 0;
gUnknown_3001B74->unkC.x = 0;
gUnknown_3001B74->unkC.y = 0;
gUnknown_3001B74->unk20 = 0;
gUnknown_3001B74->unk1C = 0;
gUnknown_3001B74->unk18 = 0;
gUnknown_3001B74->unk14 = 0;
switch (gUnknown_3001B74->unk0) {
case 9:
sub_80A3BB0(gUnknown_3001B78, 1);
gUnknown_2026E4E = 0x40c;
break;
case 7:
gUnknown_2026E4E = 0x808;
break;
case 14:
sub_80A3BB0(gUnknown_3001B78, 1);
gUnknown_2026E4E = 0x1010;
break;
case 15:
sub_80A3BB0(gUnknown_3001B78, 1);
gUnknown_2026E4E = 0x40c;
break;
case 0:
case 3:
case 4:
case 5:
case 8:
gUnknown_2026E4E = 0x1010;
break;
default:
if (pVar1[0] == 1)
sub_80A3BB0(gUnknown_3001B78, 1);
gUnknown_2026E4E = 0x1000;
break;
}
}
UNUSED static s16 sub_80A60C4(void)
{
return gUnknown_3001B74->unk0;
}
void nullsub_123(void)
{}
void sub_80A60D8(void)
{
if (gUnknown_3001B74->unk2 == 0)
return;
switch ((s16)(gUnknown_3001B74->unk0 + 1)) {
case 10: {
PixelPos localArray;
gUnknown_3001B74->unk4 += 2;
gUnknown_3001B74->unk8 += 1;
gUnknown_3001B74->unkC.x += gUnknown_3001B74->unk4 / 4;
gUnknown_3001B74->unkC.y += gUnknown_3001B74->unk8 / 4;
sub_80A4580(gUnknown_3001B78, 0, &gUnknown_3001B74->unkC);
gUnknown_3001B74->unk4 &= 3;
gUnknown_3001B74->unk8 &= 3;
sub_80A56C0(&localArray);
localArray.x -= gUnknown_3001B74->unkC.x;
localArray.y += gUnknown_3001B74->unkC.y;
sub_80A4580(gUnknown_3001B78, 0, &localArray);
sub_80A456C(gUnknown_3001B78, 0, &localArray);
break;
}
case 11:
case 12:
case 13:
case 14: {
PixelPos localArray;
sub_80A56C0(&localArray);
sub_80A456C(gUnknown_3001B78,0,&localArray);
break;
}
case 15: {
PixelPos localArray;
gUnknown_3001B74->unk4++;
gUnknown_3001B74->unkC.x += gUnknown_3001B74->unk4 / 4;
sub_80A4580(gUnknown_3001B78, 0, &gUnknown_3001B74->unkC);
gUnknown_3001B74->unk4 &= 3;
sub_80A56C0(&localArray);
localArray.x -= gUnknown_3001B74->unkC.x;
localArray.y = 0;
sub_80A4580(gUnknown_3001B78, 0, &localArray);
sub_80A456C(gUnknown_3001B78, 0, &localArray);
break;
}
case 16: {
PixelPos localArray;
gUnknown_3001B74->unk4 += 2;
gUnknown_3001B74->unkC.x += gUnknown_3001B74->unk4 / 4;
sub_80A4580(gUnknown_3001B78, 0, &gUnknown_3001B74->unkC);
gUnknown_3001B74->unk4 &= 3;
sub_80A56C0(&localArray);
localArray.x -= gUnknown_3001B74->unkC.x;
localArray.y = 0;
sub_80A4580(gUnknown_3001B78, 0, &localArray);
sub_80A456C(gUnknown_3001B78, 0, &localArray);
break;
}
default: {
PixelPos localArray;
const s16 *puVar1 = gUnknown_811E5F4[gUnknown_3001B74->unk0];
if (puVar1[0] == 0) {
sub_80A56C0(&localArray);
sub_80A456C(gUnknown_3001B78,0,&localArray);
break;
}
}
// NOTE: Fallthrough needed here.
case 0:
sub_80A456C(gUnknown_3001B78, 0, &gUnknown_81177BC);
break;
}
sub_80A4764(gUnknown_3001B78);
}
static void sub_80A62D0(void)
{
if (gUnknown_3001B74->unk2 != 0)
sub_80A49E8(gUnknown_3001B78);
}

View File

@ -1,229 +0,0 @@
#include "global.h"
#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"
IWRAM_INIT unkStruct_3001B74 *gUnknown_3001B74 = {NULL};
IWRAM_INIT GroundBg *gUnknown_3001B78 = {NULL};
extern const SubStruct_52C gUnknown_8117784;
extern const s16 gUnknown_811E5F4[][2];
extern const u8 gGroundWeatherSelect[];
extern const s32 gUnknown_81177BC[];
extern void sub_80A49E8(GroundBg *);
extern void sub_80A456C(GroundBg *, u32, const s32 *);
extern void sub_80A4580(GroundBg *, u32, s32 *);
extern void sub_80A56C0(s32 *);
extern void sub_80A4764(GroundBg *);
static void sub_80A62D0(void);
void sub_80A5E70(void)
{
if (gGroundMapDungeon_3001B70 != NULL)
sub_80A49E8(gGroundMapDungeon_3001B70);
sub_80A62D0();
}
void sub_80A5E8C(u8 param_1)
{
gUnknown_3001B74 = MemoryAlloc(sizeof(unkStruct_3001B74), 6);
gUnknown_3001B74->unk0 = -1;
gUnknown_3001B74->unk2 = 0;
sub_80A5EDC(param_1);
}
void sub_80A5EBC(void)
{
sub_80A5EDC(0);
MemoryFree(gUnknown_3001B74);
gUnknown_3001B74 = NULL;
}
void sub_80A5EDC(u8 param_1)
{
SetScriptVarValue(NULL, WEATHER_KIND, -1);
gUnknown_3001B74->unk0 = -1;
gUnknown_3001B74->unk2 = param_1;
if (gUnknown_3001B78 != NULL) {
GroundBg_FreeAll(gUnknown_3001B78);
MemoryFree(gUnknown_3001B78);
gUnknown_3001B78 = NULL;
}
if (param_1) {
gUnknown_3001B78 = MemoryAlloc(sizeof(GroundBg), 6);
GroundBg_Init(gUnknown_3001B78, &gUnknown_8117784);
sub_80A2FBC(gUnknown_3001B78, -1);
}
}
void nullsub_121(void)
{}
void nullsub_122(void)
{}
void GroundWeather_Select(s16 param_1)
{
s32 iVar2;
s32 iVar3;
const s16 *pVar1;
iVar2 = param_1;
iVar3 = iVar2;
Log(0, gGroundWeatherSelect, iVar2, gUnknown_3001B74->unk2);
SetScriptVarValue(NULL, WEATHER_KIND, iVar2);
gUnknown_3001B74->unk0 = iVar2;
if (gUnknown_3001B74->unk2 == 0)
return;
if (iVar2 == -1) {
sub_80A2FBC(gUnknown_3001B78, -1);
return;
}
pVar1 = gUnknown_811E5F4[iVar3];
sub_80A2FBC(gUnknown_3001B78, pVar1[1]);
gUnknown_3001B74->unk4 = 0;
gUnknown_3001B74->unk8 = 0;
gUnknown_3001B74->unkC = 0;
gUnknown_3001B74->unk10 = 0;
gUnknown_3001B74->unk20 = 0;
gUnknown_3001B74->unk1C = 0;
gUnknown_3001B74->unk18 = 0;
gUnknown_3001B74->unk14 = 0;
switch (gUnknown_3001B74->unk0) {
case 9:
sub_80A3BB0(gUnknown_3001B78, 1);
gUnknown_2026E4E = 0x40c;
break;
case 7:
gUnknown_2026E4E = 0x808;
break;
case 14:
sub_80A3BB0(gUnknown_3001B78, 1);
gUnknown_2026E4E = 0x1010;
break;
case 15:
sub_80A3BB0(gUnknown_3001B78, 1);
gUnknown_2026E4E = 0x40c;
break;
case 0:
case 3:
case 4:
case 5:
case 8:
gUnknown_2026E4E = 0x1010;
break;
default:
if (pVar1[0] == 1)
sub_80A3BB0(gUnknown_3001B78, 1);
gUnknown_2026E4E = 0x1000;
break;
}
}
UNUSED static s16 sub_80A60C4(void)
{
return gUnknown_3001B74->unk0;
}
void nullsub_123(void)
{}
void sub_80A60D8(void)
{
if (gUnknown_3001B74->unk2 == 0)
return;
switch ((s16)(gUnknown_3001B74->unk0 + 1)) {
case 10: {
s32 localArray[2];
gUnknown_3001B74->unk4 += 2;
gUnknown_3001B74->unk8 += 1;
gUnknown_3001B74->unkC += gUnknown_3001B74->unk4 / 4;
gUnknown_3001B74->unk10 += gUnknown_3001B74->unk8 / 4;
sub_80A4580(gUnknown_3001B78, 0, &gUnknown_3001B74->unkC);
gUnknown_3001B74->unk4 &= 3;
gUnknown_3001B74->unk8 &= 3;
sub_80A56C0(localArray);
localArray[0] -= gUnknown_3001B74->unkC;
localArray[1] += gUnknown_3001B74->unk10;
sub_80A4580(gUnknown_3001B78, 0, localArray);
sub_80A456C(gUnknown_3001B78, 0, localArray);
break;
}
case 11:
case 12:
case 13:
case 14: {
s32 localArray[2];
sub_80A56C0(localArray);
sub_80A456C(gUnknown_3001B78,0,localArray);
break;
}
case 15: {
s32 localArray[2];
gUnknown_3001B74->unk4++;
gUnknown_3001B74->unkC += gUnknown_3001B74->unk4 / 4;
sub_80A4580(gUnknown_3001B78, 0, &gUnknown_3001B74->unkC);
gUnknown_3001B74->unk4 &= 3;
sub_80A56C0(localArray);
localArray[0] -= gUnknown_3001B74->unkC;
localArray[1] = 0;
sub_80A4580(gUnknown_3001B78, 0, localArray);
sub_80A456C(gUnknown_3001B78, 0, localArray);
break;
}
case 16: {
s32 localArray[2];
gUnknown_3001B74->unk4 += 2;
gUnknown_3001B74->unkC += gUnknown_3001B74->unk4 / 4;
sub_80A4580(gUnknown_3001B78, 0, &gUnknown_3001B74->unkC);
gUnknown_3001B74->unk4 &= 3;
sub_80A56C0(localArray);
localArray[0] -= gUnknown_3001B74->unkC;
localArray[1] = 0;
sub_80A4580(gUnknown_3001B78, 0, localArray);
sub_80A456C(gUnknown_3001B78, 0, localArray);
break;
}
default: {
s32 localArray[2];
const s16 *puVar1 = gUnknown_811E5F4[gUnknown_3001B74->unk0];
if (puVar1[0] == 0) {
sub_80A56C0(localArray);
sub_80A456C(gUnknown_3001B78,0,localArray);
break;
}
}
// NOTE: Fallthrough needed here.
case 0:
sub_80A456C(gUnknown_3001B78, 0, gUnknown_81177BC);
break;
}
sub_80A4764(gUnknown_3001B78);
}
static void sub_80A62D0(void)
{
if (gUnknown_3001B74->unk2 != 0)
sub_80A49E8(gUnknown_3001B78);
}

View File

@ -160,8 +160,8 @@ bool8 sub_80A87E0();
s16 sub_80A8BFC(s16);
void sub_80A8F50(const u8 *buffer, s32, s32 size);
void sub_80A56A0(s32, s32);
void sub_80A56F0(s32 *);
void sub_80A5704(s32 *);
void sub_80A56F0(PixelPos *);
void sub_80A5704(PixelPos *);
void sub_80A86C8(s16, s32);
void sub_80AC1B0(s16, s32);
void sub_80AD0C8(s16, s32);
@ -3720,17 +3720,17 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
sub_80A56A0(0, 1);
return 0;
case 0x36: {
s32 sp_328[2];
sp_328[0] = r2;
sp_328[1] = r3;
sub_80A56F0(sp_328);
PixelPos sp_328;
sp_328.x = r2;
sp_328.y = r3;
sub_80A56F0(&sp_328);
return 0;
}
case 0x37: {
s32 sp_330[2];
sp_330[0] = r2;
sp_330[1] = r3;
sub_80A5704(sp_330);
PixelPos sp_330;
sp_330.x = r2;
sp_330.y = r3;
sub_80A5704(&sp_330);
return 0;
}
case 0x39:

View File

@ -1,5 +1,6 @@
#include "global.h"
#include "globaldata.h"
#include "debug.h"
#include "map_script_table.h"
static EWRAM_DATA s16 sScriptFileId = {0};
@ -50,7 +51,7 @@ bool8 ChangeScriptFile(s16 a0)
static const struct GroundScriptHeader sNullGroundScript = {0};
const struct GroundScriptHeader *GetGroundScript(s16 mapId)
const struct GroundScriptHeader *GetGroundScript(s16 mapId, const DebugLocation *unused)
{
if (mapId != -1)
return gMapScriptTable[mapId];

View File

@ -5,7 +5,7 @@
#include "debug.h"
#include "def_filearchives.h"
#include "file_system.h"
#include "ground_map_1.h"
#include "ground_map.h"
#include "ground_sprite.h"
#include "ground_sprite_data.h"
#include "memory.h"

View File

@ -1,4 +1,9 @@
.global RomHeaderNintendoLogo
.global Start
Start: @ 8000000
b Init
.global RomHeaderNintendoLogo
RomHeaderNintendoLogo:
.space 156

View File

@ -6,7 +6,7 @@
.include "src/textbox.o"
.include "src/unk_ds_only_feature.o"
.include "src/ground_map.o"
.include "src/ground_map_2.o"
.include "src/ground_map_1.o"
.include "src/ground_sprite.o"
.include "src/ground_lives.o"
.include "src/ground_object.o"