Skip to content

The source code of Modified DDraw. An immersive assistant in modifying Little Fighter 2.

License

Notifications You must be signed in to change notification settings

Mesujin/LF2-Modified_DDraw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Modified DDraw ( Immersive Assistant in Modifying LF2 )

Disclaimer, this is just a modification from LF2-AI-ScriptEngine.

Instead of just meant to inject an AI(s) into Little Fighter 2 ( LF2 ), this Modified DDraw (ddraw.dll) is modified to be also meant to inject a function(s) into LF2 while also providing thing(s) for modifying LF2.

By providing a friendlier way to modify LF2, this Modified DDraw serving two way to modify, either with AngelScript moduling ( a buried feature from Original DDraw ) or directly modifying this Modified DDraw with C++. Instead of directly modifying the .exe with Assembly / HEX even though it has its own favor.

Modifying The DDraw

To start modifying, generally you'll need Microsoft Visual Studio, 2019 or higher.

  • Open ddwrapper.sln.
  • Modify things you wanted in ddwrapper.cpp, it's the core of this DDraw.
  • Once done modifying the code, open Build -> Build Solution. Note the Multi / Debug / Release before build it down.

( You'd better to reformat the code to get a better look, if you didn't like/used to my code formatting style. )
( If you're using Visual Studio Code in editing the code, the + feature beside the // should help a lot if you keep my code formatting ).

Modifying With Module

If you're familiar in scripting an AI for LF2 ( or AngelScript language ), then we can talk.

The how to use the .as as a Module instead of an AI-Script is simply by providing "_" as the initial letter, for example _230.as, and then Modified DDraw will use it as a Module instead of AI-Script.
( You can name the Module with text, but naming the Module with an ID of an Object is highly recommended because unlike AI-Script which are specified to an ID, a Module is a global usage. )

In AI-Script, the main function to be used is known as void id() and int ego(), but in Module, the main function is different, which is ;

  • void core()
    will be called for once, when you run LF2.
    Note that you may not call anything from game class in this function.
  • void play()
    will be called when entering a new battle. Note that play() is called before init() or once() is called.
  • void init() / void once()
    will be called for once, when initialization time is come. Both init() and once() are mainly the same, but unlike init(), once() won't be called again if the Module is being rebuilded on runtime.
  • void main()
    will be called for every time unit ( TU ).
  • void mids()
    will be called for every TU but in the middle of TU.
  • void last()
    will be called for every TU but at the end of TU.
  • void fins()
    will be called when exiting a battle.

( In the current version, mids() and last() are still be called just after the main() is called, but it's still worthy for last priority usage )

The other aspect is remain the same except self class and target class isn't exist and most of the value in game class is modifable, for example : game.objects[0].hp = 0; is allowed in Module.

There's also some new things comes within it, which ;

  • int32 Module_ID
    which is the number in the Module's filename. ( 0 if the filename is non-numeric )
  • uint32 Get_ID_Data(int32 Object_ID)
    which will return the in-game Data address of an object. ( return 4294967295 on fail )
  • void Copy_Frame(uint32 Object_Data, uint32 Frame1, uint32 Frame2)
    which are used to copy datas in Frame1 to Frame2.
  • void Copy_Data_Frame(uint32 Object_Data1, uint32 Object_Data2, uint32 Frame1, uint32 Frame2)
    which are used to copy datas in Frame1 to Frame2 from different Data.

And some basic stuff ;

  • uint32 Maximum_Frame
    return the maximum Frame, normally it's 400, but you might want to use this for the compatibility of your script.
  • uint32 Maximum_Object
    return the maximum number of Object, normally it's 400, ...
  • int32 Maximum_MP
    return the maximum Mana Point ( MP ), normally it's 500, ...

Note that these things is a member of ENGINE, so it'll look like this Engine.Module_ID. ( Afterall, if you feels these names is way to long, you can use a pointer to short it down. )

Do note that Moduling has a priority in which supposed to be called first ...




About Little Fighter 2 (LF2) : https://lf2.net

About AngelScript : https://www.angelcode.com/angelscript

Credits (Original DDraw) : Doix, Some1Lse, zort, and everyone else who have an effort in it.
Credits (Modified DDraw) : Mesujin.

About

The source code of Modified DDraw. An immersive assistant in modifying Little Fighter 2.

Topics

Resources

License

Stars

Watchers

Forks