summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDizzyEggg <jajkodizzy@wp.pl>2017-09-08 16:46:37 +0200
committerDizzyEggg <jajkodizzy@wp.pl>2017-09-08 16:46:37 +0200
commitba1c066d572e6709562194abc98510c7e30d3cda (patch)
tree4e3cb03c02223678bcb1dc5a45c2becc552c9f35
parent4a1b2967caf329541ce7a166d3b3aea126966c22 (diff)
new game fully decompiled
-rw-r--r--asm/new_game.s49
-rw-r--r--include/global.h26
-rw-r--r--ld_script.txt1
-rw-r--r--src/battle_4.c6
-rw-r--r--src/new_game.c10
5 files changed, 35 insertions, 57 deletions
diff --git a/asm/new_game.s b/asm/new_game.s
deleted file mode 100644
index 265945eb1..000000000
--- a/asm/new_game.s
+++ /dev/null
@@ -1,49 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .syntax unified
-
- .text
-
-
-
- thumb_func_start ResetMiniGamesResults
-ResetMiniGamesResults: @ 80845CC
- push {r4-r6,lr}
- sub sp, 0x4
- mov r0, sp
- movs r5, 0
- strh r5, [r0]
- ldr r4, =gSaveBlock2Ptr
- ldr r1, [r4]
- movs r0, 0xF6
- lsls r0, 1
- adds r1, r0
- ldr r6, =0x01000008
- mov r0, sp
- adds r2, r6, 0
- bl CpuSet
- ldr r0, [r4]
- movs r1, 0xFA
- lsls r1, 1
- adds r0, r1
- movs r1, 0
- bl SetBerryPowder
- bl ResetPokeJumpResults
- mov r0, sp
- adds r0, 0x2
- strh r5, [r0]
- ldr r1, [r4]
- movs r2, 0x83
- lsls r2, 2
- adds r1, r2
- adds r2, r6, 0
- bl CpuSet
- add sp, 0x4
- pop {r4-r6}
- pop {r0}
- bx r0
- .pool
- thumb_func_end ResetMiniGamesResults
-
- .align 2, 0 @ Don't pad with nop.
diff --git a/include/global.h b/include/global.h
index 8ee40e79d..73f58a67b 100644
--- a/include/global.h
+++ b/include/global.h
@@ -124,7 +124,14 @@ struct BerryPickingResults // possibly used in the game itself? Size may be wron
u32 bestScore;
u16 berriesPicked;
u16 berriesPickedInRow;
- // unk size
+ u8 field_8;
+ u8 field_9;
+ u8 field_A;
+ u8 field_B;
+ u8 field_C;
+ u8 field_D;
+ u8 field_E;
+ u8 field_F;
};
struct PyramidBag
@@ -134,6 +141,13 @@ struct PyramidBag
u8 quantity[10];
};
+struct BerryCrush
+{
+ u16 berryCrushResults[4];
+ u32 berryPowderAmount;
+ u32 unk;
+};
+
struct SaveBlock2
{
/*0x00*/ u8 playerName[8];
@@ -160,12 +174,10 @@ struct SaveBlock2
// TODO: fix and verify labels
/*0xB0*/ u8 field_B0[316];
- /*0x1EC*/ u16 berryCrushResults[4];
- /*0x1F4*/ u32 berryPowderAmount;
- /*0x1F8*/ u32 field_1F8;
- /*0x1FC*/ struct PokemonJumpResults pokeJumpResults;
- /*0x20C*/ struct BerryPickingResults berryPickResults;
- /*0x214*/ u8 field_214[1040];
+ /*0x1EC*/ struct BerryCrush berryCrush;
+ /*0x1FC*/ struct PokemonJumpResults pokeJump;
+ /*0x20C*/ struct BerryPickingResults berryPick;
+ /*0x214*/ u8 field_214[1032];
/*0x624*/ u16 contestLinkResults[20]; // 4 positions for 5 categories, possibly a struct or a 2d array
// All below could be a one giant struct
diff --git a/ld_script.txt b/ld_script.txt
index 19a79c9ed..7a23b09e5 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -87,7 +87,6 @@ SECTIONS {
asm/berry_blender.o(.text);
src/play_time.o(.text);
src/new_game.o(.text);
- asm/new_game.o(.text);
asm/rom4.o(.text);
asm/fieldmap.o(.text);
asm/metatile_behavior.o(.text);
diff --git a/src/battle_4.c b/src/battle_4.c
index d6f1cd1f5..92561251f 100644
--- a/src/battle_4.c
+++ b/src/battle_4.c
@@ -1,5 +1,11 @@
#include "global.h"
#include "battle.h"
+#include "battle_move_effects.h"
+#include "moves.h"
+#include "abilities.h"
+#include "item.h"
+#include "items.h"
+#include "hold_effects.h"
void atk00_attackcanceler(void);
void atk01_accuracycheck(void);
diff --git a/src/new_game.c b/src/new_game.c
index 0fd220d47..2bf774c69 100644
--- a/src/new_game.c
+++ b/src/new_game.c
@@ -55,6 +55,8 @@ extern void sub_801AFD8(void);
extern void sub_800E5AC(void);
extern void sub_81D54BC(void);
extern void ResetContestLinkResults(void);
+extern void ResetPokeJumpResults(void);
+extern void SetBerryPowder(u32* powder, u32 newValue);
extern u8 gUnknown_082715DE[];
@@ -204,3 +206,11 @@ void NewGameInitData(void)
sub_81D54BC();
ResetContestLinkResults();
}
+
+void ResetMiniGamesResults(void)
+{
+ CpuFill16(0, &gSaveBlock2Ptr->berryCrush, sizeof(struct BerryCrush));
+ SetBerryPowder(&gSaveBlock2Ptr->berryCrush.berryPowderAmount, 0);
+ ResetPokeJumpResults();
+ CpuFill16(0, &gSaveBlock2Ptr->berryPick, sizeof(struct BerryPickingResults));
+}