mekhanoidy-tools/examples/mods/aim1_community_fix/my_mod.cpp
2024-02-12 21:40:20 +03:00

166 lines
6.1 KiB
C++

/*
name: aim_mod_maker
c++: 23
deps: pub.lzwdgc.Polygon4.Tools.aim1_mod_maker-master
*/
/*
* Put this file near aim.exe.
* Invoke mod creation using the following command:
* sw run my_mod.cpp
* You can run the modded game now.
* You can also distribute mod archive (requires 7z program).
**/
#define AIM_TYPES_FILE_NAME "aim.exe.h"
#define INJECTIONS_FILE_NAME "aim.exe.fixes.h"
#ifndef INJECTED_DLL
#include "aim1_mod_maker.h"
// patch note: Authors and Credits
// patch note: lz, Solant, Streef
// patch note:
// patch note: Description
// patch note: This mod fixes some issues with the original AIM v1.06 (DRM-free) (1.0.6.3) game.
// patch note:
// patch note: Installation
// patch note: Unpack and drop all files near original aim.exe. Replace files if necessary.
// patch note:
int main(int argc, char *argv[]) {
mod_maker mod;
mod.files_to_distribute.insert(INJECTIONS_FILE_NAME);
mod.files_to_distribute.insert(AIM_TYPES_FILE_NAME);
// patch note: enable double weap gliders (still have many bugs related)
mod.make_injection(0x004072FA); // can trade for buy purposes
mod.make_injection(0x004D62E4); // setup proper weapon slots for a glider
mod.make_injection(0x00417A6D); // put weapon into the right slot after purchase
mod.make_injection(0x004176BC); // sell correct weapon
mod.make_injection(0x004067C4); // empty light weap
mod.make_injection(0x0040688B); // empty heavy weap
// patch note: CHANGES
// patch note:
// patch note: General Notes
// patch note: enabled free camera (use F3 key) (Solant)
mod.enable_free_camera();
// patch note: enabled WIN key during the game (Solant)
mod.enable_win_key();
// patch note:
// patch note: Volcano Sector
// patch note: rename second FINSWIL-1 to FINSWIL-3 to make this group appear on the map (Streef)
mod.patch<uint8_t>("location4.mmo", 0x7F599, 0x31, 0x33);
// patch note: make SWIRE appear (Streef)
mod.patch<uint8_t>("location4.mmo", 0x7FA34, 1, 0);
// patch note: make SWILHUN appear (Streef)
mod.patch<uint8_t>("location4.mmo", 0x7F913, 1, 0);
// patch note: reposition SWILHUN-3 group (Streef)
mod.patch<uint8_t>("location4.mmo", 0x7F528, 0x40, 0xB1);
// patch note: reposition SWILHUN-1 group (Streef)
mod.patch<uint8_t>("location4.mmo", 0x7EE62, 0xA1, 0xA0);
// patch note:
// patch note: Desert Sector
// patch note: reposition SACREFI-2 (Streef)
mod.patch<uint8_t>("location5.mmo", 0xBAFF7, 0x18, 0x17);
// patch note: fix 'TOV_POLYMER_PLATE' spawn (Streef)
mod.replace("location5.scr", "TOV_POLYMER_PLATES", "TOV_POLYMER_PLATE");
// patch note:
// patch note: Hills Sector
// patch note: set correct model for a plant (Streef)
mod.patch<uint8_t>("location6.mmo", 0x575DD, 'R', 'F');
// patch note: fix 'TOV_POLYMER_PLATE' spawn (Streef)
mod.replace("location6.scr", "TOV_POLYMER_PLATES", "TOV_POLYMER_PLATE");
// patch note:
// patch note: Script Changes
// patch note: fix joining First Ones having one of four required gliders (lz, Streef)
mod.replace("ORG_FIRST.scr",
"IF(_PLAYERHAS(GL_M3_A_FIRST1)||_PLAYERHAS(GL_M3_A_FIRST1))",
"IF(_ISGLIDER(GL_M3_A_FIRST1)|_ISGLIDER(GL_M3_A_FIRST2))");
mod.replace("ORG_FIRST.scr",
"IF(_PLAYERHAS(GL_M4_A_FIRST1)||_PLAYERHAS(GL_M4_A_FIRST1))",
"IF(_ISGLIDER(GL_M4_S_FIRST1)|_ISGLIDER(GL_M4_S_FIRST2))");
// patch note: fix joining Sinigr having one of two required gliders (lz, Streef)
mod.replace("ORG_SINIGR.scr",
"IF(_PLAYERHAS(GL_S2_PA_SINYGR)|_PLAYERHAS(GL_S4_S_SINYGR))",
"IF(_ISGLIDER(GL_S2_PA_SINYGR)|_ISGLIDER(GL_S4_S_SINYGR))");
// patch note: _ISGLIDER() function can check exact glider name now, for example _ISGLIDER(GL_M3_A_FIRST1) (lz)
mod.make_injection(0x0043A1F6, 10);
//
// end of scripts section
// patch note:
mod.replace("Script/bin/B_L1_BASE1.scr", "_ADDBALANCE(300)", R"(
_ADDBALANCE(300 )
_ADDOBJECT(GL_S3_PS_FINDER1)
_ADDOBJECT(EQP_VACUUM_DRIVE_S3)
_ADDOBJECT(EQP_ZERO_ARMOR_S3)
_ADDOBJECT(EQP_SHIELD_GENERATOR4_S3)
//_ADDOBJECT(GL_M4_S_FIRST2)
//_ADDOBJECT(EQP_VACUUM_DRIVE_S4)
//_ADDOBJECT(EQP_MEZON_REACTOR_S4)
//_ADDOBJECT(EQP_GLUON_REACTOR_S1)
//_ADDOBJECT(EQP_ZERO_ARMOR_S4)
//_ADDOBJECT(EQP_SHIELD_GENERATOR4_S4)
//_ADDOBJECT(GUN_MICROWAVE_OSCILLATOR)
//_ADDOBJECT(GUN_RAILGUN)
_ADDRATING(300000000)
_ADDBALANCE(30000000)
_SETEVENT(SECTOR1.VISIT)
_SETEVENT(SECTOR1.ACCESS)
_SETEVENT(SECTOR2.VISIT)
_SETEVENT(SECTOR2.ACCESS)
_SETEVENT(SECTOR3.VISIT)
_SETEVENT(SECTOR3.ACCESS)
_SETEVENT(SECTOR4.VISIT)
_SETEVENT(SECTOR4.ACCESS)
_SETEVENT(SECTOR5.VISIT)
_SETEVENT(SECTOR5.ACCESS)
_SETEVENT(SECTOR6.VISIT)
_SETEVENT(SECTOR6.ACCESS)
_SETEVENT(SECTOR7.VISIT)
_SETEVENT(SECTOR7.ACCESS)
//_SETEVENT(SECTOR8.VISIT)
_SETEVENT(SECTOR8.ACCESS)
)");
// patch note: Release Manager
// patch note: lz
// patch note:
// patch note: Have fun!
mod.apply();
// patch note:
// patch note: References and Links
// patch note: * Polygon-4 Project page https://github.com/aimrebirth
// patch note: * Tools and Utilities https://github.com/aimrebirth/tools
// patch note: * Custom mod example https://github.com/aimrebirth/tools/blob/master/examples/my_mod.cpp
// discord (can expire)? telegram group?
// patch note:
// patch note: Hacking Section
// patch note: If you want to build your own mod based on this, follow the next steps:
// patch note: * Install the latest Visual Studio or Build Tools https://visualstudio.microsoft.com/downloads/
// patch note: * Download and unpack sw tool into the PATH https://software-network.org/client/
// patch note: * (Optional) You may also need archives '7z' tool installed and visible in PATH.
// patch note: * Run the following command from console (fix the according cpp filename):
// patch note: * sw run modname.cpp
// patch note: After this step the archive with your mod (modname.zip) will be created.
// patch note:
return 0;
}
#else // INJECTED_DLL
#include INJECTIONS_FILE_NAME
#endif