Skip to content

Commit

Permalink
SM64DSe R102 v2.3.3 2017/06/12
Browse files Browse the repository at this point in the history
Changes:
- Include the following changes from mibts:
-- Include latest ASM Hacking Template v2 templates and examples
-- Apply patch to allow use of ASM Hacking Template v2
- Enable all ASM hacking features
  • Loading branch information
Fiachra1993 committed Jun 14, 2017
1 parent e49d5df commit c012b77
Show file tree
Hide file tree
Showing 52 changed files with 1,097 additions and 793 deletions.
2 changes: 1 addition & 1 deletion ASMPatchTemplate/v2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export LD := $(PREFIX)ld
#---------------------------------------------------------------------------------
TARGET := newcode
BUILD := build
SOURCES := source/F_DLLoader libfat_source
SOURCES := source/P_TestPlatform libfat_source
INCLUDES := include
DATA := data
GRAPHICS := gfx
Expand Down
59 changes: 48 additions & 11 deletions ASMPatchTemplate/v2/source/Collision.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ struct CylinderClsn;
struct WithMeshClsn;
struct RaycastGround;
struct RaycastLine;
struct MeshCollider;
struct MovingMeshCollider;
struct ClsnResult;
extern "C"
{
extern MeshCollider* ACTIVE_MESH_CLSNS[0x18];
extern MovingMeshCollider* ACTIVE_MESH_CLSNS[0x18];
}

struct CLPS
Expand Down Expand Up @@ -73,6 +73,7 @@ struct CLPS
BH_SLOW_QUICKSAND = 0x07,
BH_SLOW_QUICKSAND_2 = 0x08,
BH_INSTANT_QUICKSAND = 0x09,
BH_HARD = 0x0e,
BH_RACE_START = 0x0f,
BH_RACE_END = 0x10,
BH_VANISH_LUIGI_GRATE = 0x11,
Expand All @@ -97,7 +98,8 @@ struct CLPS
inline unsigned BehaviorID() const {return low >> 19 & 0x1f;}
inline bool CanCamGoThrough() const {return low & 0x01000000;}
inline bool IsToxic() const {return low & 0x02000000;}
inline bool IsUnk26() const {return low & 0x04000000;}
inline bool IsCameraWall() const {return low & 0x04000000;}
inline unsigned Padding() const {return low >> 27;}
inline unsigned WindID() const {return high & 0xff;}
};

Expand All @@ -120,7 +122,7 @@ template<int Size> struct FixedSizeCLPS_Block //flexible arrays cannot be static

struct MeshCollider
{
unsigned* vTable;
//vtable
Actor* actor;
unsigned unk08;
Fix12i range;
Expand All @@ -140,13 +142,39 @@ struct MeshCollider
unsigned unk4c;

MeshCollider();
~MeshCollider();
virtual ~MeshCollider();

bool Disable();
bool Enable();
bool Enable(Actor* actor);
bool IsEnabled();
void Transform(Matrix4x3& mat, short rotY);
};

struct MovingMeshCollider : public MeshCollider
{
unsigned unk50;
Matrix4x3 newTransform;
Matrix4x3 invMat4x3_084;
Matrix4x3 scMat4x3_0b4;
Matrix4x3 invMat4x3_0e4;
unsigned unk114;
unsigned unk118;
unsigned unk11c;
unsigned unk120;
unsigned unk124;
unsigned unk128;
unsigned unk12c;
unsigned unk130;
Matrix4x3 ledgeMat;
unsigned unk164;
Matrix4x3 clsnInvMat;
Matrix4x3 sc2InvMat4x3_198;

MovingMeshCollider();
virtual ~MovingMeshCollider();

static char* LoadFile(SharedFilePtr& filePtr);
void SetFile(char* clsnFile, Matrix4x3& mat, Fix12i scale, short angleY, CLPS_Block& clps);
void Transform(Matrix4x3& mat, short rotY);
};

struct CylinderClsn
Expand Down Expand Up @@ -184,7 +212,6 @@ struct CylinderClsn
HIT_BY_PLAYER = 1 << 27
};

unsigned* vTable;
Fix12i radius;
Fix12i height;
Vector3 pushback;
Expand All @@ -194,10 +221,13 @@ struct CylinderClsn
unsigned otherObjID;
unsigned unk28;
unsigned unk2c;
unsigned unk30;
Actor* owner;

CylinderClsn();
~CylinderClsn();
virtual ~CylinderClsn();
virtual Vector3& GetPos();
virtual unsigned GetOwnerID();

void Init(Actor* actor, Fix12i radius, Fix12i height, unsigned flags, unsigned vulnFlags);
void Update();
void Clear();
Expand All @@ -206,6 +236,13 @@ struct CylinderClsn
struct CylinderClsnWithPos : CylinderClsn
{
Vector3 pos;

CylinderClsnWithPos();
virtual ~CylinderClsnWithPos();
virtual Vector3& GetPos() override;

void Init(Actor* actor, const Vector3& pos, Fix12i radius, Fix12i height, unsigned flags, unsigned vulnFlags); //pos is transformed by the object's Y angle
void SetPosRelativeToActor(const Vector3& pos);
};

struct ClsnResult
Expand All @@ -217,7 +254,7 @@ struct ClsnResult
short clsnID; //not constant per object, 0x18 if in air (only 24 mesh colliders can be active at a time)
unsigned objID;
Actor* obj;
MeshCollider* meshClsn;
MovingMeshCollider* meshClsn;

ClsnResult();
void Reset();
Expand Down
2 changes: 1 addition & 1 deletion ASMPatchTemplate/v2/source/E_ShyGuy/ShyGuy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ ShyGuy* ShyGuy::Spawn()
static_assert(sizeof(Model) == 0x50, "Model is wrong size");
static_assert(sizeof(ModelAnim) == 0x64, "ModelAnim is wrong size");
static_assert(sizeof(ShadowVolume) == 0x28, "Shadow is wrong size");
static_assert(sizeof(MeshCollider) == 0x50, "MeshCollider is wrong size");
static_assert(sizeof(MovingMeshCollider) == 0x50, "MovingMeshCollider is wrong size");
static_assert(sizeof(CylinderClsn) == 0x34, "CylinderClsn is wrong size");
static_assert(sizeof(WithMeshClsn) == 0x1bc, "WithMeshClsn is wrong size");
static_assert(sizeof(RaycastLine) == 0x78, "RaycastLine is wrong size");
Expand Down
2 changes: 1 addition & 1 deletion ASMPatchTemplate/v2/source/L_BlockyBlockLand/BBL_Plank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int BBL_Plank::InitResources()
UpdateModelTransform();
UpdateClsnTransform();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x199_f, ang.y, clpsBlock);

clsn.beforeClsnCallback = (decltype(clsn.beforeClsnCallback))0x02039348;
Expand Down
2 changes: 1 addition & 1 deletion ASMPatchTemplate/v2/source/L_BlockyBlockLand/BBL_Tower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int BBL_Tower::InitResources()
UpdateModelPosAndRotY();
UpdateClsnPosAndRot();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x1000_f, ang.y, clpsBlock);

clsn.beforeClsnCallback = (decltype(clsn.beforeClsnCallback))0x02039348;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int BBL2_Plank::InitResources()
UpdateModelPosAndRotXYZ();
UpdateClsnPosAndRot();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x1000_f, ang.y, clpsBlock);

//rayStart = {0, 0, -0xfa000}.RotateY(ang.y) + pos + {0, 0x14000, 0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int BBL2_MegaBlock::InitResources()
UpdateClsnPosAndRot();
UpdateShadowMatrix();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x1000_f, ang.y, clpsBlock);

Model::LoadFile(SILVER_NUMBER_MODEL_PTR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int YBG_AlcoveGrate::InitResources()
UpdateModelTransform();
UpdateClsnPosAndRot();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x1000_f, ang.y, clpsBlock);
clsn.beforeClsnCallback = (decltype(clsn.beforeClsnCallback))0x02039348;
eventID = param1 & 0xff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int YBG_CorkRock::InitResources()
UpdateModelTransform();
UpdateClsnPosAndRot();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x1000_f, ang.y, clpsBlock);
clsn.beforeClsnCallback = (decltype(clsn.beforeClsnCallback))0x02039348;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ int YBG_ExtraLava::InitResources()
UpdateModelTransform();
UpdateClsnPosAndRot();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x1000_f, ang.y, clpsBlock);

return 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ YBG_FallingRock::Spawner* YBG_FallingRock::Spawner::Spawn()
int YBG_FallingRock::Spawner::InitResources()
{
Model::LoadFile(modelFile);
MeshCollider::LoadFile(clsnFile);
MovingMeshCollider::LoadFile(clsnFile);
eventID = param1 & 0xff;
return 1;
}
Expand Down Expand Up @@ -192,7 +192,7 @@ int YBG_FallingRock::InitResources()
UpdateModelTransform();
UpdateClsnPosAndRot();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x1000_f, ang.y, clpsBlock);

wmClsn.Init(this, scale.x, 0_f, nullptr, nullptr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int YBG_Flood::InitResources()
UpdateModelPosAndRotY();
UpdateClsnPosAndRot();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x1000_f, ang.y, clpsBlock);

eventID = param1 & 0xff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ int YBG_PushPipe::InitResources()
UpdateModelTransform();
UpdateClsnTransform();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x1000_f, ang.y, clpsBlock);
clsn.beforeClsnCallback = (decltype(clsn.beforeClsnCallback))0x02039348;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int YBG_SewerBlock::InitResources()
UpdateModelTransform();
UpdateClsnPosAndRot();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x1000_f, ang.y, clpsBlock);

return 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int YBG_SewerClog::InitResources()
UpdateModelTransform();
UpdateClsnPosAndRot();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x1000_f, ang.y, clpsBlock);

eventID = param1 & 0xff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ int YBG_Spill::InitResources()
UpdateModelTransform();
UpdateClsnPosAndRot();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x1000_f, ang.y, clpsBlock);

eventID = param1 & 0x1f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ int YBG_Sprinkler::InitResources()
UpdateModelPosAndRotY();
UpdateClsnPosAndRot();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, CLSN_SCALE, ang.y, clpsBlock);
clsn.beforeClsnCallback = (decltype(clsn.beforeClsnCallback))0x02039348;
eventID = param1 & 0xff;
Expand Down
13 changes: 13 additions & 0 deletions ASMPatchTemplate/v2/source/Message.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@

struct Message
{
struct SpriteRef
{
unsigned unk0;
unsigned unk4;

static SpriteRef COIN;
static SpriteRef* NUMBER_PTRS[20]; //first 10 are gold versions of 0-9, last 10 are red versions of 0-9
static SpriteRef TIMES;
};

/*static wchar_t chars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
'W', 'X', 'Y', 'Z', '「', '」', '?', '!', '~', ',', '“', '”', '•', 'a', 'b', 'c',
Expand All @@ -37,6 +47,9 @@ struct Message

static void AddChar(char charInFontEncoding);
static void Display(unsigned msgID);
//Add 9 to the horizontal spacing to show multiple digits.
// (usual values) -1 1 0
static void ShowNumber(bool bottomScreen, SpriteRef& number, int x, int y, int dontInvertGradient, unsigned arg5, unsigned arg6);
};

struct MsgFile
Expand Down
4 changes: 2 additions & 2 deletions ASMPatchTemplate/v2/source/P_DoorBlocker/DoorBlocker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace
{
FixedSizeCLPS_Block<2> clpsBlock =
FixedSizeCLPS_Block<1> clpsBlock =
{
{'C', 'L', 'P', 'S'},
8,
Expand Down Expand Up @@ -53,7 +53,7 @@ int DoorBlocker::InitResources()
UpdateModelTransform();
UpdateClsnPosAndRot();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x1000_f, ang.y, clpsBlock);

clsn.unkFunc18 = (decltype(clsn.unkFunc18))0x02039348;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ int PipeVH::InitResources()
UpdateShadowMatrix();
UpdateStubModel();

char* clsnF = MeshCollider::LoadFile(clsnFile);
char* clsnF = MovingMeshCollider::LoadFile(clsnFile);
clsn.SetFile(clsnF, clsnNextMat, 0x0100_f, ang.y, clpsBlock);

SetClsnHeight();
Expand Down
Loading

0 comments on commit c012b77

Please sign in to comment.