Reformat to something more readable for me :3
This commit is contained in:
@@ -8,18 +8,20 @@
|
||||
#include "../engine/math_util.h"
|
||||
#include "../include/object_fields.h"
|
||||
|
||||
static Vec3f gVec3fZero = { 0.0f, 0.0f, 0.0f };
|
||||
static Vec3s gVec3sZero = { 0, 0, 0 };
|
||||
static Vec3f gVec3fZero = {0.0f, 0.0f, 0.0f};
|
||||
static Vec3s gVec3sZero = {0, 0, 0};
|
||||
|
||||
static struct Object *try_allocate_object(void) {
|
||||
static struct Object *try_allocate_object(void)
|
||||
{
|
||||
struct ObjectNode *nextObj;
|
||||
nextObj = (struct ObjectNode *) malloc(sizeof(struct Object));
|
||||
nextObj = (struct ObjectNode *)malloc(sizeof(struct Object));
|
||||
nextObj->prev = NULL;
|
||||
nextObj->next = NULL;
|
||||
return (struct Object *) nextObj;
|
||||
return (struct Object *)nextObj;
|
||||
}
|
||||
|
||||
static struct Object *allocate_object(void) {
|
||||
static struct Object *allocate_object(void)
|
||||
{
|
||||
s32 i;
|
||||
struct Object *obj = try_allocate_object();
|
||||
|
||||
@@ -31,21 +33,22 @@ static struct Object *allocate_object(void) {
|
||||
obj->collidedObjInteractTypes = 0;
|
||||
obj->numCollidedObjs = 0;
|
||||
|
||||
for (i = 0; i < 0x50; i++) {
|
||||
#ifdef _WIN32
|
||||
for (i = 0; i < 0x50; i++)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
obj->rawData.asS32[i] = 0;
|
||||
#endif
|
||||
#ifdef _WIN64
|
||||
#endif
|
||||
#ifdef _WIN64
|
||||
obj->ptrData.asVoidPtr[i] = NULL;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
obj->unused1 = 0;
|
||||
obj->bhvStackIndex = 0;
|
||||
obj->bhvDelayTimer = 0;
|
||||
|
||||
obj->hitboxRadius = 37.0f; // Override directly for Mario
|
||||
obj->hitboxHeight = 160.0f; //
|
||||
obj->hitboxRadius = 37.0f; // Override directly for Mario
|
||||
obj->hitboxHeight = 160.0f; //
|
||||
obj->hurtboxRadius = 0.0f;
|
||||
obj->hurtboxHeight = 0.0f;
|
||||
obj->hitboxDownOffset = 0.0f;
|
||||
@@ -58,9 +61,12 @@ static struct Object *allocate_object(void) {
|
||||
obj->oHealth = 2048;
|
||||
|
||||
obj->oCollisionDistance = 1000.0f;
|
||||
if (gCurrLevelNum == LEVEL_TTC) {
|
||||
if (gCurrLevelNum == LEVEL_TTC)
|
||||
{
|
||||
obj->oDrawingDistance = 2000.0f;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
obj->oDrawingDistance = 4000.0f;
|
||||
}
|
||||
|
||||
@@ -81,7 +87,8 @@ static struct Object *allocate_object(void) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
static struct Object *create_object(void) {
|
||||
static struct Object *create_object(void)
|
||||
{
|
||||
struct Object *obj;
|
||||
obj = allocate_object();
|
||||
obj->curBhvCommand = NULL;
|
||||
@@ -89,7 +96,8 @@ static struct Object *create_object(void) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
static void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, Vec3f pos, Vec3s angle) {
|
||||
static void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, Vec3f pos, Vec3s angle)
|
||||
{
|
||||
vec3f_set(graphNode->scale, 1.0f, 1.0f, 1.0f);
|
||||
vec3f_copy(graphNode->pos, pos);
|
||||
vec3s_copy(graphNode->angle, angle);
|
||||
@@ -105,14 +113,15 @@ static void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, V
|
||||
graphNode->node.flags &= ~GRAPH_RENDER_BILLBOARD;
|
||||
}
|
||||
|
||||
static struct Object *spawn_object_at_origin(void) {
|
||||
static struct Object *spawn_object_at_origin(void)
|
||||
{
|
||||
struct Object *obj;
|
||||
obj = create_object();
|
||||
|
||||
obj->parentObj = NULL;
|
||||
obj->header.gfx.areaIndex = 0;
|
||||
obj->header.gfx.activeAreaIndex = 0;
|
||||
geo_obj_init((struct GraphNodeObject *) &obj->header.gfx, NULL, gVec3fZero, gVec3sZero);
|
||||
geo_obj_init(&obj->header.gfx, NULL, gVec3fZero, gVec3sZero);
|
||||
|
||||
return obj;
|
||||
}
|
||||
@@ -121,10 +130,12 @@ static struct Object *spawn_object_at_origin(void) {
|
||||
* Copy position, velocity, and angle variables from MarioState to the Mario
|
||||
* object.
|
||||
*/
|
||||
static void copy_mario_state_to_object(void) {
|
||||
static void copy_mario_state_to_object(void)
|
||||
{
|
||||
s32 i = 0;
|
||||
// L is real
|
||||
if (gCurrentObject != gMarioObject) {
|
||||
if (gCurrentObject != gMarioObject)
|
||||
{
|
||||
i += 1;
|
||||
}
|
||||
|
||||
@@ -157,11 +168,12 @@ struct Object *hack_allocate_mario(void)
|
||||
/**
|
||||
* Mario's primary behavior update function.
|
||||
*/
|
||||
void bhv_mario_update(void) {
|
||||
void bhv_mario_update(void)
|
||||
{
|
||||
u32 particleFlags = 0;
|
||||
// s32 i;
|
||||
// s32 i;
|
||||
|
||||
gCurrentObject = gMarioObject;
|
||||
gCurrentObject = gMarioObject;
|
||||
particleFlags = execute_mario_action(gCurrentObject);
|
||||
gCurrentObject->oMarioParticleFlags = particleFlags;
|
||||
|
||||
@@ -169,18 +181,19 @@ void bhv_mario_update(void) {
|
||||
// to sync it with the Mario object
|
||||
copy_mario_state_to_object();
|
||||
|
||||
// i = 0;
|
||||
// while (sParticleTypes[i].particleFlag != 0) {
|
||||
// if (particleFlags & sParticleTypes[i].particleFlag) {
|
||||
// spawn_particle(sParticleTypes[i].activeParticleFlag, sParticleTypes[i].model,
|
||||
// sParticleTypes[i].behavior);
|
||||
// }
|
||||
// i = 0;
|
||||
// while (sParticleTypes[i].particleFlag != 0) {
|
||||
// if (particleFlags & sParticleTypes[i].particleFlag) {
|
||||
// spawn_particle(sParticleTypes[i].activeParticleFlag, sParticleTypes[i].model,
|
||||
// sParticleTypes[i].behavior);
|
||||
// }
|
||||
|
||||
// i++;
|
||||
// }
|
||||
// i++;
|
||||
// }
|
||||
}
|
||||
|
||||
void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2) {
|
||||
void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2)
|
||||
{
|
||||
f32 spC, sp8, sp4;
|
||||
|
||||
spC = a2[3][0] * a2[0][0] + a2[3][1] * a2[0][1] + a2[3][2] * a2[0][2];
|
||||
@@ -208,7 +221,9 @@ void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2) {
|
||||
a0[2][3] = 0;
|
||||
a0[3][3] = 1.0f;
|
||||
}
|
||||
void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1) {
|
||||
|
||||
void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1)
|
||||
{
|
||||
f32 spC = a1->oParentRelativePosX;
|
||||
f32 sp8 = a1->oParentRelativePosY;
|
||||
f32 sp4 = a1->oParentRelativePosZ;
|
||||
@@ -217,8 +232,10 @@ void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1) {
|
||||
a1->oPosY = spC * a0[0][1] + sp8 * a0[1][1] + sp4 * a0[2][1] + a0[3][1];
|
||||
a1->oPosZ = spC * a0[0][2] + sp8 * a0[1][2] + sp4 * a0[2][2] + a0[3][2];
|
||||
}
|
||||
void obj_set_gfx_pos_from_pos(struct Object *obj) {
|
||||
|
||||
void obj_set_gfx_pos_from_pos(struct Object *obj)
|
||||
{
|
||||
obj->header.gfx.pos[0] = obj->oPosX;
|
||||
obj->header.gfx.pos[1] = obj->oPosY;
|
||||
obj->header.gfx.pos[2] = obj->oPosZ;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user