Skip to content

Commit

Permalink
Merge pull request #456 from GrognardsFromHell/SA_bugfix
Browse files Browse the repository at this point in the history
Sa bugfix
  • Loading branch information
DudeMcDude authored Jan 15, 2021
2 parents 45f56b1 + 1c80bbf commit f033cd7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
20 changes: 18 additions & 2 deletions TemplePlus/action_sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2209,7 +2209,18 @@ int32_t ActionSequenceSystem::InterruptNonCounterspell(D20Actn* d20a)

int32_t ActionSequenceSystem::InterruptCounterspell(D20Actn* d20a)
{
uint32_t result = 0;
auto result = FALSE;

for (auto rdyAction = ReadiedActionGetNext(nullptr, d20a);
rdyAction!= nullptr; rdyAction = ReadiedActionGetNext(rdyAction, d20a)) {
if (rdyAction->readyType == ReadyVsTypeEnum::RV_Counterspell) {
InterruptSwitchActionSequence(rdyAction);
result = TRUE;
}
}

return result;
/*uint32_t result = 0;
__asm{
push esi;
push ecx;
Expand All @@ -2223,7 +2234,7 @@ int32_t ActionSequenceSystem::InterruptCounterspell(D20Actn* d20a)
pop ecx;
pop esi;
}
return result;
return result;*/

}

Expand Down Expand Up @@ -2314,6 +2325,11 @@ ReadiedActionPacket* ActionSequenceSystem::ReadiedActionGetNext(ReadiedActionPac

void ActionSequenceSystem::InterruptSwitchActionSequence(ReadiedActionPacket* readiedAction)
{
if (!readiedAction->interrupter) {
logger->error("InterruptSwitchActionSequence: Null objHnd! Aborting.");
return;
}

if (readiedAction->readyType == RV_Counterspell)
return addresses.Counterspell_sthg(readiedAction);

Expand Down
5 changes: 4 additions & 1 deletion TemplePlus/tig/tig_mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,13 @@ void MouseFuncs::SetPos(int x, int y, int wheelDelta)
auto& mouseLastChange = temple::GetRef<int>(0x10D251C4);
auto systemTime = temple::GetRef<int>(0x11E74578);



static int slowMoveRefX = mouseState->x, slowMoveRefY = mouseState->y;

auto slowMoveDelta = abs(x - slowMoveRefX) + abs(y - slowMoveRefY);
auto timeDeltaMs = systemTime - mouseLastChange;
// systemTime += 2793682137;
auto timeDeltaMs = abs(systemTime - mouseLastChange); // abs delta in case the time stamp is above the integer limit
if (x != mouseState->x || y != mouseState->y ) {
mouseIsStatic = 0;
//if (slowMoveDelta > 0) { // this was the effective vanilla condition
Expand Down

0 comments on commit f033cd7

Please sign in to comment.