Some more hopefully working progress

This commit is contained in:
2025-05-31 23:54:55 +02:00
parent 0c9698879b
commit 6b6e7df035
26 changed files with 659 additions and 393 deletions

View File

@@ -9,19 +9,20 @@
#include "../items/item.h"
extern int playerReach;
extern int playerX;
extern int playerY;
#define playerTileX (playerX / TILE_SIZE)
#define playerTileY (playerY / TILE_SIZE)
#define playerTileX (player.rect.x / TILE_SIZE)
#define playerTileY (player.rect.y / TILE_SIZE)
extern int playerSpeed;
bool isInbounds(int x, int y);
extern SDL_Texture *entityTexture;
extern SDL_Texture *hudTexture;
bool isInboundsRect(SDL_Rect rect);
//bool isInbounds(int x, int y);
//
//bool isInboundsRect(SDL_Rect rect);
//
//bool isInboundsTile(int x, int y);
bool isInboundsTile(int x, int y);
void adjustRect(SDL_Rect *rect);
void adjustRect(SDL_Rect *rect, SDL_Rect playerRect);
#define neededHealthIdle 120
@@ -45,25 +46,26 @@ typedef struct {
SDL_Rect targetTileRect;
Tile *targetTile;
Tile *prevTargetTile;
SDL_Rect heldItemRect;
int breakingProgress;
} PlayerCursor;
typedef struct {
PlayerCursor cursor;
PlayerInventory inventory;
SDL_Renderer *renderer;
uint8_t health;
uint8_t prevHealth;
uint8_t healthIdle;
SDL_Rect rect;
} Player;
void setActivePlayerSlot(Player * plr, uint16_t activeSlotIndex);
void setActivePlayerSlot(Player *plr, uint16_t activeSlotIndex);
void moveActivePlayerSlot(Player *plr, bool up, bool seek);
void renderPlayer(Player * plr);
void renderPlayer(Player *plr);
void initPlayer(Player * plr);
void initPlayer(Player *plr);
void updatePlayer(Player *plr);