This commit is contained in:
2025-06-07 00:57:00 +02:00
parent d4665c4e9b
commit 64cac7578d
100 changed files with 464 additions and 169 deletions

View File

@@ -10,63 +10,97 @@
#include "../items/item.h"
#include "../util/atlas.h"
void generateBeltFrames(SDL_Renderer *renderer) {
SDL_Texture *baseTexture = TileRegistry[TYPE_BELT].animation.textures[ORIENT_LEFT][0]; // Base belt tile
SDL_Texture *oldTarget = SDL_GetRenderTarget(renderer);
const int frameCount = TILE_SIZE; // 32 frames, 1px per frame = full seamless loop
for (OrientDirection dir = ORIENT_LEFT_DOWN; dir < ORIENT_DIRECTION_COUNT; dir++) {
double angle = 0.0;
bool isHorizontal = true;
bool reverse = false;
switch (dir) {
case ORIENT_LEFT:
angle = 0;
isHorizontal = true;
reverse = false;
break;
case ORIENT_UP:
angle = 90;
isHorizontal = false;
reverse = false;
break;
case ORIENT_RIGHT:
angle = 180;
isHorizontal = true;
reverse = true;
break;
case ORIENT_DOWN:
angle = 270;
isHorizontal = false;
reverse = true;
break;
default:
continue; // skip diagonals or unsupported directions
}
// Step 1: Rotate the tile once
SDL_Texture *rotated = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888,
SDL_TEXTUREACCESS_TARGET, TILE_SIZE, TILE_SIZE);
SDL_SetTextureBlendMode(rotated, SDL_BLENDMODE_BLEND);
SDL_SetRenderTarget(renderer, rotated);
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
SDL_RenderClear(renderer);
SDL_Rect full = {0, 0, TILE_SIZE, TILE_SIZE};
SDL_RenderCopyEx(renderer, baseTexture, NULL, &full, angle, NULL, SDL_FLIP_NONE);
// Step 2: For each frame, render 2 rotated tiles with wrapping offset
for (int f = 0; f < frameCount; f++) {
SDL_Texture *frame = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888,
SDL_TEXTUREACCESS_TARGET, TILE_SIZE, TILE_SIZE);
SDL_SetTextureBlendMode(frame, SDL_BLENDMODE_BLEND);
SDL_SetRenderTarget(renderer, frame);
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
SDL_RenderClear(renderer);
int offset = reverse ? (TILE_SIZE - f) % TILE_SIZE : f;
SDL_Rect dst1, dst2;
if (isHorizontal) {
dst1 = (SDL_Rect) {-offset, 0, TILE_SIZE, TILE_SIZE};
dst2 = (SDL_Rect) {TILE_SIZE - offset, 0, TILE_SIZE, TILE_SIZE};
} else {
dst1 = (SDL_Rect) {0, -offset, TILE_SIZE, TILE_SIZE};
dst2 = (SDL_Rect) {0, TILE_SIZE - offset, TILE_SIZE, TILE_SIZE};
}
SDL_RenderCopy(renderer, rotated, NULL, &dst1);
SDL_RenderCopy(renderer, rotated, NULL, &dst2);
TileRegistry[TYPE_BELT].animation.textures[dir][f] = frame;
TileRegistry[TYPE_BELT].animation.atlasRects[dir][f] = allocate_32x32(frame, renderer);
}
SDL_DestroyTexture(rotated);
TileRegistry[TYPE_BELT].animation.frameCount = frameCount;
TileRegistry[TYPE_BELT].animation.divisor = 1;
}
SDL_SetRenderTarget(renderer, oldTarget);
}
void renderBelt(int x, int y, int w, int h, OrientDirection dir, SDL_Rect playerRect, SDL_Renderer *renderer) {
int px = x * TILE_SIZE;
int py = y * TILE_SIZE;
Tile *t = &tileMap[y][x];
ItemType tileType = t->type;
SDL_Rect src1, src2, dst1, dst2;
if (dir == ORIENT_LEFT || dir == ORIENT_RIGHT) {
int offset = scrollFrame % TILE_SIZE;
if (dir == ORIENT_RIGHT) {
offset = TILE_SIZE - offset; // reverse scroll
}
src1 = (SDL_Rect) {offset, 0, TILE_SIZE - offset, TILE_SIZE};
dst1 = (SDL_Rect) {px, py, (w - offset), h};
src2 = (SDL_Rect) {0, 0, offset, TILE_SIZE};
dst2 = (SDL_Rect) {px + (w - offset), py, offset, h};
adjustRect(&dst1, playerRect);
adjustRect(&dst2, playerRect);
SDL_RenderCopy(renderer, TileRegistry[tileType].textures[dir], &src1, &dst1); //TODO CONVERT TO ATLAS
SDL_RenderCopy(renderer, TileRegistry[tileType].textures[dir], &src2, &dst2); //TODO CONVERT TO ATLAS
// SDL_RenderCopyx(renderer, atlasTexture, &TileRegistry[tileType].atlasRects[dir], NULL);
// SDL_RenderCopyx(renderer, atlasTexture, &TileRegistry[tileType].atlasRects[dir], NULL);
} else {
int offset = scrollFrame % TILE_SIZE;
if (dir == ORIENT_DOWN) {
offset = TILE_SIZE - offset; // reverse scroll
}
src1 = (SDL_Rect) {0, offset, TILE_SIZE, TILE_SIZE - offset};
dst1 = (SDL_Rect) {px, py, w, h - offset};
src2 = (SDL_Rect) {0, 0, TILE_SIZE, offset};
dst2 = (SDL_Rect) {px, py + (h - offset), w, offset};
adjustRect(&dst1, playerRect);
adjustRect(&dst2, playerRect);
// Rotate to make the belt vertical
// SDL_RenderCopyx(renderer, atlasTexture, &ItemRegistry[item.type].atlasRectsOnBelt[ORIENT_LEFT], NULL);
// SDL_RenderCopyx(renderer, atlasTexture, &ItemRegistry[item.type].atlasRectsOnBelt[ORIENT_LEFT], NULL);
SDL_RenderCopy(renderer, TileRegistry[tileType].textures[dir], &src1, &dst1);
SDL_RenderCopy(renderer, TileRegistry[tileType].textures[dir], &src2, &dst2);
}
}
void updateBelt(Tile * tile) {
SDL_Rect dst = {px, py, w, h};
adjustRect(&dst, playerRect);
SDL_RenderCopy(renderer, atlasTexture, &TileRegistry[TYPE_BELT].animation.atlasRects[dir][
(animationStep / TileRegistry[TYPE_BELT].animation.divisor) %
TileRegistry[TYPE_BELT].animation.frameCount],
&dst);
}

View File

@@ -11,8 +11,7 @@
struct Tile;
void renderBelt(int x, int y, int w, int h, OrientDirection dir, SDL_Rect playerRect, SDL_Renderer *renderer);
void updateBelt(struct Tile * tile);
void generateBeltFrames(SDL_Renderer *renderer);
void renderBelt(int x, int y, int w, int h, OrientDirection dir, SDL_Rect playerRect, SDL_Renderer *renderer);
#endif //FACTORYGAME_BELT_H

View File

@@ -25,6 +25,13 @@ void updateFurnace(Tile *tile) {
if (targetOutItemType != TYPE_AIR) {
if (tile->miscVal == 0) {
if (outItem->type != TYPE_AIR) {
if (tile->audioCh < NUM_SYNTH_VOICES) {
audioData.synthVoices[tile->audioCh].volume = 0;
}
tile->fixedFrame = 1;
return;
}
tile->audioCh = getAvailableChannel();
if (tile->audioCh < NUM_SYNTH_VOICES) {
audioData.synthVoices[tile->audioCh].volume = 255;
@@ -34,6 +41,7 @@ void updateFurnace(Tile *tile) {
audioData.synthVoices[tile->audioCh].waveform = WAVE_SINE;
audioData.synthVoices[tile->audioCh].frequency = 200;
}
tile->fixedFrame = 0;
}
++audioData.synthVoices[tile->audioCh].frequency;
if (audioData.synthVoices[tile->audioCh].volume < 255) {
@@ -43,10 +51,13 @@ void updateFurnace(Tile *tile) {
if (tile->audioCh < NUM_SYNTH_VOICES) {
audioData.synthVoices[tile->audioCh].volume = 0;
}
tile->fixedFrame = 1;
tile->miscVal = 0;
inItem->type = 0;
outItem->type = targetOutItemType;
outItem->offset = -0.5f;
}
} else {
tile->fixedFrame = 1;
}
}

View File

@@ -23,6 +23,7 @@ void updateMiner(Tile *tile) {
if (targetOutItemType != TYPE_AIR && outItem->type == 0) {
if (tile->miscVal == 0) {
tile->audioCh = getAvailableChannel();
tile->fixedFrame = 0;
if (tile->audioCh < NUM_SYNTH_VOICES) {
audioData.synthVoices[tile->audioCh].volume = 64;
audioData.synthVoices[tile->audioCh].phase = 0;
@@ -36,9 +37,12 @@ void updateMiner(Tile *tile) {
if (tile->audioCh < NUM_SYNTH_VOICES) {
audioData.synthVoices[tile->audioCh].volume = 0;
}
tile->fixedFrame = 1;
tile->miscVal = 0;
outItem->type = targetOutItemType;
outItem->offset = -0.5f;
}
} else {
tile->fixedFrame = 1;
}
}

View File

@@ -2,6 +2,7 @@
// Created by bruno on 4/24/25.
//
#include <dirent.h>
#include "tile.h"
#include "../player/player.h"
#include "furnace.h"
@@ -73,57 +74,189 @@ void generateTestMap() {
}
void registerTile(char name[20], SDL_Renderer *renderer) {
const char *dot = strchr(name, '.');
memcpy(TileRegistry[tileTypeIndex].name, name, dot - name);
void registerTile(char fname[20], SDL_Renderer *renderer) {
char name[21];
// Load animation frames
int frame = 0;
int indexTile = 0;
char texturePath[80];
snprintf(texturePath, 80, "./assets/tiles/%s", name);
if (sscanf(fname, "%d_%20[^_]_%d.png", &indexTile, name, &frame) == 3) {
// Success: you now have index, fname, and frame
} else {
fprintf(stderr, "Invalid format: %s\n", fname);
}
strcpy(TileRegistry[indexTile].name, name);
snprintf(texturePath, sizeof(texturePath), "./assets/tiles/%s", fname);
SDL_Texture *texture = IMG_LoadTexture(renderer, texturePath);
TileRegistry[tileTypeIndex].textures[ORIENT_LEFT] = texture;
TileRegistry[tileTypeIndex].textures[ORIENT_RIGHT] = createFlippedTexture(renderer, texture, SDL_FLIP_HORIZONTAL);
TileRegistry[tileTypeIndex].textures[ORIENT_UP] = createRotatedTexture(renderer, texture, 90);
TileRegistry[tileTypeIndex].textures[ORIENT_DOWN] = createRotatedTexture(renderer, texture, 270);
SDL_SetTextureBlendMode(TileRegistry[tileTypeIndex].textures[ORIENT_LEFT], SDL_BLENDMODE_BLEND);
SDL_SetTextureBlendMode(TileRegistry[tileTypeIndex].textures[ORIENT_RIGHT], SDL_BLENDMODE_BLEND);
SDL_SetTextureBlendMode(TileRegistry[tileTypeIndex].textures[ORIENT_UP], SDL_BLENDMODE_BLEND);
SDL_SetTextureBlendMode(TileRegistry[tileTypeIndex].textures[ORIENT_DOWN], SDL_BLENDMODE_BLEND);
if (!texture) {
// Stop loading frames if the first one fails, or after all valid ones are added
if (frame == 0) {
fprintf(stderr, "Failed to load tile texture %s: %s\n", texturePath, IMG_GetError());
}
}
TileRegistry[tileTypeIndex].atlasRects[ORIENT_LEFT] = allocate_32x32(
TileRegistry[tileTypeIndex].textures[ORIENT_LEFT], renderer);
TileRegistry[tileTypeIndex].atlasRects[ORIENT_RIGHT] = allocate_32x32(
TileRegistry[tileTypeIndex].textures[ORIENT_RIGHT], renderer);
TileRegistry[tileTypeIndex].atlasRects[ORIENT_UP] = allocate_32x32(TileRegistry[tileTypeIndex].textures[ORIENT_UP],
renderer);
TileRegistry[tileTypeIndex].atlasRects[ORIENT_DOWN] = allocate_32x32(
TileRegistry[tileTypeIndex].textures[ORIENT_DOWN], renderer);
for (int o = 0; o < ORIENT_DIRECTION_COUNT; o++) {
SDL_Texture *textures[ORIENT_DIRECTION_COUNT] = {
NULL,
texture,
NULL,
createFlippedTexture(renderer, texture, SDL_FLIP_HORIZONTAL),
NULL,
createRotatedTexture(renderer, texture, 90),
NULL,
createRotatedTexture(renderer, texture, 270)
};
TileRegistry[tileTypeIndex].type = tileTypeIndex;
TileRegistry[tileTypeIndex].breakTime = 15;
printf("Bound %s to %d orient %s\n", fname, indexTile, OrientStrings[o]);
TileRegistry[indexTile].animation.textures[o][frame] = textures[o];
SDL_SetTextureBlendMode(textures[o], SDL_BLENDMODE_BLEND);
TileRegistry[indexTile].animation.atlasRects[o][frame] = allocate_32x32(textures[o], renderer);
}
tileTypeIndex++;
TileRegistry[indexTile].type = indexTile;
TileRegistry[indexTile].animation.frameCount = frame + 1;
TileRegistry[indexTile].animation.divisor = 1;
TileRegistry[indexTile].type = tileTypeIndex;
TileRegistry[indexTile].breakTime = 15;
if (indexTile + 1 > tileTypeIndex) {
tileTypeIndex = indexTile + 1;
}
}
void registerBackgroundTile(char name[20], SDL_Renderer *renderer) {
const char *dot = strchr(name, '.');
memcpy(BackgroundTileRegistry[backgroundTileTypeIndex].name, name, dot - name);
void registerBackgroundTile(char fname[20], SDL_Renderer *renderer) {
char name[21];
// Load animation frames
int frame = 0;
int indexBgTile = 0;
char texturePath[80];
snprintf(texturePath, 80, "./assets/backgrounds/%s", name);
if (sscanf(fname, "%d_%20[^_]_%d.png", &indexBgTile, name, &frame) == 3) {
// Success: you now have index, fname, and frame
} else {
fprintf(stderr, "Invalid format: %s\n", fname);
}
strcpy(BackgroundTileRegistry[indexBgTile].name, name);
snprintf(texturePath, sizeof(texturePath), "./assets/backgrounds/%s", fname);
SDL_Texture *texture = IMG_LoadTexture(renderer, texturePath);
BackgroundTileRegistry[backgroundTileTypeIndex].texture = texture;
SDL_SetTextureBlendMode(BackgroundTileRegistry[backgroundTileTypeIndex].texture, SDL_BLENDMODE_NONE);
BackgroundTileRegistry[backgroundTileTypeIndex].atlasRect = allocate_32x32(
BackgroundTileRegistry[backgroundTileTypeIndex].texture, renderer);
if (!texture) {
if (frame == 0) {
fprintf(stderr, "Failed to load background texture %s: %s\n", texturePath, IMG_GetError());
}
}
BackgroundTileRegistry[backgroundTileTypeIndex].type = backgroundTileTypeIndex;
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_NONE);
backgroundTileTypeIndex++;
printf("Bound %s to %d\n", fname, indexBgTile);
BackgroundTileRegistry[indexBgTile].animation.textures[frame] = texture;
BackgroundTileRegistry[indexBgTile].animation.atlasRects[frame] = allocate_32x32(texture, renderer);
BackgroundTileRegistry[indexBgTile].type = indexBgTile;
BackgroundTileRegistry[indexBgTile].animation.frameCount = frame + 1;
BackgroundTileRegistry[indexBgTile].animation.divisor = 1;
if (indexBgTile + 1 > backgroundTileTypeIndex) {
backgroundTileTypeIndex = indexBgTile + 1;
}
}
int compareStrings(const void *a, const void *b) {
const char *strA = *(const char **) a;
const char *strB = *(const char **) b;
return strcmp(strA, strB);
}
void loadTiles(SDL_Renderer *renderer) {
iterateSortedDir("./assets/tiles", (DirEntryCallback) registerTile, renderer);
iterateSortedDir("./assets/backgrounds", (DirEntryCallback) registerBackgroundTile, renderer);
DIR *dir = opendir("./assets/tiles");
if (!dir) {
perror("Failed to open tiles directory");
return;
}
char *baseNames[MAX_BASE_NAMES];
int baseNameCount = 0;
struct dirent *entry;
while ((entry = readdir(dir))) {
char *dot = strrchr(entry->d_name, '.');
if (!dot || strcmp(dot, ".png") != 0) continue;
// Check if baseName already stored
int found = 0;
for (int i = 0; i < baseNameCount; ++i) {
if (strcmp(baseNames[i], entry->d_name) == 0) {
found = 1;
break;
}
}
if (!found && baseNameCount < MAX_BASE_NAMES) {
baseNames[baseNameCount++] = strdup(entry->d_name); // Only store base, not full file name
}
}
closedir(dir);
qsort(baseNames, baseNameCount, sizeof(char *), compareStrings);
// Call registerTile on each base name
for (int i = 0; i < baseNameCount; ++i) {
char fileName[64];
snprintf(fileName, sizeof(fileName), "%s", baseNames[i]);
registerTile(fileName, renderer);
free(baseNames[i]);
}
generateBeltFrames(renderer);
}
void loadBackgroundTiles(SDL_Renderer *renderer) {
DIR *dir = opendir("./assets/backgrounds");
if (!dir) {
perror("Failed to open backgrounds directory");
return;
}
char *baseNames[MAX_BASE_NAMES];
int baseNameCount = 0;
struct dirent *entry;
while ((entry = readdir(dir))) {
char *dot = strrchr(entry->d_name, '.');
if (!dot || strcmp(dot, ".png") != 0) continue;
// Check if baseName already stored
int found = 0;
for (int i = 0; i < baseNameCount; ++i) {
if (strcmp(baseNames[i], entry->d_name) == 0) {
found = 1;
break;
}
}
if (!found && baseNameCount < MAX_BASE_NAMES) {
baseNames[baseNameCount++] = strdup(entry->d_name); // Only store base, not full file name
}
}
closedir(dir);
qsort(baseNames, baseNameCount, sizeof(char *), compareStrings);
// Call registerBackgroundTile on each base name
for (int i = 0; i < baseNameCount; ++i) {
char fileName[64];
snprintf(fileName, sizeof(fileName), "%s", baseNames[i]);
registerBackgroundTile(fileName, renderer);
free(baseNames[i]);
}
}
void setupTiles() {
@@ -144,10 +277,19 @@ void setupTiles() {
}
}
TileRegistry[TYPE_FURNACE].outputLane[FURNACE_OUTPUT_SLOT] = 1;
TileRegistry[TYPE_FURNACE].startFrame = 1;
TileRegistry[TYPE_FURNACE].needsTicks = true;
TileRegistry[TYPE_FURNACE].animation.divisor = 8;
TileRegistry[TYPE_BELT].needsTicks = true;
TileRegistry[TYPE_MINER].needsTicks = true;
TileRegistry[TYPE_MINER].outputLane[MINER_OUTPUT_SLOT] = 1;
TileRegistry[TYPE_MINER].startFrame = 1;
BackgroundTileRegistry[BGType_WATER_DEEP].animation.divisor = 16;
BackgroundTileRegistry[BGType_WATER_SHALLOW].animation.divisor = 12;
BackgroundTileRegistry[BGType_GRASS_FLOWER0].animation.divisor = 16;
BackgroundTileRegistry[BGType_GRASS_FLOWER1].animation.divisor = 16;
BackgroundTileRegistry[BGType_GRASS_FLOWER2].animation.divisor = 16;
}
uint16_t getBreakTime(int type) {
@@ -205,8 +347,11 @@ void renderAllTiles(SDL_Renderer *renderer, SDL_Rect playerRect) {
adjustRect(&dstRect, playerRect);
BackgroundTile bt = backgroundMap[y][x];
SDL_Texture *tex = BackgroundTileRegistry[bt.type].texture;
SDL_Rect atlRect = BackgroundTileRegistry[bt.type].atlasRect;
SDL_Texture *tex = BackgroundTileRegistry[bt.type].animation.textures[animationStep %
BackgroundTileRegistry[bt.type].animation.frameCount];
SDL_Rect atlRect = BackgroundTileRegistry[bt.type].animation.atlasRects[
(animationStep / BackgroundTileRegistry[bt.type].animation.divisor) %
BackgroundTileRegistry[bt.type].animation.frameCount];
if (atlRect.w != 0 && atlRect.h != 0) {
SDL_RenderCopy(renderer, atlasTexture, &atlRect, &dstRect);
//SDL_RenderCopy(renderer, tex, NULL, &dstRect);
@@ -237,11 +382,18 @@ void renderAllTiles(SDL_Renderer *renderer, SDL_Rect playerRect) {
renderBelt(x, y, tileSize, tileSize, t.direction, playerRect, renderer);
break;
default: {
SDL_Rect atlRect = TileRegistry[t.type].atlasRects[t.direction];
SDL_Texture *tex = TileRegistry[t.type].textures[t.direction];
char animationFrame = ((animationStep / TileRegistry[t.type].animation.divisor) %
(TileRegistry[t.type].animation.frameCount -
TileRegistry[t.type].startFrame)) + TileRegistry[t.type].startFrame;
if (t.fixedFrame > 0) {
animationFrame = t.fixedFrame - 1;
}
SDL_Rect atlRect = TileRegistry[t.type].animation.atlasRects[t.direction][animationFrame];
SDL_Texture *tex = TileRegistry[t.type].animation.textures[t.direction][animationFrame];
if (atlRect.w == 0 || atlRect.h == 0) {
tex = TileRegistry[t.type].textures[ORIENT_LEFT];
atlRect = TileRegistry[t.type].atlasRects[ORIENT_LEFT];
tex = TileRegistry[t.type].animation.textures[ORIENT_LEFT][animationFrame];
atlRect = TileRegistry[t.type].animation.atlasRects[ORIENT_LEFT][
animationFrame];
}
if (atlRect.w != 0 && atlRect.h != 0) {
//SDL_RenderCopy(renderer, tex, NULL, &dstRect);

View File

@@ -49,20 +49,14 @@ extern unsigned long beltFrames;
#define ItemSlotCount 4
typedef enum BackgroundType {
BGType_WATER0,
BGType_WATER1,
BGType_GRASS0,
BGType_GRASS1,
BGType_GRASS2,
BGType_GRASS3,
BGType_GRASS4,
BGType_GRASS5,
BGType_GRASS6,
BGType_GRASS7,
BGType_WATER_SHALLOW,
BGType_WATER_DEEP,
BGType_GRASS_FLOWER0,
BGType_GRASS_FLOWER1,
BGType_GRASS_FLOWER2,
BGType_GRASS_FLOWER3,
BGType_GRASS0,
BGType_GRASS1,
BGType_GRASS2,
BGType_SAND0,
BGType_SAND1,
BGType_SAND2,
@@ -86,23 +80,25 @@ typedef enum BackgroundType {
BGType_END
} BackgroundType;
#define MAX_BASE_NAMES 512
#define MAX_ANIMATION_FRAMES 32
typedef struct TileTypeReg {
ItemType type;
char name[20];
SDL_Texture *textures[ORIENT_DIRECTION_COUNT];
SDL_Rect atlasRects[ORIENT_DIRECTION_COUNT];
OrientedAnimation animation;
uint16_t breakTime;
bool itemMoves;
bool allowedInItems[ItemSlotCount][ITEMREGISTRY_SIZE];
bool outputLane[ItemSlotCount];
bool needsTicks;
char startFrame;
} TileTypeReg;
typedef struct BackgroundTileType {
ItemType type;
char name[20];
SDL_Texture *texture;
SDL_Rect atlasRect;
Animation animation;
} BackgroundTileType;
typedef struct BackgroundTile {
@@ -127,6 +123,7 @@ typedef struct Tile {
uint16_t audioCh;
MiniRect rect;
int neededUpdateIndex;
char fixedFrame;
} Tile;
@@ -138,6 +135,8 @@ void setupTiles();
void generateTestMap();
void loadBackgroundTiles(SDL_Renderer *renderer);
void loadTiles(SDL_Renderer *renderer);
extern uint16_t tileTypeIndex;

View File

@@ -9,7 +9,7 @@
const UpdateTileCallback ItemTileCallbacks[TILEREGISTRY_SIZE] = {
[TYPE_AIR] = NULL,
[TYPE_BLOCK] = NULL,
[TYPE_BELT] = updateBelt,
[TYPE_BELT] = NULL,
[TYPE_FURNACE] = updateFurnace,
[TYPE_MINER] = updateMiner
};