Fix mario swimming stick direction

This commit is contained in:
jaburns
2020-10-12 17:58:16 -06:00
parent 20791ebcea
commit 259ce62dea
5 changed files with 18 additions and 18 deletions
+3 -3
View File
@@ -259,7 +259,7 @@ static void update_swimming_speed(struct MarioState *m, f32 decelThreshold) {
} }
static void update_swimming_yaw(struct MarioState *m) { static void update_swimming_yaw(struct MarioState *m) {
s16 targetYawVel = -(s16)(10.0f * m->controller->stickX); s16 targetYawVel = (s16)(10.0f * m->controller->stickX);
if (targetYawVel > 0) { if (targetYawVel > 0) {
if (m->angleVel[1] < 0) { if (m->angleVel[1] < 0) {
@@ -288,7 +288,7 @@ static void update_swimming_yaw(struct MarioState *m) {
} }
static void update_swimming_pitch(struct MarioState *m) { static void update_swimming_pitch(struct MarioState *m) {
s16 targetPitch = -(s16)(252.0f * m->controller->stickY); s16 targetPitch = (s16)(252.0f * m->controller->stickY);
s16 pitchVel; s16 pitchVel;
if (m->faceAngle[0] < 0) { if (m->faceAngle[0] < 0) {
@@ -496,7 +496,7 @@ static s32 check_water_jump(struct MarioState *m) {
s32 probe = (s32)(m->pos[1] + 1.5f); s32 probe = (s32)(m->pos[1] + 1.5f);
if (m->input & INPUT_A_PRESSED) { if (m->input & INPUT_A_PRESSED) {
if (probe >= m->waterLevel - 80 && m->faceAngle[0] >= 0 && m->controller->stickY < -60.0f) { if (probe >= m->waterLevel - 80 && m->faceAngle[0] >= 0 && m->controller->stickY > 60.0f) {
vec3s_set(m->angleVel, 0, 0, 0); vec3s_set(m->angleVel, 0, 0, 0);
m->vel[1] = 62.0f; m->vel[1] = 62.0f;
+3 -3
View File
@@ -122,6 +122,8 @@ static void process_display_list( void *dl )
*s_uvPtr++ = 1.0f; *s_uvPtr++ = 1.0f;
} }
s_outBuffers->numTrianglesUsed = (uint16_t)((s_trianglePtr - s_outBuffers->position) / 9);
break; break;
} }
@@ -190,8 +192,6 @@ static void process_display_list( void *dl )
} }
} }
s_outBuffers->bufferUsedSize = s_trianglePtr - s_outBuffers->position;
break_top: break_top:
{} {}
} }
@@ -213,5 +213,5 @@ void gfx_adapter_bind_output_buffers( struct SM64MarioGeometryBuffers *outBuffer
s_colorPtr = s_outBuffers->color; s_colorPtr = s_outBuffers->color;
s_normalPtr = s_outBuffers->normal; s_normalPtr = s_outBuffers->normal;
s_uvPtr = s_outBuffers->uv; s_uvPtr = s_outBuffers->uv;
s_outBuffers->bufferUsedSize = 0; s_outBuffers->numTrianglesUsed = 0;
} }
+7 -5
View File
@@ -24,6 +24,7 @@
static struct AllocOnlyPool *s_mario_geo_pool; static struct AllocOnlyPool *s_mario_geo_pool;
static struct GraphNode *s_mario_graph_node; static struct GraphNode *s_mario_graph_node;
static uint32_t s_last_colors_hash;
static void update_button( bool on, u16 button ) static void update_button( bool on, u16 button )
{ {
@@ -78,6 +79,7 @@ static struct Area *hack_build_area( void )
void sm64_global_init( uint8_t *rom, uint8_t *outTexture, SM64DebugPrintFunctionPtr debugPrintFunction ) void sm64_global_init( uint8_t *rom, uint8_t *outTexture, SM64DebugPrintFunctionPtr debugPrintFunction )
{ {
s_last_colors_hash = 0;
gDebugPrint = debugPrintFunction; gDebugPrint = debugPrintFunction;
load_mario_textures_from_rom( rom, outTexture ); load_mario_textures_from_rom( rom, outTexture );
@@ -97,7 +99,7 @@ void sm64_global_init( uint8_t *rom, uint8_t *outTexture, SM64DebugPrintFunction
void sm64_load_surfaces( uint16_t terrainType, const struct SM64Surface *surfaceArray, size_t numSurfaces ) void sm64_load_surfaces( uint16_t terrainType, const struct SM64Surface *surfaceArray, size_t numSurfaces )
{ {
surface_load_for_libsm64( surfaceArray, numSurfaces ); surface_load_for_libsm64( surfaceArray, numSurfaces );
gCurrentArea->terrainType = terrainType; gCurrentArea->terrainType = terrainType;
} }
@@ -144,10 +146,10 @@ void sm64_mario_tick( const struct SM64MarioInputs *inputs, struct SM64MarioStat
gAreaUpdateCounter++; gAreaUpdateCounter++;
outState->health = gMarioState->health; outState->health = gMarioState->health;
vec3f_copy( outState->position, gMarioState->pos ); vec3f_copy( outState->position, gMarioState->pos );
vec3f_copy( outState->velocity, gMarioState->vel ); vec3f_copy( outState->velocity, gMarioState->vel );
outState->faceAngle = (float)gMarioState->faceAngle[1] / 32768.0f * 3.14159f; outState->faceAngle = (float)gMarioState->faceAngle[1] / 32768.0f * 3.14159f;
} }
void sm64_global_terminate( void ) void sm64_global_terminate( void )
+1 -2
View File
@@ -29,12 +29,11 @@ struct SM64MarioState
struct SM64MarioGeometryBuffers struct SM64MarioGeometryBuffers
{ {
size_t bufferMaxSize;
size_t bufferUsedSize;
float *position; float *position;
float *normal; float *normal;
float *color; float *color;
float *uv; float *uv;
uint16_t numTrianglesUsed;
}; };
typedef void (*SM64DebugPrintFunctionPtr)( const char * ); typedef void (*SM64DebugPrintFunctionPtr)( const char * );
+4 -5
View File
@@ -69,11 +69,10 @@ typedef struct {
Light l[1]; Light l[1];
} Lights1; } Lights1;
#define G_TX_RENDERTILE 0
#define G_TX_RENDERTILE 0 #define G_ON 1
#define G_ON (1) #define G_OFF 0
#define G_OFF (0) #define G_TEXTURE_IMAGE_FRAC 2
#define G_TEXTURE_IMAGE_FRAC 2
#define gdSPDefLights1(ar,ag,ab,r1,g1,b1,x1,y1,z1) {{{ {ar,ag,ab},0,{ar,ag,ab},0}}, {{{ {r1,g1,b1},0,{r1,g1,b1},0,{x1,y1,z1},0}}} } #define gdSPDefLights1(ar,ag,ab,r1,g1,b1,x1,y1,z1) {{{ {ar,ag,ab},0,{ar,ag,ab},0}}, {{{ {r1,g1,b1},0,{r1,g1,b1},0,{x1,y1,z1},0}}} }