Skip to content

Commit

Permalink
#368 GBA T-Rex AI
Browse files Browse the repository at this point in the history
  • Loading branch information
XProger committed May 7, 2022
1 parent 7da3aad commit d91a919
Show file tree
Hide file tree
Showing 6 changed files with 264 additions and 79 deletions.
9 changes: 6 additions & 3 deletions src/fixed/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,14 @@ void Camera::update()

if (center)
{
int32 offset = (box.minZ + box.maxZ) >> 1;
int32 dx = (box.minX + box.maxX) >> 1;
int32 dz = (box.minZ + box.maxZ) >> 1;
int32 s, c;
sincos(item->angle.y, s, c);
target.pos.x += (s * offset) >> FIXED_SHIFT;
target.pos.z += (c * offset) >> FIXED_SHIFT;
X_ROTXY(dz, dx, s, c);

target.pos.x += dx;
target.pos.z += dz;
}

lastFixed = (int32(lastFixed) ^ int32(isFixed)) != 0; // armcpp 3DO compiler (lastFixed ^= isFixed)
Expand Down
20 changes: 18 additions & 2 deletions src/fixed/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,20 @@
#endif

#ifdef _DEBUG
#define LOG(...) printf(__VA_ARGS__)
#if defined(__WIN32__)
#include <stdio.h>
inline void LOG(const char* format, ...)
{
char str[1024];
va_list arglist;
va_start(arglist, format);
_vsnprintf(str, 1024, format, arglist);
va_end(arglist);
OutputDebugStringA(str);
}
#else
#define LOG(...) printf(__VA_ARGS__)
#endif
#else
#define LOG(...)
#endif
Expand Down Expand Up @@ -1776,6 +1789,8 @@ struct ItemObj

uint32 updateHitMask(Lara* lara, CollisionInfo* cinfo);

void meshSwap(ItemType type, uint32 mask);

ItemObj* init(Room* room);

X_INLINE ItemObj() {}
Expand Down Expand Up @@ -2203,7 +2218,8 @@ struct TargetInfo
uint16 boxIndexTarget;
uint16 zoneIndex;
uint16 zoneIndexTarget;
bool aim;
bool front;
bool behind;
bool canAttack;
};

Expand Down
Loading

0 comments on commit d91a919

Please sign in to comment.