Little Fighter Empire - Forums

Full Version: Friendly Fire
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Friendly fire: [attachment=3317]

How it works. There is a check which checks if you are on the same team as the object with the itr you are getting "hit" by. Pretty obvious. Assembly:

Code:
CPU Disasm
Address   Hex dump          Command                                  Comments
004177C4  |.  8B85 64030000 MOV EAX,DWORD PTR SS:[EBP+364]
004177CA  |.  3B83 64030000 CMP EAX,DWORD PTR DS:[EBX+364]
004177D0      0F85 90000000 JNE 00417866


JNE = jump if not equal. This exe replaces that JNE with a JMP, so it makes the game think all objects are always on separate teams.

Thanks to xsoameix for reverse engineering the giant "process_attack" function here: https://github.com/xsoameix/lf2/blob/mas...ss.rb#L506

And to Zort for bringing it up on IRC.


Friendly fire 2:
[attachment=3318]

So in the first one, you could hit yourself with your own projectiles. That was cool but kind of broke firen and freeze as they would hit them selves with the explosion and tornado which kinda made them stupidly weak. This version works by changing the comparison to check if the "owner" is the same rather than the team. i.e (notcie the 354 instead of 364 :P):

Code:
CPU Disasm
Address   Hex dump          Command                                  Comments
004177C4  |.  8B85 64030000 MOV EAX,DWORD PTR SS:[EBP+354]
004177CA  |.  3B83 64030000 CMP EAX,DWORD PTR DS:[EBX+354]
004177D0      0F85 90000000 JNE 00417866


Edit 3:

They are probably both broken in different ways. Too lazy to think about the best way of fixing them.
(02-28-2015, 03:42 PM)Lord Silva Wrote: [ -> ]They are probably both broken in different ways. Too lazy to think about the best way of fixing them.
Perhaps have it be an itr kind :P. Could try doing it if you won't.
(02-28-2015, 06:07 PM)Doctor A Wrote: [ -> ]
(02-28-2015, 03:42 PM)Lord Silva Wrote: [ -> ]They are probably both broken in different ways. Too lazy to think about the best way of fixing them.
Perhaps have it be an itr kind :P. Could try doing it if you won't.

Then you have to modify data. The goal is to make friendly fire "just work", then maybe make it toggle-able or something.
Oh well. The only way I can see it working flawlessly is to add these attacks' ball as exceptions in the code. How hard would it be to implement a simple fstream reading procedure with asm? I thought maybe these exception ids could be placed in a text file.
I have translated the original assembly code to C and have tested it, so you can change the logic more easily and safely.
All you need to do is that edit this line, and run it:
https://github.com/xsoameix/openlf2/blob...bal.c#L109