All global state coming from g_state now
This commit is contained in:
@@ -52,8 +52,11 @@
|
||||
#define INT_ATTACK_NOT_WEAK_FROM_ABOVE \
|
||||
(INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_HIT_FROM_BELOW)
|
||||
|
||||
u8 sDelayInvincTimer;
|
||||
s16 sInvulnerable;
|
||||
|
||||
#define sDelayInvincTimer (g_state->msDelayInvincTimer)
|
||||
#define sInvulnerable (g_state->msInvulnerable)
|
||||
// u8 sDelayInvincTimer;
|
||||
// s16 sInvulnerable;
|
||||
|
||||
struct InteractionHandler {
|
||||
u32 interactType;
|
||||
|
||||
@@ -65,8 +65,6 @@ struct LandingAction sBackflipLandAction = {
|
||||
4, 0, ACT_FREEFALL, ACT_BACKFLIP_LAND_STOP, ACT_BACKFLIP, ACT_FREEFALL, ACT_BEGIN_SLIDING,
|
||||
};
|
||||
|
||||
Mat4 sFloorAlignMatrix[2];
|
||||
|
||||
s16 tilt_body_running(struct MarioState *m) {
|
||||
s16 pitch = find_floor_slope(m, 0);
|
||||
pitch = pitch * m->forwardVel / 40.0f;
|
||||
@@ -93,8 +91,8 @@ void play_step_sound(struct MarioState *m, s16 frame1, s16 frame2) {
|
||||
|
||||
void align_with_floor(struct MarioState *m) {
|
||||
m->pos[1] = m->floorHeight;
|
||||
mtxf_align_terrain_triangle(sFloorAlignMatrix[m->unk00], m->pos, m->faceAngle[1], 40.0f);
|
||||
m->marioObj->header.gfx.throwMatrix = &sFloorAlignMatrix[m->unk00];
|
||||
mtxf_align_terrain_triangle(g_state->msFloorAlignMatrix, m->pos, m->faceAngle[1], 40.0f);
|
||||
m->marioObj->header.gfx.throwMatrix = g_state->msFloorAlignMatrix;
|
||||
}
|
||||
|
||||
s32 begin_walking_action(struct MarioState *m, f32 forwardVel, u32 action, u32 actionArg) {
|
||||
|
||||
@@ -23,17 +23,23 @@
|
||||
#include "../include/object_fields.h"
|
||||
#include "../include/mario_geo_switch_case_ids.h"
|
||||
|
||||
#define MIN_SWIM_STRENGTH 160
|
||||
#define MIN_SWIM_SPEED 16.0f
|
||||
|
||||
static s16 sWasAtSurface = FALSE;
|
||||
static s16 sSwimStrength = MIN_SWIM_STRENGTH;
|
||||
|
||||
#define sWasAtSurface (g_state->msWasAtSurface)
|
||||
#define sSwimStrength (g_state->msSwimStrength)
|
||||
#define D_80339FD0 (g_state->mD_80339FD0)
|
||||
#define D_80339FD2 (g_state->mD_80339FD2)
|
||||
#define D_80339FD4 (g_state->mD_80339FD4)
|
||||
|
||||
//static s16 sWasAtSurface = FALSE;
|
||||
//static s16 sSwimStrength = MIN_SWIM_STRENGTH;
|
||||
static s16 sWaterCurrentSpeeds[] = { 28, 12, 8, 4 };
|
||||
//static s16 D_80339FD0;
|
||||
//static s16 D_80339FD2;
|
||||
//static f32 D_80339FD4;
|
||||
|
||||
static s16 D_80339FD0;
|
||||
static s16 D_80339FD2;
|
||||
static f32 D_80339FD4;
|
||||
|
||||
|
||||
static void set_swimming_at_surface_particles(struct MarioState *m, u32 particleFlag) {
|
||||
s16 atSurface = m->pos[1] >= m->waterLevel - 130;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ struct GlobalState *global_state_create(void)
|
||||
{
|
||||
struct GlobalState *state = malloc( sizeof( struct GlobalState ));
|
||||
memset( state, 0, sizeof( struct GlobalState ));
|
||||
state->msSwimStrength = MIN_SWIM_STRENGTH;
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
|
||||
struct GlobalState
|
||||
{
|
||||
// Not yet implemented:
|
||||
|
||||
// interaction.c
|
||||
u8 msDelayInvincTimer;
|
||||
s16 msInvulnerable;
|
||||
@@ -27,8 +25,6 @@ struct GlobalState
|
||||
// rendering_graph_node.c
|
||||
u16 mgAreaUpdateCounter;
|
||||
|
||||
// Implemented and in use:
|
||||
|
||||
// platform_displacement.c
|
||||
void *mgMarioPlatform;
|
||||
|
||||
@@ -50,6 +46,9 @@ struct GlobalState
|
||||
struct MarioState mgMarioStateVal;
|
||||
};
|
||||
|
||||
// From mario_actions_submerged.c, needed to initialize global state
|
||||
#define MIN_SWIM_STRENGTH 160
|
||||
|
||||
extern struct GlobalState *g_state;
|
||||
|
||||
extern struct GlobalState *global_state_create(void);
|
||||
|
||||
Reference in New Issue
Block a user