Little Fighter Empire - Forums
Friendly Fire - Printable Version

+- Little Fighter Empire - Forums (https://lf-empire.de/forum)
+-- Forum: Little Fighter 2 Zone (https://lf-empire.de/forum/forumdisplay.php?fid=7)
+--- Forum: [2.0] Exe Editing (https://lf-empire.de/forum/forumdisplay.php?fid=43)
+--- Thread: Friendly Fire (/showthread.php?tid=9654)



Friendly Fire - Boop - 02-28-2015

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/master/func_417400_does_attack_success.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.


RE: Friendly Fire - A-Man - 02-28-2015

(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.


RE: Friendly Fire - Boop - 02-28-2015

(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.


RE: Friendly Fire - A-Man - 03-01-2015

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.


RE: Friendly Fire - o_g349 - 03-14-2015

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/master/src/class_global.c#L109