diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2017-06-29 22:06:27 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2017-06-29 22:06:27 -0400 |
commit | fe40c6053622e89dbc0f9e26493946fa098765fb (patch) | |
tree | 90f82530289d127bff16ee19d1b5cdbb25403388 | |
parent | eb9df8bc6699093ef8f3c9ccb985bec9809910c7 (diff) |
sub_8136F74
-rwxr-xr-x | asm/use_pokeblock.s | 117 | ||||
-rwxr-xr-x[-rw-r--r--] | include/pokemon.h | 1 | ||||
-rwxr-xr-x | include/use_pokeblock.h | 1 | ||||
-rwxr-xr-x | src/use_pokeblock.c | 37 |
4 files changed, 36 insertions, 120 deletions
diff --git a/asm/use_pokeblock.s b/asm/use_pokeblock.s index c153f7cfb..d16abf724 100755 --- a/asm/use_pokeblock.s +++ b/asm/use_pokeblock.s @@ -6,123 +6,6 @@ .text - thumb_func_start sub_8136F74 -sub_8136F74: @ 8136F74 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r10, r1 - ldr r1, _08136FBC @ =gUnknown_02039304 - ldr r3, [r1] - ldrb r1, [r0, 0x1] - adds r2, r3, 0 - adds r2, 0x66 - strh r1, [r2] - ldrb r2, [r0, 0x5] - adds r1, r3, 0 - adds r1, 0x68 - strh r2, [r1] - ldrb r1, [r0, 0x4] - adds r2, r3, 0 - adds r2, 0x6A - strh r1, [r2] - ldrb r2, [r0, 0x3] - adds r1, r3, 0 - adds r1, 0x6C - strh r2, [r1] - ldrb r1, [r0, 0x2] - adds r0, r3, 0 - adds r0, 0x6E - strh r1, [r0] - ldr r0, _08136FC0 @ =gUnknown_02039312 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - ble _08136FC4 - movs r0, 0x1 - b _08136FCA - .align 2, 0 -_08136FBC: .4byte gUnknown_02039304 -_08136FC0: .4byte gUnknown_02039312 -_08136FC4: - cmp r0, 0 - bge _08137040 - movs r0, 0xFF -_08136FCA: - movs r2, 0 - lsls r0, 24 - mov r9, r0 - ldr r0, _08137050 @ =gUnknown_02039304 - mov r8, r0 -_08136FD4: - mov r0, r8 - ldr r1, [r0] - lsls r0, r2, 24 - asrs r6, r0, 24 - lsls r7, r6, 1 - adds r1, 0x66 - adds r1, r7 - movs r2, 0 - ldrsh r4, [r1, r2] - adds r0, r4, 0 - movs r1, 0xA - bl __divsi3 - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r4, 0 - movs r1, 0xA - bl __modsi3 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - ble _0813700C - lsls r0, r5, 24 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r5, r0, 24 -_0813700C: - ldr r0, _08137054 @ =gUnknown_0840612C - adds r0, r6, r0 - ldrb r1, [r0] - mov r0, r10 - bl sub_8040A54 - lsls r0, 24 - asrs r2, r0, 24 - cmp r0, r9 - bne _08137034 - mov r1, r8 - ldr r0, [r1] - adds r0, 0x66 - adds r0, r7 - lsls r1, r5, 24 - asrs r1, 24 - muls r1, r2 - ldrh r2, [r0] - adds r1, r2 - strh r1, [r0] -_08137034: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - asrs r0, 24 - cmp r0, 0x4 - ble _08136FD4 -_08137040: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08137050: .4byte gUnknown_02039304 -_08137054: .4byte gUnknown_0840612C - thumb_func_end sub_8136F74 - thumb_func_start sub_8137058 sub_8137058: @ 8137058 push {lr} diff --git a/include/pokemon.h b/include/pokemon.h index be8e4e56d..6fbdb18d3 100644..100755 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -511,5 +511,6 @@ void sub_8040B8C(void); void SetWildMonHeldItem(void); u8 *sub_8040D08(); bool32 sub_8040D3C(u16 species, u8 *name, u8 language); +s8 sub_8040A54(struct Pokemon *, u8); #endif // GUARD_POKEMON_H diff --git a/include/use_pokeblock.h b/include/use_pokeblock.h index 779ba27d1..978476d89 100755 --- a/include/use_pokeblock.h +++ b/include/use_pokeblock.h @@ -6,6 +6,7 @@ #define POKERUBY_USE_POKEBLOCK_H extern void *gUnknown_02030400; +extern s16 gUnknown_02039312; void sub_8136130(struct Pokeblock *, MainCallback); diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c index e21984180..5a14f74fa 100755 --- a/src/use_pokeblock.c +++ b/src/use_pokeblock.c @@ -20,7 +20,6 @@ #include "use_pokeblock.h" #define GFX_TAG_CONDITIONUPDOWN 0 -#define GFX_TAG_UNKNOWN02030400 1 #ifndef GERMAN const u16 ConditionUpDownPalette[] = INCBIN_U16("graphics/misc/condition_up_down.gbapal"); @@ -35,8 +34,8 @@ const u32 gUnknown_08406118[] = { MON_DATA_BEAUTY }; -const struct SpritePalette gUnknown_0840612C = { - (u16 *const)&gUnknown_02030400, GFX_TAG_UNKNOWN02030400 +const u8 gUnknown_0840612C[] = { + 0, 4, 3, 2, 1 }; const u8 *const gUnknown_08406134[] = { @@ -797,3 +796,35 @@ void sub_8136EF0(void) gUnknown_02039304->unk61[i] = gUnknown_02039304->unk5c[i] - gUnknown_02039304->unk57[i]; } } + +void sub_8136F74(struct Pokeblock *pokeblock, struct Pokemon *pokemon) +{ + s8 direction; + s8 i; + s16 amount; + s8 boost; + s8 taste; + gUnknown_02039304->unk66[0] = pokeblock->spicy; + gUnknown_02039304->unk66[1] = pokeblock->sour; + gUnknown_02039304->unk66[2] = pokeblock->bitter; + gUnknown_02039304->unk66[3] = pokeblock->sweet; + gUnknown_02039304->unk66[4] = pokeblock->dry; + if (gUnknown_02039312 > 0) + direction = 1; + else if (gUnknown_02039312 < 0) + direction = -1; + else + return; + for (i=0; i<5; i++) + { + amount = gUnknown_02039304->unk66[i]; + boost = amount / 10; + if (amount % 10 >= 5) // round to the nearest + boost++; + taste = sub_8040A54(pokemon, gUnknown_0840612C[i]); + if (taste == direction) + { + gUnknown_02039304->unk66[i] += boost * taste; + } + } +} |