Working on some script modules

This commit is contained in:
YourWishes committed 2026-05-05 16:22:04 -05:00
1 parent 6edcf75a0c
commit bb29c0edef
28 files changed
+712 -229

No files matched your search

+1 -1
View File
@@ -9,8 +9,8 @@ cmake_minimum_required(VERSION 3.13)
set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
# [cmake] This is allowed only when policy CMP0079 is set to NEW.
cmake_policy(SET CMP0079 NEW) cmake_policy(SET CMP0079 NEW)
set(FETCHCONTENT_UPDATES_DISCONNECTED ON)
option(DUSK_BUILD_TESTS "Enable tests" OFF) option(DUSK_BUILD_TESTS "Enable tests" OFF)
+3
View File
@@ -5,6 +5,9 @@ function CubeEntity() {
this.add(MESH); this.add(MESH);
this.add(MATERIAL); this.add(MATERIAL);
this.cubeMesh = Mesh.createCube();
this.mesh.mesh = this.cubeMesh;
} }
CubeEntity.prototype = Object.create(OverworldEntity.prototype); CubeEntity.prototype = Object.create(OverworldEntity.prototype);
-1
View File
@@ -4,7 +4,6 @@
# https://opensource.org/licenses/MIT # https://opensource.org/licenses/MIT
add_subdirectory(dusk) add_subdirectory(dusk)
add_subdirectory(duskrpg)
if(DUSK_TARGET_SYSTEM STREQUAL "linux" OR DUSK_TARGET_SYSTEM STREQUAL "knulli") if(DUSK_TARGET_SYSTEM STREQUAL "linux" OR DUSK_TARGET_SYSTEM STREQUAL "knulli")
add_subdirectory(dusklinux) add_subdirectory(dusklinux)
+2
View File
@@ -56,6 +56,8 @@ target_sources(${DUSK_BINARY_TARGET_NAME}
# Subdirs # Subdirs
add_subdirectory(assert) add_subdirectory(assert)
add_subdirectory(asset) add_subdirectory(asset)
add_subdirectory(item)
add_subdirectory(story)
add_subdirectory(console) add_subdirectory(console)
add_subdirectory(display) add_subdirectory(display)
add_subdirectory(log) add_subdirectory(log)
+2 -4
View File
@@ -18,11 +18,11 @@
#include "assert/assert.h" #include "assert/assert.h"
#include "entity/entitymanager.h" #include "entity/entitymanager.h"
#include "entity/component/physics/entityphysics.h" #include "entity/component/physics/entityphysics.h"
#include "game/game.h"
#include "physics/physicsmanager.h" #include "physics/physicsmanager.h"
#include "network/network.h" #include "network/network.h"
#include "system/system.h" #include "system/system.h"
#include "console/console.h" #include "console/console.h"
#include "item/backpack.h"
double jerry_port_current_time(void) { double jerry_port_current_time(void) {
dusktimeepoch_t epoch = timeGetEpoch(); dusktimeepoch_t epoch = timeGetEpoch();
@@ -54,9 +54,9 @@ errorret_t engineInit(const int32_t argc, const char_t **argv) {
errorChain(uiInit()); errorChain(uiInit());
errorChain(sceneInit()); errorChain(sceneInit());
entityManagerInit(); entityManagerInit();
backpackInit();
physicsManagerInit(); physicsManagerInit();
errorChain(networkInit()); errorChain(networkInit());
errorChain(gameInit());
/* Run the init script. */ /* Run the init script. */
consolePrint("Engine initialized"); consolePrint("Engine initialized");
@@ -73,7 +73,6 @@ errorret_t engineUpdate(void) {
consoleUpdate(); consoleUpdate();
uiUpdate(); uiUpdate();
physicsManagerUpdate(); physicsManagerUpdate();
errorChain(gameUpdate());
errorChain(displayUpdate()); errorChain(displayUpdate());
if(inputPressed(INPUT_ACTION_RAGEQUIT)) ENGINE.running = false; if(inputPressed(INPUT_ACTION_RAGEQUIT)) ENGINE.running = false;
@@ -91,7 +90,6 @@ void engineExit(void) {
errorret_t engineDispose(void) { errorret_t engineDispose(void) {
sceneDispose(); sceneDispose();
errorChain(gameDispose());
errorChain(networkDispose()); errorChain(networkDispose());
entityManagerDispose(); entityManagerDispose();
localeManagerDispose(); localeManagerDispose();
+1 -102
View File
@@ -7,11 +7,6 @@
#include "entitymesh.h" #include "entitymesh.h"
#include "entity/entitymanager.h" #include "entity/entitymanager.h"
#include "assert/assert.h"
#include "util/memory.h"
#include "display/mesh/cube.h"
#include "display/mesh/plane.h"
#include "display/mesh/capsule.h"
void entityMeshInit( void entityMeshInit(
const entityid_t entityId, const entityid_t entityId,
@@ -20,9 +15,7 @@ void entityMeshInit(
entitymesh_t *comp = componentGetData( entitymesh_t *comp = componentGetData(
entityId, componentId, COMPONENT_TYPE_MESH entityId, componentId, COMPONENT_TYPE_MESH
); );
comp->mesh = &CUBE_MESH_SIMPLE; comp->mesh = NULL;
comp->ownedVertices = NULL;
comp->ownsData = false;
} }
mesh_t * entityMeshGetMesh( mesh_t * entityMeshGetMesh(
@@ -50,98 +43,4 @@ void entityMeshDispose(
const entityid_t entityId, const entityid_t entityId,
const componentid_t componentId const componentid_t componentId
) { ) {
entitymesh_t *comp = componentGetData(
entityId, componentId, COMPONENT_TYPE_MESH
);
if(!comp->ownsData) return;
(void)meshDispose(&comp->ownedMesh);
memoryFree(comp->ownedVertices);
comp->ownedVertices = NULL;
comp->ownsData = false;
comp->mesh = NULL;
}
errorret_t entityMeshGeneratePlane(
const entityid_t entityId,
const componentid_t componentId,
const float_t width,
const float_t height
) {
entitymesh_t *comp = componentGetData(
entityId, componentId, COMPONENT_TYPE_MESH
);
entityMeshDispose(entityId, componentId);
comp->ownedVertices = memoryAllocate(
PLANE_VERTEX_COUNT * sizeof(meshvertex_t)
);
assertNotNull(comp->ownedVertices, "Failed to allocate plane vertices");
vec3 min = { -width * 0.5f, 0.0f, -height * 0.5f };
vec3 max = { width * 0.5f, 0.0f, height * 0.5f };
vec2 uvMin = { 0.0f, 0.0f };
vec2 uvMax = { 1.0f, 1.0f };
planeBuffer(
comp->ownedVertices,
PLANE_AXIS_XZ,
min,
max
#if MESH_ENABLE_COLOR
, COLOR_WHITE_4B
#endif
, uvMin,
uvMax
);
errorChain(meshInit(
&comp->ownedMesh,
PLANE_PRIMITIVE_TYPE,
PLANE_VERTEX_COUNT,
comp->ownedVertices
));
comp->mesh = &comp->ownedMesh;
comp->ownsData = true;
errorOk();
}
errorret_t entityMeshGenerateCapsule(
const entityid_t entityId,
const componentid_t componentId,
const float_t radius,
const float_t halfHeight
) {
entitymesh_t *comp = componentGetData(
entityId, componentId, COMPONENT_TYPE_MESH
);
entityMeshDispose(entityId, componentId);
comp->ownedVertices = memoryAllocate(
CAPSULE_VERTEX_COUNT * sizeof(meshvertex_t)
);
assertNotNull(comp->ownedVertices, "Failed to allocate capsule vertices");
vec3 center = { 0.0f, 0.0f, 0.0f };
capsuleBuffer(
comp->ownedVertices,
center,
radius,
halfHeight,
CAPSULE_CAP_RINGS,
CAPSULE_SECTORS
#if MESH_ENABLE_COLOR
, COLOR_WHITE_4B
#endif
);
errorChain(meshInit(
&comp->ownedMesh,
CAPSULE_PRIMITIVE_TYPE,
CAPSULE_VERTEX_COUNT,
comp->ownedVertices
));
comp->mesh = &comp->ownedMesh;
comp->ownsData = true;
errorOk();
} }
+1 -36
View File
@@ -11,9 +11,6 @@
typedef struct { typedef struct {
mesh_t *mesh; mesh_t *mesh;
mesh_t ownedMesh;
meshvertex_t *ownedVertices;
bool_t ownsData;
} entitymesh_t; } entitymesh_t;
/** /**
@@ -53,7 +50,7 @@ void entityMeshSetMesh(
); );
/** /**
* Disposes the entity mesh component, freeing any owned mesh data. * Disposes the entity mesh component.
* *
* @param entityId The entity ID. * @param entityId The entity ID.
* @param componentId The component ID. * @param componentId The component ID.
@@ -62,35 +59,3 @@ void entityMeshDispose(
const entityid_t entityId, const entityid_t entityId,
const componentid_t componentId const componentid_t componentId
); );
/**
* Generates an XZ-aligned plane mesh owned by the component.
*
* @param entityId The entity ID.
* @param componentId The component ID.
* @param width Width of the plane along the X axis.
* @param height Height of the plane along the Z axis.
* @return Error return value.
*/
errorret_t entityMeshGeneratePlane(
const entityid_t entityId,
const componentid_t componentId,
const float_t width,
const float_t height
);
/**
* Generates a Y-axis capsule mesh owned by the component.
*
* @param entityId The entity ID.
* @param componentId The component ID.
* @param radius Radius of the cylinder and hemisphere caps.
* @param halfHeight Half-height of the cylindrical section.
* @return Error return value.
*/
errorret_t entityMeshGenerateCapsule(
const entityid_t entityId,
const componentid_t componentId,
const float_t radius,
const float_t halfHeight
);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Internal Server Error - Dominic "YourWishes" Masters git
500 Internal Server Error

An error occurred:

An error occurred

Gitea Version: 28.2.0