tibia_alpha/objects.h

41 lines
1.1 KiB
C

//
// Created by rov on 12/27/25.
//
#ifndef TIBIA_OBJECTS_H
#define TIBIA_OBJECTS_H
#define SPRITE_TABLE_SIZE 500
#define THING_DATA_POOL_SIZE 256
#define ACTIVE_OBJECT_LIST_SIZE 256
#include <stdbool.h>
#include <stdint.h>
#include <SDL3/SDL_render.h>
#pragma pack(push, 1)
typedef struct {
uint16_t properties;
uint16_t spriteIndex;
uint16_t flags;
} ThingHeader;
#pragma pack(pop)
typedef struct Objects {
// TODO: not sure about the name/purpose of these.
void* spriteTable[SPRITE_TABLE_SIZE];
void* thingDataPool[THING_DATA_POOL_SIZE];
void* activeObjectList[ACTIVE_OBJECT_LIST_SIZE];
SDL_Texture* activeTextures[SPRITE_TABLE_SIZE];
} Objects_t;
bool Objects_Init(Objects_t* objects);
bool Objects_LoadData(Objects_t* objects);
bool Objects_LoadSprites(Objects_t* objects);
void Objects_Destroy(const Objects_t* objects);
SDL_Texture* Objects_GetSpriteTexture(const Objects_t* objects, uint16_t spriteID);
// TODO: move this somewhere else
SDL_Texture* Objects_TextureFromRaw(SDL_Renderer* renderer, uint8_t* rawData);
#endif //TIBIA_OBJECTS_H