From: Javier Sancho Date: Wed, 24 Apr 2019 15:20:19 +0000 (+0200) Subject: Compiled binaries are placed in root directory X-Git-Url: https://git.jsancho.org/?p=dungeon-master.git;a=commitdiff_plain;h=1d17d59eac87eaf5095ef852045224cc77e4d8ce Compiled binaries are placed in root directory --- diff --git a/mods/default/main.scm b/mods/default/main.scm new file mode 100644 index 0000000..7a64459 --- /dev/null +++ b/mods/default/main.scm @@ -0,0 +1,34 @@ +(define-module (dungeon-master plugins default) + #:use-module ((dungeon-master) #:prefix dm:)) + +(define (random-bool) + (= (random 2) 1)) + +(define pi 3.141592654) + +(define (city-map-generator patches) + "City generator from https://github.com/watabou/TownGeneratorOS/blob/master/Source/com/watabou/towngenerator/building/Model.hx" + (set! *random-state* (random-state-from-platform)) + (when (= patches -1) (set! patches 15)) + (build-patches patches)) + +(define (build-patches patches) + (define* (get-points n seed #:optional (l '())) + (cond ((> n 0) + (let* ((a (+ seed (* (sqrt n) 5))) + (r (if (= n 0) + 0 + (+ 10 (* n (+ 2 (random:exp)))))) + (point (list + (* (cos a) r) + (* (sin a) r)))) + (get-points (- n 1) seed (cons point l)))) + (else + l))) + + (let* ((sa (* (random:exp) 2 pi)) + (points (get-points (* 8 patches) sa))) + (display points) + (newline))) + +(dm:register-generator "city-map-generator" city-map-generator) diff --git a/src/Makefile.am b/src/Makefile.am index 69f3129..20ec91a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -bin_PROGRAMS = DungeonMaster -DungeonMaster_SOURCES = main.cpp -DungeonMaster_CPPFLAGS = @GUILE_CFLAGS@ -DungeonMaster_LDFLAGS = @GUILE_LIBS@ +bin_PROGRAMS = $(top_builddir)/DungeonMaster +__top_builddir__DungeonMaster_SOURCES = main.cpp +__top_builddir__DungeonMaster_CPPFLAGS = @GUILE_CFLAGS@ +__top_builddir__DungeonMaster_LDFLAGS = @GUILE_LIBS@ diff --git a/src/main.cpp b/src/main.cpp index 18007c2..9f3ad6d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,7 +28,7 @@ int main() { scm_init_guile(); scm_init_dungeon_master_module(); - scm_primitive_load(scm_from_locale_string("plugins/default/main.scm")); + scm_primitive_load(scm_from_locale_string("mods/default/main.scm")); IrrlichtDevice* device = createDevice(EDT_OPENGL, diff --git a/src/plugins/default/main.scm b/src/plugins/default/main.scm deleted file mode 100644 index 7a64459..0000000 --- a/src/plugins/default/main.scm +++ /dev/null @@ -1,34 +0,0 @@ -(define-module (dungeon-master plugins default) - #:use-module ((dungeon-master) #:prefix dm:)) - -(define (random-bool) - (= (random 2) 1)) - -(define pi 3.141592654) - -(define (city-map-generator patches) - "City generator from https://github.com/watabou/TownGeneratorOS/blob/master/Source/com/watabou/towngenerator/building/Model.hx" - (set! *random-state* (random-state-from-platform)) - (when (= patches -1) (set! patches 15)) - (build-patches patches)) - -(define (build-patches patches) - (define* (get-points n seed #:optional (l '())) - (cond ((> n 0) - (let* ((a (+ seed (* (sqrt n) 5))) - (r (if (= n 0) - 0 - (+ 10 (* n (+ 2 (random:exp)))))) - (point (list - (* (cos a) r) - (* (sin a) r)))) - (get-points (- n 1) seed (cons point l)))) - (else - l))) - - (let* ((sa (* (random:exp) 2 pi)) - (points (get-points (* 8 patches) sa))) - (display points) - (newline))) - -(dm:register-generator "city-map-generator" city-map-generator)