mirror of
https://github.com/pret/pmd-sky.git
synced 2026-08-20 01:25:24 -05:00
Decomp five more leftover single-function asm files
Second cleanup sweep. Each was the only function left in its own asm file, so each removes an asm file and its include: asm/overlay_29_0234B0CC.s SetMessageLogPreprocessorArgsStringToName asm/overlay_29_023268CC.s DoMoveSmokescreen asm/overlay_29_02325F74.s DoMoveMorningSun asm/overlay_29_02326E20.s DoMoveGust asm/overlay_29_022EA980.s GenerateDungeonRngSeed Two needed a second reading: - DoMoveGust doubles the damage multiplier when the defender's bide_class_status.bide is 7 or 8. The target tests it as a byte with `add #0xF9`, so the source adds 0xF9 rather than subtracting 7; `- 7` compiles to `sub #7` and does not match. - GenerateDungeonRngSeed runs the LCG twice, stores the second result back to prng_state::preseed, and returns the two halves recombined. The operand order in the final or-expression decides whether the mask or the shift is scheduled first; taking the shifted half first matches. Authored by Claude (Opus 5) under human direction. All five verified at score 0. Confirmed by a matching build: build/pmdsky.us/pmdsky.us.nds: OK. None carries a region conditional, so US alone is sufficient. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
#pragma once
|
||||
.public DUNGEON_PRNG_STATE
|
||||
@@ -1,4 +0,0 @@
|
||||
#pragma once
|
||||
.public GetApparentWeather
|
||||
.public MORNING_SUN_HP_RESTORATION_TABLE
|
||||
.public TryIncreaseHp
|
||||
@@ -1,4 +0,0 @@
|
||||
#pragma once
|
||||
.public CalcStatusDuration
|
||||
.public SMOKESCREEN_TURN_RANGE
|
||||
.public TryInflictWhifferStatus
|
||||
@@ -1,2 +0,0 @@
|
||||
#pragma once
|
||||
.public DealDamage
|
||||
@@ -1,4 +0,0 @@
|
||||
#pragma once
|
||||
.public GetName
|
||||
.public GetSize0x80Buffer
|
||||
.public MESSAGE_LOG_INFO
|
||||
@@ -1,28 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "overlay_29_022EA980.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start GenerateDungeonRngSeed
|
||||
GenerateDungeonRngSeed: ; 0x022EA980
|
||||
ldr r2, _022EA9C4 ; =DUNGEON_PRNG_STATE
|
||||
mov r1, #0x10000
|
||||
ldr r3, [r2, #8]
|
||||
ldr r0, _022EA9C8 ; =0x5D588B65
|
||||
rsb r1, r1, #0
|
||||
mul ip, r3, r0
|
||||
add ip, ip, #1
|
||||
mul r0, ip, r0
|
||||
add r3, r0, #1
|
||||
mov r0, ip, lsr #0x10
|
||||
mov r0, r0, lsl #0x10
|
||||
and r1, r3, r1
|
||||
orr r0, r1, r0, lsr #16
|
||||
bic r0, r0, #0xff000000
|
||||
str r3, [r2, #8]
|
||||
orr r0, r0, #1
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_022EA9C4: .word DUNGEON_PRNG_STATE
|
||||
_022EA9C8: .word 0x5D588B65
|
||||
arm_func_end GenerateDungeonRngSeed
|
||||
@@ -1,25 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "overlay_29_02325F74.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start DoMoveMorningSun
|
||||
DoMoveMorningSun: ; 0x02325F74
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r5, r0
|
||||
mov r4, r1
|
||||
bl GetApparentWeather
|
||||
mov ip, #1
|
||||
ldr r1, _02325FB0 ; =MORNING_SUN_HP_RESTORATION_TABLE
|
||||
mov r0, r0, lsl #1
|
||||
ldrsh r2, [r1, r0]
|
||||
mov r0, r5
|
||||
mov r1, r4
|
||||
mov r3, #0
|
||||
str ip, [sp]
|
||||
bl TryIncreaseHp
|
||||
mov r0, #1
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
.align 2, 0
|
||||
_02325FB0: .word MORNING_SUN_HP_RESTORATION_TABLE
|
||||
arm_func_end DoMoveMorningSun
|
||||
@@ -1,24 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "overlay_29_023268CC.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start DoMoveSmokescreen
|
||||
DoMoveSmokescreen: ; 0x023268CC
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r4, r1
|
||||
mov r5, r0
|
||||
ldr r1, _02326904 ; =SMOKESCREEN_TURN_RANGE
|
||||
mov r0, r4
|
||||
mov r2, #1
|
||||
bl CalcStatusDuration
|
||||
mov r2, r0
|
||||
mov r0, r5
|
||||
mov r1, r4
|
||||
mov r3, #0
|
||||
bl TryInflictWhifferStatus
|
||||
mov r0, #1
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
.align 2, 0
|
||||
_02326904: .word SMOKESCREEN_TURN_RANGE
|
||||
arm_func_end DoMoveSmokescreen
|
||||
@@ -1,24 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "overlay_29_02326E20.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start DoMoveGust
|
||||
DoMoveGust: ; 0x02326E20
|
||||
stmdb sp!, {r3, lr}
|
||||
ldr ip, [r1, #0xb4]
|
||||
mov lr, #1
|
||||
ldrb ip, [ip, #0xd2]
|
||||
add ip, ip, #0xf9
|
||||
and ip, ip, #0xff
|
||||
cmp ip, #1
|
||||
movls lr, #2
|
||||
str r3, [sp]
|
||||
mov r3, lr, lsl #8
|
||||
bl DealDamage
|
||||
cmp r0, #0
|
||||
movne r0, #1
|
||||
moveq r0, #0
|
||||
and r0, r0, #0xff
|
||||
ldmia sp!, {r3, pc}
|
||||
arm_func_end DoMoveGust
|
||||
@@ -1,23 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "overlay_29_0234B0CC.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start SetMessageLogPreprocessorArgsStringToName
|
||||
SetMessageLogPreprocessorArgsStringToName: ; 0x0234B0CC
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r4, r1
|
||||
mov r5, r0
|
||||
bl GetSize0x80Buffer
|
||||
mov r1, r4
|
||||
mov r2, #0x4e
|
||||
mov r4, r0
|
||||
bl GetName
|
||||
ldr r0, _0234B100 ; =MESSAGE_LOG_INFO
|
||||
ldr r0, [r0, #4]
|
||||
add r0, r0, r5, lsl #2
|
||||
str r4, [r0, #0xcd4]
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
.align 2, 0
|
||||
_0234B100: .word MESSAGE_LOG_INFO
|
||||
arm_func_end SetMessageLogPreprocessorArgsStringToName
|
||||
@@ -4,5 +4,6 @@
|
||||
#include "util.h"
|
||||
|
||||
void SetDungeonRngPreseed23Bit(u32 preseed);
|
||||
u32 GenerateDungeonRngSeed(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#ifndef PMDSKY_OVERLAY_29_02325F3C_H
|
||||
#define PMDSKY_OVERLAY_29_02325F3C_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include "dungeon_mode.h"
|
||||
#include "item.h"
|
||||
#include "move.h"
|
||||
|
||||
bool8 DoMoveNightmare(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id);
|
||||
bool8 DoMoveMorningSun(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#ifndef PMDSKY_OVERLAY_29_023268BC_H
|
||||
#define PMDSKY_OVERLAY_29_023268BC_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include "dungeon_mode.h"
|
||||
#include "item.h"
|
||||
#include "move.h"
|
||||
|
||||
bool8 DoMoveFocusEnergy(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id);
|
||||
bool8 DoMoveSmokescreen(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#ifndef PMDSKY_OVERLAY_29_02326E04_H
|
||||
#define PMDSKY_OVERLAY_29_02326E04_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include "dungeon_mode.h"
|
||||
#include "item.h"
|
||||
#include "move.h"
|
||||
|
||||
bool8 DoMoveExpose(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id);
|
||||
bool8 DoMoveDoubleTeam(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id);
|
||||
bool8 DoMoveGust(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "util.h"
|
||||
#include "main_0200C4FC.h"
|
||||
#include "dungeon_mode.h"
|
||||
|
||||
void SetMessageLogGroupStartFlag(bool8 flag);
|
||||
struct preprocessor_args* GetMessageLogPreprocessorArgs(void);
|
||||
@@ -11,5 +12,6 @@ void SetMessageLogPreprocessorArgsFlagVal(s32 idx, u32 val);
|
||||
void SetPreprocessorArgsIdVal(s32 idx, u32 val);
|
||||
void SetMessageLogPreprocessorArgsNumberVal(s32 idx, s32 val);
|
||||
void SetMessageLogPreprocessorArgsString(s32 idx, char *str);
|
||||
void SetMessageLogPreprocessorArgsStringToName(s32 idx, struct entity* entity);
|
||||
|
||||
#endif
|
||||
|
||||
5
main.lsf
5
main.lsf
@@ -806,7 +806,6 @@ Overlay OVY_29
|
||||
Object src/overlay_29_022E9FC0.o
|
||||
Object asm/overlay_29_022E9FE0.o
|
||||
Object src/overlay_29_022EA968.o
|
||||
Object asm/overlay_29_022EA980.o
|
||||
Object src/overlay_29_022EA9CC.o
|
||||
Object src/dg_random.o
|
||||
Object asm/overlay_29_022EAB50.o
|
||||
@@ -1037,7 +1036,6 @@ Overlay OVY_29
|
||||
Object src/overlay_29_02325DC0.o
|
||||
Object asm/overlay_29_02325DE4.o
|
||||
Object src/overlay_29_02325F3C.o
|
||||
Object asm/overlay_29_02325F74.o
|
||||
Object src/overlay_29_02325FB4.o
|
||||
Object asm/overlay_29_02325FC4.o
|
||||
Object src/overlay_29_02326088.o
|
||||
@@ -1053,13 +1051,11 @@ Overlay OVY_29
|
||||
Object src/overlay_29_023267D8.o
|
||||
Object asm/overlay_29_0232680C.o
|
||||
Object src/overlay_29_023268BC.o
|
||||
Object asm/overlay_29_023268CC.o
|
||||
Object src/overlay_29_02326908.o
|
||||
Object asm/overlay_29_0232692C.o
|
||||
Object src/overlay_29_02326CB4.o
|
||||
Object asm/overlay_29_02326CC8.o
|
||||
Object src/overlay_29_02326E04.o
|
||||
Object asm/overlay_29_02326E20.o
|
||||
Object src/overlay_29_02326E80.o
|
||||
Object asm/overlay_29_02326EB8.o
|
||||
Object src/overlay_29_023276B4.o
|
||||
@@ -1263,7 +1259,6 @@ Overlay OVY_29
|
||||
Object asm/overlay_29_0234AEE8.o
|
||||
Object src/overlay_29_0234AFFC.o
|
||||
Object src/overlay_29_0234B024.o
|
||||
Object asm/overlay_29_0234B0CC.o
|
||||
Object src/overlay_29_0234B104.o
|
||||
Object asm/overlay_29_0234B130.o
|
||||
Object src/overlay_29_0234B340.o
|
||||
|
||||
@@ -7,3 +7,13 @@ void SetDungeonRngPreseed23Bit(u32 preseed)
|
||||
{
|
||||
DUNGEON_PRNG_STATE.preseed = (preseed | 1) & 0xFFFFFF;
|
||||
}
|
||||
|
||||
u32 GenerateDungeonRngSeed(void)
|
||||
{
|
||||
u32 a = DUNGEON_PRNG_STATE.preseed * 0x5D588B65 + 1;
|
||||
u32 b = a * 0x5D588B65 + 1;
|
||||
|
||||
DUNGEON_PRNG_STATE.preseed = b;
|
||||
|
||||
return (((u16) (a >> 16) | (b & 0xFFFF0000)) & 0xFFFFFF) | 1;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
#include "overlay_29_02325F3C.h"
|
||||
#include "weather.h"
|
||||
|
||||
extern const s16 MORNING_SUN_HP_RESTORATION_TABLE[];
|
||||
|
||||
extern void TryIncreaseHp(struct entity *user, struct entity *target, s16 hp, s32 a, bool8 b);
|
||||
|
||||
extern s32 NIGHTMARE_TURN_RANGE;
|
||||
|
||||
@@ -12,3 +17,10 @@ bool8 DoMoveNightmare(struct entity* attacker, struct entity* defender, struct m
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 DoMoveMorningSun(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id)
|
||||
{
|
||||
TryIncreaseHp(attacker, defender, MORNING_SUN_HP_RESTORATION_TABLE[GetApparentWeather(attacker)], 0, TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
#include "overlay_29_023268BC.h"
|
||||
|
||||
extern const s32 SMOKESCREEN_TURN_RANGE;
|
||||
|
||||
extern s32 CalcStatusDuration(struct entity *target, const s32 *turn_range, s32 a);
|
||||
|
||||
extern void TryInflictWhifferStatus(struct entity *user, struct entity *target, s32 turns, s32 a);
|
||||
|
||||
extern void TryInflictFocusEnergyStatus(struct entity *user, struct entity *target);
|
||||
|
||||
bool8 DoMoveFocusEnergy(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id)
|
||||
@@ -8,3 +14,10 @@ bool8 DoMoveFocusEnergy(struct entity* attacker, struct entity* defender, struct
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 DoMoveSmokescreen(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id)
|
||||
{
|
||||
TryInflictWhifferStatus(attacker, defender, CalcStatusDuration(defender, &SMOKESCREEN_TURN_RANGE, TRUE), 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#include "overlay_29_02326E04.h"
|
||||
#include "dungeon_util_static.h"
|
||||
|
||||
extern s32 DealDamage(struct entity *attacker, struct entity *defender, struct move *move, s32 damageMultiplier, enum item_id item_id);
|
||||
|
||||
extern void TryInflictExposedStatus(struct entity *user, struct entity *target, s32 a, s32 b);
|
||||
#include "move_orb_effects.h"
|
||||
@@ -20,3 +23,14 @@ bool8 DoMoveDoubleTeam(struct entity* attacker, struct entity* defender, struct
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 DoMoveGust(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id)
|
||||
{
|
||||
s32 multiplier = 1;
|
||||
|
||||
if ((u8) (GetEntInfo(defender)->bide_class_status.bide + 0xF9) <= 1) {
|
||||
multiplier = 2;
|
||||
}
|
||||
|
||||
return DealDamage(attacker, defender, move, multiplier << 8, item_id) != 0;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
#include "overlay_29_0234B024.h"
|
||||
#include "dungeon_mode.h"
|
||||
|
||||
extern char *GetSize0x80Buffer(void);
|
||||
|
||||
extern void GetName(char *buffer, struct entity *entity, s32 a);
|
||||
#include "main_0200C4FC.h"
|
||||
|
||||
extern void InitPreprocessorArgs(struct preprocessor_args *args);
|
||||
@@ -47,3 +52,11 @@ void SetMessageLogPreprocessorArgsString(s32 idx, char *str)
|
||||
{
|
||||
((struct preprocessor_args *) (MESSAGE_LOG_INFO.field_0x4 + 0xC9C))->strings[idx] = str;
|
||||
}
|
||||
|
||||
void SetMessageLogPreprocessorArgsStringToName(s32 idx, struct entity* entity)
|
||||
{
|
||||
char *buffer = GetSize0x80Buffer();
|
||||
|
||||
GetName(buffer, entity, 0x4E);
|
||||
((struct preprocessor_args *) (MESSAGE_LOG_INFO.field_0x4 + 0xC9C))->strings[idx] = buffer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user