RoseKavalier,
Try to use era.h
https://gofile.io/d/KXWJqA
Example of language file can be found in Era II\Mods\WoG\Lang\era.json
Code:
{
"era": {
"global_scripts_vs_map_scripts_warning": "{Skip global scripts?}\n\nThe map has its own set of ERM scripts. Do you wish to skip loading global ERM scripts (they may cause errors, if map was not intended to be played with other ERM scripts)?",
"no_memory_for_erm_optimization": "Sorry, but compiled ERM scripts size exceeds @limit@ MB limit. ERM optimization failed. ERM will be disabled"
}
}
Calling tr('era.no_memory_for_erm_optimization') will return std::string with translation in ANSI (current active page) encoding (json files use UTF-8). String can be stored anywere and .c_str() method returns null terminated string pointer then.
If you need parameters in string, you can write in json:
"no_memory_for_erm_optimization": "There are only @mem_free@ MB left"
And call something like tr('era.no_memory_for_erm_optimization', { "mem_free", IntToStr(100) });
Quote:how is it handled by the game - unicode? utf8?
Json are in UTF-8. Era translation API always returns ANSI version.
RoseKavalier, there is no tactical phase in BattleHeroes. All player actions occur between BG1 and BG0.
If it is possible to update the queue when updating the battlefield via !!BU:R, it will be great.
Code:
BG0 - event before stack action
BG1 - event after stack action when another stack already obtained turn
BACall3 in ERM.
{0x473F6B,0,DP(Monster2Battle)}, // hook address
void _MonsterAfterBattle(void)
{
__asm pusha
//asm int 3
_EAX(MAB_ret);
#include "templ.h"
if((*(int *)&((Byte *)M2B_BatMan)[0x132F8])==1){
// for(int i=0;i<(21*2);i++) *(Dword *)&M2B_BatMan[0x54CC+0x548*i+0x84]|=0x00200000;
CheckForAliveNPCAfterBattle((Byte *)M2B_BatMan);
MAB_ret=2;
}
// BACall3(1,*(int *)&((Byte *)M2B_BatMan)[0x13D6C]);
BACall3(1,BACall_Day);
STOP
__asm popa
__asm mov eax,MAB_ret
}
void __stdcall Monster2Battle(Dword Pv2,Dword Pv1)
{
_ECX(M2B_BatMan);
_Monster2Battle();
#include "templ.h"
__asm push Pv1
__asm push Pv2
__asm mov ecx,M2B_BatMan
__asm mov eax,0x4786B0
__asm call eax
STOP
_MonsterAfterBattle();
}
BU:R — redraw battlefield, executes:
Code:
void RedrawBF(void)
{
#include "templ.h"
__asm{
mov ecx,0x699420 //-> CombatManager
mov ecx,[ecx]
push 0
push -1
mov eax,0x468570
call eax
}
RETURNV
}