Skip to content

Commit

Permalink
Hotfix for wand issue and missing proto 9200 (Bazar of the Bizarre)
Browse files Browse the repository at this point in the history
  • Loading branch information
DudeMcDude committed Apr 11, 2016
1 parent fbe06c9 commit e7d65ea
Show file tree
Hide file tree
Showing 18 changed files with 424 additions and 199 deletions.
2 changes: 2 additions & 0 deletions Infrastructure/elfhash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ uint32_t ElfHash::Hash(const char * text)
}
return hash;
}


8 changes: 4 additions & 4 deletions TemplePlus/action_sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void ActionSequenceSystem::ActSeqGetPicker()
auto tgtClassif = d20Sys.TargetClassification(d20Sys.globD20Action);
if (tgtClassif == D20TargetClassification::D20TC_ItemInteraction)
{
if (d20Sys.d20Defs[d20Sys.globD20Action->d20ActType].flags & D20ADF_Unk8000)
if (d20Sys.d20Defs[d20Sys.globD20Action->d20ActType].flags & D20ADF_UseCursorForPicking)
{
temple::GetRef<int>(0x118A0980) = d20Sys.globD20Action->d20ActType;
temple::GetRef<int>(0x118CD570) = d20Sys.globD20Action->data1;
Expand All @@ -324,7 +324,7 @@ void ActionSequenceSystem::ActSeqGetPicker()

if (tgtClassif == D20TargetClassification::D20TC_SingleIncSelf)
{
if (d20Sys.d20Defs[d20Sys.globD20Action->d20ActType].flags & D20ADF_Unk8000)
if (d20Sys.d20Defs[d20Sys.globD20Action->d20ActType].flags & D20ADF_UseCursorForPicking)
{
temple::GetRef<int>(0x118A0980) = d20Sys.globD20Action->d20ActType;
temple::GetRef<int>(0x118CD570) = d20Sys.globD20Action->data1;
Expand All @@ -347,7 +347,7 @@ void ActionSequenceSystem::ActSeqGetPicker()

if (tgtClassif == D20TargetClassification::D20TC_SingleExcSelf)
{
if (d20Sys.d20Defs[d20Sys.globD20Action->d20ActType].flags & D20ADF_Unk8000)
if (d20Sys.d20Defs[d20Sys.globD20Action->d20ActType].flags & D20ADF_UseCursorForPicking)
{
temple::GetRef<int>(0x118A0980) = d20Sys.globD20Action->d20ActType;
temple::GetRef<int>(0x118CD570) = d20Sys.globD20Action->data1;
Expand Down Expand Up @@ -2259,7 +2259,7 @@ void ActionSequenceSystem::ActionPerform()
} else
{
memcpy(&curSeq->tbStatus, &tbStatus, sizeof(tbStatus));
*(uint32_t*)(&curSeq->tbStatus.tbsFlags) |= (uint32_t)D20CAF_NEED_ANIM_COMPLETED;
*(uint32_t*)(&curSeq->tbStatus.tbsFlags) |= TBSF_AoO;
InterruptCounterspell(d20a);
logger->debug("PerformActions: \t Performing action for {} ({}): {}",
description.getDisplayName(d20a->d20APerformer),
Expand Down
6 changes: 3 additions & 3 deletions TemplePlus/action_sequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ enum TurnBasedStatusFlags : uint32_t
TBSF_Movement = 2,
TBSF_Movement2 = 4,
TBSF_8 = 8,
TBSF_CritterSpell = 0x10,
TBSF_20 = 0x20,
TBSF_CritterSpell = 0x10, // denotes that the spell being cast is actually a critter's natural ability, so don't provoke AoO
TBSF_AoO = 0x20, // denotes that the critter was interrupted by an AoO
TBSF_FullAttack = 0x40,
TBSF_80 = 0x80,
TBSF_100 = 0x100
Expand Down Expand Up @@ -234,7 +234,7 @@ extern ActionSequenceSystem actSeqSys;
struct TurnBasedStatus
{
uint32_t hourglassState; // 4 - full action remaining; 3 - partial?? used in interrupts, checked by partial charge; 2 - single action remaining; 1 - move action remaining
int tbsFlags; // 0x40 full attack, 0x1 0x2 sthg to do with turn ending?, 0x2 0x4 sthg to do with movement, 0x10 spell?
int tbsFlags; // see TurnBasedStatusFlags
uint32_t idxSthg;
float surplusMoveDistance; // is nonzero when you have started a move action already and haven't used it all up
uint32_t baseAttackNumCode; // is composed of the base number of attacks (dispatch 51 or 53) + a code number: 99 for dual wielding (+1 for extra offhand attack), 999 for natural attacks
Expand Down
13 changes: 11 additions & 2 deletions TemplePlus/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,15 @@ void CombatSystemReplacements::CombatTurnAdvance(objHndl obj)
#pragma region Combat System Implementation
LegacyCombatSystem combatSys;

char * LegacyCombatSystem::GetCombatMesLine(int line)
char * LegacyCombatSystem::GetCombatMesLine(int line) const
{
MesLine mesLine;
MesHandle combatMes = *combatSys.combatMesfileIdx;
if (line > 197 && line < 300
|| line > 5104 && line < 6000
|| line > 6016 && line < 7000
|| line > 10104)
combatMes = combatSys.combatMesNew;
combatMes = combatMesNew;

mesLine.key = line;
if (!mesFuncs.GetLine(combatMes, &mesLine))
Expand Down Expand Up @@ -806,6 +807,14 @@ objHndl LegacyCombatSystem::GetWeapon(AttackPacket* attackPacket)
return result;
}

bool LegacyCombatSystem::IsUnarmed(objHndl handle){
if (inventory.ItemWornAt(handle, EquipSlot::WeaponPrimary))
return false;
if (inventory.ItemWornAt(handle, EquipSlot::WeaponSecondary))
return false;
return true;
}

bool LegacyCombatSystem::DisarmCheck(objHndl attacker, objHndl defender, D20Actn* d20a)
{
objHndl attackerWeapon = inventory.ItemWornAt(attacker, 3);
Expand Down
4 changes: 3 additions & 1 deletion TemplePlus/combat.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct LegacyCombatSystem : temple::AddressTable {
MesHandle combatMesNew;
GroupArray * groupInitiativeList;

char * GetCombatMesLine(int line);
char * GetCombatMesLine(int line) const;
void FloatCombatLine(objHndl obj, int line);
void FloatCombatLine(objHndl obj, int line, FloatLineColor floatColor);
int IsWithinReach(objHndl attacker, objHndl target);
Expand All @@ -48,6 +48,7 @@ struct LegacyCombatSystem : temple::AddressTable {
void TurnStart2( int initiativeIdx);
void CombatAdvanceTurn(objHndl obj);
BOOL IsBrawlInProgress();

uint32_t* combatModeActive;
bool isCombatActive();
uint32_t IsCloseToParty(objHndl objHnd);
Expand All @@ -61,6 +62,7 @@ struct LegacyCombatSystem : temple::AddressTable {
*/
int GetEnemiesCanMelee(objHndl obj, objHndl* canMeleeList);
objHndl GetWeapon(AttackPacket* attackPacket);
static bool IsUnarmed(objHndl handle);
bool DisarmCheck(objHndl attacker, objHndl defender, D20Actn* d20a);
bool SunderCheck(objHndl attacker, objHndl defender, D20Actn* d20a);
int GetClosestEnemy(objHndl obj, LocAndOffsets* locOut, objHndl * objOut, float* distOut, int flags);
Expand Down
Loading

0 comments on commit e7d65ea

Please sign in to comment.