Skip to content

Commit

Permalink
CheckIfTrig bin exact (#636)
Browse files Browse the repository at this point in the history
* CheckIfTrig bin exact

* CheckIfTrig bin exact suggestion #1

Co-Authored-By: qndel <stefan551@o2.pl>

* CheckIfTrig bin exact suggestion #2

Co-Authored-By: qndel <stefan551@o2.pl>
  • Loading branch information
qndel authored and mewmew committed Mar 14, 2019
1 parent 0f95e48 commit 2525f5b
Showing 1 changed file with 5 additions and 22 deletions.
27 changes: 5 additions & 22 deletions Source/missiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2180,30 +2180,13 @@ void __fastcall AddWeapexp(int mi, int sx, int sy, int dx, int dy, int midir, in

BOOL __fastcall CheckIfTrig(int x, int y)
{
int v2; // edi
int v3; // ebx
int *v4; // esi
int v5; // eax
int v7; // [esp+Ch] [ebp-4h]
int i;

v7 = 0;
v2 = y;
v3 = x;
if (trigflag[4] <= 0)
return 0;
v4 = &trigs[0]._ty;
while (1) {
v5 = *(v4 - 1);
if (v3 == v5 && v2 == *v4)
break;
if (abs(v5 - v3) < 2 && abs(*v4 - v2) < 2)
break;
++v7;
v4 += 4;
if (v7 >= trigflag[4])
return 0;
for (i = 0; i < trigflag[4]; i++){
if ((x == trigs[i]._tx && y == trigs[i]._ty) || (abs(trigs[i]._tx - x) < 2 && abs(trigs[i]._ty - y) < 2))
return TRUE;
}
return 1;
return FALSE;
}

void __fastcall AddTown(int mi, int sx, int sy, int dx, int dy, int midir, int mienemy, int id, int dam)
Expand Down

0 comments on commit 2525f5b

Please sign in to comment.