#ifndef LMUD_H__
#define LMUD_H__
+#define LMUD_DEBUG
+
/**
* System includes
*/
#include "u_stdio.h"
#include "u_mem.h"
+#include "t_actor.h"
+#include "u_assert.h"
#define LMUD_VER "0.0.1"
#define LMUD_OPTS_ARG "c:"
#define LMUD_HELP(a, desc) printf("\t-%s\t%s\n", (a), desc);
+/**
+ * generic typedefs
+ */
+
typedef unsigned char lmud_bool;
#define LMUD_TRUE 1
#define LMUD_FALSE 0
int argc;
};
+typedef unsigned char u8;
+typedef char i8;
+typedef unsigned short u16;
+typedef short i16;
+typedef unsigned int u32;
+typedef int i32;
+
struct lmud_config* lmud_cfg();
void lmud_help(int argc, char **argv);
void lmud_version(void);
#include "lmud.c"
#include "u_stdio.c"
#include "u_mem.c"
+#include "t_actor.c"
+#include "u_rand.h"
#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;
+};
+
+struct t_actor {
+ unsigned int id;
+ unsigned short faction_id;
+
+ struct t_stats stats;
+ struct t_actor_state state;
+};
+
+
+#endif
--- /dev/null
+#ifndef U_ASSERT_H__
+#define U_ASSERT_H__
+
+#include <assert.h>
+
+#ifdef DEBUG
+
+#define lmud_assert(e, message) assert(e)
+
+#define lmud_todo(message) assert(0)
+
+#else
+
+#define lmud_assert(e, message)
+
+#define lmud_todo(message)
+
+#endif
+
+#endif
+#include <string.h>
#include "u_mem.h"
+
+
+void *u_memset(void *src, int c, size_t n) {
+ return memset(src, c, n);
+}
+
+void *u_memcpy(void *dst, const void *src, size_t n) {
+ return memcpy(dst, src, n);
+}
#define U_MEM_H__
+void *u_memset(void *src, int count, size_t n);
+void *u_memcpy(void *det, const void *src, size_t n);
#endif
--- /dev/null
+#include "u_rand.h"
+#include "u_assert.h"
+
+void u_srand(u32 s) {
+ lmud_assert();
+}
+
+u32 u_rand(void) {
+ lmud_todo("Not yet implemented")
+}
--- /dev/null
+#ifndef U_RAND_H__
+#define U_RAND_H__
+
+#include "lmud.h"
+
+void u_srand(u32 s);
+
+u32 u_rand(void);
+
+#endif