47 lines
984 B
C
47 lines
984 B
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "rpg.h"
|
|
#include "entity/entity.h"
|
|
#include "time/time.h"
|
|
#include "rpgcamera.h"
|
|
#include "util/memory.h"
|
|
|
|
errorret_t rpgInit(void) {
|
|
memoryZero(ENTITIES, sizeof(ENTITIES));
|
|
|
|
rpgCameraInit();
|
|
|
|
entity_t *ent;
|
|
ent = &ENTITIES[0];
|
|
entityInit(ent, ENTITY_TYPE_PLAYER);
|
|
RPG_CAMERA.mode = RPG_CAMERA_MODE_FOLLOW_ENTITY;
|
|
RPG_CAMERA.followEntity.followEntityId = ent->id;
|
|
ent->position[0].tile = 32, ent->position[1].tile = 32;
|
|
|
|
ent = &ENTITIES[1];
|
|
entityInit(ent, ENTITY_TYPE_NPC);
|
|
ent->position[0].tile = 40, ent->position[1].tile = 32;
|
|
|
|
errorOk();
|
|
}
|
|
|
|
void rpgUpdate(void) {
|
|
if(!TIME.fixedUpdate) return;
|
|
|
|
entity_t *ent = &ENTITIES[0];
|
|
do {
|
|
if(ent->type == ENTITY_TYPE_NULL) continue;
|
|
entityUpdate(ent);
|
|
} while(++ent < &ENTITIES[ENTITY_COUNT]);
|
|
|
|
rpgCameraUpdate();
|
|
}
|
|
|
|
void rpgDispose(void) {
|
|
|
|
} |