Author Topic: [FF7PSX NTSC-U] Enemy long range attack mod  (Read 2466 times)

Bosola

  • Fire hazard!
  • Global moderator
  • No life
  • *
  • Posts: 1755
  • Karma: 15
    • View Profile
    • My YouTube Channel
[FF7PSX NTSC-U] Enemy long range attack mod
« on: 2014-02-12 22:07:20 »
You might not be aware of this, but in the vanilla FFVII, all enemy attacks are treated as short range. This includes attacks that use the 'magical' upper formula and attacks that lack the 'short range' flag. If it's an enemy attack (command type 0x20) and it uses the X1 formula, it's always treated as range-sensitive, with halved damage if either actor or target is in the back.

This might not be desirable. If you're creating a 'rebalance' mod that relies on a few enemy attacks being able to counter the use of the back row, it won't work as you expect. This was the problem I faced for my own PSX rebalance, Rebirth.

As such, and following the discussion here, I've written a little ASM hack to fix this behaviour. As I imagine most users will be modders themselves, I've chosen to distribute this as both a binary patch for the BATTLE.X file, and the assembler itself (for use with ARMIPS). You can download the BATTLE patch here.

Source

The assembler itself is as follows:

Code: [Select]
.open "BATTLE",0x800A0000
.psx

.org 0x800ADA28

.area $9C

//check_long_range_attack
   lw   v1, $0050(a1)
   nop
   andi   v1, v1, $0020
   bgtz   v1, check_self_backrow ; if short range attack, check self/target backrow
   nop
   j   0x800ADAC8 ; else skip to next sub

check_self_backrow:
   lw   v0, $0000(a1)
   nop
   sll   v1, v0, 1
   addu   v1, v1, v0
   sll   v1, v1, 2
   addu   v1, v1, v0
   sll   v1, v1, 3
   lui   at, $8010
   addu   at, at, v1
   lw   v0, $83E4(at)
   lw   v1, $0208(a1) ; start loading word for check_target_backrow (save space)
   andi   v0, v0, $0040 ;v0 now contains self.isBackRow

//check_target_backrow   
   sll   at, v1, 1
   addu   at, at, v1
   sll   at, at, 2
   addu   at, at, v1
   sll   at, at, 3
   lui   v1, $8010
   addu   v1, v1, at ;v1 contains address for lookup
   lw   at, $83E4(v1)
   nop
   andi   v1, at, $0040 ;v1 now contains target.isBackRow

//do_comparison
   or   at, v0, v1
   bgtz   at, reduceDmg ; if target.isBackRow || self.isBackRow, go to reduceDmg branch
   nop
   j   0x000ADAC8 ;skip to next sub
   nop

reduceDmg:
   j   0x000ADABC ; sends to damage reduction subfunction
   nop

.endarea

.close

You will need to use ARMIPS to compile this with a decompressed BATTLE.X, then you'll need to repack with gizp compression and re-add the header bytes to create an X file. The procedure is detailed elsewhere (I'm about to post a thread on it, in fact).

This file was made with the NTSC version, but as I believe the European PAL version uses the same BATTLE.X, it should work fine. I will need to investigate.

I have tested this patch myself, but it's always possible I missed something. If you have any issues, let me know in the thread below.
« Last Edit: 2014-07-17 22:02:55 by Covarr »

Loki_

  • Fast newbie
  • *
  • Posts: 21
  • Karma: 1
    • View Profile
Re: [PSX] Enemy long range attack mod
« Reply #1 on: 2014-03-22 09:52:49 »
Mate i tryed myself but have some issues.. cam you add your code lines for long range mod to ARMs Damage Limit Break patch? here are the files http://www23.zippyshare.com/v/15568068/file.html. Eventually thanks in advance :)

Science Is Bigoted

  • Right Wing Safety Squads
  • Insane poster
  • *
  • Posts: 479
  • Karma: 7
  • I ♥ SCIENCE
    • View Profile
Re: [FF7PSX NTSC-U] Enemy long range attack mod
« Reply #2 on: 2016-06-12 19:44:38 »
Why not upload a PPF file, Bosola?