Render test
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
# Copyright (c) 2025 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DUSK_TARGET_NAME}
|
||||
PRIVATE
|
||||
itemtype.c
|
||||
inventory.c
|
||||
)
|
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "assert/assert.h"
|
||||
#include "inventory.h"
|
||||
#include "util/memory.h"
|
||||
|
||||
void inventoryInit(inventory_t *inventory) {
|
||||
assertNotNull(inventory, "Inventory pointer cannot be NULL");
|
||||
|
||||
memoryZero(inventory, sizeof(inventory_t));
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "itemstack.h"
|
||||
|
||||
#define INVENTORY_ITEM_COUNT 32
|
||||
|
||||
typedef struct {
|
||||
itemstack_t items[INVENTORY_ITEM_COUNT];
|
||||
uint8_t itemCount;
|
||||
} inventory_t;
|
||||
|
||||
/**
|
||||
* Initializes the inventory.
|
||||
*
|
||||
* @param inventory Pointer to the inventory to initialize.
|
||||
*/
|
||||
void inventoryInit(inventory_t *inventory);
|
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "itemtype.h"
|
||||
|
||||
typedef struct {
|
||||
itemtype_t type;
|
||||
uint8_t count;
|
||||
} itemstack_t;
|
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "assert/assert.h"
|
||||
#include "itemtype.h"
|
||||
|
||||
iteminfo_t ITEM_INFO[ITEM_TYPE_COUNT] = {
|
||||
[ITEM_TYPE_NULL] = { 0 },
|
||||
|
||||
// Consumables
|
||||
[ITEM_TYPE_POTION] = { .stackable = true },
|
||||
|
||||
// Ingredients
|
||||
[ITEM_TYPE_ONION] = { .stackable = true },
|
||||
[ITEM_TYPE_SWEET_POTATO] = { .stackable = true },
|
||||
|
||||
// Cooked Items
|
||||
[ITEM_TYPE_BAKED_SWEET_POTATO] = { .stackable = true },
|
||||
};
|
||||
|
||||
static inline bool_t itemTypeIsStackable(const itemtype_t type) {
|
||||
assertTrue(type < ITEM_TYPE_COUNT, "Invalid item type");
|
||||
return ITEM_INFO[type].stackable;
|
||||
}
|
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "dusk.h"
|
||||
|
||||
typedef enum {
|
||||
ITEM_TYPE_NULL,
|
||||
|
||||
// Consumables
|
||||
ITEM_TYPE_POTION,
|
||||
|
||||
// Ingredients
|
||||
ITEM_TYPE_ONION,
|
||||
ITEM_TYPE_SWEET_POTATO,
|
||||
|
||||
// Cooked Items
|
||||
ITEM_TYPE_BAKED_SWEET_POTATO,
|
||||
} itemtype_t;
|
||||
|
||||
#define ITEM_TYPE_COUNT (ITEM_TYPE_BAKED_SWEET_POTATO + 1)
|
||||
|
||||
typedef struct {
|
||||
bool_t stackable;
|
||||
} iteminfo_t;
|
||||
extern iteminfo_t ITEM_INFO[ITEM_TYPE_COUNT];
|
||||
|
||||
/**
|
||||
* Returns true if the item type is stackable.
|
||||
*
|
||||
* @param type The item type to check.
|
||||
* @return true if the item type is stackable, false otherwise.
|
||||
*/
|
||||
static inline bool_t itemTypeIsStackable(const itemtype_t type);
|
Reference in New Issue
Block a user