through game_continue

This commit is contained in:
PikalaxALT 2017-10-26 21:39:34 -04:00
parent de5d9361f9
commit 135da0136f
4 changed files with 105 additions and 244 deletions

View File

@ -5,250 +5,6 @@
.text
thumb_func_start sub_80E9BDC
sub_80E9BDC: @ 80E9BDC
push {lr}
ldr r0, =0x00004054
bl VarGet
lsls r0, 24
lsrs r0, 24
bl sub_80E9878
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0x1
bne _080E9C04
ldr r0, =gScriptResult
strh r1, [r0]
b _080E9C22
.pool
_080E9C04:
bl sub_80E9BA8
lsls r0, 24
lsrs r0, 24
cmp r0, 0x9
bls _080E9C1C
ldr r1, =gScriptResult
movs r0, 0x2
b _080E9C20
.pool
_080E9C1C:
ldr r1, =gScriptResult
movs r0, 0
_080E9C20:
strh r0, [r1]
_080E9C22:
pop {r0}
bx r0
.pool
thumb_func_end sub_80E9BDC
thumb_func_start sub_80E9C2C
sub_80E9C2C: @ 80E9C2C
push {lr}
ldr r0, =0x00004054
bl VarGet
ldr r1, =gSaveBlock1Ptr
ldr r2, [r1]
lsls r0, 16
lsrs r0, 16
lsls r1, r0, 2
adds r1, r0
lsls r1, 5
adds r2, r1
ldr r0, =0x00001a9d
adds r2, r0
ldrb r3, [r2]
lsrs r1, r3, 6
movs r0, 0x1
eors r1, r0
lsls r1, 6
movs r0, 0x3F
ands r0, r3
orrs r0, r1
strb r0, [r2]
movs r0, 0x86
lsls r0, 1
bl FlagSet
pop {r0}
bx r0
.pool
thumb_func_end sub_80E9C2C
thumb_func_start sub_80E9C74
sub_80E9C74: @ 80E9C74
push {lr}
ldr r0, =sub_8126AD8
movs r1, 0
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_80E9C74
thumb_func_start sub_80E9C88
sub_80E9C88: @ 80E9C88
push {lr}
ldr r0, =sub_80E9C9C
movs r1, 0
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_80E9C88
thumb_func_start sub_80E9C9C
sub_80E9C9C: @ 80E9C9C
push {r4-r7,lr}
mov r7, r8
push {r7}
lsls r0, 24
lsrs r6, r0, 24
lsls r0, r6, 2
adds r0, r6
lsls r7, r0, 3
ldr r0, =gTasks + 0x8
mov r8, r0
adds r5, r7, r0
bl ScriptContext2_Enable
bl sub_80E9BA8
lsls r0, 24
lsrs r0, 24
strh r0, [r5]
cmp r0, 0
beq _080E9D10
movs r0, 0
strh r0, [r5, 0x2]
strh r0, [r5, 0x4]
movs r0, 0
movs r1, 0
bl sub_8197434
ldr r4, =gUnknown_0203A020
movs r0, 0xDC
lsls r0, 1
bl AllocZeroed
str r0, [r4]
ldr r0, =gUnknown_0858D06C
bl AddWindow
strh r0, [r5, 0xC]
adds r0, r6, 0
bl game_continue
adds r0, r6, 0
bl sub_80E9E00
mov r0, r8
subs r0, 0x8
adds r0, r7, r0
ldr r1, =sub_80E9E90
str r1, [r0]
b _080E9D1A
.pool
_080E9D10:
ldr r1, =gText_NoRegistry
ldr r2, =task_pc_turn_off
adds r0, r6, 0
bl DisplayItemMessageOnField
_080E9D1A:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_80E9C9C
thumb_func_start game_continue
game_continue: @ 80E9D2C
push {r4-r7,lr}
mov r7, r8
push {r7}
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
ldr r0, =gTasks + 0x8
adds r7, r1, r0
movs r6, 0
movs r5, 0x1
ldr r0, =gUnknown_0203A020
mov r8, r0
_080E9D48:
adds r0, r5, 0
bl sub_80E9878
lsls r0, 24
cmp r0, 0
beq _080E9D7C
lsls r4, r6, 5
adds r4, 0x58
mov r1, r8
ldr r0, [r1]
adds r0, r4
adds r1, r5, 0
bl sub_80E9780
mov r3, r8
ldr r0, [r3]
lsls r2, r6, 3
adds r1, r0, r2
adds r4, r0, r4
str r4, [r1]
adds r0, 0x4
adds r0, r2
str r5, [r0]
adds r0, r6, 0x1
lsls r0, 24
lsrs r6, r0, 24
_080E9D7C:
adds r0, r5, 0x1
lsls r0, 24
lsrs r5, r0, 24
cmp r5, 0x13
bls _080E9D48
ldr r4, =gUnknown_0203A020
ldr r1, [r4]
lsls r3, r6, 3
adds r2, r1, r3
ldr r0, =gText_Cancel
str r0, [r2]
adds r1, 0x4
adds r1, r3
movs r0, 0x2
negs r0, r0
str r0, [r1]
adds r2, r6, 0x1
strh r2, [r7]
lsls r0, r2, 16
asrs r0, 16
cmp r0, 0x7
bgt _080E9DB8
strh r2, [r7, 0x6]
b _080E9DBC
.pool
_080E9DB8:
movs r0, 0x8
strh r0, [r7, 0x6]
_080E9DBC:
ldr r2, =gUnknown_03006310
adds r1, r2, 0
ldr r0, =gUnknown_0858D07C
ldm r0!, {r3,r5,r6}
stm r1!, {r3,r5,r6}
ldm r0!, {r3,r5,r6}
stm r1!, {r3,r5,r6}
ldrh r0, [r7, 0xC]
strb r0, [r2, 0x10]
ldrh r0, [r7]
strh r0, [r2, 0xC]
ldr r0, [r4]
str r0, [r2]
ldrh r0, [r7, 0x6]
strh r0, [r2, 0xE]
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end game_continue
thumb_func_start sub_80E9DEC
sub_80E9DEC: @ 80E9DEC
push {lr}

View File

@ -191,6 +191,7 @@ extern EWRAM_DATA u8 *gCurDecorInventoryItems;
extern EWRAM_DATA u8 gCurDecorationIndex;
void sub_8126968(void);
void sub_8126AD8(u8 taskId);
void sub_8127D38(u16 mapX, u16 mapY, u16 decor);
#endif //GUARD_DECORATION_H

View File

@ -362,5 +362,6 @@ extern const u8 gPokeNewsTextBlendMaster_Upcoming[];
extern const u8 gPokeNewsTextBlendMaster_Ongoing[];
extern const u8 gPokeNewsTextBlendMaster_Ending[];
extern const u8 gText_ApostropheSBase[];
extern const u8 gText_NoRegistry[];
#endif //GUARD_EVENT_SCRIPTS_H

View File

@ -1,9 +1,12 @@
// Includes
#include "global.h"
#include "malloc.h"
#include "task.h"
#include "palette.h"
#include "list_menu.h"
#include "window.h"
#include "new_menu_helpers.h"
#include "map_constants.h"
#include "species.h"
#include "moves.h"
@ -21,6 +24,7 @@
#include "string_util.h"
#include "script.h"
#include "event_scripts.h"
#include "strings.h"
#include "event_data.h"
#include "decoration.h"
#include "decoration_inventory.h"
@ -40,6 +44,11 @@ EWRAM_DATA struct SecretBaseListMenuBuffer *gUnknown_0203A020 = NULL;
// Static ROM declarations
void sub_80E9C9C(u8 taskId);
void game_continue(u8 taskId);
void sub_80E9E00(u8 taskId);
void sub_80E9E90(u8 taskId);
void task_pc_turn_off(u8 taskId);
u8 sub_80EA20C(u8 sbId);
// .rodata
@ -51,6 +60,8 @@ extern const struct {
extern const u8 gUnknown_0858CFE8[];
extern const u8 gUnknown_0858D060[];
extern const struct WindowTemplate gUnknown_0858D06C;
extern const struct ListMenuTemplate gUnknown_0858D07C;
// .text
@ -920,3 +931,95 @@ u8 sub_80E9BA8(void)
}
return tot;
}
void sub_80E9BDC(void)
{
if (sub_80E9878(VarGet(VAR_0x4054)) == TRUE)
{
gScriptResult = 1;
}
else if (sub_80E9BA8() > 9)
{
gScriptResult = 2;
}
else
{
gScriptResult = 0;
}
}
void sub_80E9C2C(void)
{
gSaveBlock1Ptr->secretBases[VarGet(VAR_0x4054)].sbr_field_1_6 ^= 1;
FlagSet(0x10C);
}
void sub_80E9C74(void)
{
CreateTask(sub_8126AD8, 0);
}
void sub_80E9C88(void)
{
CreateTask(sub_80E9C9C, 0);
}
void sub_80E9C9C(u8 taskId)
{
s16 *data;
data = gTasks[taskId].data;
ScriptContext2_Enable();
data[0] = sub_80E9BA8();
if (data[0] != 0)
{
data[1] = 0;
data[2] = 0;
sub_8197434(0, 0);
gUnknown_0203A020 = calloc(1, sizeof(struct SecretBaseListMenuBuffer));
data[6] = AddWindow(&gUnknown_0858D06C);
game_continue(taskId);
sub_80E9E00(taskId);
gTasks[taskId].func = sub_80E9E90;
}
else
{
DisplayItemMessageOnField(taskId, gText_NoRegistry, task_pc_turn_off);
}
}
void game_continue(u8 taskId)
{
s16 *data;
u8 i;
u8 ct;
data = gTasks[taskId].data;
ct = 0;
for (i = 1; i < 20; i ++)
{
if (sub_80E9878(i))
{
sub_80E9780(gUnknown_0203A020->names[ct], i);
gUnknown_0203A020->items[ct].unk_00 = gUnknown_0203A020->names[ct];
gUnknown_0203A020->items[ct].unk_04 = i;
ct ++;
}
}
gUnknown_0203A020->items[ct].unk_00 = gText_Cancel;
gUnknown_0203A020->items[ct].unk_04 = -2;
data[0] = ct + 1;
if (data[0] < 8)
{
data[3] = data[0];
}
else
{
data[3] = 8;
}
gUnknown_03006310 = gUnknown_0858D07C;
gUnknown_03006310.unk_10 = data[6];
gUnknown_03006310.unk_0c = data[0];
gUnknown_03006310.unk_00 = gUnknown_0203A020->items;
gUnknown_03006310.unk_0e = data[3];
}