Skip to content

Commit

Permalink
Fixed zero bonus line printing with the extended bonus.mes file
Browse files Browse the repository at this point in the history
  • Loading branch information
DMD authored and DMD committed Feb 9, 2018
1 parent 8fecd8e commit 17a22ab
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
8 changes: 8 additions & 0 deletions TemplePlus/bonus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class BonusSysReplacements : public TempleFix
{
public:

static void _GetLine_BonusMes_Hook(MesHandle bonusMesHandle, MesLine & line);

void apply() override
{
OrgBonusInit = (int(__cdecl *)())replaceFunction(0x100E5EB0, BonusMesInit);
Expand All @@ -26,6 +28,8 @@ class BonusSysReplacements : public TempleFix
replaceFunction(0x100E6380, _zeroBonusSetMeslineNum);
replaceFunction(0x100E61A0, _bonusSetOverallCap);

redirectCall(0x100E6786, _GetLine_BonusMes_Hook); // replace call to GetLine_Safe inside bonusPrintString (0x100E6740). Fixes missing line errors for "zero bonus reason" lines.

}
} bonusSystemReplacements;

Expand Down Expand Up @@ -258,3 +262,7 @@ uint32_t _bonusSetOverallCap(uint32_t bonFlags, BonusList* bonList, int32_t newC
return bonusSys.bonusSetOverallCap(bonFlags, bonList, newCap, a4, bonMesLineNum, capDescr);
}
#pragma endregion

void BonusSysReplacements::_GetLine_BonusMes_Hook(MesHandle bonusMesHandle, MesLine & line){
bonusSys.GetBonusMesLine(line);
}
14 changes: 8 additions & 6 deletions TemplePlus/history.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ struct HistorySystem : temple::AddressTable
{
int32_t(__cdecl * RollHistoryAdd)(HistoryEntry * hist);
// todo: the annoying AppendHistoryId
int RollHistoryAddType6OpposedCheck(objHndl attacker, objHndl defender, int attackerRoll, int defenderRoll, BonusList* attackerBonlist, BonusList* defenderBonlist, int combatMesLineTitle, int combatMesLineResult, int sthg); // 10047F70
int RollHistoryAddType6OpposedCheck(objHndl attacker, objHndl defender, int attackerRoll, int defenderRoll, BonusList* attackerBonlist, BonusList* defenderBonlist, int combatMesLineTitle, int combatMesLineResult, int sthg); // 10047F70 Opposed Check Roll
int CreateRollHistoryString(int histId);// 100DFFF0
HistorySystem();
int CreateRollHistoryLineFromMesfile(int historyMesLine, objHndl obj, objHndl obj2);
int RollHistoryType4Add(objHndl obj, int dc, const char* text, uint32_t dicePacked, int d20RollRes, BonusList* bonlist);
int RollHistoryType7Add(objHndl obj, BonusList* bonlist, int line, int unk);
int RollHistoryType0Add(int RollResult, int unk, objHndl Obj, objHndl Obj2, BonusList* Bonlist, BonusList* Bonlist2, D20CAF flags);
int RollHistoryType5Add(objHndl obj, objHndl tgt, int defenderMissChance, int combatMesLine, int missChanceRoll, int combatMesLineResult, int combatMesLineCheckType);

int RollHistoryType4Add(objHndl obj, int dc, const char* text, uint32_t dicePacked, int d20RollRes, BonusList* bonlist); // MiscCheckRoll
int RollHistoryType7Add(objHndl obj, BonusList* bonlist, int line, int unk); // Misc Bonus
int RollHistoryType0Add(int RollResult, int unk, objHndl Obj, objHndl Obj2, BonusList* Bonlist, BonusList* Bonlist2, D20CAF flags); // Attack roll
int RollHistoryType5Add(objHndl obj, objHndl tgt, int defenderMissChance, int combatMesLine, int missChanceRoll, int combatMesLineResult, int combatMesLineCheckType); // Percent Chance Roll
// 1 - Damage Roll
// 2 - Skill Roll
// 3 - Saving Throw


static void CreateFromFreeText(const char *);
Expand Down
2 changes: 1 addition & 1 deletion TemplePlus/ui/ui_pc_creation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ struct ChargenSystem{ // incomplete
void(__cdecl *hide)();
void(__cdecl *show)();
int(__cdecl *checkComplete)(); // checks if the char editing stage is complete (thus allowing you to move on to the next stage). This is checked at every render call.
int field24;
void(__cdecl* finalize)(CharEditorSelectionPacket & charSpec, objHndl & handle);
void(__cdecl *buttonExited)();
};

Expand Down

0 comments on commit 17a22ab

Please sign in to comment.