Most texure work

This commit is contained in:
2025-06-10 21:59:51 +02:00
parent a17e3abbff
commit 39c31f0042
103 changed files with 666 additions and 246 deletions

37
util/crafter.h Normal file
View File

@@ -0,0 +1,37 @@
//
// Created by bruno on 10.6.2025.
//
#ifndef FACTORYGAME_CRAFTER_H
#define FACTORYGAME_CRAFTER_H
#include "../items/item.h"
#define MATCHES(a, b, x, y) ((a == x && b == y) || (a == y && b == x))
enum {
SLOT_INPUT1 = 0,
SLOT_INPUT2 = 1,
SLOT_OUTPUT = 2,
MACHINE_SLOTS = 3
};
typedef struct {
ItemType input1;
ItemType input2; // use TYPE_AIR if single-input
ItemType output;
uint16_t ticksRequired; // used for output delay
} MachineRecipe;
void updateMachine(Tile *tile,
const MachineRecipe *recipes, size_t recipeCount,
uint8_t waveform, uint16_t freqStart, uint16_t freqStep);
bool findMachineRecipe(const MachineRecipe *recipes, size_t count, ItemType in1, ItemType in2,
ItemType *out, uint16_t *ticks);
void initMachineTile(ItemType type, const MachineRecipe *recipes, size_t count,
uint8_t startFrame, uint8_t divisor);
#endif //FACTORYGAME_CRAFTER_H