84 lines
1.5 KiB
C
84 lines
1.5 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,
|
|
TYPE_MINER,
|
|
TYPE_TURRET,
|
|
TYPE_SPLITTER,
|
|
TYPE_CORE,
|
|
TYPE_AMMOCRAFTER,
|
|
TYPE_WIRECRAFTER,
|
|
IRON_ORE = ITEMREGISTRY_SIZE / 2,
|
|
SILVER_ORE,
|
|
GOLD_ORE,
|
|
PLATINUM_ORE,
|
|
IRON_INGOT,
|
|
SILVER_INGOT,
|
|
GOLD_INGOT,
|
|
PLATINUM_INGOT,
|
|
IRON_BULLET,
|
|
SILVER_BULLET,
|
|
GOLD_BULLET,
|
|
PLATINUM_BULLET,
|
|
LOG,
|
|
SILVER_PLATE,
|
|
GOLD_PLATE,
|
|
PLATINUM_PLATE,
|
|
IRON_PLATE,
|
|
SILVER_ROD,
|
|
GOLD_ROD,
|
|
PLATINUM_ROD,
|
|
IRON_ROD,
|
|
} ItemType;
|
|
|
|
|
|
typedef struct ItemOnBelt {
|
|
float offset;
|
|
MiniRect tile;
|
|
MiniRect prevTile;
|
|
ItemType type;
|
|
} ItemOnBelt;
|
|
|
|
typedef struct Item {
|
|
bool isTile;
|
|
ItemType type;
|
|
char name[20];
|
|
uint16_t miscVal;
|
|
OrientedAnimation animation;
|
|
OrientedAnimation beltAnimation;
|
|
} 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
|