#endif
-#include "t_actor.c"
+#include "t_unit.c"
#include "u_rand.c"
#include "n_conn.c"
+#include "u_math.c"
#endif
+++ /dev/null
-#include "t_actor.h"
+++ /dev/null
-#ifndef T_ACTOR_H__
-#define T_ACTOR_H__
-
-enum t_actor_flags {
- T_ACTOR_F_NONE = 0
-};
-
-/**
- * Character stats
- */
-struct t_stats {
- /**
- * base stats
- */
- short str;
- short wis;
- short agi;
- short vit;
-
- /* resistances */
- short poison_res;
- short fire_res;
- short holy_res;
- short chaos_res;
-
- /* damage stats */
- unsigned int physical_damage;
- unsigned int magic_damage;
-
- /* misc */
- unsigned char tohit;
-};
-
-/* current actor state
- * this struct mostly contains
- * mutable variables related to an actor
- */
-struct t_actor_state {
- int hp;
- int mp;
- int level;
- int xp;
-};
-
-enum t_actor_type {
- T_ACTOR_TYPE_PLAYER,
- T_ACTOR_TYPE_PET
-};
-
-struct t_actor {
- unsigned int id;
- enum t_actor_type type;
-
- unsigned short faction_id;
-
- struct t_stats stats;
- struct t_actor_state state;
-};
-
-
-#endif
--- /dev/null
+#ifndef T_COMMAND_H__
+#define T_COMMAND_H__
+
+/**
+ * A command is an order for a unit.
+ * each unit has a command queue.
+ */
+
+#define T_COMMANDS_MAX 8
+
+enum t_command_type {
+ T_COMMAND_NONE = 0
+};
+
+enum t_command_flags {
+ T_COMMAND_F_NONE = 0
+};
+
+struct t_command {
+ enum t_command_type type;
+ enum t_command_flags flags;
+};
+
+/**
+ * This is a comamnd buffer
+ * It wraps around and keeps track of the current command
+ */
+struct t_command_queue {
+ u8 current;
+ struct t_command buffer[T_COMMANDS_MAX];
+};
+
+#endif
--- /dev/null
+#include "t_unit.h"
--- /dev/null
+#ifndef T_UNIT_H__
+#define T_UNIT_H__
+
+#include "t_command.h"
+#include "u_defs.h"
+
+enum t_unit_flags {
+ T_UNIT_F_NONE = 0
+};
+
+enum t_unit_type {
+ T_UNIT_TYPE_NONE = 0
+};
+
+/* unit damage type */
+enum t_unit_damage_type {
+ T_UNIT_SLASHING,
+ T_UNIT_PIERCING,
+ T_UNIT_SIEGE
+};
+
+struct t_unit {
+ unsigned int id;
+ enum t_unit_type type;
+ enum t_unit_flags flags;
+
+ i16 view_radius;
+
+ i16 hp;
+ i16 hp_max;
+ i16 armor;
+
+ /* Unit damage type and damage range */
+ i16 damage_min;
+ i16 damage_max;
+ enum t_unit_damage_type damage_type;
+
+ /* a unit can be reistant to certain damage types */
+ enum t_unit_damage_type res;
+
+ struct t_command_queue commands;
+};
+
+#endif
--- /dev/null
+#include "u_math.h"
+
+struct u_fp u_fp_add(struct u_fp a, struct u_fp b) {
+ struct u_fp c = U_FP(0, 0);
+ lrts_todo("");
+ return c;
+}
+
+struct u_fp u_fp_sub(struct u_fp a, struct u_fp b) {
+ struct u_fp c = U_FP(0, 0);
+ lrts_todo("");
+ return c;
+}
+
+struct u_fp u_fp_mul(struct u_fp a, struct u_fp b) {
+ struct u_fp c = U_FP(0, 0);
+ lrts_todo("");
+ return c;
+}
+
+struct u_fp u_fp_div(struct u_fp a, struct u_fp b) {
+ struct u_fp c = U_FP(0, 0);
+ lrts_todo("");
+ return c;
+}
+
+struct u_fp u_fp_mod(struct u_fp a, struct u_fp b) {
+ struct u_fp c = U_FP(0, 0);
+ lrts_todo("");
+ return c;
+}
--- /dev/null
+#ifndef U_MATH_H__
+#define U_MATH_H__
+
+#define U_FP(n, f) {n, f}
+
+/* fixed point number
+ * n: whole part
+ * f: fractional part
+ */
+struct u_fp {
+ u16 n;
+ u16 f;
+};
+
+struct u_fp u_fp_add(struct u_fp a, struct u_fp b);
+struct u_fp u_fp_sub(struct u_fp a, struct u_fp b);
+struct u_fp u_fp_mul(struct u_fp a, struct u_fp b);
+struct u_fp u_fp_div(struct u_fp a, struct u_fp b);
+struct u_fp u_fp_mod(struct u_fp a, struct u_fp b);
+
+#endif