Move a few files around, modify buid script, start on some collision stuff, and J3DSys FIFO

This commit is contained in:
shibbo 2020-01-21 22:29:31 -05:00
parent 6292c6f71c
commit 635b99e61e
12 changed files with 228 additions and 24 deletions

View File

@ -139,4 +139,9 @@ for f in assembly_files:
numFilesCompiled += 1
if numFilesCompiled == 0:
print("No changes to compile.")
print("No changes to compile.")
if forceCompile == True:
print(f"{numFilesCompiled} files. [{len(cpp_files)} C++, {len(c_files)} C, {len(assembly_files)} assembly]...")
else:
print("Complete.")

View File

@ -1,18 +0,0 @@
#ifndef HITINFO_H
#define HITINFO_H
#include "Collision/Triangle.h"
class HitInfo : public Triangle
{
public:
HitInfo();
f32 _60;
JGeometry::TVec3<f32> _64;
JGeometry::TVec3<f32> _70;
JGeometry::TVec3<f32> _7C;
u8 _88;
};
#endif // HITINFO_H

View File

@ -17,8 +17,13 @@ namespace JGeometry
class TMatrix34
{
public:
void mult(const JGeometry::TVec3<f32> &, JGeometry::TVec3<f32> &);
void concat(const JGeometry::SMatrix34C<f32> &, const JGeometry::SMatrix34C<f32> &);
void identity();
void mult(const JGeometry::TVec3<T> &, JGeometry::TVec3<T> &);
void concat(const T &);
operator Mtx*() { return reinterpret_cast<Mtx*>(this); }
T val[3][4];
};
};

View File

@ -0,0 +1,50 @@
#ifndef COLLISIONCATEGORIZEDKEEPER_H
#define COLLISIONCATEGORIZEDKEEPER_H
#include "Actor/NameObj/NameObj.h"
#include "Map/Collision/Triangle.h"
class CollisionZone;
class CollisionCategorizedKeeper : public NameObj
{
public:
CollisionCategorizedKeeper(u32);
virtual ~CollisionCategorizedKeeper();
virtual void movement();
void addToZone(CollisionParts *, s32);
void removeFromZone(CollisionParts *, s32);
void addToGlobal(CollisionParts *);
void removeFromGlobal(CollisionParts *);
HitInfo* getStrikeInfo(u32);
HitInfo* mHitInfo; // _C
u32 _10;
u32 mNumCollisionParts; // _14
CollisionZone* mGlobalZones; // _18
u8 _1C[0x98-0x1C];
u32 mNumZones; // _98
u32 _9C;
u8 _A0;
u8 _A1;
};
class CollisionZone
{
public:
CollisionZone(u32);
void addParts(CollisionParts *);
void eraseParts(CollisionParts *);
void calcMinMaxAndRadius();
void calcMinMaxAndRadiusIfMoveOuter(CollisionParts *);
u32 _0;
u8 _4[0x804-0x4];
u32 mPartsCount; // _804
};
#endif // COLLISIONCATEGORIEDKEEPER_H

View File

@ -0,0 +1,34 @@
#ifndef COLLISIONPARTS_H
#define COLLISIONPARTS_H
#include "types.h"
class KCollisionServer;
class CollisionParts
{
public:
CollisionParts();
void updateMtx();
u32 _0;
Mtx _4;
Mtx _34;
Mtx _64;
Mtx _94;
KCollisionServer* mCollisionServer; // _C4
u32 _C8;
u8 _CC;
u8 _CD;
u8 _CE;
u8 _CF;
u8 _D0;
u32 _D4;
f32 _D8;
f32 _DC;
s32 _E0;
u32 _E4;
};
#endif // COLLISIONPARTS_H

View File

@ -0,0 +1,14 @@
#ifndef KCOLLISIONSERVER_H
#define KCOLLISIONSERVER_H
#include "types.h"
class KCollisionServer
{
public:
KCollisionServer();
u8 _0[0xC];
};
#endif // KCOLLISIONSERVER_H

View File

@ -4,14 +4,17 @@
#include "types.h"
#include "JGeometry/TVec3.h"
class CollisionParts;
class HitSensor;
class Triangle
{
public:
Triangle();
u32 _0;
s32 _4;
u32 _8;
CollisionParts* mColParts; // _0
s32 mIndex; // _4
HitSensor* mSensor; // _8
JGeometry::TVec3<f32> mFaceNormal; // _C
JGeometry::TVec3<f32> mEdgeNormal_1;
JGeometry::TVec3<f32> mEdgeNormal_2;
@ -22,4 +25,16 @@ public:
};
class HitInfo : public Triangle
{
public:
HitInfo();
f32 _60;
JGeometry::TVec3<f32> _64;
JGeometry::TVec3<f32> _70;
JGeometry::TVec3<f32> _7C;
u8 _88;
};
#endif // TRIANGLE_H

View File

@ -0,0 +1,15 @@
#ifndef J3DSYS_H
#define J3DSYS_H
#include "types.h"
const s32 GPU_FIFO_ADDR = 0xCC008000;
class J3DSys
{
public:
void loadPosMtxIndx(s32, u16) const;
void loadNrmMtxIndx(s32, u16) const;
};
#endif // J3DSYS_H

View File

@ -14,6 +14,15 @@ typedef long long u64;
typedef float f32;
typedef double f64;
typedef volatile u8 vu8;
typedef volatile u16 vu16;
typedef volatile u32 vu32;
typedef volatile u64 vu64;
typedef volatile s8 vs8;
typedef volatile s16 vs16;
typedef volatile s32 vs32;
typedef volatile s64 vs64;
#define NULL 0
#define override
#define noexcept

View File

@ -0,0 +1,35 @@
#include "Map/Collision/CollisionCategorizedKeeper.h"
CollisionCategorizedKeeper::CollisionCategorizedKeeper(u32 unk) : NameObj("地形コリジョンカテゴリキーパー")
{
mHitInfo = 0;
_10 = 0;
mNumCollisionParts = 0;
mNumZones = 0;
_9C = unk;
_A0 = 0;
_A1 = 1;
mHitInfo = new HitInfo[0x20];
}
void CollisionCategorizedKeeper::addToGlobal(CollisionParts *pParts)
{
mGlobalZones->addParts(pParts);
mNumCollisionParts++;
}
void CollisionCategorizedKeeper::removeFromGlobal(CollisionParts *pParts)
{
mGlobalZones->eraseParts(pParts);
mNumCollisionParts--;
}
HitInfo* CollisionCategorizedKeeper::getStrikeInfo(u32 idx)
{
return &mHitInfo[idx];
}
void CollisionZone::addParts(CollisionParts *pParts)
{
}

View File

@ -0,0 +1,23 @@
#include "Map/Collision/CollisionParts.h"
#include "Map/Collision/KCollisionServer.h"
#include "JGeometry/TMatrix34.h"
CollisionParts::CollisionParts()
{
_0 = 0;
_C8 = 0;
_CC = 0;
_CD = 1;
_CE = 0;
_CF = 0;
_D0 = 0;
_D4 = 0;
_D8 = -1.0f;
_DC = 1.0f;
_E0 = -1;
_E4 = 0;
mCollisionServer = new KCollisionServer();
// todo -- finish me
}

View File

@ -0,0 +1,17 @@
#include "Model/J3D/J3DSys.h"
void J3DSys::loadPosMtxIndx(s32 unk1, u16 unk2) const
{
s32 val = (unk1 * 0xC) & 0xFFFF;
*((vu8*)GPU_FIFO_ADDR) = 0x20;
*((vu16*)GPU_FIFO_ADDR) = unk2;
*((vs16*)GPU_FIFO_ADDR) = val | 0xB000;
}
void J3DSys::loadNrmMtxIndx(s32 unk1, u16 unk2) const
{
s32 val = ((unk1 * 0x9) + 0x400) & 0xFFFF;
*((vu8*)GPU_FIFO_ADDR) = 0x28;
*((vu16*)GPU_FIFO_ADDR) = unk2;
*((vs16*)GPU_FIFO_ADDR) = val | 0xB000;
}