Changing FE7's weapon effectiveness factor

Want FE7’s weapon effectiveness to be x3 like FE8? Never fear!
(This routine is at 028B3E…)
Use this instead

29 1C 5A 31 01 28 07 D1 30 88 EE F7 34 FB 0A 88 XX 20 50 43 08 80 C0 46,
Edit yet again: 29 1C 5A 31 01 28 07 D1 30 78 C0 46 C0 46 0A 88 XX 20 50 43 08 80 C0 46
where XX is the effectiveness factor

As before, if you want some different half-factor, like 2.5x, then replace the XX 20 50 43 08 80 C0 46
with XX 20 50 43 40 10 08 80
Where XX is effectiveness2
(This can also be done with quarter-factors, like 2.75x, but go compile that on your own. asr by 2 instead of 1 and use effectiveness
4)

Also, I wanted this to be as flexible as possible, but if you’re into ASM-ing, you can find a smarter way than a mul command. Like for x3, just lsr by 1 and add. Anyway, the source code is yours to mess with.

[source code][1]
[dump file][2]
[1]: Dropbox - Error - Simplify your life
[2]: Dropbox - Error - Simplify your life

WAIT I SPOKE TOO SOON
Those two commands aren’t unnecessary, but they’re called in both cases of a branch, so I can shift them to being done before the branch. Same solution, but a bit more code.
I’m leaving it here for the documentation, however.

Original:

@r2 holds the attack
lsl r0, r2, #0x1
strh r0, [r1]
@two unnecessary commands
@

into a

mov r0, #EFFECTIVENESS
mul r0, r2
strh r0, [r1]
nop @do nothing to let the number of commands line up

How do we do that?
at 028B4E you’ll see 50 00 08 80 29 1C 5A 31
Change that into XX 20 50 43 08 80 C0 46,
where XX is how many times you want the effectiveness to be. (e.g. 03 for FE8 style 3x effectiveness)

Also, if you want something weird like 2.5 times effectiveness, we can put that extra instruction to good use by right shifting by 2. Namely,

mov r0, #EFFECTIVENESS*2
mul r0, r2
asr r0, #0x1
strh r0, [r1]

Which is XX 20 50 43 40 10 08 80

Where XX is effectiveness*2, 05 in this case.

Edit: Prettifying the formatting.

Hey, I actually have something like this somewhere… Blazer made it a while ago for me(or publically, I don’t remember which), but let me upload it anyway.
Basically instead of having a static effectiveness, you can have a varied amount of effectiveness for weapons(x3 for this, x4 for that, x.5 for that, x2 for that, etc). Possibly you can use the notes and source?

Eh, once you know what this routine does, it’s just a matter of looking it up in a table and multiplying by that. Though it’d be interesting to see if he did it in-place or had to repoint it. I wrote this one in place so it’s not intrusive to change it.

edit:

.org 0x028B48
	ldr		r0, =0x09BCDC01
	bx		r0

He did repoint it, which is fair, since it does allow for more flexibility than before.

Error in the original should be 29 1C 5A 31 01 28 07 D1 30 88 EE F7 34 FB 0A 88 XX 20 50 43 08 80 C0 46. Has been updated to reflect this.