67 lines
1.3 KiB
C
67 lines
1.3 KiB
C
//
|
|
// Created by bruno on 4/24/25.
|
|
//
|
|
|
|
#include <SDL2/SDL.h>
|
|
#include "../util/util.h"
|
|
#include "../tiles/belt.h"
|
|
#include "../tiles/tile.h"
|
|
|
|
#ifndef FACTORYGAME_ITEM_H
|
|
#define FACTORYGAME_ITEM_H
|
|
|
|
#define ITEMREGISTRY_SIZE 128
|
|
|
|
|
|
typedef enum ItemType {
|
|
TYPE_AIR = 0,
|
|
TYPE_BLOCK,
|
|
TYPE_BELT,
|
|
TYPE_FURNACE,
|
|
IRON_ORE = ITEMREGISTRY_SIZE / 2,
|
|
SILVER_ORE,
|
|
GOLD_ORE,
|
|
PLATINUM_ORE,
|
|
IRON_INGOT,
|
|
SILVER_INGOT,
|
|
GOLD_INGOT,
|
|
PLATINUM_INGOT,
|
|
LOG
|
|
} ItemType;
|
|
|
|
|
|
typedef struct ItemOnBelt {
|
|
float offset;
|
|
int tileX, tileY;
|
|
ItemType type;
|
|
} ItemOnBelt;
|
|
|
|
typedef struct Item {
|
|
bool isTile;
|
|
ItemType type;
|
|
char name[20];
|
|
uint16_t miscVal;
|
|
SDL_Texture * texture[ORIENT_DIRECTION_COUNT];
|
|
SDL_Texture * textureOnBelt[ORIENT_DIRECTION_COUNT];
|
|
SDL_Rect atlasRects[ORIENT_DIRECTION_COUNT];
|
|
SDL_Rect atlasRectsOnBelt[ORIENT_DIRECTION_COUNT];
|
|
} Item;
|
|
|
|
|
|
extern Item ItemRegistry[ITEMREGISTRY_SIZE];
|
|
|
|
void updateItems();
|
|
|
|
void loadItems(SDL_Renderer *mainRenderer);
|
|
|
|
void renderItem(ItemOnBelt item, SDL_Renderer *mainRenderer, int lane, SDL_Rect playerRect);
|
|
|
|
extern uint16_t itemRegistryIndex;
|
|
|
|
extern uint8_t laneTarget;
|
|
extern double speed;
|
|
|
|
|
|
void putItem(int x, int y, ItemType itemType, uint8_t lane);
|
|
#endif //FACTORYGAME_ITEM_H
|