Merge pull request #117 from SethBarberee/jan_2023

Jan 2023
This commit is contained in:
Seth Barberee
2023-01-30 08:31:27 -08:00
committed by GitHub
54 changed files with 3443 additions and 6261 deletions

View File

@@ -1,204 +0,0 @@
#!/usr/bin/perl
use IPC::Cmd qw[ run ];
(@ARGV == 1)
or die "ERROR: no map file specified.\n";
open(my $file, $ARGV[0])
or die "ERROR: could not open file '$ARGV[0]'.\n";
my $src = 0;
my $asm = 0;
my $srcdata = 0;
my $data = 0;
while (my $line = <$file>)
{
if ($line =~ /^ \.(\w+)\s+0x[0-9a-f]+\s+(0x[0-9a-f]+) (\w+)\/.+\.o/)
{
my $section = $1;
my $size = hex($2);
my $dir = $3;
if ($section =~ /text/)
{
if ($dir eq 'src')
{
$src += $size;
}
elsif ($dir eq 'asm')
{
$asm += $size;
}
}
elsif ($section =~ /rodata/)
{
if ($dir eq 'src')
{
$srcdata += $size;
}
elsif ($dir eq 'data')
{
$data += $size;
}
}
}
}
(my $elffname = $ARGV[0]) =~ s/\.map/.elf/;
# Note that the grep filters out all branch labels. It also requires a minimum
# line length of 5, to filter out a ton of generated symbols (like AcCn). No
# settings to nm seem to remove these symbols. Finally, nm prints out a separate
# entry for whenever a name appears in a file, not just where it's defined. uniq
# removes all the duplicate entries.
#
#
# You'd expect this to take a while, because of uniq. It runs in under a second,
# though. Uniq is pretty fast!
my $base_cmd = "nm $elffname | awk '{print \$3}' | grep '^[^_].\\{4\\}' | uniq";
# This looks for Unknown_, Unknown_, or sub_, followed by just numbers. Note that
# it matches even if stuff precedes the unknown, like sUnknown/gUnknown.
# 'sub_' anchors to the start so it does not consider symbols like 'nullsub_12' undocumented.
my $undoc_cmd = "grep -E '[Uu]nknown_[0-9a-fA-F]*|^sub_[0-9a-fA-F]*'";
# This looks for every symbol with an address at the end of it. Some things are
# given a name based on their type / location, but still have an unknown purpose.
# For example, FooMap_EventScript_FFFFFFF.
my $partial_doc_cmd = "grep '_[0-38-9][0-9a-fA-F]\\{5,6\\}'";
my $count_cmd = "wc -l";
my $incbin_cmd = "find \"\$(dirname $elffname)\" \\( -name '*.s' -o -name '*.inc' \\) -exec cat {} ';' | grep -oE '^\\s*\\.incbin\\s*\"[^\"]+\"\s*,\\s*(0x)?[0-9a-fA-F]+\\s*,\\s*(0x)?[0-9a-fA-F]+' -";
# It sucks that we have to run this three times, but I can't figure out how to get
# stdin working for subcommands in perl while still having a timeout. It's decently
# fast anyway.
my $total_syms_as_string;
(run (
command => "$base_cmd | $count_cmd",
buffer => \$total_syms_as_string,
timeout => 60
))
or die "ERROR: Error while getting all symbols: $?";
my $undocumented_as_string;
(run (
command => "$base_cmd | $undoc_cmd | $count_cmd",
buffer => \$undocumented_as_string,
timeout => 60
))
or die "ERROR: Error while filtering for undocumented symbols: $?";
my $partial_documented_as_string;
(run (
command => "$base_cmd | $partial_doc_cmd | $count_cmd",
buffer => \$partial_documented_as_string,
timeout => 60
))
or die "ERROR: Error while filtering for partial symbols: $?";
my $incbin_count_as_string;
(run (
command => "$incbin_cmd | $count_cmd",
buffer => \$incbin_count_as_string,
timeout => 60
))
or die "ERROR: Error while counting incbins: $?";
my $incbin_bytes_as_string;
(run (
command => "(echo -n 'ibase=16;' ; $incbin_cmd | sed -E 's/.*,\\s*0x([0-9a-fA-F]+)/\\1/' | tr '\\n' '+'; echo '0' ) | bc",
buffer => \$incbin_bytes_as_string,
timeout => 60
))
or die "ERROR: Error while calculating incbin totals: $?";
# Performing addition on a string converts it to a number. Any string that fails
# to convert to a number becomes 0. So if our converted number is 0, but our string
# is nonzero, then the conversion was an error.
my $undocumented = $undocumented_as_string + 0;
(($undocumented != 0) and ($undocumented_as_string ne "0"))
or die "ERROR: Cannot convert string to num: '$undocumented_as_string'";
my $partial_documented = $partial_documented_as_string + 0;
(($partial_documented != 0) and ($partial_documented_as_string ne "0"))
or die "ERROR: Cannot convert string to num: '$partial_documented_as_string'";
my $total_syms = $total_syms_as_string + 0;
(($total_syms != 0) and ($total_syms_as_string ne "0"))
or die "ERROR: Cannot convert string to num: '$total_syms_as_string'";
($total_syms != 0)
or die "ERROR: No symbols found.";
my $incbin_count = $incbin_count_as_string + 0;
(($incbin_count != 0) and ($incbin_count_as_string ne "0"))
or die "ERROR: Cannot convert string to num: '$incbin_count_as_string'";
my $incbin_bytes = $incbin_bytes_as_string + 0;
(($incbin_bytes != 0) and ($incbin_bytes_as_string ne "0"))
or die "ERROR: Cannot convert string to num: '$incbin_bytes_as_string'";
my $total = $src + $asm;
my $srcPct = sprintf("%.4f", 100 * $src / $total);
my $asmPct = sprintf("%.4f", 100 * $asm / $total);
# partial_documented is double-counting the unknown_* and sub_* symbols.
$partial_documented = $partial_documented - $undocumented;
my $documented = $total_syms - ($undocumented + $partial_documented);
my $docPct = sprintf("%.4f", 100 * $documented / $total_syms);
my $partialPct = sprintf("%.4f", 100 * $partial_documented / $total_syms);
my $undocPct = sprintf("%.4f", 100 * $undocumented / $total_syms);
if ($asm == 0)
{
print "Code decompilation is 100% complete\n"
}
else
{
print "$total total bytes of code\n";
print "$src bytes of code in src ($srcPct%)\n";
print "$asm bytes of code in asm ($asmPct%)\n";
}
print "\n";
if ($partial_documented == 0 && $undocumented == 0)
{
print "Documentation is 100% complete\n"
}
else
{
print "$total_syms total symbols\n";
print "$documented symbols documented ($docPct%)\n";
print "$partial_documented symbols partially documented ($partialPct%)\n";
print "$undocumented symbols undocumented ($undocPct%)\n";
}
print "\n";
my $dataTotal = $srcdata + $data;
my $srcDataPct = sprintf("%.4f", 100 * $srcdata / $dataTotal);
my $dataPct = sprintf("%.4f", 100 * $data / $dataTotal);
my $incPct = sprintf("%.4f", 100 * $incbin_bytes / $dataTotal);
if ($data == 0)
{
print "Data porting to C is 100% complete\n"
}
else
{
print "$dataTotal total bytes of data\n";
print "$srcdata bytes of data in src ($srcDataPct%)\n";
print "$data bytes of data in data ($dataPct%)\n";
}
print "\n";
if ($incbin_count == 0) {
print "All incbins have been eliminated\n"
} else {
print "$incbin_bytes bytes of data in $incbin_count incbins ($incPct%)\n"
}

View File

@@ -1,16 +0,0 @@
#!/bin/bash -ex
# Only run this script if it's the master branch build.
if [[ "$TRAVIS_BRANCH" != "master" || "$TRAVIS_PULL_REQUEST" != "false" ]]; then
exit 0
fi
build_name=$1
map_file=$build_name.map
if [ ! -f $map_file ]; then
echo "$map_file does not exist!"
exit 1
fi
output=$(perl $(dirname "$0")/calcrom.pl $build_name.map | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')
curl -d "{\"username\": \"$CALCROM_DISCORD_WEBHOOK_USERNAME\", \"avatar_url\": \"$CALCROM_DISCORD_WEBHOOK_AVATAR_URL\", \"content\":\"\`\`\`$build_name progress:\\n$output\`\`\`\"}" -H "Content-Type: application/json" -X POST $CALCROM_DISCORD_WEBHOOK_URL

View File

@@ -67,6 +67,8 @@ SCANINC := tools/scaninc/scaninc
RAMSCRGEN := tools/ramscrgen/ramscrgen
DUNGEONJSON := tools/dungeonjson/dungeonjson
PERL := perl
TOOLDIRS := $(filter-out tools/agbcc tools/binutils,$(wildcard tools/*))
TOOLBASE = $(TOOLDIRS:tools/%=%)
TOOLS = $(foreach tool,$(TOOLBASE),tools/$(tool)/$(tool)$(EXE))
@@ -86,6 +88,7 @@ BUILD_DIR := build/pmd_$(BUILD_NAME)
ROM := pmd_$(BUILD_NAME).gba
ELF := $(ROM:%.gba=%.elf)
MAP := $(ROM:%.gba=%.map)
SYM := $(ROM:%.gba=%.sym)
C_SUBDIR = src
ASM_SUBDIR = asm
@@ -164,6 +167,8 @@ all: $(ROM)
tools: $(TOOLDIRS)
syms: $(SYM)
include dungeon_pokemon.mk
include dungeon_floor.mk
include dungeon_trap.mk
@@ -185,7 +190,7 @@ clean-tools:
@$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);)
tidy:
$(RM) -f $(ROM) $(ELF) $(MAP)
$(RM) -f $(ROM) $(ELF) $(MAP) $(SYM)
$(RM) -r $(BUILD_DIR)
$(RM) -f $(ITEM_DATA)
$(RM) -f $(MOVE_DATA)
@@ -231,10 +236,16 @@ $(ASM_BUILDDIR)/%.d: $(ASM_SUBDIR)/%.s
libagbsyscall:
@$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN)
$(BUILD_DIR)/sym_%.txt: sym_%.txt
cp $< $(BUILD_DIR)
$(BUILD_DIR)/sym_ewram.ld: sym_ewram.txt
$(RAMSCRGEN) ewram_data $< ENGLISH > $@
$(LD_SCRIPT): ld_script.txt $(BUILD_DIR)/sym_ewram.txt $(BUILD_DIR)/sym_ewram2.txt $(BUILD_DIR)/sym_iwram.txt
$(BUILD_DIR)/sym_ewram2.ld: sym_ewram2.txt
$(RAMSCRGEN) ewram_data $< ENGLISH > $@
$(BUILD_DIR)/sym_iwram.ld: sym_iwram.txt
$(RAMSCRGEN) iwram_data $< ENGLISH > $@
$(LD_SCRIPT): ld_script.txt $(BUILD_DIR)/sym_ewram.ld $(BUILD_DIR)/sym_ewram2.ld $(BUILD_DIR)/sym_iwram.ld
cd $(BUILD_DIR) && sed -e "s#tools/#../../tools/#g" ../../ld_script.txt >ld_script.ld
$(ELF): $(LD_SCRIPT) $(ALL_OBJECTS) $(LIBC) libagbsyscall tools
@@ -247,3 +258,10 @@ $(ROM): %.gba: $(ELF)
ifeq (,$(filter clean,$(MAKECMDGOALS)))
-include $(ALL_OBJECTS:.o=.d)
endif
###################
### Symbol file ###
###################
$(SYM): $(ELF)
$(OBJDUMP) -t $< | sort -u | grep -E "^0[2389]" | $(PERL) -p -e 's/^(\w{8}) (\w).{6} \S+\t(\w{8}) (\S+)$$/\1 \2 \3 \4/g' > $@

View File

@@ -169,7 +169,7 @@ _08048918: .4byte gUnknown_80FD6E8
sub_804891C:
push {lr}
movs r2, 0x3
bl sub_80793B0
bl RaiseAtkStatTarget
pop {r0}
bx r0
thumb_func_end sub_804891C
@@ -178,7 +178,7 @@ sub_804891C:
sub_8048928:
push {lr}
movs r2, 0x3
bl sub_8079420
bl RaiseSpAtkStatTarget
pop {r0}
bx r0
thumb_func_end sub_8048928
@@ -187,7 +187,7 @@ sub_8048928:
sub_8048934:
push {lr}
movs r2, 0x3
bl sub_8079490
bl RaiseDefStatTarget
pop {r0}
bx r0
thumb_func_end sub_8048934
@@ -196,7 +196,7 @@ sub_8048934:
sub_8048940:
push {lr}
movs r2, 0x3
bl sub_8079500
bl RaiseSpDefStatTarget
pop {r0}
bx r0
thumb_func_end sub_8048940

View File

@@ -3889,7 +3889,7 @@ _0805461A:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805A2E8
bl SurfMoveAction
bl _080554BA
_0805462A:
adds r0, r7, 0
@@ -4084,7 +4084,7 @@ _080547D8:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805A0A8
bl TriAttackMoveAction
bl _080554BA
_080547E8:
adds r0, r7, 0
@@ -4224,7 +4224,7 @@ _08054918:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805A588
bl TickleMoveAction
bl _080554BA
_08054928:
adds r0, r7, 0
@@ -4287,7 +4287,7 @@ _080549A8:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805ACD8
bl BulkUpMoveAction
bl _080554BA
_080549B8:
adds r0, r7, 0
@@ -4469,7 +4469,7 @@ _08054B48:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805968C
bl SolarBeamMoveAction
bl _080554BA
_08054B58:
adds r0, r7, 0
@@ -4518,7 +4518,7 @@ _08054BB8:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805AF30
bl PresentMoveAction
bl _080554BA
_08054BC8:
adds r0, r7, 0
@@ -4553,7 +4553,7 @@ _08054C08:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805AB48
bl LightScreenMoveAction
bl _080554BA
_08054C18:
adds r0, r7, 0
@@ -4679,7 +4679,7 @@ _08054D1A:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805A55C
bl CurseMoveAction
b _080554BA
_08054D28:
movs r0, 0
@@ -4856,7 +4856,7 @@ _08054E7C:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805A3FC
bl WishMoveAction
b _080554BA
_08054E8A:
adds r0, r7, 0
@@ -5017,7 +5017,7 @@ _08054FBE:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_8059790
bl FlyMoveAction
b _080554BA
_08054FCC:
adds r0, r7, 0
@@ -5059,7 +5059,7 @@ _08055012:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805A6C8
bl KnockOffMoveAction
b _080554BA
_08055020:
adds r0, r7, 0
@@ -5243,7 +5243,7 @@ _08055182:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805A508
bl SwallowMoveAction
b _080554BA
_08055190:
adds r0, r7, 0
@@ -5348,7 +5348,7 @@ _08055254:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805AAE0
bl BellyDrumMoveAction
b _080554BA
_08055262:
adds r0, r7, 0
@@ -5404,7 +5404,7 @@ _080552C4:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805C468
bl MobileOrbAction
b _080554BA
_080552D2:
adds r0, r7, 0
@@ -5481,7 +5481,7 @@ _0805535E:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805AB54
bl SecretPowerMoveAction
b _080554BA
_0805536C:
adds r0, r7, 0
@@ -5516,7 +5516,7 @@ _080553A4:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_805A31C
bl RolePlayMoveAction
b _080554BA
_080553B2:
adds r0, r7, 0
@@ -5530,7 +5530,7 @@ _080553C0:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_8059BAC
bl ConversionMoveAction
b _080554BA
_080553CE:
adds r0, r7, 0
@@ -5614,7 +5614,7 @@ _08055468:
adds r1, r5, 0
mov r2, r8
mov r3, r9
bl sub_8059C80
bl Conversion2MoveAction
b _080554BA
_08055476:
adds r0, r7, 0

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.align 2, 0

View File

@@ -5,8 +5,8 @@
.text
thumb_func_start sub_8095B28
sub_8095B28:
thumb_func_start GenerateMailJobInfo
GenerateMailJobInfo:
push {r4-r7,lr}
mov r7, r9
mov r6, r8
@@ -14,7 +14,7 @@ sub_8095B28:
ldr r4, _08095B44
add sp, r4
adds r4, r0, 0
bl sub_8095CE0
bl GenerateMailJobDungeonInfo
lsls r0, 24
cmp r0, 0
bne _08095B48
@@ -224,375 +224,6 @@ _08095CCC:
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_8095B28
thumb_func_start sub_8095CE0
sub_8095CE0:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x60
str r0, [sp, 0x44]
mov r0, sp
bl sub_80A29B0
str r0, [sp, 0x4C]
cmp r0, 0
bne _08095D0C
mov r0, sp
add r1, sp, 0x4C
ldrb r1, [r1]
strb r1, [r0]
mov r1, sp
movs r0, 0x1
strb r0, [r1, 0x1]
movs r2, 0x2
str r2, [sp, 0x4C]
_08095D0C:
ldr r0, [sp, 0x4C]
bl RandInt
mov r9, r0
str r0, [sp, 0x48]
mov r1, sp
adds r1, 0x40
str r1, [sp, 0x5C]
_08095D1C:
mov r0, sp
add r0, r9
ldrb r7, [r0]
adds r0, r7, 0
bl GetDungeonFloorCount
str r0, [sp, 0x58]
lsrs r0, 31
ldr r2, [sp, 0x58]
adds r0, r2, r0
asrs r0, 1
str r0, [sp, 0x54]
adds r1, r2, 0
bl RandRange
adds r4, r0, 0
str r4, [sp, 0x50]
_08095D3E:
movs r0, 0x1
mov r8, r0
ldr r1, _08095DF4
ldr r0, [sp, 0x40]
ands r0, r1
orrs r0, r7
lsls r2, r4, 24
lsrs r2, 16
ldr r1, _08095DF8
ands r0, r1
orrs r0, r2
str r0, [sp, 0x40]
ldr r0, [sp, 0x5C]
bl sub_809017C
lsls r0, 24
cmp r0, 0
beq _08095D66
movs r1, 0
mov r8, r1
_08095D66:
ldr r2, _08095DFC
mov r10, r2
movs r6, 0
movs r5, 0x3
_08095D6E:
mov r1, r10
ldr r0, [r1]
adds r0, r6
adds r1, r7, 0
adds r2, r4, 0
movs r3, 0x1
bl sub_8095E38
lsls r0, 24
cmp r0, 0
beq _08095D88
movs r2, 0
mov r8, r2
_08095D88:
adds r6, 0x14
subs r5, 0x1
cmp r5, 0
bge _08095D6E
ldr r0, _08095DFC
mov r10, r0
movs r6, 0x50
movs r5, 0x7
_08095D98:
mov r1, r10
ldr r0, [r1]
adds r0, r6
adds r1, r7, 0
adds r2, r4, 0
movs r3, 0x1
bl sub_8095E38
lsls r0, 24
cmp r0, 0
beq _08095DB2
movs r2, 0
mov r8, r2
_08095DB2:
adds r6, 0x14
subs r5, 0x1
cmp r5, 0
bge _08095D98
ldr r0, _08095DFC
mov r10, r0
movs r6, 0xF0
movs r5, 0x7
_08095DC2:
mov r1, r10
ldr r0, [r1]
adds r0, r6
adds r1, r7, 0
adds r2, r4, 0
movs r3, 0x1
bl sub_8095E38
lsls r0, 24
cmp r0, 0
beq _08095DDC
movs r2, 0
mov r8, r2
_08095DDC:
adds r6, 0x14
subs r5, 0x1
cmp r5, 0
bge _08095DC2
mov r0, r8
cmp r0, 0
beq _08095E00
ldr r1, [sp, 0x44]
strb r7, [r1, 0x4]
strb r4, [r1, 0x5]
movs r0, 0x1
b _08095E28
.align 2, 0
_08095DF4: .4byte 0xffffff00
_08095DF8: .4byte 0xffff00ff
_08095DFC: .4byte gUnknown_203B490
_08095E00:
adds r4, 0x1
ldr r2, [sp, 0x58]
cmp r4, r2
blt _08095E0A
ldr r4, [sp, 0x54]
_08095E0A:
ldr r0, [sp, 0x50]
cmp r4, r0
bne _08095D3E
movs r1, 0x1
add r9, r1
ldr r2, [sp, 0x4C]
cmp r9, r2
bne _08095E1E
movs r0, 0
mov r9, r0
_08095E1E:
ldr r1, [sp, 0x48]
cmp r9, r1
beq _08095E26
b _08095D1C
_08095E26:
movs r0, 0
_08095E28:
add sp, 0x60
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_8095CE0
thumb_func_start sub_8095E38
sub_8095E38:
push {r4,lr}
adds r4, r0, 0
lsls r1, 24
lsrs r1, 24
lsls r3, 24
lsrs r3, 24
ldrb r0, [r4]
cmp r0, 0
beq _08095E6E
ldrb r0, [r4, 0x1]
cmp r0, 0x2
bne _08095E5E
cmp r3, 0x1
bne _08095E5E
ldrb r0, [r4, 0x4]
cmp r0, r1
bne _08095E6E
movs r0, 0x1
b _08095E70
_08095E5E:
ldrb r0, [r4, 0x4]
cmp r0, r1
bne _08095E6E
ldrb r0, [r4, 0x5]
cmp r0, r2
bne _08095E6E
movs r0, 0x1
b _08095E70
_08095E6E:
movs r0, 0
_08095E70:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_8095E38
thumb_func_start sub_8095E78
sub_8095E78:
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x3C
movs r6, 0
movs r5, 0x1
_08095E84:
ldr r0, _08095F04
ldr r0, [r0]
adds r0, r5
ldrb r0, [r0]
adds r1, r5, 0x1
mov r8, r1
cmp r0, 0
bne _08095EF6
lsls r0, r5, 24
lsrs r0, 24
bl GetFriendAreaUnlockCondition
lsls r0, 24
lsrs r0, 24
cmp r0, 0x2
bne _08095EF6
movs r4, 0
ldr r0, _08095F08
ldr r1, [r0]
movs r3, 0x3
_08095EAC:
ldrb r0, [r1]
cmp r0, 0
beq _08095EBA
ldrb r0, [r1, 0x11]
cmp r0, 0x9
bne _08095EBA
movs r4, 0x1
_08095EBA:
adds r1, 0x14
subs r3, 0x1
cmp r3, 0
bge _08095EAC
ldr r0, _08095F08
ldr r0, [r0]
adds r2, r0, 0
adds r2, 0xF0
adds r1, r0, 0
movs r3, 0x7
_08095ECE:
ldrb r0, [r2]
cmp r0, 0
beq _08095EE0
ldr r7, _08095F0C
adds r0, r1, r7
ldrb r0, [r0]
cmp r0, 0x9
bne _08095EE0
movs r4, 0x1
_08095EE0:
adds r2, 0x14
adds r1, 0x14
subs r3, 0x1
cmp r3, 0
bge _08095ECE
cmp r4, 0
bne _08095EF6
mov r1, sp
adds r0, r1, r6
strb r5, [r0]
adds r6, 0x1
_08095EF6:
mov r5, r8
cmp r5, 0x39
ble _08095E84
cmp r6, 0
bne _08095F10
movs r0, 0
b _08095F1A
.align 2, 0
_08095F04: .4byte gFriendAreas
_08095F08: .4byte gUnknown_203B490
_08095F0C: .4byte 0x00000101
_08095F10:
adds r0, r6, 0
bl RandInt
add r0, sp
ldrb r0, [r0]
_08095F1A:
add sp, 0x3C
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_8095E78
thumb_func_start sub_8095F28
sub_8095F28:
push {r4-r7,lr}
sub sp, 0xF0
lsls r0, 24
lsrs r7, r0, 24
movs r6, 0
movs r5, 0x1
_08095F34:
lsls r4, r5, 24
cmp r7, 0x63
beq _08095F48
lsrs r1, r4, 24
adds r0, r7, 0
bl xxx_bit_lut_lookup_8091E50
lsls r0, 24
cmp r0, 0
beq _08095F6A
_08095F48:
lsrs r4, 24
adds r0, r4, 0
bl IsThrowableItem
lsls r0, 24
cmp r0, 0
bne _08095F6A
adds r0, r4, 0
bl IsNotMoneyOrUsedTMItem
lsls r0, 24
cmp r0, 0
beq _08095F6A
mov r1, sp
adds r0, r1, r6
strb r5, [r0]
adds r6, 0x1
_08095F6A:
adds r5, 0x1
cmp r5, 0xEF
ble _08095F34
cmp r6, 0
beq _08095F80
adds r0, r6, 0
bl RandInt
add r0, sp
ldrb r0, [r0]
b _08095F82
_08095F80:
movs r0, 0
_08095F82:
add sp, 0xF0
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_8095F28
thumb_func_end GenerateMailJobInfo
.align 2,0

View File

@@ -377,7 +377,7 @@ _08096340:
lsrs r0, 24
bl GetMailboxSlotInfo
adds r4, r0, 0
bl sub_8095B28
bl GenerateMailJobInfo
lsls r0, 24
cmp r0, 0
beq _08096392

View File

@@ -1,142 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_8030E48
sub_8030E48:
push {r4-r6,lr}
mov r6, r8
push {r6}
sub sp, 0x15C
ldr r3, _08030EA8
ldr r4, _08030EAC
ldr r2, [r4]
ldrb r1, [r2, 0xC]
lsls r0, r1, 1
adds r0, r1
lsls r0, 4
ldr r1, [r3]
adds r5, r1, r0
ldr r0, [r2, 0x10]
bl sub_80073B8
ldr r0, [r4]
ldr r0, [r0, 0x10]
str r0, [sp, 0x4]
add r1, sp, 0x44
movs r2, 0
movs r0, 0x7
strb r0, [r1]
mov r0, sp
adds r0, 0x46
strb r2, [r0]
add r0, sp, 0x48
strb r2, [r0]
adds r0, r5, 0x4
str r0, [sp, 0xC]
adds r0, 0x10
str r0, [sp, 0x10]
add r1, sp, 0x4
ldrh r0, [r5, 0xC]
strh r0, [r1, 0x10]
ldrh r0, [r5, 0xC]
strh r0, [r1, 0x12]
adds r0, r1, 0
strb r2, [r0, 0x14]
adds r2, r5, 0
adds r2, 0x22
ldrb r0, [r2]
cmp r0, 0
bne _08030EB0
adds r1, 0x2E
movs r0, 0x5
strb r0, [r1]
b _08030EBE
.align 2, 0
_08030EA8: .4byte gUnknown_203B480
_08030EAC: .4byte gUnknown_203B324
_08030EB0:
mov r1, sp
adds r1, 0x32
movs r0, 0x2
strb r0, [r1]
ldrb r1, [r2]
add r0, sp, 0x38
strb r1, [r0]
_08030EBE:
ldrb r0, [r5]
cmp r0, 0x2
beq _08030ED2
cmp r0, 0x2
ble _08030EE2
cmp r0, 0x4
beq _08030ED2
cmp r0, 0x5
beq _08030EDA
b _08030EE2
_08030ED2:
mov r1, sp
adds r1, 0x45
movs r0, 0xA
b _08030EE8
_08030EDA:
mov r1, sp
adds r1, 0x45
movs r0, 0xB
b _08030EE8
_08030EE2:
mov r1, sp
adds r1, 0x45
movs r0, 0x9
_08030EE8:
strb r0, [r1]
add r0, sp, 0x4
bl CreateRescueDescription
ldrh r0, [r5, 0x10]
ldr r1, _08030F48
bl __umodsi3
adds r4, r0, 0
lsls r4, 16
lsrs r4, 16
ldr r2, _08030F4C
ldr r5, _08030F50
ldr r0, [r5]
ldr r3, [r0, 0x10]
movs r0, 0
mov r8, r0
str r0, [sp]
movs r0, 0xA
movs r1, 0x68
bl xxx_call_draw_string
add r6, sp, 0x5C
ldr r1, _08030F54
adds r0, r6, 0
adds r2, r4, 0
bl sprintfStatic
ldr r0, [r5]
ldr r3, [r0, 0x10]
mov r0, r8
str r0, [sp]
movs r0, 0x44
movs r1, 0x68
adds r2, r6, 0
bl xxx_call_draw_string
ldr r0, [r5]
ldr r0, [r0, 0x10]
bl sub_80073E0
add sp, 0x15C
pop {r3}
mov r8, r3
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_08030F48: .4byte 0x00002710
_08030F4C: .4byte gUnknown_80E0934
_08030F50: .4byte gUnknown_203B324
_08030F54: .4byte gUnknown_80E0938
thumb_func_end sub_8030E48
.align 2,0

View File

@@ -4622,53 +4622,3 @@ gUnknown_80DCA2C: @ 80DCA2C
#include "friend_area.inc"
#include "text/party_menu.inc"
.global gUnknown_80DD6EC
gUnknown_80DD6EC: @ 80DD6EC
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global gUnknown_80DD704
gUnknown_80DD704: @ 80DD704
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x13, 0x00, 0x04, 0x00
.byte 0x09, 0x00, 0x03, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global gUnknown_80DD71C
gUnknown_80DD71C: @ 80DD71C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x14, 0x00, 0x04, 0x00
.byte 0x06, 0x00, 0x03, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x16, 0x00, 0x04, 0x00
.byte 0x06, 0x00, 0x03, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global gUnknown_80DD74C
gUnknown_80DD74C: @ 80DD74C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0x11, 0x00
.byte 0x1A, 0x00, 0x02, 0x00
.byte 0x02, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00

View File

@@ -1,144 +0,0 @@
.section .rodata
.string "pksdir0\0"
.align 2,0
.global gUnknown_80E07EC
gUnknown_80E07EC: @ 80E07EC
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global gUnknown_80E0804
gUnknown_80E0804: @ 80E0804
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x06, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0x02, 0x00
.byte 0x0e, 0x00, 0x0e, 0x00
.byte 0x0e, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global gUnknown_80E081C
gUnknown_80E081C: @ 80E081C
.string "Courses\0"
.align 2,0
.global gUnknown_80E0824
gUnknown_80E0824: @ 80E0824
.byte 0x87, 0x42, 0x00, 0x00
.global gUnknown_80E0828
gUnknown_80E0828: @ 80E0828
.string "{COLOR_2}%c%s{END_COLOR_TEXT_2}\0"
.align 2,0
.string "pksdir0\0"
.align 2,0
.global gUnknown_80E083C
gUnknown_80E083C: @ 80E083C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global gUnknown_80E0854
gUnknown_80E0854: @ 80E0854
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x06, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0x02, 0x00
.byte 0x18, 0x00, 0x11, 0x00
.byte 0x11, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global gUnknown_80E086C
gUnknown_80E086C: @ 80E086C
.4byte SOSList
.4byte RequestList
.4byte SOSMail
.4byte ToDoList
.4byte AOKMail
.4byte ThanksList
.4byte CompletedJobs
.4byte OkdRescue
.global OkdRescue
OkdRescue:
.string "OK{APOSTROPHE}d Rescues\0"
.align 2,0
.global CompletedJobs
CompletedJobs:
.string "Completed Jobs\0"
.align 2,0
.global ThanksList
ThanksList:
.string "Thanks List\0"
.align 2,0
.global AOKMail
AOKMail:
.string "A-OK Mail\0"
.align 2,0
.global ToDoList
ToDoList:
.string "To-Do List\0"
.align 2,0
.global SOSMail
SOSMail:
.string "SOS Mail\0"
.align 2,0
.global RequestList
RequestList:
.string "Request List\0"
.align 2,0
.global SOSList
SOSList:
.string "SOS List\0"
.align 2,0
.string "pksdir0\0"
.align 2,0
.global gUnknown_80E0900
gUnknown_80E0900: @ 80E0900
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global DATA_80E0918
DATA_80E0918:
.byte 0x01, 0x00, 0x12, 0x00
.global gUnknown_80E091C
gUnknown_80E091C: @ 80E091C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x06, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0x02, 0x00
.byte 0x1a, 0x00, 0x10, 0x00
.byte 0x10, 0x00, 0x00, 0x00
.4byte DATA_80E0918
.global gUnknown_80E0934
gUnknown_80E0934: @ 80E0934
.string "ID:\0"
.global gUnknown_80E0938
gUnknown_80E0938: @ 80E0938
.string "%-4d\0"
.align 2,0
.string "pksdir0\0"

View File

@@ -426,11 +426,10 @@ gUnknown_80F4F46: @ 80F4F46
@ replacing .incbin "baserom.gba", 0x000f4f46, 0x2
.byte 0x0c, 0x00
.global gUnknown_80F4F48
gUnknown_80F4F48: @ 80F4F48
.global gSolarBeamMovePower
gSolarBeamMovePower: @ 80F4F48
@ replacing .incbin "baserom.gba", 0x000f4f48, 0x4
.byte 0x00, 0x02
.byte 0x00, 0x00
.4byte 0x0200
.global gUnknown_80F4F4C
gUnknown_80F4F4C: @ 80F4F4C

25
include/code_802C39C.h Normal file
View File

@@ -0,0 +1,25 @@
struct unkStruct_802C39C
{
/* 0x0 */ u32 unk0[2];
/* 0x8 */ struct DungeonLocation *dungeon;
/* 0xC */ u8 *playerName;
/* 0x10 */ s16 clientSpecies;
/* 0x12 */ s16 targetSpecies;
/* 0x14 */ u8 unk14;
/* 0x15 */ u8 fill15[0x2E - 0x15];
u8 unk2E;
u8 fill2F[0x34 - 0x2F];
u8 unk34;
u8 fill35[0x38 - 0x35];
/* 0x38 */ u8 unk38[0x40 - 0x38];
u8 unk40;
u8 unk41;
u8 unk42;
u8 unk43;
u8 unk44;
u8 unk45;
u8 fill46[0x48 - 0x46];
/* 0x48 */ u32 y;
/* 0x4C */ u8 *unk4C;
/* 0x50 */ u8 *unk50[2];
};

View File

@@ -3,22 +3,22 @@
void MuzzleTarget(struct Entity *pokemon, struct Entity *target);
void sub_8078E18(struct Entity * pokemon, struct Entity * target);
void sub_8078F50(struct Entity * pokemon, struct Entity * target);
void MobileStatusTarget(struct Entity * pokemon, struct Entity * target);
void ExposeStatusTarget(struct Entity * pokemon, struct Entity * target, s16 param_3);
void IdentityItemHolders(struct Entity *pokemon, struct Entity *target);
void BlindTarget(struct Entity *pokemon, struct Entity *target);
void CrossEyeVisionTarget(struct Entity *pokemon, struct Entity *target);
void RestoreVisionTarget(struct Entity *pokemon, struct Entity *target);
void RestorePPTarget(struct Entity * pokemon,struct Entity * target, s32 param_3);
void sub_80793B0(struct Entity * pokemon,struct Entity * target, s32 param_3);
void sub_8079420(struct Entity * pokemon,struct Entity * target, s32 param_3);
void sub_8079490(struct Entity * pokemon,struct Entity * target, s32 param_3);
void sub_8079500(struct Entity * pokemon,struct Entity * target, s32 param_3);
void RaiseAtkStatTarget(struct Entity * pokemon,struct Entity * target, s32 increment);
void RaiseSpAtkStatTarget(struct Entity * pokemon,struct Entity * target, s32 increment);
void RaiseDefStatTarget(struct Entity * pokemon,struct Entity * target, s32 increment);
void RaiseSpDefStatTarget(struct Entity * pokemon,struct Entity * target, s32 increment);
void LongTossStatusTarget(struct Entity * pokemon,struct Entity * target);
void PierceStatusTarget(struct Entity * pokemon,struct Entity * target);
void SetChargeStatusTarget(struct Entity *pokemon, struct Entity *target, u8 newStatus, struct Move *move, u8 *message);
void sub_8079764(struct Entity * pokemon);
void sub_80797A0(struct Entity * pokemon, struct Entity * target, u8 newStatus);
void CounterStatusTarget(struct Entity * pokemon, struct Entity * target, u8 newStatus);
void SafeguardStatusTarget(struct Entity * pokemon, struct Entity * target);
void MistStatusTarget(struct Entity * pokemon, struct Entity * target);
void WishStatusTarget(struct Entity * pokemon, struct Entity * target);

View File

@@ -11,7 +11,11 @@ struct unkStruct_203B480
/* 0x8 */ u32 unk8;
/* 0xC */ s16 clientSpecies;
/* 0xE */ s16 targetSpecies;
/* 0x10 */ u32 unk10;
union unk10_temp
{
u32 unk10;
u16 unk10_u16;
} unk10;
/* 0x14 */ u8 playerName[0x20 - 0x14];;
struct Item unk20;
u32 unk24;

View File

@@ -257,7 +257,10 @@ struct Entity
/* 0x14 */ struct Position32 prevPixelPos;
s32 unk1C;
/* 0x20 */ bool8 isVisible; // Turned off when a Pokémon faints.
u8 fill21[0x25 - 0x21];
u8 fill21;
u8 unk22;
u8 fill23;
u8 unk24;
/* 0x25 */ u8 room;
// The global spawn index counter starts at 10. Each Pokémon that spawns increments the counter and
// gets assigned the current counter value as its spawn index.

View File

@@ -121,7 +121,9 @@ struct Dungeon
/* 0x37F8 */ bool8 plusIsActive[2]; // Index 0: Enemy , Index 1: Team
/* 0x37FA */ bool8 minusIsActive[2]; // Index 0: Enemy , Index 1: Team
/* 0x37FC */ bool8 decoyActive;
u8 fill37FD[0x3A0D - 0x37FD];
u8 fill37FD[0x3A08 - 0x37FD];
/* 0x3A08 */ u8 unk3A08;
u8 fill3A09[0x3A0D - 0x3A09];
/* 0x3A0D */ u8 unk3A0D;
/* 0x3A0E */ s16 tileset;
/* 0x3A10 */ u16 unk3A10;
@@ -135,7 +137,9 @@ struct Dungeon
/* 0xE264 */ u8 weather; // Uses the weather constants in weather.h.
u8 unkE265; // Uses the weather constants in weather.h
/* 0xE266 */ u8 weatherDamageCounter; // Timer for applying sandstorm/hail damage periodically.
u8 unkE267[0xE26B - 0xE267];
/* 0xE267 */ u8 unkE267[0xE269 - 0xE267];
u8 unkE269;
u8 fillE26A;
u8 unkE26B;
u8 weatherTurns;
u8 fillE26D[0xE26F - 0xE26D];

View File

@@ -125,7 +125,7 @@ bool8 IsNotMoneyOrUsedTMItem(u8 id);
s32 FindItemInInventory(u8 id);
bool8 IsHMItem(u8 id);
bool8 IsEdibleItem(u8 id);
u8 xxx_bit_lut_lookup_8091E50(u8 i0, u8 i1);
void RestoreHeldItem(struct unkStruct_8094924*, struct BulkItem*);
void SaveHeldItem(struct unkStruct_8094924*, struct BulkItem*);

View File

@@ -17,7 +17,7 @@ s32 GetMoveBasePower(struct Move *move);
s32 GetMoveAccuracyOrAIChance(struct Move *move, u32 accuracyType);
u32 GetMoveBasePP(struct Move *move);
u32 GetMoveMaxUpgradeLevel(struct Move *move);
u8 GetMoveCritChance(struct Move *move);
u32 GetMoveCritChance(struct Move *move);
bool8 MoveCannotHitFrozen(struct Move *move);
bool8 MovesIgnoresTaunted(struct Move *move);
u32 GetMoveRangeID(struct Move *move);

View File

@@ -48,7 +48,7 @@ bool8 FillInOrbAction(struct Entity *pokemon,struct Entity *target);
bool8 sub_805C3DC(struct Entity *pokemon, struct Entity *target);
bool8 sub_805C3F8(struct Entity *pokemon, struct Entity *target);
bool8 sub_805C45C(struct Entity *pokemon, struct Entity *target);
bool8 sub_805C468(struct Entity *pokemon, struct Entity *target);
bool8 MobileOrbAction(struct Entity *pokemon, struct Entity *target);
bool8 StairsOrbAction(struct Entity *pokemon, struct Entity *target);
bool8 LongtossOrbAction(struct Entity *pokemon, struct Entity *target);
bool8 PierceOrbAction(struct Entity *pokemon, struct Entity *target);

View File

@@ -12,23 +12,6 @@ struct unkStruct_203B2F4
};
extern struct unkStruct_203B2F4 *gUnknown_203B2F4;
struct unkStruct_802C39C
{
/* 0x0 */ u32 unk0[2];
/* 0x8 */ struct DungeonLocation *unk8;
/* 0xC */ u8 *playerName;
/* 0x10 */ s16 unk10;
/* 0x12 */ s16 unk12;
/* 0x14 */ u8 unk14;
/* 0x15 */ u8 fill15[0x1B];
/* 0x34 */ u8 fill34[2];
/* 0x36 */ u8 fill36[0x3C - 0x36];
/* 0x3C */ u8 unk3C[0xC];
/* 0x48 */ u8 fill48[4];
/* 0x4C */ u32 unk4C;
/* 0x50 */ u8 *unk50[3];
};
struct unkStruct_803B344
{
// size: 0xB4

View File

@@ -10,13 +10,13 @@ SECTIONS {
ALIGN(4)
{
ewram_start = .;
INCLUDE "sym_ewram.txt"
INCLUDE "sym_ewram.ld"
src/agb_flash.o(.bss);
*libgcc.a:fp-bit.o(.bss);
*libgcc.a:dp-bit.o(.bss);
*libc.a:syscalls.o(.bss);
. = ALIGN(16);
INCLUDE "sym_ewram2.txt"
INCLUDE "sym_ewram2.ld"
*libc.a:impure.o(.data);
*libc.a:locale.o(.data);
*libc.a:mallocr.o(.data);
@@ -30,7 +30,7 @@ SECTIONS {
ALIGN(4)
{
iwram_start = .;
INCLUDE "sym_iwram.txt"
INCLUDE "sym_iwram.ld"
. = 0x8000;
}
@@ -151,7 +151,6 @@ SECTIONS {
src/makuhita_dojo_1.o(.text);
src/wonder_mail_4.o(.text);
src/wonder_mail_5.o(.text);
asm/wonder_mail_5.o(.text);
src/wonder_mail_6.o(.text);
src/post_office_guide.o(.text);
asm/code_8031D70.o(.text);
@@ -223,6 +222,7 @@ SECTIONS {
asm/code_805744C.o(.text);
src/code_8057824.o(.text);
asm/code_8057824.o(.text);
src/code_805A120.o(.text);
src/status_actions.o(.text);
src/move_checks.o(.text);
asm/code_805D8C8.o(.text);
@@ -318,6 +318,7 @@ SECTIONS {
src/code_8095824.o(.text);
src/code_80958E8.o(.text);
asm/code_80958E8.o(.text);
src/code_80958E8_mid.o(.text);
src/mailbox_8095F8C.o(.text);
asm/code_80958E8_1.o(.text);
src/code_80958E8_1.o(.text);
@@ -440,7 +441,9 @@ SECTIONS {
src/pelipper_board.o(.rodata);
src/wonder_mail_3_mid.o(.rodata);
src/makuhita_dojo.o(.rodata);
data/data_80DED44.o(.rodata);
src/makuhita_dojo_1.o(.rodata);
src/wonder_mail_4.o(.rodata);
src/wonder_mail_5.o(.rodata);
src/wonder_mail_6.o(.rodata);
src/post_office_guide.o(.rodata);
data/data_80E1F30.o(.rodata);

View File

@@ -37,7 +37,7 @@ extern u8 sub_8042768(struct Entity *pokemon);
extern void sub_806CDD4(struct Entity *pokemon, u8, u32);
extern u32 sub_806F62C(u32);
extern void PlaySoundEffect(u32);
extern u8 sub_803F428(struct Entity *pokemon);
extern u8 sub_803F428(struct Position *pos);
extern void sub_8041550(struct Entity *pokemon, u32, u32, u32, u32, u32);
@@ -836,9 +836,9 @@ void sub_80421C0(struct Entity *pokemon, u16 r1)
PlaySoundEffect(r1);
}
void sub_80421EC(struct Entity *pokemon, u16 r1)
void sub_80421EC(struct Position *pos, u16 r1)
{
if(sub_803F428(pokemon) != 0)
if(sub_803F428(pos) != 0)
PlaySoundEffect(r1);
}

View File

@@ -183,17 +183,17 @@ void sub_8057588(struct Entity * pokemon, u8 param_2)
}
}
s16 sub_8057600(struct Move *move, s32 param_2)
s16 sub_8057600(struct Move *move, s32 itemID)
{
return sub_8094828(move->id, sub_8057620(param_2));
return sub_8094828(move->id, sub_8057620(itemID));
}
u8 sub_8057620(u32 param_1)
u8 sub_8057620(u32 itemID)
{
if(param_1 == 0)
return 0;
if(itemID == ITEM_NOTHING)
return ITEM_NOTHING;
else
return param_1;
return itemID;
}
bool8 sub_8057634(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4)
@@ -772,7 +772,7 @@ bool8 GrudgeMoveAction(struct Entity *pokemon, struct Entity * target)
bool8 sub_805815C(struct Entity *pokemon, struct Entity *target)
{
sub_80797A0(pokemon, target, STATUS_COUNTER);
CounterStatusTarget(pokemon, target, STATUS_COUNTER);
return TRUE;
}

1478
src/code_805A120.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -294,7 +294,7 @@ print:
}
}
void sub_8078F50(struct Entity * pokemon, struct Entity * target)
void MobileStatusTarget(struct Entity * pokemon, struct Entity * target)
{
struct EntityInfo *entityInfo_1;
struct EntityInfo *entityInfo;
@@ -505,7 +505,7 @@ void RestorePPTarget(struct Entity * pokemon,struct Entity * target, s32 param_3
}
}
void sub_80793B0(struct Entity * pokemon, struct Entity *target, s32 param_3)
void RaiseAtkStatTarget(struct Entity * pokemon, struct Entity *target, s32 increment)
{
u32 oldStat;
u32 oldStat1;
@@ -522,7 +522,7 @@ void sub_80793B0(struct Entity * pokemon, struct Entity *target, s32 param_3)
oldStat = entityInfo->atk;
oldStat1 = oldStat;
newStat = entityInfo->atk + param_3;
newStat = entityInfo->atk + increment;
if (0xfe < newStat) {
newStat = 0xff;
}
@@ -538,7 +538,7 @@ void sub_80793B0(struct Entity * pokemon, struct Entity *target, s32 param_3)
}
}
void sub_8079420(struct Entity * pokemon, struct Entity *target, s32 param_3)
void RaiseSpAtkStatTarget(struct Entity * pokemon, struct Entity *target, s32 increment)
{
u32 oldStat;
u32 oldStat1;
@@ -555,7 +555,7 @@ void sub_8079420(struct Entity * pokemon, struct Entity *target, s32 param_3)
oldStat = entityInfo->spAtk;
oldStat1 = oldStat;
newStat = entityInfo->spAtk + param_3;
newStat = entityInfo->spAtk + increment;
if (0xfe < newStat) {
newStat = 0xff;
}
@@ -571,7 +571,7 @@ void sub_8079420(struct Entity * pokemon, struct Entity *target, s32 param_3)
}
}
void sub_8079490(struct Entity * pokemon, struct Entity *target, s32 param_3)
void RaiseDefStatTarget(struct Entity * pokemon, struct Entity *target, s32 increment)
{
u32 oldStat;
u32 oldStat1;
@@ -588,7 +588,7 @@ void sub_8079490(struct Entity * pokemon, struct Entity *target, s32 param_3)
oldStat = entityInfo->def;
oldStat1 = oldStat;
newStat = entityInfo->def + param_3;
newStat = entityInfo->def + increment;
if (0xfe < newStat) {
newStat = 0xff;
}
@@ -604,7 +604,7 @@ void sub_8079490(struct Entity * pokemon, struct Entity *target, s32 param_3)
}
}
void sub_8079500(struct Entity * pokemon, struct Entity *target, s32 param_3)
void RaiseSpDefStatTarget(struct Entity * pokemon, struct Entity *target, s32 increment)
{
u32 oldStat;
u32 oldStat1;
@@ -621,7 +621,7 @@ void sub_8079500(struct Entity * pokemon, struct Entity *target, s32 param_3)
oldStat = entityInfo->spDef;
oldStat1 = oldStat;
newStat = entityInfo->spDef + param_3;
newStat = entityInfo->spDef + increment;
if (0xfe < newStat) {
newStat = 0xff;
}
@@ -752,7 +752,7 @@ void sub_8079764(struct Entity * pokemon)
}
}
void sub_80797A0(struct Entity * pokemon, struct Entity * target, u8 newStatus)
void CounterStatusTarget(struct Entity * pokemon, struct Entity * target, u8 newStatus)
{
struct EntityInfo *entityInfo;

View File

@@ -4,7 +4,7 @@
#include "item.h"
s16 sub_8094828(u16 r0, u8 id)
s16 sub_8094828(u16 moveID, u8 id)
{
if(id != 0)
{
@@ -15,7 +15,7 @@ s16 sub_8094828(u16 r0, u8 id)
}
else
{
return r0;
return moveID;
}
}

View File

@@ -102,7 +102,7 @@ bool8 sub_80952F0(u8 mailType, u32 param_2)
for(index = 0, ptr = &gUnknown_203B480[0]; index < 0x20; ptr++, index++)
{
if ((ptr->mailType == mailType) && (ptr->unk10 == param_2)) return TRUE;
if ((ptr->mailType == mailType) && (ptr->unk10.unk10 == param_2)) return TRUE;
}
return FALSE;
}
@@ -153,7 +153,7 @@ s32 sub_809539C(u8 mailType, u32 param_2)
for(index = 0, ptr = &gUnknown_203B480[0]; index < 0x20; ptr++, index++)
{
if ((ptr->mailType == mailType) && (ptr->unk10 == param_2)) return index;
if ((ptr->mailType == mailType) && (ptr->unk10.unk10 == param_2)) return index;
}
return -1;
}
@@ -175,7 +175,7 @@ s32 sub_8095400(u32 param_1)
u32 *ptr;
s32 index;
for(index = 0, ptr = &gUnknown_203B480[0].unk10; index < 0x20; ptr += 0xC, index++)
for(index = 0, ptr = &gUnknown_203B480[0].unk10.unk10; index < 0x20; ptr += 0xC, index++)
{
if (*ptr == param_1) return index;
}
@@ -200,7 +200,7 @@ void sub_809542C(struct unkStruct_809542C *param_1)
preload->dungeon = param_1->unk0;
preload->unk8 = uVar4;
sub_8094D28(Rand32Bit());
gUnknown_203B480->unk10 = sub_8094E4C();
gUnknown_203B480->unk10.unk10 = sub_8094E4C();
gUnknown_203B480->clientSpecies = GetPlayerPokemonStruct()->speciesNum;
PrintPokeNameToBuffer(buffer, GetPlayerPokemonStruct());
CopyStringtoBuffer(gUnknown_203B480->playerName, buffer);
@@ -324,7 +324,7 @@ void sub_8095774(struct unkStruct_8094924 * a, struct unkStruct_203B480 *b)
RestoreDungeonLocation(a, &b->dungeon);
RestoreIntegerBits(a, &b->unk8, 0x18);
RestoreIntegerBits(a, &b->clientSpecies, 0x9);
RestoreIntegerBits(a, &b->unk10, 0x20);
RestoreIntegerBits(a, &b->unk10.unk10, 0x20);
RestoreIntegerBits(a, &b->playerName, 0x50);
RestoreIntegerBits(a, &b->unk20.flags, 0x8);
RestoreIntegerBits(a, &b->unk20.quantity, 0x8);
@@ -349,7 +349,7 @@ void sub_8095824(struct unkStruct_8094924 * a, struct unkStruct_203B480 *b)
SaveDungeonLocation(a, &b->dungeon);
SaveIntegerBits(a, &b->unk8, 0x18);
SaveIntegerBits(a, &b->clientSpecies, 0x9);
SaveIntegerBits(a, &b->unk10, 0x20);
SaveIntegerBits(a, &b->unk10.unk10, 0x20);
SaveIntegerBits(a, &b->playerName, 0x50);
SaveIntegerBits(a, &b->unk20.flags, 0x8);
SaveIntegerBits(a, &b->unk20.quantity, 0x8);

View File

@@ -26,7 +26,7 @@ extern void sub_80965F4();
extern void SortPelipperJobs();
extern struct WonderMail *GetPelipperBoardSlotInfo(u8);
u8 sub_8097318(s16 param_1);
extern u8 sub_8095B28(struct WonderMail *);
extern bool8 GenerateMailJobInfo(struct WonderMail *);
void SortPelipperJobs(void)
{
@@ -118,7 +118,7 @@ void GeneratePelipperJobs(void)
index++;
}
for (; index <= range; index++) {
if (sub_8095B28(&gUnknown_203B490->pelipperBoardJobs[index]) == 0) break;
if (!GenerateMailJobInfo(&gUnknown_203B490->pelipperBoardJobs[index])) break;
gUnknown_203B490->pelipperBoardJobs[index].rewardType = RandRange(MONEY, BLANK_4);
}
sub_80965F4();

178
src/code_80958E8_mid.c Normal file
View File

@@ -0,0 +1,178 @@
#include "global.h"
#include "constants/dungeon.h"
#include "constants/friend_area.h"
#include "constants/wonder_mail.h"
#include "item.h"
#include "random.h"
#include "friend_area.h"
#include "code_80958E8.h"
extern u8 *gFriendAreas;
bool8 sub_8095E38(struct WonderMail *mail, u8 dungeon, u32 floor, u8 param_4);
extern s32 sub_80A29B0(u8 *param_1);
extern s32 GetDungeonFloorCount(u8);
extern bool8 sub_809017C(struct DungeonLocation *);
bool8 GenerateMailJobDungeonInfo(struct WonderMail *mail)
{
s32 counter;
s32 floor;
s32 index;
u8 dungeon;
bool8 flag;
u8 dungeonStack [64];
s32 counter_1;
s32 cap;
s32 floor_1;
s32 halfFloorCount;
s32 floorCount;
struct DungeonLocation dungeonLoc;
cap = sub_80A29B0(dungeonStack);
if (cap == 0) {
dungeonStack[0] = DUNGEON_TINY_WOODS;
dungeonStack[1] = DUNGEON_THUNDERWAVE_CAVE;
cap = 2;
}
counter = RandInt(cap);
counter_1 = counter;
do {
dungeon = dungeonStack[counter];
floorCount = GetDungeonFloorCount(dungeon);
halfFloorCount = floorCount / 2;
floor = RandRange(halfFloorCount, floorCount);
floor_1 = floor;
do {
flag = TRUE;
dungeonLoc.id = dungeon;
dungeonLoc.floor = floor;
if(sub_809017C(&dungeonLoc))
flag = FALSE;
for(index = 0; index < 4; index++)
{
if (sub_8095E38(&gUnknown_203B490->mailboxSlots[index],dungeon,floor,1)) {
flag = FALSE;
}
}
for(index = 0; index < 8; index++)
{
if (sub_8095E38(&gUnknown_203B490->pelipperBoardJobs[index],dungeon,floor,1)) {
flag = FALSE;
}
}
for(index = 0; index < 8; index++)
{
if (sub_8095E38(&gUnknown_203B490->jobSlots[index],dungeon,floor,1)) {
flag = FALSE;
}
}
if (flag) {
mail->dungeon.id = dungeon;
mail->dungeon.floor = floor;
return TRUE;
}
floor++;
if (floor >= floorCount) {
floor = halfFloorCount;
}
} while (floor != floor_1);
counter++;
if (counter == cap) {
counter = 0;
}
if (counter == counter_1) {
return FALSE;
}
} while( TRUE );
}
bool8 sub_8095E38(struct WonderMail *mail, u8 dungeon, u32 floor, u8 param_4)
{
if (mail->mailType != 0) {
if ((mail->missionType == WONDER_MAIL_MISSION_TYPE_ESCORT_CLIENT) && (param_4 == 1)) {
if (mail->dungeon.id == dungeon) {
return TRUE;
}
}
else if ((mail->dungeon.id == dungeon) && (mail->dungeon.floor == floor)) {
return TRUE;
}
}
return FALSE;
}
u8 sub_8095E78(void)
{
bool8 flag;
s32 index;
s32 friendAreaIndex;
s32 counter;
u8 friendAreaStack[NUM_FRIEND_AREAS];
counter = 0;
for(friendAreaIndex = BOUNTIFUL_SEA; friendAreaIndex < NUM_FRIEND_AREAS; friendAreaIndex++)
{
if ((!gFriendAreas[friendAreaIndex]) &&
(GetFriendAreaUnlockCondition(friendAreaIndex) == UNLOCK_WONDER_MAIL)) {
flag = FALSE;
for(index = 0; index < 4; index++)
{
if((gUnknown_203B490->mailboxSlots[index].mailType != 0) && (gUnknown_203B490->mailboxSlots[index].rewardType == FRIEND_AREA))
flag = TRUE;
}
for(index = 0; index < 8; index++)
{
if((gUnknown_203B490->jobSlots[index].mailType != 0) && (gUnknown_203B490->jobSlots[index].rewardType == FRIEND_AREA))
flag = TRUE;
}
if (!flag) {
friendAreaStack[counter] = friendAreaIndex;
counter++;
}
}
}
if (counter != 0) {
return friendAreaStack[RandInt(counter)];
}
else {
return NONE;
}
}
u8 sub_8095F28(u8 param_1)
{
s32 itemID;
s32 counter;
u8 itemStack [NUMBER_OF_ITEM_IDS];
counter = 0;
for(itemID = ITEM_STICK; itemID < NUMBER_OF_ITEM_IDS; itemID++)
{
if ((param_1 == 0x63) ||
(xxx_bit_lut_lookup_8091E50(param_1, itemID) != 0)) {
if ((!IsThrowableItem(itemID)) && (IsNotMoneyOrUsedTMItem(itemID))) {
itemStack[counter] = itemID;
counter++;
}
}
}
if (counter == 0) {
return ITEM_NOTHING;
}
else {
return itemStack[RandInt(counter)];
}
}

View File

@@ -9,10 +9,6 @@
#include "friend_area_action_menu.h"
extern struct unkStruct_203B2BC *gUnknown_203B2BC;
extern struct UnkTextStruct2 gUnknown_80DD74C;
extern struct UnkTextStruct2 gUnknown_80DD704;
extern struct UnkTextStruct2 gUnknown_80DD6EC;
extern struct UnkTextStruct2 gUnknown_80DD71C;
extern void sub_80141B4(const char *r0, u32, u32 *r1, u32);
extern void sub_8014248(const char *r0, u32, u32, struct MenuItem *r4, u32, u32, u32, u32 *r5, u32);
@@ -54,6 +50,58 @@ extern void sub_8027D00();
extern void CreateFriendActionMenu();
extern void sub_80276A8();
const struct UnkTextStruct2 gUnknown_80DD6EC =
{
0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
NULL
};
const struct UnkTextStruct2 gUnknown_80DD704 =
{
0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00,
0x13, 0x00, 0x04, 0x00,
0x09, 0x03,
0x03, 0x00,
NULL
};
const struct UnkTextStruct2 gUnknown_80DD71C =
{
0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00,
0x14, 0x00, 0x04, 0x00,
0x06, 0x03,
0x03, 0x00,
NULL
};
const struct UnkTextStruct2 gUnknown_80DD734 =
{
0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00,
0x16, 0x00, 0x04, 0x00,
0x06, 0x03,
0x03, 0x00,
NULL
};
const struct UnkTextStruct2 gUnknown_80DD74C =
{
0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00,
0x02, 0x00, 0x11, 0x00,
0x1A, 0x02,
0x02, 0x00,
NULL
};
ALIGNED(4) const u8 gFriendAreaActionSayFarewellPrompt[] = _(
"You have chosen to say farewell\n"
"to this Pokémon.{EXTRA_MSG}"

View File

@@ -712,7 +712,7 @@ void sub_8033DBC(void)
SetFriendRescueMenuState(8);
break;
case PASSWORD_ENTRY_SOS_MAIL_SUCCESS:
sub_8095274(mail.unk10);
sub_8095274(mail.unk10.unk10);
mail.mailType = 2;
sub_80951BC(&mail);
sub_80141B4(gUnknown_80E4928, 0, 0, 0x101);
@@ -729,7 +729,7 @@ void sub_8033DBC(void)
case PASSWORD_ENTRY_AOK_MAIL_SUCCESS:
mail.mailType = 5;
sub_80951FC(&mail);
mail2 = sub_8095228(sub_809539C(1, mail.unk10));
mail2 = sub_8095228(sub_809539C(1, mail.unk10.unk10));
mail2->mailType = 7;
MemoryFill8((u8 *)gUnknown_203B484, 0, sizeof(struct unkStruct_203B484));
SetFriendRescueMenuState(0x40);
@@ -1597,10 +1597,10 @@ void sub_8034D74(void)
SetFriendRescueMenuState(0x6B);
break;
case PASSWORD_ENTRY_THANK_YOU_MAIL_SUCCESS:
mail2 = sub_8095228(sub_809539C(4, mail.unk10));
mail2 = sub_8095228(sub_809539C(4, mail.unk10.unk10));
*mail2 = mail;
mail2->mailType = 6;
gUnknown_203B33C->unk420 = mail.unk10;
gUnknown_203B33C->unk420 = mail.unk10.unk10;
SetFriendRescueMenuState(0x6D);
break;
case 7:

View File

@@ -1237,7 +1237,7 @@ const char *sub_8091E50(u8 index)
return gUnknown_810AF50[index];
}
u32 xxx_bit_lut_lookup_8091E50(u8 i0, u8 i1)
u8 xxx_bit_lut_lookup_8091E50(u8 i0, u8 i1)
{
if (i0 > 0x3e)
return 0;

View File

@@ -84,14 +84,6 @@ extern u8 gUnknown_80DB830[];
extern u8 *gUnknown_80D4920[];
extern u8 *gUnknown_80D4928[];
struct BulkItem_Alt {
union tempHeld
{
struct BulkItem norm;
u32 full_bits;
} temp;
};
void sub_80177F8(void)
{
struct unkStruct_203B208 *preload;
@@ -180,24 +172,16 @@ void sub_80178D0(void)
void sub_8017928(void)
{
int menuAction;
u32 itemindex;
u32 quantity;
struct BulkItem_Alt item;
struct BulkItem item;
if (sub_80144A4(&menuAction) == 0) {
switch(menuAction)
{
case 4:
gTeamInventory_203B460->teamStorage[gUnknown_203B208->unkC.id] -= gUnknown_203B208->unkC.quantity;
itemindex = gUnknown_203B208->unkC.id;
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | itemindex;
quantity = gUnknown_203B208->unkC.quantity << 8;
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | quantity;
AddHeldItemToInventory((struct BulkItem *)&item);
item.id = gUnknown_203B208->unkC.id;
item.quantity = gUnknown_203B208->unkC.quantity;
AddHeldItemToInventory(&item);
UpdateKangaskhanStorageState(0x1d);
break;
case 1:
@@ -240,12 +224,9 @@ void sub_80179A8(void)
void sub_8017A1C(void)
{
u8 itemID_u8;
u32 quantity_cast;
s32 itemID;
int menuAction;
u16 cast;
struct BulkItem_Alt item;
struct BulkItem item;
if (sub_80144A4(&menuAction) == 0) {
@@ -254,24 +235,24 @@ void sub_8017A1C(void)
case 4:
for(itemID = 0; itemID < NUMBER_OF_ITEM_IDS; itemID++)
{
itemID_u8 = itemID;
if (sub_801CFE0(itemID) != 0) {
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | itemID_u8;
if (IsThrowableItem(item.temp.norm.id)) {
quantity_cast = gTeamInventory_203B460->teamStorage[item.temp.norm.id];
if (quantity_cast > 99) {
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | 0x6300;
if(sub_801CFE0(itemID) != 0)
{
item.id = itemID;
if(IsThrowableItem(item.id))
if(gTeamInventory_203B460->teamStorage[item.id] > 0x63)
{
item.quantity = 0x63;
}
else {
cast = quantity_cast << 8;
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | cast;
else
{
item.quantity = gTeamInventory_203B460->teamStorage[item.id];
}
else
{
item.quantity = 1;
}
else {
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | 0x100;
}
gTeamInventory_203B460->teamStorage[item.temp.norm.id] -= item.temp.norm.quantity;
AddHeldItemToInventory((struct BulkItem *)&item);
gTeamInventory_203B460->teamStorage[item.id] -= item.quantity;
AddHeldItemToInventory(&item);
}
}
FillInventoryGaps();

View File

@@ -11,14 +11,6 @@ extern void sub_8017F10(u32);
extern u8 sub_801CF14(u32);
struct BulkItem_Alt {
union tempHeld
{
struct BulkItem norm;
u32 full_bits;
} temp;
};
extern u8 sub_8012FD8(u32 *r0);
extern void sub_8013114(u32 *, s32 *);
extern void sub_801CBB8(void);
@@ -128,10 +120,8 @@ void sub_8018620(void)
void sub_80186F8(void)
{
struct BulkItem_Alt item;
u16 cast;
struct BulkItem item;
s32 itemID;
u8 itemID_u8;
switch(sub_801CA08(1))
{
@@ -140,26 +130,24 @@ void sub_80186F8(void)
{
for(itemID = 0; itemID < NUMBER_OF_ITEM_IDS; itemID++)
{
itemID_u8 = itemID; // dumb cast needed to match
if(sub_801CFE0(itemID) != 0)
{
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | itemID_u8;
if(IsThrowableItem(item.temp.norm.id))
if(gTeamInventory_203B460->teamStorage[item.temp.norm.id] > 0x63)
item.id = itemID;
if(IsThrowableItem(item.id))
if(gTeamInventory_203B460->teamStorage[item.id] > 0x63)
{
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | (0xC6 << 7);
item.quantity = 0x63;
}
else
{
cast = gTeamInventory_203B460->teamStorage[item.temp.norm.id] << 8;
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | cast;
item.quantity = gTeamInventory_203B460->teamStorage[item.id];
}
else
{
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | (0x80 << 1);
item.quantity = 1;
}
gTeamInventory_203B460->teamStorage[item.temp.norm.id] -= item.temp.norm.quantity;
AddHeldItemToInventory((struct BulkItem *)&item);
gTeamInventory_203B460->teamStorage[item.id] -= item.quantity;
AddHeldItemToInventory(&item);
}
}
FillInventoryGaps();
@@ -198,9 +186,7 @@ void sub_80186F8(void)
void sub_8018854(void)
{
struct BulkItem_Alt item;
u32 itemsCast;
u32 indexCast;
struct BulkItem item;
sub_801CA08(0);
sub_8012FD8(&gUnknown_203B20C->unk70);
@@ -209,16 +195,10 @@ void sub_8018854(void)
{
case 3:
gUnknown_203B20C->unk8.quantity = gUnknown_203B20C->unkC0;
gTeamInventory_203B460->teamStorage[gUnknown_203B20C->unk8.id] -= gUnknown_203B20C->unk8.quantity;
indexCast = gUnknown_203B20C->unk8.id;
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | indexCast;
itemsCast = (gUnknown_203B20C->unk8.quantity << 8);
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | itemsCast;
AddHeldItemToInventory((struct BulkItem *)&item);
item.id = gUnknown_203B20C->unk8.id;
item.quantity = gUnknown_203B20C->unk8.quantity;
AddHeldItemToInventory(&item);
if(sub_801CF14(1) == 0)
if(GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE)
{
@@ -289,10 +269,8 @@ void sub_8018904(void)
void sub_80189C8(void)
{
struct BulkItem_Alt item;
struct BulkItem item;
s32 menuAction;
u32 itemsCast;
u32 indexCast;
menuAction = 0;
@@ -312,14 +290,9 @@ void sub_80189C8(void)
else
{
gTeamInventory_203B460->teamStorage[gUnknown_203B20C->unk8.id] -= gUnknown_203B20C->unk8.quantity;
indexCast = gUnknown_203B20C->unk8.id;
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | indexCast;
itemsCast = (gUnknown_203B20C->unk8.quantity << 8);
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | itemsCast;
AddHeldItemToInventory((struct BulkItem *)&item);
item.id = gUnknown_203B20C->unk8.id;
item.quantity = gUnknown_203B20C->unk8.quantity;
AddHeldItemToInventory(&item);
if(sub_801CF14(1) == 0)
if(GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE)
{

View File

@@ -83,14 +83,6 @@ struct unkStruct_203B214
extern struct unkStruct_203B214 *gUnknown_203B214;
extern struct unkStruct_203B214 *gUnknown_203B21C;
struct Item_Alt
{
union temp {
struct Item norm;
u32 full_bits;
} temp;
};
extern void sub_8013818(void *, u32, u32, u32);
extern u8 sub_8019FB0(void);
@@ -523,10 +515,8 @@ u32 sub_8019E40(u32 r0)
u32 sub_8019EDC(u8 r0)
{
struct Item_Alt slot;
struct Item slot;
struct BulkItem *item;
u32 itemIndex;
u32 numItems;
if(r0 == 0)
{
@@ -542,14 +532,9 @@ u32 sub_8019EDC(u8 r0)
return 2;
case 1:
item = GetKecleonShopItem(sub_8019FB0());
// NOTE: needs seperate vars to match
itemIndex = item->id << 16;
slot.temp.full_bits = (slot.temp.full_bits & 0xff00ffff) | itemIndex;
numItems = item->quantity << 8;
slot.temp.full_bits = (slot.temp.full_bits & 0xffff00ff) | numItems;
if(GetStackBuyPrice((struct Item *)&slot) > gTeamInventory_203B460->teamMoney)
slot.id = item->id;
slot.quantity = item->quantity;
if(GetStackBuyPrice(&slot) > gTeamInventory_203B460->teamMoney)
{
PlayMenuSoundEffect(2);
}
@@ -675,7 +660,7 @@ void sub_801A0D8(void)
u8 auStack204 [80];
struct unkStruct_8090F58 local_7c;
u8 auStack112 [80];
struct Item_Alt item;
struct Item item;
u8 temp_calc;
// Needed for the shifts..
@@ -691,21 +676,15 @@ void sub_801A0D8(void)
{
temp_calc = (gUnknown_203B214->unk1E * gUnknown_203B214->unk1C) + index;
heldItem = GetKecleonShopItem(temp_calc);
index_shift = heldItem->id << 16;
item.temp.full_bits = (item.temp.full_bits & 0xff00ffff) | index_shift;
quantity_shift = heldItem->quantity << 8;
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | quantity_shift;
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | (ITEM_FLAG_EXISTS | ITEM_FLAG_IN_SHOP);
item.id = heldItem->id;
item.quantity = heldItem->quantity;
item.flags = (ITEM_FLAG_EXISTS | ITEM_FLAG_IN_SHOP);
local_7c.unk0 = 1;
local_7c.unk4 = 0;
local_7c.unk6 = 0x58;
local_7c.unk8 = 1;
sub_8090E14(auStack204,(struct Item *)&item,&local_7c);
buyPrice = GetStackBuyPrice((struct Item *)&item);
sub_8090E14(auStack204,&item,&local_7c);
buyPrice = GetStackBuyPrice(&item);
if (buyPrice <= gTeamInventory_203B460->teamMoney) {
y = sub_8013800(gUnknown_203B214,index);
xxx_call_draw_string(8,y,auStack204,gUnknown_203B214->unk34,0);
@@ -746,10 +725,8 @@ u32 sub_801A20C(u32 r0)
u32 sub_801A2A8(u8 r0)
{
struct Item_Alt slot;
struct Item slot;
struct BulkItem *item;
u32 itemIndex;
u32 numItems;
if(r0 == 0)
{
@@ -767,12 +744,10 @@ u32 sub_801A2A8(u8 r0)
item = GetKecleonWareItem(sub_801A37C());
// NOTE: needs seperate vars to match
itemIndex = item->id << 16;
slot.temp.full_bits = (slot.temp.full_bits & 0xff00ffff) | itemIndex;
numItems = item->quantity << 8;
slot.temp.full_bits = (slot.temp.full_bits & 0xffff00ff) | numItems;
slot.id = item->id;
slot.quantity = item->quantity;
if(GetStackBuyPrice((struct Item *)&slot) > gTeamInventory_203B460->teamMoney)
if(GetStackBuyPrice(&slot) > gTeamInventory_203B460->teamMoney)
{
PlayMenuSoundEffect(2);
}
@@ -897,7 +872,7 @@ void sub_801A4A4(void)
u8 buffer1 [80];
struct unkStruct_8090F58 local_7c;
u8 buffer2 [80];
struct Item_Alt item;
struct Item item;
u8 temp_calc;
// Needed for the shifts..
@@ -913,15 +888,9 @@ void sub_801A4A4(void)
{
temp_calc = (gUnknown_203B21C->unk1E * gUnknown_203B21C->unk1C) + index;
heldItem = GetKecleonWareItem(temp_calc);
index_shift = heldItem->id << 16;
item.temp.full_bits = (item.temp.full_bits & 0xff00ffff) | index_shift;
quantity_shift = heldItem->quantity << 8;
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | quantity_shift;
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | (ITEM_FLAG_EXISTS | ITEM_FLAG_IN_SHOP);
item.id = heldItem->id;
item.quantity = heldItem->quantity;
item.flags = (ITEM_FLAG_EXISTS | ITEM_FLAG_IN_SHOP);
local_7c.unk0 = 1;
local_7c.unk4 = 0;
local_7c.unk6 = 0x58;

View File

@@ -31,22 +31,40 @@ struct unkStruct_203B31C
extern struct unkStruct_203B31C *gUnknown_203B31C;
extern struct unkStruct_203B318 *gUnknown_203B318;
extern struct UnkTextStruct2 gUnknown_80E07EC;
extern struct UnkTextStruct2 gUnknown_80E0804;
static const u8 makuhita_dojo_fill[] = "pksdir0";
const struct UnkTextStruct2 gUnknown_80E07EC = {
0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
NULL
};
const struct UnkTextStruct2 gUnknown_80E0804 = {
0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00,
0x02, 0x00, 0x02, 0x00,
0x0E, 0x0E,
0x0E, 0x00,
NULL
};
const u8 gMakuhitaDojoHeader[] = "Courses";
ALIGNED(4) const u8 gUnknown_80E0824[] = _("{STAR_BULLET}");
ALIGNED(4) const u8 gMakuhitaCoursePlaceholder[] = _("{COLOR_2}%c%s{END_COLOR_TEXT_2}");
static const u8 makuhita_dojo_fill2[] = "pksdir0";
extern u8 gMakuhitaDojoGoTrain[];
extern u8 *gUnknown_80D4970[];
extern u8 *gUnknown_80D4934[];
extern u8 gUnknown_80E081C[];
extern u8 gUnknown_80E0824[];
extern u8 gUnknown_80E0828[];
extern u8 *gUnknown_80D4970[];
extern bool8 sub_8097504(s16);
extern s16 sub_80A26CC(s16 r0);
extern void sub_8008C54(u32);
extern void sub_80073B8(u32);
extern void sub_80073E0(u32);
extern void xxx_call_draw_string(s32 x, u32 y, u8 *, u32 , u32);
extern void xxx_call_draw_string(s32 x, u32 y, const u8 *, u32 , u32);
extern void sub_8012BC4(u32 x, u32 y, u32, u32, u32, u32);
extern u8 sub_80A2740(s32 r0);
extern s16 sub_80A2668(u32 r0);
@@ -301,7 +319,7 @@ void sub_80304C8(void)
void DrawDojoCourseList(void)
{
u8 dungeonIndex;
s32 sVar3;
s32 mazeIndex;
s32 y;
s32 iVar6;
u32 color;
@@ -310,7 +328,7 @@ void DrawDojoCourseList(void)
sub_8008C54(gUnknown_203B31C->unk64);
sub_80073B8(gUnknown_203B31C->unk64);
xxx_call_draw_string(10,0,gUnknown_80E081C,gUnknown_203B31C->unk64,0); // Courses
xxx_call_draw_string(10,0,gMakuhitaDojoHeader,gUnknown_203B31C->unk64,0); // Courses
sub_8012BC4(gUnknown_203B31C->unkCC[2] * 8 + 4,0,
gUnknown_203B31C->unk4E + 1,2,7,gUnknown_203B31C->unk64);
index = 0;
@@ -319,15 +337,15 @@ void DrawDojoCourseList(void)
iVar6 = gUnknown_203B31C->unk0[gUnknown_203B31C->unk4E * gUnknown_203B31C->unk4C + index];
dungeonIndex = sub_80A2740(iVar6);
sVar3 = sub_80A2668(iVar6);
mazeIndex = sub_80A2668(iVar6);
y = sub_8013800(&gUnknown_203B31C->unk30, index);
color = COLOR_WHITE_2; // COLOR_WHITE again?
if (IsMazeCompleted(sVar3)) {
if (IsMazeCompleted(mazeIndex)) {
xxx_call_draw_string(8,y,gUnknown_80E0824,gUnknown_203B31C->unk64,0); // Draw Star symbol
color = COLOR_GREEN;
}
sprintfStatic(buffer,gUnknown_80E0828,color,GetDungeonName1(dungeonIndex)); // "#c%c%s#r"
sprintfStatic(buffer,gMakuhitaCoursePlaceholder,color,GetDungeonName1(dungeonIndex)); // "#c%c%s#r"
xxx_call_draw_string(0x10,y,buffer,gUnknown_203B31C->unk64,0);
index++;
} while (index < gUnknown_203B31C->unk4A);

View File

@@ -265,7 +265,7 @@ u32 GetMoveMaxUpgradeLevel(struct Move *move)
return gMovesData[move->id].maxUpgradeLevel;
}
u8 GetMoveCritChance(struct Move *move)
u32 GetMoveCritChance(struct Move *move)
{
return gMovesData[move->id].critChance;
}

View File

@@ -220,7 +220,7 @@ s32 UpdateRescuePasswordMenu(void)
nextMenu = MENU_NO_SCREEN_CHANGE;
break;
case PASSWORD_ENTRY_SOS_MAIL_SUCCESS:
sub_8095274(local_44.unk10);
sub_8095274(local_44.unk10.unk10);
DisplayPasswordAcceptScreen();
gRescuePasswordMenu->state = 9;
nextMenu = MENU_NO_SCREEN_CHANGE;
@@ -245,7 +245,7 @@ s32 UpdateRescuePasswordMenu(void)
nextMenu = MENU_NO_SCREEN_CHANGE;
local_44.mailType = 5;
sub_80951FC(&local_44);
puVar5 = sub_8095228(sub_809539C(1, local_44.unk10));
puVar5 = sub_8095228(sub_809539C(1, local_44.unk10.unk10));
puVar5->mailType = WONDER_MAIL_TYPE_OKD;
MemoryFill8((u8 *)&gUnknown_203B484, 0, sizeof(struct unkStruct_203B484));
break;
@@ -265,7 +265,7 @@ s32 UpdateRescuePasswordMenu(void)
DisplayPasswordAcceptScreen();
gRescuePasswordMenu->state = 9;
nextMenu = MENU_NO_SCREEN_CHANGE;
puVar6 = sub_8095228(sub_809539C(4, local_44.unk10));
puVar6 = sub_8095228(sub_809539C(4, local_44.unk10.unk10));
*puVar6 = local_44;
puVar6->mailType = 6;
iVar9 = GetMainMenu();
@@ -462,7 +462,7 @@ u32 sub_8039068(u32 mailMode, u8 *passwordBuffer, struct unkStruct_203B480 *para
if (param_3->mailType != WONDER_MAIL_TYPE_SOS) {
return PASSWORD_ENTRY_NOT_SOS_MAIL;
}
else if ( (sub_80952F0(2, param_3->unk10)) || (sub_80952F0(WONDER_MAIL_TYPE_AOK, param_3->unk10)) || (sub_80952F0(WONDER_MAIL_TYPE_COMPLETED, param_3->unk10)) || (sub_8095298(param_3->unk10))) {
else if ( (sub_80952F0(2, param_3->unk10.unk10)) || (sub_80952F0(WONDER_MAIL_TYPE_AOK, param_3->unk10.unk10)) || (sub_80952F0(WONDER_MAIL_TYPE_COMPLETED, param_3->unk10.unk10)) || (sub_8095298(param_3->unk10.unk10))) {
return PASSWORD_ENTRY_DUPLICATE_SOS_MAIL;
}
else if (FindOpenMailSlot() == -1) {
@@ -476,7 +476,7 @@ u32 sub_8039068(u32 mailMode, u8 *passwordBuffer, struct unkStruct_203B480 *para
if (param_3->mailType != WONDER_MAIL_TYPE_AOK) {
return PASSWORD_ENTRY_NOT_AOK_MAIL;
}
else if (!sub_80952F0(1, param_3->unk10)) {
else if (!sub_80952F0(1, param_3->unk10.unk10)) {
return PASSWORD_ENTRY_DUPLICATE_AOK_MAIL;
}
else {
@@ -487,7 +487,7 @@ u32 sub_8039068(u32 mailMode, u8 *passwordBuffer, struct unkStruct_203B480 *para
if (param_3->mailType != WONDER_MAIL_TYPE_THANK_YOU) {
return PASSWORD_ENTRY_NOT_THANK_YOU_MAIL;
}
else if ((!sub_80952F0(4, param_3->unk10)) || (param_3->unk28 != sub_8011C34())) {
else if ((!sub_80952F0(4, param_3->unk10.unk10)) || (param_3->unk28 != sub_8011C34())) {
return PASSWORD_ENTRY_DUPLICATE_THANK_YOU_MAIL;
}
else {

View File

@@ -31,11 +31,11 @@
#include "weather.h"
extern void sub_807F43C(struct Entity *, struct Entity *);
extern void sub_8078F50(struct Entity *, struct Entity *);
extern void MobileStatusTarget(struct Entity *, struct Entity *);
extern void sub_807DC68(struct Entity *, struct Entity *);
extern void sub_8078A58(struct Entity *, struct Entity *, s16, u32);
extern u32 sub_803D73C(u32);
extern void sub_8045C28(struct Item *, u8 , u8 *);
extern void sub_8045C28(struct Item *, u8 , u8);
extern void sub_80464C8(struct Entity *, struct Position *, struct Item *);
extern void sub_8068FE0(struct Entity *, u32, struct Entity *r2);
extern void sub_80522F4(struct Entity *r1, struct Entity *r2, const char []);
@@ -149,16 +149,6 @@ extern s16 gUnknown_80F4E08;
extern u8 gDungeonCamouflageTypes[76];
extern u32 gUnknown_202F228;
struct Position_Alt
{
union PositionAlt
{
struct Position norm;
u32 full_bits;
} temp;
};
extern s16 gUnknown_80F4DC6;
extern u8 *gUnknown_80FEFF4[];
@@ -235,16 +225,16 @@ bool8 TransformMoveAction(struct Entity * pokemon, struct Entity * target, struc
bool8 sub_805B074(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4)
{
bool8 uVar5;
bool8 flag;
uVar5 = FALSE;
flag = FALSE;
if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) {
uVar5 = TRUE;
flag = TRUE;
if (sub_805727C(pokemon,target,gUnknown_80F4DC6) != 0) {
PoisonedStatusTarget(pokemon,target,FALSE);
}
}
return uVar5;
return flag;
}
bool8 sub_805B0BC(struct Entity * pokemon, struct Entity * target)
@@ -286,9 +276,9 @@ bool8 sub_805B164(struct Entity * pokemon, struct Entity * target, struct Move *
bool8 sub_805B17C(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4)
{
s32 uVar4;
bool8 uVar5;
bool8 flag;
uVar5 = FALSE;
flag = FALSE;
if (move->id == MOVE_FIRE_SPIN) {
SendThawedMessage(pokemon,target);
uVar4 = 0x13c;
@@ -300,12 +290,12 @@ bool8 sub_805B17C(struct Entity * pokemon, struct Entity * target, struct Move *
}
}
if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) {
uVar5 = TRUE;
flag = TRUE;
if (sub_805727C(pokemon,target,gUnknown_80F4E08) != 0) {
SqueezedStatusTarget(pokemon,target,uVar4,0);
}
}
return uVar5;
return flag;
}
bool8 PerishSongMoveAction(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4)
@@ -391,16 +381,16 @@ bool8 sub_805B314(struct Entity * pokemon,struct Entity * target,struct Move *mo
bool8 sub_805B324(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4)
{
bool8 uVar3;
bool8 flag;
uVar3 = FALSE;
flag = FALSE;
if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) {
uVar3 = TRUE;
flag = TRUE;
if (sub_805727C(pokemon,target,gUnknown_80F4DD8) != 0) {
LowerAttackStageTarget(pokemon,target,gUnknown_8106A50,1,1,0);
}
}
return uVar3;
return flag;
}
bool8 DestinyBondMoveAction(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4)
@@ -422,9 +412,9 @@ bool8 MirrorCoatMoveAction(struct Entity * pokemon,struct Entity * target,struct
bool8 sub_805B3B4(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4)
{
u32 uVar1 = gUnknown_8106A50;
RaiseAttackStageTarget(pokemon,target,uVar1,1);
RaiseDefenseStageTarget(pokemon,target,uVar1,1);
u32 stat = gUnknown_8106A50;
RaiseAttackStageTarget(pokemon,target,stat,1);
RaiseDefenseStageTarget(pokemon,target,stat,1);
return TRUE;
}
@@ -437,11 +427,11 @@ bool8 sub_805B3E0(struct Entity * pokemon,struct Entity * target,struct Move *mo
bool8 sub_805B3FC(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4, s32 param_5)
{
struct EntityInfo *entityInfo;
bool8 uVar4;
bool8 flag;
uVar4 = FALSE;
flag = FALSE;
if (sub_8055640(pokemon,target,move,0x100,param_5) != 0) {
uVar4 = TRUE;
flag = TRUE;
if (sub_805727C(pokemon,pokemon,gUnknown_80F4DCE) != 0) {
entityInfo = pokemon->info;
RaiseAttackStageTarget(pokemon,pokemon,param_4,1);
@@ -450,7 +440,7 @@ bool8 sub_805B3FC(struct Entity * pokemon,struct Entity * target,struct Move *mo
}
}
}
return uVar4;
return flag;
}
bool8 sub_805B454(struct Entity * pokemon, struct Entity * target)
@@ -553,18 +543,18 @@ bool8 sub_805B668(struct Entity * pokemon, struct Entity * target, struct Move *
{
bool8 hasLiquidOoze;
s32 iVar3;
s32 iVar4;
bool8 uVar5;
s32 newHP;
bool8 flag;
uVar5 = FALSE;
flag = FALSE;
hasLiquidOoze = HasAbility(target, ABILITY_LIQUID_OOZE);
if (IsSleeping(target)) {
iVar3 = sub_8055640(pokemon,target,move,0x100,param_4);
if (iVar3 != 0) {
uVar5 = TRUE;
iVar4 = iVar3 / 2;
if (iVar4 < 1) {
iVar4 = 1;
flag = TRUE;
newHP = iVar3 / 2;
if (newHP < 1) {
newHP = 1;
}
if (sub_8057308(pokemon,0) != 0) {
if (pokemon->info->unkFB == 0) {
@@ -572,10 +562,10 @@ bool8 sub_805B668(struct Entity * pokemon, struct Entity * target, struct Move *
}
if (sub_8057308(pokemon,0) != 0) {
if (hasLiquidOoze) {
sub_806F324(pokemon,iVar4,0xd,0x1fa);
sub_806F324(pokemon,newHP,0xd,0x1fa);
}
else {
HealTargetHP(pokemon,pokemon,iVar4,0,TRUE);
HealTargetHP(pokemon,pokemon,newHP,0,TRUE);
}
}
}
@@ -584,7 +574,7 @@ bool8 sub_805B668(struct Entity * pokemon, struct Entity * target, struct Move *
else {
sub_80522F4(pokemon,target,*gPtrSleepingTargetOnlyMessage);
}
return uVar5;
return flag;
}
bool8 sub_805B734(struct Entity * pokemon, struct Entity * target)
@@ -689,7 +679,7 @@ bool8 sub_805B910(struct Entity * pokemon, struct Entity * target, struct Move *
bool8 sub_805B968(struct Entity * pokemon, struct Entity * target, struct Move * move, s32 param_4)
{
s32 entityHP;
s32 iVar5;
s32 newHP;
bool8 flag;
flag = FALSE;
@@ -700,11 +690,11 @@ bool8 sub_805B968(struct Entity * pokemon, struct Entity * target, struct Move *
if (entityHP < 0) {
entityHP = entityHP + 3;
}
iVar5 = entityHP >> 2;
if (iVar5 < 1) {
iVar5 = 1;
newHP = entityHP >> 2;
if (newHP < 1) {
newHP = 1;
}
sub_806F370(pokemon,pokemon,iVar5,0,0,0,sub_8057600(move,param_4),0,1,0);
sub_806F370(pokemon,pokemon,newHP,0,0,0,sub_8057600(move,param_4),0,1,0);
}
}
return flag;
@@ -712,7 +702,7 @@ bool8 sub_805B968(struct Entity * pokemon, struct Entity * target, struct Move *
bool8 RockSmashMoveAction(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4)
{
bool8 uVar3;
bool8 flag;
struct Position pos;
#ifdef NONMATCHING
@@ -726,17 +716,17 @@ bool8 RockSmashMoveAction(struct Entity * pokemon, struct Entity * target, struc
temp = pokemon;
temp1 = target;
uVar3 = 0;
flag = 0;
if (sub_8069D18(&pos) != 0) {
sub_80522F4(temp,temp1,*gUnknown_80FD430); // Can't use that diagonally!
}
else if (uVar3 = (sub_804AD34(&pos)), uVar3 != 0) {
else if (flag = (sub_804AD34(&pos)), flag != 0) {
sub_80522F4(temp,temp1,*gUnknown_80FD3F0); // It dug the wall in front!
}
else {
sub_80522F4(temp,temp1,*gUnknown_80FD40C); // Can't use that here!
}
return uVar3;
return flag;
}
bool8 sub_805BA44(struct Entity * pokemon, struct Entity * target)
@@ -751,13 +741,13 @@ bool8 sub_805BA50(struct Entity * pokemon, struct Entity * target, struct Move *
struct EntityInfo *iVar3;
struct EntityInfo *iVar5;
struct EntityInfo *iVar6;
bool8 uVar6;
bool8 flag;
struct Item *pokeItem;
struct Item *targetItem;
uVar6 = FALSE;
flag = FALSE;
if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) {
uVar6 = TRUE;
flag = TRUE;
if (sub_805727C(pokemon,target, 0) != 0) {
iVar2 = pokemon->info;
iVar3 = pokemon->info;
@@ -798,12 +788,12 @@ bool8 sub_805BA50(struct Entity * pokemon, struct Entity * target, struct Move *
}
}
}
return uVar6;
return flag;
}
bool8 sub_805BB64(struct Entity * pokemon, struct Entity * target)
{
sub_80797A0(pokemon, target, STATUS_MINI_COUNTER);
CounterStatusTarget(pokemon, target, STATUS_MINI_COUNTER);
return TRUE;
}
@@ -880,7 +870,7 @@ bool8 sub_805BC70(struct Entity * pokemon, struct Entity * target)
bool8 sub_805BC98(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4)
{
struct EntityInfo *entityInfo;
bool8 uVar3;
bool8 flag;
s32 targetHP;
s32 pokeHP;
u8 local_28;
@@ -903,11 +893,11 @@ bool8 sub_805BC98(struct Entity * pokemon, struct Entity * target, struct Move *
local_28 = (local_28 == 0);
local_27 = (local_27 == 0);
uVar3 = FALSE;
flag = FALSE;
if ((local_28 != 0) || (local_27 != 0)) {
uVar3 = TRUE;
flag = TRUE;
}
return uVar3;
return flag;
}
bool8 SilenceOrbAction(struct Entity * pokemon, struct Entity * target)
@@ -1152,12 +1142,12 @@ bool8 ShockerOrbAction(struct Entity *pokemon, struct Entity *target)
bool8 sub_805C208(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
{
u32 uVar3;
u32 targetSize;
u8 local_24;
local_24 = 0;
uVar3 = GetSize(target->info->apparentID);
sub_806F370(pokemon,target,uVar3,1,&local_24,GetMoveType(move),sub_8057600(move,param_4),0,1,0);
targetSize = GetSize(target->info->apparentID);
sub_806F370(pokemon,target,targetSize,1,&local_24,GetMoveType(move),sub_8057600(move,param_4),0,1,0);
local_24 = local_24 == 0;
return local_24;
@@ -1178,16 +1168,14 @@ bool8 sub_805C2A0(struct Entity *pokemon, struct Entity *target)
bool8 FillInOrbAction(struct Entity *pokemon,struct Entity *target)
{
struct Tile *tileToFill;
struct EntityInfo *iVar5;
struct EntityInfo *targetInfo;
int y;
bool8 filledInTile;
int x;
u16 cast_x;
u32 cast_y;
struct Position_Alt tileCoords;
struct Position tileCoords;
filledInTile = FALSE;
iVar5 = target->info;
targetInfo = target->info;
if (IsBossFight()) {
SendMessage(pokemon,*gUnknown_80FD0B8);
return FALSE;
@@ -1195,20 +1183,17 @@ bool8 FillInOrbAction(struct Entity *pokemon,struct Entity *target)
else
{
// Calculate the coordinates of the tile in front of the user
cast_x = target->pos.x + gAdjacentTileOffsets[iVar5->action.direction].x;
tileCoords.temp.full_bits = (tileCoords.temp.full_bits & 0xffff0000) | cast_x;
tileCoords.x = target->pos.x + gAdjacentTileOffsets[targetInfo->action.direction].x;
tileCoords.y = target->pos.y + gAdjacentTileOffsets[targetInfo->action.direction].y;
cast_y = ((u16)(target->pos.y + gAdjacentTileOffsets[iVar5->action.direction].y)) << 0x10;
tileCoords.temp.full_bits = (tileCoords.temp.full_bits & 0x0000ffff) | cast_y;
sub_8042A54((struct Position *)&tileCoords);
tileToFill = GetTileSafe(tileCoords.temp.norm.x,tileCoords.temp.norm.y);
sub_8042A54(&tileCoords);
tileToFill = GetTileSafe(tileCoords.x,tileCoords.y);
if ((tileToFill->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) == TERRAIN_TYPE_SECONDARY) {
tileToFill->terrainType = (tileToFill->terrainType & ~(TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) | TERRAIN_TYPE_NORMAL;
for(y = -1; y < 2; y++)
for(x = -1; x < 2; x++)
sub_80498A8(tileCoords.temp.norm.x + x, tileCoords.temp.norm.y + y);
sub_80498A8(tileCoords.x + x, tileCoords.y + y);
filledInTile = TRUE;
sub_806CF60();
}
@@ -1218,7 +1203,7 @@ bool8 FillInOrbAction(struct Entity *pokemon,struct Entity *target)
sub_8049BB0(x,y);
if (filledInTile) {
sub_8042A64((struct Position *)&tileCoords);
sub_8042A64(&tileCoords);
sub_80522F4(pokemon,target,*gUnknown_80FD0B4);
}
else {
@@ -1264,9 +1249,9 @@ bool8 sub_805C45C(struct Entity *pokemon, struct Entity *target)
return TRUE;
}
bool8 sub_805C468(struct Entity *pokemon, struct Entity *target)
bool8 MobileOrbAction(struct Entity *pokemon, struct Entity *target)
{
sub_8078F50(pokemon, target);
MobileStatusTarget(pokemon, target);
return TRUE;
}

View File

@@ -291,7 +291,7 @@ u32 CreateThankYouMailPelipper(void)
mail = sub_8095228(index);
gUnknown_203B2C4->unk41C = mail->unk20;
gUnknown_203B2C4->mailIndex = index;
gUnknown_203B2C4->unk430 = mail->unk10;
gUnknown_203B2C4->unk430 = mail->unk10.unk10;
SetThankYouMailMenuState(5);
}
else {
@@ -841,11 +841,11 @@ void HandleThankYouMailPasswordMenu(void)
SetThankYouMailMenuState(PRINT_THANK_YOU_ERROR);
break;
case PASSWORD_ENTRY_THANK_YOU_MAIL_SUCCESS:
uVar1 = sub_809539C(4,mail1.unk10);
uVar1 = sub_809539C(4,mail1.unk10.unk10);
mail = sub_8095228(uVar1);
*mail = mail1;
mail->mailType = 6;
gUnknown_203B2C4->unk430 = mail1.unk10;
gUnknown_203B2C4->unk430 = mail1.unk10.unk10;
SetThankYouMailMenuState(THANK_YOU_PASSWORD_SUCCESS);
break;
default:
@@ -1346,10 +1346,10 @@ void UpdateThankYouMailText(void)
case 7:
gUnknown_203B2C4->linkError = sub_80381F4(gUnknown_203B2C4->unk40,&gUnknown_203B2C4->unk1B8,&gUnknown_203B2C4->unk1E8);
if ( sub_800D588() != '\0') {
gUnknown_203B2C4->unk430 = gUnknown_203B2C4->unk1E8.unk10;
gUnknown_203B2C4->unk430 = gUnknown_203B2C4->unk1E8.unk10.unk10;
}
else {
gUnknown_203B2C4->unk430 = gUnknown_203B2C4->unk1B8.unk10;
gUnknown_203B2C4->unk430 = gUnknown_203B2C4->unk1B8.unk10.unk10;
}
break;
}

View File

@@ -1471,7 +1471,7 @@ void sub_80293F4(void)
sub_8028B04(7);
break;
case PASSWORD_ENTRY_SOS_MAIL_SUCCESS:
sub_8095274(mail.unk10);
sub_8095274(mail.unk10.unk10);
mail.mailType = 2;
sub_80951BC(&mail);
sub_80141B4(gWonderMailAOKMailReceivedText, 0, &gUnknown_203B2C0->faceFile, 0x101);

View File

@@ -1,4 +1,5 @@
#include "global.h"
#include "constants/item.h"
#include "constants/wonder_mail.h"
#include "file_system.h"
#include "input.h"
@@ -389,8 +390,8 @@ void sub_802B3E0(void)
mail = sub_8095228(gUnknown_203B2C8->unk1);
sub_803C37C(&mail->dungeon, 0, gUnknown_203B2C8->unk114.itemRewards);
gUnknown_203B2C8->unk114.teamRankPtsReward = GetDungeonTeamRankPts(&mail->dungeon, 0);
gUnknown_203B2C8->unk114.itemRewards[1] = 0;
gUnknown_203B2C8->unk114.itemRewards[2] = 0;
gUnknown_203B2C8->unk114.itemRewards[1] = ITEM_NOTHING;
gUnknown_203B2C8->unk114.itemRewards[2] = ITEM_NOTHING;
gUnknown_203B2C8->unk114.quantity = 10;
gUnknown_203B2C8->unk114.friendAreaReward = 0;
sub_802F204(&gUnknown_203B2C8->unk114, 0);

View File

@@ -4,22 +4,7 @@
#include "memory.h"
#include "text.h"
#include "menu.h"
struct unkStruct_802C39C
{
/* 0x0 */ u32 unk0[2];
/* 0x8 */ struct DungeonLocation *unk8;
/* 0xC */ u8 *unkC;
/* 0x10 */ s16 unk10;
/* 0x12 */ s16 unk12;
/* 0x14 */ u8 unk14;
/* 0x15 */ u8 fill15[0x1B];
/* 0x36 */ u8 fill36[0x3C - 0x36];
/* 0x3C */ u8 unk3C[0xC];
/* 0x48 */ u8 fill48[4];
/* 0x4C */ u32 unk4C;
/* 0x50 */ u32 unk50[3];
};
#include "code_802C39C.h"
struct unkStruct_203B2E8
{
@@ -365,8 +350,8 @@ void sub_802C6DC(void)
void sub_802C750(void)
{
struct WonderMail *uVar1;
int iVar2;
struct WonderMail *mail;
int index;
s32 r4;
s32 r5;
struct unkStruct_802C39C local;
@@ -380,18 +365,18 @@ void sub_802C750(void)
r4 += 4;
r5 = r4 + gUnknown_203B2E8->unkA4[2] * 8;
sub_8012BC4(r5,0,gUnknown_203B2E8->unk26 + 1,2,7,gUnknown_203B2E8->unk3C);
iVar2 = 0;
index = 0;
if(( iVar2 < gUnknown_203B2E8->unk22))
if(( index < gUnknown_203B2E8->unk22))
do
{
uVar1 = GetJobSlotInfo(gUnknown_203B2E8->unk0[gUnknown_203B2E8->unk26 * gUnknown_203B2E8->unk24 + iVar2]);
mail = GetJobSlotInfo(gUnknown_203B2E8->unk0[gUnknown_203B2E8->unk26 * gUnknown_203B2E8->unk24 + index]);
local.unk0[0] = gUnknown_203B2E8->unk3C;
local.unk4C = sub_8013800(&gUnknown_203B2E8->unk8,iVar2);
sub_803B35C(uVar1,local.unk0);
local.y = sub_8013800(&gUnknown_203B2E8->unk8,index);
sub_803B35C(mail,local.unk0);
CreateRescueTitle(&local);
iVar2++;
} while( iVar2 < gUnknown_203B2E8->unk22);
index++;
} while( index < gUnknown_203B2E8->unk22);
sub_80073E0(gUnknown_203B2E8->unk3C);
}

View File

@@ -6,6 +6,7 @@
#include "text.h"
#include "pokemon_mail.h"
#include "wonder_mail.h"
#include "code_802C39C.h"
bool8 IsMailSlotEmpty(u8);
extern void sub_8013984(void *);
@@ -76,23 +77,6 @@ struct unkStruct_203B2E0
};
extern struct unkStruct_203B2E0 *gUnknown_203B2E0;
struct unkStruct_802C39C
{
/* 0x0 */ u32 unk0[2];
/* 0x8 */ struct DungeonLocation *unk8;
/* 0xC */ u8 *unkC;
/* 0x10 */ s16 unk10;
/* 0x12 */ s16 unk12;
/* 0x14 */ u8 unk14;
/* 0x15 */ u8 fill15[0x1B];
/* 0x34 */ u8 fill34[2];
/* 0x36 */ u8 fill36[0x3C - 0x36];
/* 0x3C */ u8 unk3C[0xC];
/* 0x48 */ u8 fill48[4];
/* 0x4C */ u32 unk4C;
/* 0x50 */ u32 unk50[3];
};
extern struct UnkTextStruct2 gUnknown_80DFCB4;
extern struct UnkTextStruct2 gUnknown_80DFC9C;
@@ -110,21 +94,21 @@ void CreateMailMenu(void)
{
struct WonderMail *mail;
s32 y;
s32 iVar5;
s32 index;
struct unkStruct_802C39C local;
u8 buffer [128];
sub_8008C54(gUnknown_203B2D8->unk38);
sub_80073B8(gUnknown_203B2D8->unk38);
xxx_call_draw_string(gUnknown_203B2D8->unk22 * 8 + 10,0,gMailboxText,gUnknown_203B2D8->unk38,0);
iVar5 = 0;
if (iVar5 < gUnknown_203B2D8->unk1E) {
index = 0;
if (index < gUnknown_203B2D8->unk1E) {
do {
mail = GetMailboxSlotInfo(gUnknown_203B2D8->unk0[(gUnknown_203B2D8->unk22 * gUnknown_203B2D8->unk20) + iVar5]);
mail = GetMailboxSlotInfo(gUnknown_203B2D8->unk0[(gUnknown_203B2D8->unk22 * gUnknown_203B2D8->unk20) + index]);
local.unk0[0] = gUnknown_203B2D8->unk38;
local.unk4C = sub_8013800(&gUnknown_203B2D8->unk4, iVar5);
local.y = sub_8013800(&gUnknown_203B2D8->unk4, index);
if (mail->mailType == 1) {
y = sub_8013800(&gUnknown_203B2D8->unk4, iVar5);
y = sub_8013800(&gUnknown_203B2D8->unk4, index);
sub_803B6B0(10,y,6,gUnknown_203B2D8->unk38);
PrintPokeNameToBuffer(gAvailablePokemonNames, GetPlayerPokemonStruct());
sprintfStatic(buffer, GetPokemonMailHeadline(mail->dungeon.floor), gAvailablePokemonNames);
@@ -133,12 +117,12 @@ void CreateMailMenu(void)
else {
sub_803B35C(mail,local.unk0);
if (IsMailinJobSlot(mail)) {
local.unk3C[11] = 2;
local.unk43 = 2;
}
CreateRescueTitle(&local);
}
iVar5++;
} while (iVar5 < gUnknown_203B2D8->unk1E);
index++;
} while (index < gUnknown_203B2D8->unk1E);
}
sub_80073E0(gUnknown_203B2D8->unk38);
}
@@ -326,11 +310,11 @@ void sub_802C328(void)
void sub_802C39C(void)
{
u32 uVar1;
u32 slotIndex;
struct WonderMail *mail;
s32 iVar4;
s32 x;
s32 iVar6;
s32 index;
struct unkStruct_802C39C local;
sub_8008C54(gUnknown_203B2E0->unk3C);
@@ -343,20 +327,20 @@ void sub_802C39C(void)
x = iVar4 + gUnknown_203B2E0->unkA4[2] * 8;
sub_8012BC4(x,0,gUnknown_203B2E0->unk26 + 1,2,7,gUnknown_203B2E0->unk3C);
iVar6 = 0;
if(iVar6 < gUnknown_203B2E0->unk22)
index = 0;
if(index < gUnknown_203B2E0->unk22)
do
{
uVar1 = (gUnknown_203B2E0->unk0[gUnknown_203B2E0->unk26 * gUnknown_203B2E0->unk24 + iVar6]);
mail = GetPelipperBoardSlotInfo(uVar1);
slotIndex = (gUnknown_203B2E0->unk0[gUnknown_203B2E0->unk26 * gUnknown_203B2E0->unk24 + index]);
mail = GetPelipperBoardSlotInfo(slotIndex);
local.unk0[0] = gUnknown_203B2E0->unk3C;
local.unk4C = sub_8013800(&gUnknown_203B2E0->unk8,iVar6);
local.y = sub_8013800(&gUnknown_203B2E0->unk8,index);
sub_803B35C(mail,local.unk0);
if (IsMailinJobSlot(GetPelipperBoardSlotInfo(uVar1))) {
local.unk3C[11] = 2;
if (IsMailinJobSlot(GetPelipperBoardSlotInfo(slotIndex))) {
local.unk43 = 2;
}
CreateRescueTitle(&local);
iVar6++;
} while (iVar6 < gUnknown_203B2E0->unk22);
index++;
} while (index < gUnknown_203B2E0->unk22);
sub_80073E0(gUnknown_203B2E0->unk3C);
}

View File

@@ -7,6 +7,7 @@
#include "constants/dungeon.h"
#include "wonder_mail.h"
#include "wonder_mail_3.h"
#include "code_802C39C.h"
const struct UnkTextStruct2 gUnknown_80DFDD4 =
{
@@ -179,10 +180,10 @@ void sub_802CFD0(void)
while(r5 < gUnknown_203B2F4->unk1A) {
iVar1 = sub_803B344(gUnknown_203B2F4->unk1E * gUnknown_203B2F4->unk1C + r5);
local.unk0[0] = gUnknown_203B2F4->unk34;
local.unk4C = sub_8013800(gUnknown_203B2F4,r5);
local.y = sub_8013800(gUnknown_203B2F4,r5);
sub_803B35C(iVar1,local.unk0);
local.unk3C[11] = 1;
local.unk50[0] = iVar1->unk14;
local.unk43 = 1;
local.unk4C = iVar1->unk14;
CreateRescueTitle(&local);
r5++;
}

View File

@@ -539,12 +539,9 @@ void HandleMissionReward(void)
{
int moneyReward;
const u8 *rankString;
u8 uVar7;
u8 itemID;
struct unkStruct_8090F58 local_20;
struct Item_Alt item;
u32 quantity;
u32 index_cast;
u32 index_cast2;
struct Item item;
switch(gUnknown_203B310->state) {
case 0:
@@ -615,29 +612,22 @@ void HandleMissionReward(void)
gUnknown_203B310->nextState = 4;
break;
case 4:
uVar7 = gUnknown_203B310->unk10->itemRewards[0];
if (uVar7 != 0)
itemID = gUnknown_203B310->unk10->itemRewards[0];
if (itemID != ITEM_NOTHING)
{
if (gUnknown_203B310->unk10->moneyReward == 0) {
// Cast ItemIndex
index_cast = uVar7 << 16;
item.temp.full_bits = (item.temp.full_bits & 0xff00ffff) | index_cast;
index_cast2 = item.temp.full_bits >> 16;
if (IsThrowableItem(index_cast2)) {
// Cast number items
quantity = (gUnknown_203B310->unk10->quantity << 8);
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | quantity;
item.id = itemID;
if (IsThrowableItem(item.id)) {
item.quantity = gUnknown_203B310->unk10->quantity;
}
else {
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | 0;
item.quantity = 0;
}
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | ITEM_FLAG_EXISTS;
item.flags = ITEM_FLAG_EXISTS;
local_20.unk0 = 0;
local_20.unk4 = 0;
local_20.unk8 = 1;
sub_8090E14(gUnknown_202DEA8,(struct Item *)&item,&local_20);
sub_8090E14(gUnknown_202DEA8,&item,&local_20);
if (gUnknown_203B310->displayClientDialogueSprite) {
sub_80141B4(gUnknown_80E0640,0,&gUnknown_203B310->faceFile,0x10d);
gUnknown_203B310->nextState = 5;

View File

@@ -6,6 +6,7 @@
#include "pokemon.h"
#include "code_8094F88.h"
#include "constants/wonder_mail.h"
#include "code_802C39C.h"
struct unkStruct_203B320
{
@@ -27,27 +28,59 @@ struct unkStruct_203B320
u8 unkC0[4];
};
extern struct unkStruct_203B320 *gUnknown_203B320;
extern struct UnkTextStruct2 gUnknown_80E083C;
extern struct UnkTextStruct2 gUnknown_80E0854;
extern u8 *gUnknown_80E086C[];
extern struct unkStruct_203B480 *gUnknown_203B480;
struct unkStruct_802C39C
{
/* 0x0 */ u32 unk0[2];
/* 0x8 */ struct DungeonLocation *unk8;
/* 0xC */ u8 *unkC;
/* 0x10 */ s16 unk10;
/* 0x12 */ s16 unk12;
/* 0x14 */ u8 unk14;
/* 0x15 */ u8 fill15[0x1B];
/* 0x34 */ u8 fill34[2];
/* 0x36 */ u8 fill36[0x3C - 0x36];
/* 0x3C */ u8 unk3C[0x10];
/* 0x4C */ u32 unk4C;
/* 0x50 */ u32 unk50[3];
const struct UnkTextStruct2 gUnknown_80E083C = {
0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
NULL
};
const struct UnkTextStruct2 gUnknown_80E0854 = {
0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00,
0x02, 0x00, 0x02, 0x00,
0x18, 0x11,
0x11, 0x00,
NULL
};
extern const u8 SOSList[];
extern const u8 RequestList[];
extern const u8 SOSMail[];
extern const u8 ToDoList[];
extern const u8 AOKMail[];
extern const u8 ThanksList[];
extern const u8 CompletedJobs[];
extern const u8 OkdRescue[];
const u8 * const gUnknown_80E086C[] =
{
SOSList,
RequestList,
SOSMail,
ToDoList,
AOKMail,
ThanksList,
CompletedJobs,
OkdRescue
};
ALIGNED(4) const u8 OkdRescue[] = _("OK{APOSTROPHE}d Rescues");
ALIGNED(4) const u8 CompletedJobs[] = "Completed Jobs";
ALIGNED(4) const u8 ThanksList[] = "Thanks List";
ALIGNED(4) const u8 AOKMail[] = "A-OK Mail";
ALIGNED(4) const u8 ToDoList[] = "To-Do List";
ALIGNED(4) const u8 SOSMail[] = "SOS Mail";
ALIGNED(4) const u8 RequestList[] = "Request List";
ALIGNED(4) const u8 SOSList[] = "SOS List";
static const u8 wonder_mail_fill[] = "pksdir0";
extern bool8 HasNoWonderMailType(u32);
extern s32 sub_8030A74(void);
extern void sub_80308A0(void);
@@ -236,7 +269,7 @@ void sub_803092C(void)
struct unkStruct_203B480 *mail;
s32 r4;
s32 r5;
s32 r6;
s32 index;
struct unkStruct_802C39C local;
sub_8008C54(gUnknown_203B320->unk58);
@@ -249,43 +282,43 @@ void sub_803092C(void)
r5 = r4 + gUnknown_203B320->unkC0[2] * 8;
sub_8012BC4(r5,0,gUnknown_203B320->unk42 + 1,1,7,gUnknown_203B320->unk58);
r6 = 0;
if (r6 < gUnknown_203B320->unk3E) {
index = 0;
if (index < gUnknown_203B320->unk3E) {
do {
mail = sub_8095228(gUnknown_203B320->unk0[(gUnknown_203B320->unk42 * gUnknown_203B320->unk40) + r6]);
mail = sub_8095228(gUnknown_203B320->unk0[(gUnknown_203B320->unk42 * gUnknown_203B320->unk40) + index]);
local.unk0[0] = gUnknown_203B320->unk58;
local.unk4C = sub_8013800(&gUnknown_203B320->unk24,r6);
local.unk3C[8] = 7;
local.unk3C[10] = 0;
local.unk3C[12] = 0;
local.y = sub_8013800(&gUnknown_203B320->unk24,index);
local.unk40 = 7;
local.unk42 = 0;
local.unk44 = 0;
local.unk8 = &mail->dungeon;
local.unkC = mail->playerName;
local.dungeon = &mail->dungeon;
local.playerName = mail->playerName;
local.unk10 = (mail->clientSpecies);
local.unk12 = (mail->clientSpecies);
local.clientSpecies = (mail->clientSpecies);
local.targetSpecies = (mail->clientSpecies);
local.unk14 = 0;
local.fill15[0x19] = 5;
local.unk2E = 5;
switch(mail->mailType)
{
case WONDER_MAIL_TYPE_AOK:
local.unk3C[11] = 3;
local.unk43 = 3;
break;
case WONDER_MAIL_TYPE_THANK_YOU:
local.unk3C[11] = 4;
local.unk43 = 4;
break;
case 1:
case 2:
local.unk3C[11]= 1;
local.unk43 = 1;
break;
default:
local.unk3C[11]= 0;
local.unk43 = 0;
break;
}
CreateRescueTitle(&local);
r6++;
} while (r6 < gUnknown_203B320->unk3E);
index++;
} while (index < gUnknown_203B320->unk3E);
}
sub_80073E0(gUnknown_203B320->unk58);
}

View File

@@ -1,34 +1,67 @@
#include "global.h"
#include "constants/wonder_mail.h"
#include "memory.h"
#include "text.h"
#include "input.h"
#include "dungeon.h"
#include "pokemon.h"
#include "code_8094F88.h"
#include "code_800D090.h"
#include "code_802C39C.h"
struct unkStruct_203B324
{
// size: 0x78
u8 fill0[0xC];
u8 unkC;
u8 mailIndex;
u32 unk10;
struct UnkTextStruct2 *unk14;
struct UnkTextStruct2 unk18[4];
};
extern struct unkStruct_203B324 *gUnknown_203B324;
extern struct unkStruct_203B480 *gUnknown_203B480;
extern const struct UnkTextStruct2 gUnknown_80E091C;
extern const struct UnkTextStruct2 gUnknown_80E0900;
const struct UnkTextStruct2 gUnknown_80E0900 = {
0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
NULL
};
const u8 DATA_80E0918[] = {0x01, 0x00, 0x12, 0x00};
const struct UnkTextStruct2 gUnknown_80E091C = {
0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00,
0x02, 0x00, 0x02, 0x00,
0x1A, 0x10,
0x10, 0x00,
DATA_80E0918
};
const u8 gUnknown_80E0934[] = "ID:";
const u8 gUnknown_80E0938[] = "%-4d";
static const u8 wonder_mail_fill[] = "pksdir0";
extern void sub_8030DD4(void);
extern void sub_801317C(void *);
extern void PlayMenuSoundEffect(u32);
extern u32 sub_8012A64(void *, u32);
extern void CreateRescueDescription(void *);
extern void xxx_call_draw_string(u32, u32, const char *, u32, u32);
extern void sub_80073E0(u32);
extern void sub_80073B8(u32);
void sub_8030E2C(void);
void sub_8030E48(void);
bool8 sub_8030D40(u8 param_1, s32 param_2)
bool8 sub_8030D40(u8 mailIndex, s32 param_2)
{
gUnknown_203B324 = MemoryAlloc(sizeof(struct unkStruct_203B324), 8);
gUnknown_203B324->unkC = param_1;
gUnknown_203B324->mailIndex = mailIndex;
sub_801317C(gUnknown_203B324);
gUnknown_203B324->unk10 = param_2;
gUnknown_203B324->unk14 = &gUnknown_203B324->unk18[param_2];
@@ -77,3 +110,49 @@ void sub_8030E2C(void)
sub_800641C(gUnknown_203B324->unk18, 1, 1);
}
void sub_8030E48(void)
{
u16 uVar2;
struct unkStruct_203B480 *mail;
struct unkStruct_802C39C stack;
u8 buffer [256];
mail = &gUnknown_203B480[gUnknown_203B324->mailIndex];
sub_80073B8(gUnknown_203B324->unk10);
stack.unk0[0] = gUnknown_203B324->unk10;
stack.unk40 = 7;
stack.unk42 = 0;
stack.unk44 = 0;
stack.dungeon = &mail->dungeon;
stack.playerName = mail->playerName;
stack.clientSpecies = mail->clientSpecies;
stack.targetSpecies = mail->clientSpecies;
stack.unk14 = 0;
if (mail->unk20.id == ITEM_NOTHING) {
stack.unk2E = 5;
}
else {
stack.unk2E = 2;
stack.unk34 = mail->unk20.id;
}
switch(mail->mailType)
{
case 2:
case WONDER_MAIL_TYPE_AOK:
stack.unk41 = 10;
break;
case 5:
stack.unk41 = 11;
break;
case WONDER_MAIL_TYPE_NONE:
default:
stack.unk41 = 9;
break;
}
CreateRescueDescription(&stack);
uVar2 = mail->unk10.unk10_u16 % 10000;
xxx_call_draw_string(10,0x68,gUnknown_80E0934,gUnknown_203B324->unk10,0); // ID:
sprintfStatic(buffer,gUnknown_80E0938,uVar2); // %-4d
xxx_call_draw_string(0x44,0x68,buffer,gUnknown_203B324->unk10,0);
sub_80073E0(gUnknown_203B324->unk10);
}

View File

@@ -13,7 +13,7 @@ struct unkStruct_203B328
{
// size: 0x11C
u32 state;
u8 unk4;
u8 mailIndex;
u32 unk8;
u8 fillC[0x58 - 0xC];
u32 unk58;
@@ -241,7 +241,7 @@ void sub_8031258(void)
sub_8012D60(&gUnknown_203B328->unk58, gUnknown_80E0948, 0, 0, 3, 2);
break;
case 4:
sub_8030D40(gUnknown_203B328->unk4, 3);
sub_8030D40(gUnknown_203B328->mailIndex, 3);
break;
case 5:
case 6:
@@ -255,11 +255,11 @@ void sub_8031300(void)
switch(sub_8030768(1))
{
case 3:
gUnknown_203B328->unk4 = sub_80307EC();
gUnknown_203B328->mailIndex = sub_80307EC();
sub_80310E4(1);
break;
case 4:
gUnknown_203B328->unk4 = sub_80307EC();
gUnknown_203B328->mailIndex = sub_80307EC();
sub_80310E4(4);
break;
case 2:
@@ -301,7 +301,7 @@ void sub_803136C(void)
void sub_80313D8(u32 state)
{
s32 iVar2;
s32 index;
s32 local_10;
struct unkStruct_203B480 *unused;
@@ -322,15 +322,15 @@ void sub_80313D8(u32 state)
switch(state)
{
case 2:
sub_8095240(gUnknown_203B328->unk4);
sub_8095240(gUnknown_203B328->mailIndex);
break;
case 3:
for(iVar2 = 0; iVar2 < 0x20; iVar2++)
for(index = 0; index < 0x20; index++)
{
unused = &gUnknown_203B480[iVar2];
gUnknown_203B480[iVar2].mailType = 0;
unused = &gUnknown_203B480[iVar2];
gUnknown_203B480[iVar2].unk20.id = 0;
unused = &gUnknown_203B480[index];
gUnknown_203B480[index].mailType = 0;
unused = &gUnknown_203B480[index];
gUnknown_203B480[index].unk20.id = ITEM_NOTHING;
}
break;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,77 +1,77 @@
SoundMainRAM_Buffer = .; /* 3000000 */
. += 0x400;
SoundMainRAM_Buffer: /* 3000000 */
.space 0x400
gUnknown_3000400 = .; /* 3000400 */
. += 0x800;
gUnknown_3000400: /* 3000400 */
.space 0x800
gUnknown_3000C00 = .; /* 3000C00 */
. += 0x294;
gUnknown_3000C00: /* 3000C00 */
.space 0x294
gUnknown_3000E94 = .; /* 3000E94 */
. += 0x144;
gUnknown_3000E94: /* 3000E94 */
.space 0x144
gUnknown_3000FD8 = .; /* 3000FD8 */
. += 0x10;
gUnknown_3000FD8: /* 3000FD8 */
.space 0x10
gUnknown_3000FE8 = .; /* 3000FE8 */
. += 0x30;
gUnknown_3000FE8: /* 3000FE8 */
.space 0x30
gUnknown_3001018 = .; /* 3001018 */
. += 0x180;
gUnknown_3001018: /* 3001018 */
.space 0x180
gUnknown_3001198 = .; /* 3001198 */
. += 0x9C0;
gUnknown_3001198: /* 3001198 */
.space 0x9C0
alt_3001B58 = .;
alt_3001B58:
unk_code_ram = .; /* 3001B58 */
unk_code_ram: /* 3001B58 */
gUnknown_3001B58 = .; /* 3001B58 */
. += 0x2;
gUnknown_3001B58: /* 3001B58 */
.space 0x2
gUnknown_3001B5A = .; /* 3001B5A */
. += 0x2;
gUnknown_3001B5A: /* 3001B5A */
.space 0x2
gUnknown_3001B5C = .; /* 3001B5C */
. += 0x4;
gUnknown_3001B5C: /* 3001B5C */
.space 0x4
gUnknown_3001B60 = .; /* 3001B60 */
. += 0x4;
gUnknown_3001B60: /* 3001B60 */
.space 0x4
gUnknown_3001B64 = .; /* 3001B64 */
. += 0x4;
gUnknown_3001B64: /* 3001B64 */
.space 0x4
gUnknown_3001B68 = .; /* 3001B68 */
. += 0x4;
gUnknown_3001B68: /* 3001B68 */
.space 0x4
gUnknown_3001B6C = .; /* 3001B6C */
. += 0x4;
gUnknown_3001B6C: /* 3001B6C */
.space 0x4
gUnknown_3001B70 = .; /* 3001B70 */
. += 0x4;
gUnknown_3001B70: /* 3001B70 */
.space 0x4
gUnknown_3001B74 = .; /* 3001B74 */
. += 0x4;
gUnknown_3001B74: /* 3001B74 */
.space 0x4
gUnknown_3001B78 = .; /* 3001B78 */
. += 0x4;
gUnknown_3001B78: /* 3001B78 */
.space 0x4
gUnknown_3001B7C = .; /* 3001B7C */
. += 0x4;
gUnknown_3001B7C: /* 3001B7C */
.space 0x4
gUnknown_3001B80 = .; /* 3001B80 */
. += 0x4;
gUnknown_3001B80: /* 3001B80 */
.space 0x4
gUnknown_3001B84 = .; /* 3001B84 */
. += 0x4;
gUnknown_3001B84: /* 3001B84 */
.space 0x4
gUnknown_3001B88 = .; /* 3001B88 */
. += 0x4;
gUnknown_3001B88: /* 3001B88 */
.space 0x4
gUnknown_3001B8C = .; /* 3001B8C */
. += 0x4;
gUnknown_3001B8C: /* 3001B8C */
.space 0x4
gUnknown_3001B90 = .; /* 3001B90 */
. += 0x2470;
gUnknown_3001B90: /* 3001B90 */
.space 0x2470
gUnknown_3004000 = .; /* 3004000 */
gUnknown_3004000: /* 3004000 */