This commit is contained in:
2025-10-26 08:06:39 -05:00
parent d74226dab1
commit 3feb43fdad
34 changed files with 112 additions and 1141 deletions

View File

@@ -7,6 +7,7 @@
#include "rpg.h"
#include "entity/entity.h"
#include "rpg/world/world.h"
#include "time/time.h"
#include "rpgcamera.h"
#include "util/memory.h"
@@ -14,8 +15,13 @@
errorret_t rpgInit(void) {
memoryZero(ENTITIES, sizeof(ENTITIES));
// Init the world.
worldInit();
// Initialize the camera
rpgCameraInit();
// TEST: Create some entities.
entity_t *ent;
ent = &ENTITIES[0];
entityInit(ent, ENTITY_TYPE_PLAYER);
@@ -27,18 +33,26 @@ errorret_t rpgInit(void) {
entityInit(ent, ENTITY_TYPE_NPC);
ent->position[0] = 6, ent->position[1] = 6;
// All Good!
errorOk();
}
void rpgUpdate(void) {
if(!TIME.fixedUpdate) return;
// TODO: Do not update if the scene is not the map scene?
// Update the world.
worldUpdate();
// Update overworld ents.
entity_t *ent = &ENTITIES[0];
do {
if(ent->type == ENTITY_TYPE_NULL) continue;
entityUpdate(ent);
} while(++ent < &ENTITIES[ENTITY_COUNT]);
// Update the camera.
rpgCameraUpdate();
}