Skip to content

Commit d91a919

Browse files
committed
#368 GBA T-Rex AI
1 parent 7da3aad commit d91a919

File tree

6 files changed

+264
-79
lines changed

6 files changed

+264
-79
lines changed

src/fixed/camera.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,14 @@ void Camera::update()
449449

450450
if (center)
451451
{
452-
int32 offset = (box.minZ + box.maxZ) >> 1;
452+
int32 dx = (box.minX + box.maxX) >> 1;
453+
int32 dz = (box.minZ + box.maxZ) >> 1;
453454
int32 s, c;
454455
sincos(item->angle.y, s, c);
455-
target.pos.x += (s * offset) >> FIXED_SHIFT;
456-
target.pos.z += (c * offset) >> FIXED_SHIFT;
456+
X_ROTXY(dz, dx, s, c);
457+
458+
target.pos.x += dx;
459+
target.pos.z += dz;
457460
}
458461

459462
lastFixed = (int32(lastFixed) ^ int32(isFixed)) != 0; // armcpp 3DO compiler (lastFixed ^= isFixed)

src/fixed/common.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,20 @@
154154
#endif
155155

156156
#ifdef _DEBUG
157-
#define LOG(...) printf(__VA_ARGS__)
157+
#if defined(__WIN32__)
158+
#include <stdio.h>
159+
inline void LOG(const char* format, ...)
160+
{
161+
char str[1024];
162+
va_list arglist;
163+
va_start(arglist, format);
164+
_vsnprintf(str, 1024, format, arglist);
165+
va_end(arglist);
166+
OutputDebugStringA(str);
167+
}
168+
#else
169+
#define LOG(...) printf(__VA_ARGS__)
170+
#endif
158171
#else
159172
#define LOG(...)
160173
#endif
@@ -1776,6 +1789,8 @@ struct ItemObj
17761789

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

1792+
void meshSwap(ItemType type, uint32 mask);
1793+
17791794
ItemObj* init(Room* room);
17801795

17811796
X_INLINE ItemObj() {}
@@ -2203,7 +2218,8 @@ struct TargetInfo
22032218
uint16 boxIndexTarget;
22042219
uint16 zoneIndex;
22052220
uint16 zoneIndexTarget;
2206-
bool aim;
2221+
bool front;
2222+
bool behind;
22072223
bool canAttack;
22082224
};
22092225

0 commit comments

Comments
 (0)