summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonAki <konaki@anokonaki.org>2026-10-16 15:38:03 +0800
committerKonAki <konaki@anokonaki.org>2026-10-16 15:38:03 +0800
commiteb07fabdea8f3ebec3c1774e9a1aef09f6152bf1 (patch)
treeb06f87a19ebbad68ef8f66bab77a0bcdb1c02f6d
parent8d3cf3a9ebb1bc5d96152da2f11b8b6af850d0e5 (diff)
rmdata: actors, and starting them with their equipment
-rw-r--r--kon/konrmdata.c19
-rw-r--r--kon/konrmdata.h18
2 files changed, 37 insertions, 0 deletions
diff --git a/kon/konrmdata.c b/kon/konrmdata.c
index 1957942..b84973a 100644
--- a/kon/konrmdata.c
+++ b/kon/konrmdata.c
@@ -27,6 +27,25 @@
#include <stddef.h>
+/*** actors ***/
+
+int kon_rmActorStart(kon_party_t *party, int index, const kon_rmActor_t *actor, int weaponBase, int armorBase)
+{
+ int slot;
+
+ if (!party || !actor || !actor->name) return 0;
+ if (!kon_actorInit(party, index, actor->name, actor->classId, actor->initialLevel)) return 0;
+ for (slot = 0; slot < KON_EQUIP_SLOTS; slot++) {
+ int id = actor->equips[slot], item;
+
+ if (id <= 0 || id > 1000000) continue;
+ item = (slot == 0 ? weaponBase : armorBase) + id;
+ if (kon_bagAdd(party, item, 1) != 1) continue;
+ if (!kon_actorEquip(party, index, slot, item)) kon_bagRemove(party, item, 1);
+ }
+ return 1;
+}
+
/*** enemies ***/
void kon_rmEnemyBattler(const kon_rmEnemy_t *enemy, kon_battler_t *out)
diff --git a/kon/konrmdata.h b/kon/konrmdata.h
index 1f5b8cd..7d402f6 100644
--- a/kon/konrmdata.h
+++ b/kon/konrmdata.h
@@ -27,6 +27,7 @@
#define KONRMDATA_H
#include "konbattle.h"
+#include "konparty.h"
#ifdef __cplusplus
extern "C" {
@@ -91,6 +92,23 @@ typedef struct kon_rmTroop {
int pageCount;
} kon_rmTroop_t;
+/*** actors ***/
+
+/* who the game starts with, by the actor's id. the party module keeps the people that change, this is how they begin: the pictures
+ they are drawn with, their class, level and what they wear (weapon and armor ids by slot, 0 for nothing) */
+typedef struct kon_rmActor {
+ const char *name, *nickname;
+ const char *characterName, *faceName, *battlerName;
+ int characterIndex, faceIndex;
+ int classId, initialLevel, maxLevel;
+ int equips[KON_EQUIP_SLOTS];
+} kon_rmActor_t;
+
+/* makes actor number index of the party from a table entry, wearing what it starts with. the weapons and armor come into the bag
+ and are put on, so the bag ends up as it was. weaponBase and armorBase are what the converter wrote (name_WEAPON_BASE and
+ name_ARMOR_BASE). returns 0 when the class is not in the database */
+int kon_rmActorStart(kon_party_t *party, int index, const kon_rmActor_t *actor, int weaponBase, int armorBase);
+
/*** enemies ***/
/* the battler of an enemy, at full hp and mp. the name is the enemy's */