diff --git a/src/game/mario_actions_submerged.c b/src/game/mario_actions_submerged.c index e5b7056..d74c7ae 100644 --- a/src/game/mario_actions_submerged.c +++ b/src/game/mario_actions_submerged.c @@ -259,7 +259,7 @@ static void update_swimming_speed(struct MarioState *m, f32 decelThreshold) { } 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 (m->angleVel[1] < 0) { @@ -288,7 +288,7 @@ static void update_swimming_yaw(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; 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); 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); m->vel[1] = 62.0f; diff --git a/src/gfx_adapter.c b/src/gfx_adapter.c index 5738aec..6fb69b1 100644 --- a/src/gfx_adapter.c +++ b/src/gfx_adapter.c @@ -122,6 +122,8 @@ static void process_display_list( void *dl ) *s_uvPtr++ = 1.0f; } + s_outBuffers->numTrianglesUsed = (uint16_t)((s_trianglePtr - s_outBuffers->position) / 9); + break; } @@ -190,8 +192,6 @@ static void process_display_list( void *dl ) } } - s_outBuffers->bufferUsedSize = s_trianglePtr - s_outBuffers->position; - break_top: {} } @@ -213,5 +213,5 @@ void gfx_adapter_bind_output_buffers( struct SM64MarioGeometryBuffers *outBuffer s_colorPtr = s_outBuffers->color; s_normalPtr = s_outBuffers->normal; s_uvPtr = s_outBuffers->uv; - s_outBuffers->bufferUsedSize = 0; + s_outBuffers->numTrianglesUsed = 0; } \ No newline at end of file diff --git a/src/libsm64.c b/src/libsm64.c index bcd13fa..81d83dd 100644 --- a/src/libsm64.c +++ b/src/libsm64.c @@ -24,6 +24,7 @@ static struct AllocOnlyPool *s_mario_geo_pool; static struct GraphNode *s_mario_graph_node; +static uint32_t s_last_colors_hash; 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 ) { + s_last_colors_hash = 0; gDebugPrint = debugPrintFunction; 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 ) { - surface_load_for_libsm64( surfaceArray, numSurfaces ); + surface_load_for_libsm64( surfaceArray, numSurfaces ); gCurrentArea->terrainType = terrainType; } @@ -144,10 +146,10 @@ void sm64_mario_tick( const struct SM64MarioInputs *inputs, struct SM64MarioStat gAreaUpdateCounter++; - outState->health = gMarioState->health; - vec3f_copy( outState->position, gMarioState->pos ); - vec3f_copy( outState->velocity, gMarioState->vel ); - outState->faceAngle = (float)gMarioState->faceAngle[1] / 32768.0f * 3.14159f; + outState->health = gMarioState->health; + vec3f_copy( outState->position, gMarioState->pos ); + vec3f_copy( outState->velocity, gMarioState->vel ); + outState->faceAngle = (float)gMarioState->faceAngle[1] / 32768.0f * 3.14159f; } void sm64_global_terminate( void ) diff --git a/src/libsm64.h b/src/libsm64.h index 73834aa..e744b2f 100644 --- a/src/libsm64.h +++ b/src/libsm64.h @@ -29,12 +29,11 @@ struct SM64MarioState struct SM64MarioGeometryBuffers { - size_t bufferMaxSize; - size_t bufferUsedSize; float *position; float *normal; float *color; float *uv; + uint16_t numTrianglesUsed; }; typedef void (*SM64DebugPrintFunctionPtr)( const char * ); diff --git a/src/model_hack.h b/src/model_hack.h index 6cf62e5..09cd4f1 100644 --- a/src/model_hack.h +++ b/src/model_hack.h @@ -69,11 +69,10 @@ typedef struct { Light l[1]; } Lights1; - -#define G_TX_RENDERTILE 0 -#define G_ON (1) -#define G_OFF (0) -#define G_TEXTURE_IMAGE_FRAC 2 +#define G_TX_RENDERTILE 0 +#define G_ON 1 +#define G_OFF 0 +#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}}} }