mirror of
https://github.com/pret/pmd-red.git
synced 2026-08-28 03:34:22 -05:00
move const data to code_803E724
This commit is contained in:
@@ -1,62 +0,0 @@
|
||||
#include "constants/status.h"
|
||||
.section .rodata
|
||||
#.incbin "baserom.gba", 0xF59C4, 0x4
|
||||
|
||||
.string "pksdir0\0"
|
||||
.global gUnknown_80F6490
|
||||
gUnknown_80F6490: @ 80F6490
|
||||
@ replacing .incbin "baserom.gba", 0x000f6490, 0x24
|
||||
.byte 0x00, 0x00, 0x00, 0x0
|
||||
.byte 0x0f, 0x00, 0x00, 0x00
|
||||
.byte 0xff, 0x00, 0x00, 0x00
|
||||
.byte 0xff, 0x0f, 0x00, 0x00
|
||||
.byte 0xff, 0xff, 0x00, 0x00
|
||||
.byte 0xff, 0xff, 0x0f, 0x00
|
||||
.byte 0xff, 0xff, 0xff, 0x00
|
||||
.byte 0xff, 0xff, 0xff, 0x0f
|
||||
.byte 0xff, 0xff, 0xff, 0xff
|
||||
|
||||
.global gUnknown_80F64B4
|
||||
gUnknown_80F64B4: @ 80F64B4
|
||||
@ replacing .incbin "baserom.gba", 0x000f64b4, 0x24
|
||||
.byte 0x5a, 0x00, 0x00, 0x00
|
||||
.byte 0x50, 0x00, 0x00, 0x00
|
||||
.byte 0x46, 0x00, 0x00, 0x00
|
||||
.byte 0x3c, 0x00, 0x00, 0x00
|
||||
.byte 0x32, 0x00, 0x00, 0x00
|
||||
.byte 0x28, 0x00, 0x00, 0x00
|
||||
.byte 0x1e, 0x00, 0x00, 0x00
|
||||
.byte 0x14, 0x00, 0x00, 0x00
|
||||
.byte 0x0a, 0x00, 0x00, 0x00
|
||||
|
||||
.global gUnknown_80F64D8
|
||||
gUnknown_80F64D8: @ 80F64D8
|
||||
@ replacing .incbin "baserom.gba", 0x000f64d8, 0x24
|
||||
.byte 0x91, 0xf2, 0x90, 0xf2, 0x8f, 0xf2, 0x8e, 0xf2, 0x8d, 0xf2, 0x8c, 0xf2, 0x8b, 0xf2, 0x8a, 0xf2, 0x89, 0xf2, 0xc8, 0xf2, 0xc7, 0xf2, 0xc6, 0xf2, 0xc5, 0xf2, 0xc4, 0xf2, 0xc3, 0xf2, 0xc2, 0xf2
|
||||
.byte 0xc1, 0xf2, 0xc0, 0xf2
|
||||
|
||||
.global gUnknown_80F64FC
|
||||
gUnknown_80F64FC: @ 80F64FC
|
||||
@ replacing .incbin "baserom.gba", 0x000f64fc, 0x24
|
||||
.byte 0x84, 0x03, 0x00, 0x00, 0x20, 0x03, 0x00, 0x00, 0xbc, 0x02, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00
|
||||
.byte 0x64, 0x00, 0x00, 0x00
|
||||
|
||||
.global gUnknown_80F6520
|
||||
gUnknown_80F6520: @ 80F6520
|
||||
@ replacing .incbin "baserom.gba", 0x000f6520, 0x24
|
||||
.byte 0x5a, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
|
||||
.byte 0x0a, 0x00, 0x00, 0x00
|
||||
|
||||
.global gUnknown_80F6544
|
||||
gUnknown_80F6544: @ 80F6544
|
||||
@ replacing .incbin "baserom.gba", 0x000f6544, 0x24
|
||||
.byte 0x91, 0xf2, 0x90, 0xf2, 0x8f, 0xf2, 0x8e, 0xf2, 0x8d, 0xf2, 0x8c, 0xf2, 0x8b, 0xf2, 0x8a, 0xf2, 0x89, 0xf2, 0xc8, 0xf2, 0xc7, 0xf2, 0xc6, 0xf2, 0xc5, 0xf2, 0xc4, 0xf2, 0xc3, 0xf2, 0xc2, 0xf2
|
||||
.byte 0xc1, 0xf2, 0xc0, 0xf2
|
||||
|
||||
.global gUnknown_80F6568
|
||||
gUnknown_80F6568: @ 80F6568
|
||||
@ replacing .incbin "baserom.gba", 0x000f6568, 0x88
|
||||
.byte 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff
|
||||
.byte 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff
|
||||
.byte 0x03, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff
|
||||
.byte 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff
|
||||
@@ -67,7 +67,7 @@ static inline bool8 AreStringsDifferent(const u8 *str1, const u8 *str2)
|
||||
#define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided\n")
|
||||
|
||||
#define ARRAY_COUNT(array) (sizeof(array) / sizeof((array)[0]))
|
||||
#define ARRAY_COUNT_INT(array) ((s32)(sizeof(array) / sizeof((array)[0]))) // When an int is needed to match.
|
||||
#define ARRAY_COUNT_INT(array) ((s32)(ARRAY_COUNT(array))) // When an int is needed to match.
|
||||
|
||||
#define SWAP(a, b, temp) \
|
||||
{ \
|
||||
|
||||
@@ -559,7 +559,6 @@ SECTIONS {
|
||||
src/code_803DA7C.o(.rodata);
|
||||
src/dungeon_vram.o(.rodata);
|
||||
src/code_803E724.o(.rodata);
|
||||
data/data_80F59C8_0.o(.rodata);
|
||||
src/dungeon_map.o(.rodata);
|
||||
src/code_8040094_1.o(.rodata);
|
||||
data/pksdir_0.o(.rodata);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "globaldata.h"
|
||||
#include "constants/item.h"
|
||||
#include "constants/status.h"
|
||||
#include "structs/str_202EDE8.h"
|
||||
@@ -26,21 +27,19 @@
|
||||
#include "menu_input.h"
|
||||
#include "sprite.h"
|
||||
#include "text_1.h"
|
||||
#include "play_time.h"
|
||||
#include "code_800C9CC.h"
|
||||
#include "code_80118A4.h"
|
||||
#include "dungeon_strings.h"
|
||||
|
||||
extern u32 gUnknown_202EDFC;
|
||||
|
||||
extern const u32 gUnknown_80F6490[];
|
||||
extern const s32 gUnknown_80F64B4[];
|
||||
extern const s32 gUnknown_80F64FC[];
|
||||
extern const s32 gUnknown_80F6520[];
|
||||
extern const u16 gUnknown_80F64D8[][9];
|
||||
extern const u16 gUnknown_80F6544[][9];
|
||||
|
||||
extern s32 gDungeonFramesCounter;
|
||||
|
||||
extern void ShowWholeRevealedDungeonMap(void);
|
||||
extern void sub_80400D4(void);
|
||||
extern void sub_8041888(u8 param_1);
|
||||
extern void sub_803F7BC(void);
|
||||
extern void ShowWholeRevealedDungeonMap();
|
||||
|
||||
void sub_803EC94(void);
|
||||
s32 sub_803EF90(s32 a0, u8 a1);
|
||||
@@ -417,10 +416,9 @@ void sub_803FA4C(s32 a0, s32 a1, bool8 a2)
|
||||
s32 i;
|
||||
s32 r5;
|
||||
u32 r10, r9;
|
||||
u32 sp[9];
|
||||
UnkDungeonGlobal_unk181E8_sub *strPtr = &gDungeon->unk181e8;
|
||||
u32 *dst = gUnknown_3001018;
|
||||
memcpy(sp, gUnknown_80F6490, sizeof(sp));
|
||||
u32 sp[9] = {0, 0xF, 0xFF, 0xFFF, 0xFFFF, 0xFFFFF, 0xFFFFFF, 0xFFFFFFF, 0xFFFFFFFF};
|
||||
|
||||
r10 = 0x22222222;
|
||||
r9 = 0x44444444;
|
||||
@@ -596,6 +594,12 @@ void sub_803FB74(void)
|
||||
}
|
||||
}
|
||||
|
||||
static const s32 gUnknown_80F64B4[] = {90, 80, 70, 60, 50, 40, 30, 20, 10};
|
||||
static const u16 gUnknown_80F64D8[][9] = {
|
||||
[0] = {0xF291, 0xF290, 0xF28F, 0xF28E, 0xF28D, 0xF28C, 0xF28B, 0xF28A, 0xF289},
|
||||
[1] = {0xF2C8, 0xF2C7, 0xF2C6, 0xF2C5, 0xF2C4, 0xF2C3, 0xF2C2, 0xF2C1, 0xF2C0},
|
||||
};
|
||||
|
||||
void sub_803FE30(s32 a0, u16 *a1, bool8 a2, bool8 a3)
|
||||
{
|
||||
s32 var = (a2) ? 0 : 55;
|
||||
@@ -609,11 +613,15 @@ void sub_803FE30(s32 a0, u16 *a1, bool8 a2, bool8 a3)
|
||||
a1[0] = 0xF2C8;
|
||||
a1[1] = 0xF2C8;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (a0 == 100) {
|
||||
|
||||
if (a0 == 100) {
|
||||
a1[0] = 0xF294;
|
||||
a1[1] = 0xF295;
|
||||
return;
|
||||
}
|
||||
// This is a fakematch, I was actually to decompile this function for Blue(https://decomp.me/scratch/tqonk), but agbcc doesn't want to cooperate...
|
||||
else {
|
||||
// I thought 'ptr' was a compiler generated variable, but I couldn't match the function without declaring it.
|
||||
u16 *ptr = a1 + 1;
|
||||
@@ -623,7 +631,7 @@ void sub_803FE30(s32 a0, u16 *a1, bool8 a2, bool8 a3)
|
||||
s32 i;
|
||||
s32 arrId = (!a2) ? 1 : 0;
|
||||
|
||||
for (i = 0; i < 9; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT_INT(gUnknown_80F64B4); i++) {
|
||||
ASM_MATCH_TRICK(a1);
|
||||
if (gUnknown_80F64B4[i] <= a0) {
|
||||
*a1 = gUnknown_80F64D8[arrId][i];
|
||||
@@ -640,6 +648,13 @@ void sub_803FE30(s32 a0, u16 *a1, bool8 a2, bool8 a3)
|
||||
}
|
||||
}
|
||||
|
||||
static const s32 gUnknown_80F64FC[] = {900, 800, 700, 600, 500, 400, 300, 200, 100};
|
||||
static const s32 gUnknown_80F6520[] = {90, 80, 70, 60, 50, 40, 30, 20, 10};
|
||||
static const u16 gUnknown_80F6544[][9] = {
|
||||
[0] = {0xF291, 0xF290, 0xF28F, 0xF28E, 0xF28D, 0xF28C, 0xF28B, 0xF28A, 0xF289},
|
||||
[1] = {0xF2C8, 0xF2C7, 0xF2C6, 0xF2C5, 0xF2C4, 0xF2C3, 0xF2C2, 0xF2C1, 0xF2C0},
|
||||
};
|
||||
|
||||
void sub_803FF18(s32 a0, u16 *a1, bool8 a2)
|
||||
{
|
||||
s32 arrId = (!a2) ? 1 : 0;
|
||||
@@ -656,7 +671,7 @@ void sub_803FF18(s32 a0, u16 *a1, bool8 a2)
|
||||
s32 i = 0;
|
||||
s32 varAdd = var + 48;
|
||||
|
||||
for (i = 0; i < 9; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT_INT(gUnknown_80F64FC); i++) {
|
||||
if (gUnknown_80F64FC[i] <= a0) {
|
||||
*(a1++) = gUnknown_80F6544[arrId][i];
|
||||
a0 -= gUnknown_80F64FC[i];
|
||||
@@ -668,7 +683,7 @@ void sub_803FF18(s32 a0, u16 *a1, bool8 a2)
|
||||
*(a1++) = (toAdd + 0x258) | 0xF000;
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT_INT(gUnknown_80F6520); i++) {
|
||||
if (gUnknown_80F6520[i] <= a0) {
|
||||
*(a1++) = gUnknown_80F6544[arrId][i];
|
||||
a0 -= gUnknown_80F6520[i];
|
||||
@@ -682,3 +697,55 @@ void sub_803FF18(s32 a0, u16 *a1, bool8 a2)
|
||||
*a1 = (a0 + varAdd + 0x258) | 0xF000;
|
||||
}
|
||||
}
|
||||
|
||||
void HandleLuminousOrbAction(Entity *pokemon)
|
||||
{
|
||||
int XCoord;
|
||||
int YCoord;
|
||||
|
||||
gDungeon->unk181e8.allTilesRevealed = TRUE;
|
||||
|
||||
for(YCoord = 0; YCoord < DUNGEON_MAX_SIZE_Y; YCoord++)
|
||||
{
|
||||
for(XCoord = 0; XCoord < DUNGEON_MAX_SIZE_X; XCoord++)
|
||||
{
|
||||
Tile *mapTile = GetTileMut(XCoord, YCoord);
|
||||
mapTile->spawnOrVisibilityFlags |= VISIBILITY_FLAG_REVEALED;
|
||||
}
|
||||
}
|
||||
sub_803F580(0);
|
||||
sub_8049ED4();
|
||||
ShowWholeRevealedDungeonMap();
|
||||
LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FD040);
|
||||
}
|
||||
|
||||
void sub_8040094(u8 r0)
|
||||
{
|
||||
gDungeon->unk181e8.unk18217 = r0;
|
||||
sub_803F7BC();
|
||||
sub_80060EC();
|
||||
IncrementPlayTime(gPlayTimeRef);
|
||||
WaitForNextFrameAndAdvanceRNG();
|
||||
LoadBufferedInputs();
|
||||
xxx_call_update_bg_sound_input();
|
||||
UpdateDungeonMusic();
|
||||
sub_8011860();
|
||||
}
|
||||
|
||||
static const s32 gUnknown_80F6568[] = {
|
||||
0, -1, 1, -1, 1, -1, 1, -2, 1, -2, 2, -2, 2, -2, 2, -3, 3, -3, 3, -3, 4, -4, 4, -4, 4, -5, 4, -5, 4, -5, 4, -5
|
||||
};
|
||||
|
||||
void sub_80400D4(void)
|
||||
{
|
||||
s32 temp;
|
||||
temp = gDungeon->unk181e8.unk18200;
|
||||
if(temp == 0)
|
||||
return;
|
||||
if(temp >= 0x1F)
|
||||
temp = 0x1F;
|
||||
gDungeon->unk181e8.unk181FC = gUnknown_80F6568[temp];
|
||||
gDungeon->unk181e8.unk18200--;
|
||||
if(gDungeon->unk181e8.unk18200 == 0)
|
||||
gDungeon->unk181e8.unk18200 = gDungeon->unk181e8.unk18204;
|
||||
}
|
||||
|
||||
@@ -1,71 +1,10 @@
|
||||
#include "global.h"
|
||||
#include "structs/dungeon_entity.h"
|
||||
#include "structs/str_dungeon.h"
|
||||
#include "code_800558C.h"
|
||||
#include "code_800C9CC.h"
|
||||
#include "code_80118A4.h"
|
||||
#include "def_filearchives.h"
|
||||
#include "dungeon_message.h"
|
||||
#include "dungeon_map_access.h"
|
||||
#include "dungeon_music.h"
|
||||
#include "file_system.h"
|
||||
#include "play_time.h"
|
||||
|
||||
extern s32 gUnknown_80F6568[];
|
||||
extern const char gUnknown_80F6604; // "zmappat"
|
||||
|
||||
extern void sub_803F7BC(void);
|
||||
|
||||
extern void sub_803F580(u32);
|
||||
extern void ShowWholeRevealedDungeonMap();
|
||||
|
||||
extern const char *gUnknown_80FD040; // It became brighter on the floor
|
||||
|
||||
// Luminous Orb???
|
||||
void HandleLuminousOrbAction(Entity *pokemon)
|
||||
{
|
||||
int XCoord;
|
||||
int YCoord;
|
||||
|
||||
gDungeon->unk181e8.allTilesRevealed = TRUE;
|
||||
|
||||
for(YCoord = 0; YCoord < DUNGEON_MAX_SIZE_Y; YCoord++)
|
||||
{
|
||||
for(XCoord = 0; XCoord < DUNGEON_MAX_SIZE_X; XCoord++)
|
||||
{
|
||||
Tile *mapTile = GetTileMut(XCoord, YCoord);
|
||||
mapTile->spawnOrVisibilityFlags |= VISIBILITY_FLAG_REVEALED;
|
||||
}
|
||||
}
|
||||
sub_803F580(0);
|
||||
sub_8049ED4();
|
||||
ShowWholeRevealedDungeonMap();
|
||||
LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FD040);
|
||||
}
|
||||
|
||||
void sub_8040094(u8 r0)
|
||||
{
|
||||
gDungeon->unk181e8.unk18217 = r0;
|
||||
sub_803F7BC();
|
||||
sub_80060EC();
|
||||
IncrementPlayTime(gPlayTimeRef);
|
||||
WaitForNextFrameAndAdvanceRNG();
|
||||
LoadBufferedInputs();
|
||||
xxx_call_update_bg_sound_input();
|
||||
UpdateDungeonMusic();
|
||||
sub_8011860();
|
||||
}
|
||||
|
||||
void sub_80400D4(void)
|
||||
{
|
||||
s32 temp;
|
||||
temp = gDungeon->unk181e8.unk18200;
|
||||
if(temp == 0)
|
||||
return;
|
||||
if(temp > 0x1E)
|
||||
temp = 0x1F;
|
||||
gDungeon->unk181e8.unk181FC = gUnknown_80F6568[temp];
|
||||
gDungeon->unk181e8.unk18200--;
|
||||
if(gDungeon->unk181e8.unk18200 == 0)
|
||||
gDungeon->unk181e8.unk18200 = gDungeon->unk181e8.unk18204;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user