Skip to content

Commit

Permalink
Max battlemap size (EOP V4)
Browse files Browse the repository at this point in the history
  • Loading branch information
EddieEldridge committed Sep 30, 2024
1 parent 0f19800 commit 3ea4605
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions M2TWEOP Code/M2TWEOP library/dataOffsets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void dataOffsets::initDataOffsets(int gameVer)
offsets.saveGameHandler = 0x02C649BC;
offsets.ancLimit = 0x005A57CD;
offsets.maxUnitSize = 0x008ef381;
offsets.battleMapSize = 0x00441335;
offsets.maxBgSize1 = 0x008ebd95;
offsets.maxBgSize2 = 0x008ebd9a;
offsets.unlockConsoleCommands1 = 0x00d2d763;
Expand Down Expand Up @@ -170,6 +171,7 @@ void dataOffsets::initDataOffsets(int gameVer)
offsets.saveGameHandler = 0x02C1B904;
offsets.ancLimit = 0x005A5CAD;
offsets.maxUnitSize = 0x008efe01;
offsets.battleMapSize = 0x00441675;
offsets.maxBgSize1 = 0x008ec815;
offsets.maxBgSize2 = 0x008ec81a;
offsets.unlockConsoleCommands1 = 0x00d27ae3;
Expand Down
1 change: 1 addition & 0 deletions M2TWEOP Code/M2TWEOP library/dataOffsets.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class dataOffsets
DWORD saveGameHandler = NULL;
DWORD ancLimit = NULL;
DWORD maxUnitSize = NULL;
DWORD battleMapSize = NULL;
DWORD maxBgSize1 = NULL;
DWORD maxBgSize2 = NULL;
DWORD unlockConsoleCommands1 = NULL;
Expand Down
10 changes: 10 additions & 0 deletions M2TWEOP Code/M2TWEOP library/luaPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,16 @@ sol::state* luaPlugin::init(std::string& luaFilePath, std::string& modPath)
*/
tables.M2TWEOP.set_function("setMaxBgSize", &gameHelpers::setMaxBgSize);

/***
Sets the new max size of battlemaps.
@function M2TWEOP.setBattlemapSize
@tparam int x
@tparam int y
@usage
M2TWEOP.setBattlemapSize(500,500);
*/
tables.M2TWEOP.set_function("setBattlemapSize", &gameHelpers::setMaxBgSize);

/***
Sets the new maximum soldier count.
@function M2TWEOP.setEDUUnitsSize
Expand Down
8 changes: 8 additions & 0 deletions M2TWEOP Code/M2TWEOP library/types/gameHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,14 @@ namespace gameHelpers
MemWork::WriteData(&size, cmpAdr, 1);
MemWork::WriteData(&size, retAdr, 1);
}

void setBattlemapSize(signed short x, signed short y)
{
DWORD codeOffset = dataOffsets::offsets.battleMapSize;

MemWork::WriteData(&x, codeOffset, 0x00000080);
MemWork::WriteData(&y, codeOffset, 0x0000007C);
}

gameDataAllStruct* getGameDataAll()
{
Expand Down
1 change: 1 addition & 0 deletions M2TWEOP Code/M2TWEOP library/types/gameHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ namespace gameHelpers
void setAncLimit(uint8_t limit);
void setMaxUnitSize(signed short min, signed short max);
void setMaxBgSize(unsigned char size);
void setBattlemapSize(signed short x, signed short y);
void unlockConsoleCommands();
void toggleUnitHighlight();
void setReligionsLimit(unsigned char limit);
Expand Down

0 comments on commit 3ea4605

Please sign in to comment.