small syntax change
This commit is contained in:
@@ -158,7 +158,7 @@ void render_loop(int speed) {
|
||||
if (need_redraw) {
|
||||
draw_mask(bg_file, shift, message_active ? message : nullptr);
|
||||
PlayerFrame player_frame = get_player_frame(player_state.current_state);
|
||||
PlayerPosition draw_pos = get_aligned_frame_position(pos, static_cast<int>(player_frame));
|
||||
PlayerPosition draw_pos = get_aligned_frame_position(pos, player_frame);
|
||||
draw_player(draw_pos.x, draw_pos.y, player_frame);
|
||||
|
||||
// alternate between frame 0 and 1 when not crawling
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
#include <cstdio>
|
||||
|
||||
// Convert a pivot coordinate (bottom-left) to the top-left draw position
|
||||
PlayerPosition get_aligned_frame_position(PlayerPosition base, int frame_index) {
|
||||
PlayerPosition get_aligned_frame_position(PlayerPosition base, PlayerFrame frame) {
|
||||
int frame_index = static_cast<int>(frame);
|
||||
if (frame_index < 0 || frame_index >= PLAYER_FRAME_COUNT)
|
||||
frame_index = 0;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// src/render/player_positioning.h
|
||||
#pragma once
|
||||
#include "../background_dark_inverted.h"
|
||||
#include "player_mask.h"
|
||||
|
||||
struct PlayerPosition {
|
||||
@@ -8,4 +9,4 @@ struct PlayerPosition {
|
||||
};
|
||||
|
||||
// Calculates drawing position relative to bottom-left pivot
|
||||
PlayerPosition get_aligned_frame_position(PlayerPosition base, int frame_index);
|
||||
PlayerPosition get_aligned_frame_position(PlayerPosition base, PlayerFrame frame);
|
||||
|
||||
Reference in New Issue
Block a user