Fix unable to bash box on the side underwater

main
En Yi 2024-11-24 15:53:32 +08:00
parent 2de6eaa107
commit a123e59c82
2 changed files with 5 additions and 4 deletions

View File

@ -25,7 +25,7 @@
#ifndef TILE16_SIZE #ifndef TILE16_SIZE
#define PLAYER_WIDTH 22 #define PLAYER_WIDTH 22
#define PLAYER_HEIGHT 42 #define PLAYER_HEIGHT 42
#define PLAYER_C_WIDTH 22 #define PLAYER_C_WIDTH 30
#define PLAYER_C_HEIGHT 26 #define PLAYER_C_HEIGHT 26
#else #else
#define PLAYER_WIDTH 14 #define PLAYER_WIDTH 14

View File

@ -565,7 +565,8 @@ void player_bbox_update_system(Scene_t* scene)
if ((p_mstate->water_state & 1) && !(p_mstate->ground_state & 1)) if ((p_mstate->water_state & 1) && !(p_mstate->ground_state & 1))
{ {
#define EXTENDED_WIDTH_FACTOR 1.5f; // Unsure about this extension, keep it for now.
#define EXTENDED_WIDTH_FACTOR 1.0f;
float extended_width = p_bbox->size.x * EXTENDED_WIDTH_FACTOR; float extended_width = p_bbox->size.x * EXTENDED_WIDTH_FACTOR;
p_hurtbox->size = p_bbox->size; p_hurtbox->size = p_bbox->size;
p_hurtbox->size.x *= EXTENDED_WIDTH_FACTOR; p_hurtbox->size.x *= EXTENDED_WIDTH_FACTOR;
@ -580,7 +581,7 @@ void player_bbox_update_system(Scene_t* scene)
}, },
anchor anchor
); );
p_hitbox->boxes[0].x = offset.x; p_hitbox->boxes[0].x = offset.x * p_mstate->x_dir > 0 ? 1 : -1;
offset = shift_bbox( offset = shift_bbox(
p_bbox->size, p_bbox->size,
@ -589,7 +590,7 @@ void player_bbox_update_system(Scene_t* scene)
}, },
anchor anchor
); );
p_hitbox->boxes[1].x = offset.x; p_hitbox->boxes[1].x = (offset.x + 1) * p_mstate->x_dir > 0 ? 1 : -1;
p_hurtbox->offset = shift_bbox(p_bbox->size, p_hurtbox->size, anchor); p_hurtbox->offset = shift_bbox(p_bbox->size, p_hurtbox->size, anchor);
} }