From 1f7ee179f3c0955fef4e825f8e3d9429dd63a872 Mon Sep 17 00:00:00 2001 From: FynnTW Date: Mon, 10 Jun 2024 01:17:54 +0300 Subject: [PATCH] Release: M2TWEOP-3.3.0 --- .../M2TWEOP Common/m2tweopConstData.h | 2 +- M2TWEOP-luaPlugin/luaPlugin/gameHelpers.cpp | 16 ++++++ M2TWEOP-luaPlugin/luaPlugin/gameHelpers.h | 2 + M2TWEOP-luaPlugin/luaPlugin/luaP.cpp | 18 ++++++ .../releaseInfo/releaseDescription.md | 55 +++++++++++++++++-- 5 files changed, 88 insertions(+), 5 deletions(-) diff --git a/M2TWEOP Code/M2TWEOP Common/m2tweopConstData.h b/M2TWEOP Code/M2TWEOP Common/m2tweopConstData.h index 107fd401..2db7c812 100644 --- a/M2TWEOP Code/M2TWEOP Common/m2tweopConstData.h +++ b/M2TWEOP Code/M2TWEOP Common/m2tweopConstData.h @@ -1,5 +1,5 @@ #pragma once namespace eopConstData { - const char eopVersionName[] = "M2TWEOP-3.2.0"; + const char eopVersionName[] = "M2TWEOP-3.3.0"; } \ No newline at end of file diff --git a/M2TWEOP-luaPlugin/luaPlugin/gameHelpers.cpp b/M2TWEOP-luaPlugin/luaPlugin/gameHelpers.cpp index bd9451ba..1c7b4be1 100644 --- a/M2TWEOP-luaPlugin/luaPlugin/gameHelpers.cpp +++ b/M2TWEOP-luaPlugin/luaPlugin/gameHelpers.cpp @@ -121,6 +121,22 @@ namespace gameHelpers return region->forts[index]; } + campaignDb* getCampaignDb() + { + DWORD offset = 0x0161E7E4; + if (m2tweopHelpers::getGameVersion() == 1) + offset = 0x16666BC; + return reinterpret_cast(offset); + } + + campaignDbExtra* getCampaignDbExtra() + { + DWORD offset = 0x0186170C; + if (m2tweopHelpers::getGameVersion() == 1) + offset = 0x18AA87C; + return reinterpret_cast(offset); + } + watchTowerStruct* gameHelpers::getWatchtower(const regionStruct* region, const int index) { return region->watchtowers[index]; diff --git a/M2TWEOP-luaPlugin/luaPlugin/gameHelpers.h b/M2TWEOP-luaPlugin/luaPlugin/gameHelpers.h index 5057aa92..7cf270c2 100644 --- a/M2TWEOP-luaPlugin/luaPlugin/gameHelpers.h +++ b/M2TWEOP-luaPlugin/luaPlugin/gameHelpers.h @@ -114,6 +114,8 @@ namespace gameHelpers coordPair* convertTileCoords(DWORD arrayIndex); int getTileX(const oneTile* tile); int getTileY(const oneTile* tile); + campaignDbExtra* getCampaignDbExtra(); + campaignDb* getCampaignDb(); seaConnectedRegion* getSeaConnectedRegion(const regionStruct* region, const int index); seaConnectedRegion* getSeaImportRegion(const regionStruct* region, const int index); oneTile* getRegionSeaEdge(const regionStruct* region, const int index); diff --git a/M2TWEOP-luaPlugin/luaPlugin/luaP.cpp b/M2TWEOP-luaPlugin/luaPlugin/luaP.cpp index a59fc2aa..51a21565 100644 --- a/M2TWEOP-luaPlugin/luaPlugin/luaP.cpp +++ b/M2TWEOP-luaPlugin/luaPlugin/luaP.cpp @@ -252,6 +252,8 @@ sol::state* luaP::init(std::string& luaFilePath, std::string& modPath) @tfield setConversionLvlFromCity setConversionLvlFromCity @tfield loadGame loadGame @tfield logGame logGame + @tfield getCampaignDb getCampaignDb + @tfield getCampaignDbExtra getCampaignDbExtra @table M2TWEOP */ @@ -680,6 +682,22 @@ sol::state* luaP::init(std::string& luaFilePath, std::string& modPath) */ tables.M2TWEOPTable.set_function("getCampaignDifficulty2", &m2tweopHelpers::getCampaignDifficulty2); /*** + Get the campaign options. + @function M2TWEOP.getCampaignDb + @treturn campaignDb options + @usage + local options = M2TWEOP.getCampaignDb(); + */ + tables.M2TWEOPTable.set_function("getCampaignDb", &gameHelpers::getCampaignDb); + /*** + Get the campaign options. + @function M2TWEOP.getCampaignDbExtra + @treturn campaignDbExtra options + @usage + local options = M2TWEOP.getCampaignDbExtra(); + */ + tables.M2TWEOPTable.set_function("getCampaignDbExtra", &gameHelpers::getCampaignDbExtra); + /*** Check game condition. @function M2TWEOP.condition @tparam string condition diff --git a/documentationGenerator/releaseInfo/releaseDescription.md b/documentationGenerator/releaseInfo/releaseDescription.md index 4e008467..6509f76a 100644 --- a/documentationGenerator/releaseInfo/releaseDescription.md +++ b/documentationGenerator/releaseInfo/releaseDescription.md @@ -5,23 +5,70 @@ [![Build Status](https://img.shields.io/github/v/release/youneuoy/M2TWEOP-library?label=Download&style=for-the-badge)](#download) ## **Release Notes** +***NOTE : NOT SAVEGAME COMPATIBLE!!!!*** - + +(all changes by Fynn) +### **Library** +- Increased culture limit to 31. NOTE: the 8th culture (index 7) is NOT valid and you need to place a dummy culture there you won't actually use. +- Do not use cultures over limit in offmap_models file, event_bodies and sound files. +- Added ability to use EOP units in custom battle. +- Added ability to use EOP units in game files like export_descr_buildings, descr_strat, descr_rebel_factions etc +- Can spawn EOP units by name instead of index. (Both this and using in game files only works for file-added EOP units) +- EOP unit type names need to be unique now. +- Fixed maintain option for siegeSettlement/siegeFort. +- Fixed "random_name" in spawnArmy +- Fixed armies not attacking in sieges with Elephants in their army. +- Fixed elephant artillery not attacking gates. +- Fixed crashes relating to EOP mercenaries. + ### **Lua Plugin** - [Added new `mapImage` struct](https://youneuoy.github.io/M2TWEOP-library/_static/LuaLib/index.html#mapImage) - Enables users to render their own versions of the campaign strategy map - Includes options for filling certain tiles and regions with color and blurring options for smoothing out jagged lines -- Expanded `coords` to `xCoord` and `yCoord` in the `tileStruct` +- Added all the unit actions that were possible to execute in campaign_script, and expanded the unit struct. +- Added get unit by label +- Added 2 extra unit functions: Attack building and collect engine. +- Added unit groups, getting group by label, defining groups, and every script function relating to groups. +- Added siegeEngine struct and ability to get all engines in battle or get the engine a unit is carrying. +- Fixed checking if unit/eduEntry has an attribute. +- Added creating watchtowers. +- Added all character stratmap actions, diplomacy, spying, assassination, blockading, sabotage etc +- Added ability to split armies, disembark and embark on ships. +- Added ability to merge by movement instead of by teleportation. +- Added new functions to switch a characters or fort faction, and added option to convert the settlement garrison when switching a settlement's faction. +- Added loading saves. +- Added function to log something to game log (flushes log immediately). +- Expanded EDU entry struct, and added ability to get localized name, description. +- CreateFortXY does not cost money any more, and both fort construction functions now will always work even if you have buildable forts off. +- Expanded `coords` to `xCoord` and `yCoord` in the `tileStruct` and added many new fields. - Added `aiFaction` to `factionStruct` - Fixed `battleBuilding:getBuilding()` returning the wrong thing - Fixed a bug where right clicking an EOP unit in the building description would do nothing +- Added ability to get the character/settlement/fort the cursor is hovering over. +- Added getting merc pool by name. +- Added global roads db to campaign struct. +- Fixed setting diplomatic stances and getting them. +- Added sending characters off map through lua. +- Added ability to get various info on the battlemap, like height at any point, street deployment positions, hill positions, terrain lines, zones etc. +- Added get culture/climate id by name, and getting their name by id. +- Added recruitment queue info +- Added ability to check all the available construction/recruitment items in a settlement and add them to the queue. +- Added ability to see which unit/building is being looked at in the info scroll. +- Added all the options from the campaign DB. +- Many new fields in many structs. + + +### **ImGUI** +- Added all the drawList functions to draw stuff on the screen. +- Added optional extra parameters to image to draw only parts of it. - +NOT SAVEGAME COMPATIBLE!!!! -### **Documentation** + ### **Links** - [Known Bugs](https://github.com/youneuoy/M2TWEOP-library/issues/71)