From: Javier Sancho Date: Sun, 9 Aug 2020 18:16:23 +0000 (+0200) Subject: Modules reorganization X-Git-Url: https://git.jsancho.org/?p=dungeon-master.git;a=commitdiff_plain;h=8f36ecdca1766ddd2a177fa46dc885c7f8e14130 Modules reorganization --- diff --git a/Makefile.am b/Makefile.am index 05cea95..fdf853c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ bin_PROGRAMS = dmaster dmaster_SOURCES = \ src/generators.cpp \ src/main.cpp \ - src/mods.cpp \ + src/modules.cpp \ src/paths.cpp dmaster_CPPFLAGS = \ @GUILE_CFLAGS@ \ diff --git a/dungeon-master/generators/town.scm b/dungeon-master/generators/town.scm deleted file mode 100644 index 7e93636..0000000 --- a/dungeon-master/generators/town.scm +++ /dev/null @@ -1,63 +0,0 @@ -;;; Dungeon Master --- RPG Adventure Generator -;;; Copyright © 2019 Javier Sancho -;;; -;;; Dungeon Master is free software; you can redistribute it and/or modify it -;;; under the terms of the GNU General Public License as published by -;;; the Free Software Foundation; either version 3 of the License, or -;;; (at your option) any later version. -;;; -;;; Dungeon Master is distributed in the hope that it will be useful, but -;;; WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;; General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with Dungeon Master. If not, see . - - -(define-module (dungeon-master generators town) - #:use-module (dungeon-master geom voronoi) - #:use-module (dungeon-master geom point) - #:export (generate)) - -(define (random-bool) - (= (random 2) 1)) - -(define pi 3.141592654) -(define relax-steps 3) - -(define (generate 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 n-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 (make-point - (* (cos a) r) - (* (sin a) r)))) - (get-points (- n 1) seed (cons point l)))) - (else - l))) - - (define (relax voronoi n step) - "Relaxing central wards" - (cond ((> step 0) - (let* ((voronoi-points (voronoi-mesh-points voronoi)) - (n-points (length voronoi-points)) - (to-relax (cons (list-ref voronoi-points (- n-points n-patches)) - (list-tail voronoi-points (- n-points 3))))) - (relax (voronoi-mesh-relax voronoi to-relax) n (- step 1)))) - (else - voronoi))) - - (let* ((sa (* (random:exp) 2 pi)) - (points (get-points (* 8 n-patches) sa)) - (voronoi (relax (make-voronoi-mesh points) n-patches relax-steps))) - "end")) diff --git a/dungeon-master/geom.scm b/dungeon-master/geom.scm deleted file mode 100644 index 466d369..0000000 --- a/dungeon-master/geom.scm +++ /dev/null @@ -1,37 +0,0 @@ -;;; Dungeon Master --- RPG Adventure Generator -;;; Copyright © 2019 Javier Sancho -;;; -;;; Dungeon Master is free software; you can redistribute it and/or modify it -;;; under the terms of the GNU General Public License as published by -;;; the Free Software Foundation; either version 3 of the License, or -;;; (at your option) any later version. -;;; -;;; Dungeon Master is distributed in the hope that it will be useful, but -;;; WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;; General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with Dungeon Master. If not, see . - - -(define-module (dungeon-master geom) - #:use-module (dungeon-master geom point) - #:export (angle-sign)) - - -(define (angle-sign center a b) - "Return the sign of (- (atan (- a center)) - (atan (- b center)))" - (let ((x1 (- (point-x a) (point-x center))) - (y1 (- (point-y a) (point-y center))) - (x2 (- (point-x b) (point-x center))) - (y2 (- (point-y b) (point-y center)))) - (cond ((and (>= x1 0) (< x2 0)) - 1) - ((and (>= x2 0) (< x1 0)) - -1) - ((and (= x1 0) (= x2 0)) - (if (> y2 y1) 1 -1)) - (else - (if (> (- (* x2 y1) (* x1 y2)) 0) 1 -1))))) diff --git a/dungeon-master/geom/bowyer-watson.scm b/dungeon-master/geom/bowyer-watson.scm deleted file mode 100644 index 1445539..0000000 --- a/dungeon-master/geom/bowyer-watson.scm +++ /dev/null @@ -1,144 +0,0 @@ -;;; Dungeon Master --- RPG Adventure Generator -;;; Copyright © 2019 Javier Sancho -;;; -;;; Dungeon Master is free software; you can redistribute it and/or modify it -;;; under the terms of the GNU General Public License as published by -;;; the Free Software Foundation; either version 3 of the License, or -;;; (at your option) any later version. -;;; -;;; Dungeon Master is distributed in the hope that it will be useful, but -;;; WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;; General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with Dungeon Master. If not, see . - - -(define-module (dungeon-master geom bowyer-watson) - #:use-module (ice-9 receive) - #:use-module (srfi srfi-1) - #:use-module (srfi srfi-9) - #:use-module (dungeon-master geom point) - #:use-module (dungeon-master geom triangle) - #:export (bowyer-watson)) - -" -Compute the Delaunay triangulation using Bowyer–Watson algorithm -https://en.wikipedia.org/wiki/Bowyer-Watson_algorithm -" - -(define (bowyer-watson vertices) - (receive (minx miny maxx maxy) - (calculate-limits vertices) - (let ((c1 (make-point minx miny)) - (c2 (make-point minx maxy)) - (c3 (make-point maxx miny)) - (c4 (make-point maxx maxy))) - (let ((frame (list c1 c2 c3 c4))) - (receive (points triangles) - (calculate-triangulation - (list c4 c3 c2 c1) - (list (make-triangle c1 c2 c3) - (make-triangle c2 c3 c4)) - vertices) - (values triangles points frame)))))) - -(define (calculate-limits vertices) - (let ((xs (map (lambda (p) (point-x p)) vertices)) - (ys (map (lambda (p) (point-y p)) vertices))) - (let ((minx (apply min (cons (expt 10 10) xs))) - (miny (apply min (cons (expt 10 10) ys))) - (maxx (apply max (cons (- (expt 10 9)) xs))) - (maxy (apply max (cons (- (expt 10 9)) ys)))) - (let ((dx (* (- maxx minx) 0.5)) - (dy (* (- maxy miny) 0.5))) - (values (- minx (/ dx 2)) - (- miny (/ dy 2)) - (+ maxx (/ dx 2)) - (+ maxy (/ dy 2))))))) - -(define (calculate-triangulation points triangles vertices) - (cond ((null? vertices) - (values points triangles)) - (else - (let ((vertice (car vertices))) - (receive (to-split to-keep) - (triangles-contains-point triangles vertice) - (cond ((null? to-split) - (calculate-triangulation points triangles (cdr vertices))) - (else - (calculate-triangulation - (cons vertice points) - (concatenate - (list (calculate-new-triangles to-split vertice) - to-keep)) - (cdr vertices))))))))) - -(define (calculate-new-triangles to-split p1) - (receive (a b) - (calculate-new-edges to-split) - (let loop ((p2-list a) - (p3-list b) - (triangles '())) - (cond ((null? p2-list) - triangles) - (else - (let ((p2 (car p2-list)) - (p3 (car p3-list))) - (loop (cdr p2-list) - (cdr p3-list) - (cons (make-triangle p1 p2 p3) triangles)))))))) - -(define* (calculate-new-edges triangles #:optional (original-t triangles) (a '()) (b '())) - (cond ((null? triangles) - (values a b)) - (else - (let* ((triangle (car triangles)) - (common-edge (triangles-has-common-edge triangle original-t))) - (let ((points (triangle-points triangle))) - (let ((p1 (car points)) - (p2 (cadr points)) - (p3 (caddr points)) - (e1 (car common-edge)) - (e2 (cadr common-edge)) - (e3 (caddr common-edge))) - (cond (e1 - (set! a (cons p1 a)) - (set! b (cons p2 b)))) - (cond (e2 - (set! a (cons p2 a)) - (set! b (cons p3 b)))) - (cond (e3 - (set! a (cons p3 a)) - (set! b (cons p1 b)))) - (calculate-new-edges (cdr triangles) original-t a b))))))) - -(define* (triangles-has-common-edge triangle triangles #:optional (e1 #t) (e2 #t) (e3 #t)) - (cond ((not (or e1 e2 e3)) - (list e1 e2 e3)) - ((null? triangles) - (list e1 e2 e3)) - (else - (let ((t (car triangles))) - (cond ((equal? t triangle) - (triangles-has-common-edge triangle (cdr triangles) e1 e2 e3)) - (else - (let ((points (triangle-points triangle))) - (let ((p1 (car points)) - (p2 (cadr points)) - (p3 (caddr points))) - (when (and e1 (triangle-has-edge t p2 p1)) - (set! e1 #f)) - (when (and e2 (triangle-has-edge t p3 p2)) - (set! e2 #f)) - (when (and e3 (triangle-has-edge t p1 p3)) - (set! e3 #f)))) - (triangles-has-common-edge triangle (cdr triangles) e1 e2 e3))))))) - -(define (triangles-contains-point triangles point) - (partition - (lambda (triangle) - (< (points-distance point (triangle-center triangle)) - (triangle-radius triangle))) - triangles)) diff --git a/dungeon-master/geom/point.scm b/dungeon-master/geom/point.scm deleted file mode 100644 index 72ca1bb..0000000 --- a/dungeon-master/geom/point.scm +++ /dev/null @@ -1,53 +0,0 @@ -;;; Dungeon Master --- RPG Adventure Generator -;;; Copyright © 2019 Javier Sancho -;;; -;;; Dungeon Master is free software; you can redistribute it and/or modify it -;;; under the terms of the GNU General Public License as published by -;;; the Free Software Foundation; either version 3 of the License, or -;;; (at your option) any later version. -;;; -;;; Dungeon Master is distributed in the hope that it will be useful, but -;;; WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;; General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with Dungeon Master. If not, see . - - -(define-module (dungeon-master geom point) - #:use-module (srfi srfi-9) - #:export (make-point - point? - point-x - point-y - points-distance - sum-points - scale-point)) - -(define-record-type - (make-point x y) - point? - (x point-x) - (y point-y)) - -(define (points-distance p1 p2) - (abs - (sqrt (+ (expt (- (point-x p1) (point-x p2)) 2) - (expt (- (point-y p1) (point-y p2)) 2))))) - -(define (sum-points . points-to-sum) - (let loop ((points points-to-sum) - (x 0) - (y 0)) - (cond ((null? points) - (make-point x y)) - (else - (loop (cdr points) - (+ x (point-x (car points))) - (+ y (point-y (car points)))))))) - -(define (scale-point point scale) - (make-point - (* (point-x point) scale) - (* (point-y point) scale))) diff --git a/dungeon-master/geom/triangle.scm b/dungeon-master/geom/triangle.scm deleted file mode 100644 index 6f7ccf8..0000000 --- a/dungeon-master/geom/triangle.scm +++ /dev/null @@ -1,77 +0,0 @@ -;;; Dungeon Master --- RPG Adventure Generator -;;; Copyright © 2019 Javier Sancho -;;; -;;; Dungeon Master is free software; you can redistribute it and/or modify it -;;; under the terms of the GNU General Public License as published by -;;; the Free Software Foundation; either version 3 of the License, or -;;; (at your option) any later version. -;;; -;;; Dungeon Master is distributed in the hope that it will be useful, but -;;; WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;; General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with Dungeon Master. If not, see . - - -(define-module (dungeon-master geom triangle) - #:use-module (ice-9 receive) - #:use-module (srfi srfi-9) - #:use-module (dungeon-master geom point) - #:export (make-triangle - triangle? - triangle-points - triangle-center - triangle-radius - triangle-has-edge)) - -(define-record-type - (make-raw-triangle points center radius) - triangle? - (points triangle-points) - (center triangle-center) - (radius triangle-radius)) - -(define (make-triangle p1 p2 p3) - (let ((center (circumcenter p1 p2 p3))) - (make-raw-triangle - (list p1 p2 p3) - center - (points-distance center p1)))) - -(define (circumcenter p1 p2 p3) - (receive (a b c) - (perpendicular-line-from-points p1 p2) - (receive (e f g) - (perpendicular-line-from-points p2 p3) - (let ((determinant (- (* a f) (* e b)))) - (make-point - (/ (- (* f c) (* b g)) determinant) - (/ (- (* a g) (* e c)) determinant)))))) - -(define (perpendicular-line-from-points p1 p2) - (let ((x1 (point-x p1)) - (y1 (point-y p1)) - (x2 (point-x p2)) - (y2 (point-y p2))) - (let* ((a (- y2 y1)) - (b (- x1 x2)) - (c (+ (* a x1) (* b y2)))) - (let ((mid-x (/ (+ x1 x2) 2)) - (mid-y (/ (+ y1 y2) 2))) - (values (- b) - a - (+ (* (- b) mid-x) (* a mid-y))))))) - -(define (triangle-has-edge triangle a b) - (let ((points (triangle-points triangle))) - (let ((p1 (car points)) - (p2 (cadr points)) - (p3 (caddr points))) - (or (and (equal? p1 a) (equal? p2 b)) - (and (equal? p1 b) (equal? p2 a)) - (and (equal? p2 a) (equal? p3 b)) - (and (equal? p2 b) (equal? p3 a)) - (and (equal? p3 a) (equal? p1 b)) - (and (equal? p3 b) (equal? p1 a)))))) diff --git a/dungeon-master/geom/voronoi.scm b/dungeon-master/geom/voronoi.scm deleted file mode 100644 index 553beec..0000000 --- a/dungeon-master/geom/voronoi.scm +++ /dev/null @@ -1,144 +0,0 @@ -;;; Dungeon Master --- RPG Adventure Generator -;;; Copyright © 2019 Javier Sancho -;;; -;;; Dungeon Master is free software; you can redistribute it and/or modify it -;;; under the terms of the GNU General Public License as published by -;;; the Free Software Foundation; either version 3 of the License, or -;;; (at your option) any later version. -;;; -;;; Dungeon Master is distributed in the hope that it will be useful, but -;;; WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;; General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with Dungeon Master. If not, see . - - -(define-module (dungeon-master geom voronoi) - #:use-module (ice-9 receive) - #:use-module (rnrs sorting) - #:use-module (srfi srfi-1) - #:use-module (srfi srfi-9) - #:use-module (dungeon-master geom) - #:use-module (dungeon-master geom point) - #:use-module (dungeon-master geom triangle) - #:use-module (dungeon-master geom bowyer-watson) - #:export (make-voronoi-mesh - voronoi-mesh? - voronoi-mesh-triangles - voronoi-mesh-points - voronoi-mesh-frame - voronoi-mesh-regions - voronoi-mesh-relax)) - -"https://github.com/watabou/TownGeneratorOS/blob/master/Source/com/watabou/geom/Voronoi.hx" - -;;; Voronoi mesh region - -(define-record-type - (make-raw-voronoi-region seed vertices) - voronoi-region? - (seed voronoi-region-seed) - (vertices voronoi-region-vertices)) - -(define (make-voronoi-region seed vertices) - (define (compare-angles triangle1 triangle2) - (let ((c1 (triangle-center triangle1)) - (c2 (triangle-center triangle2))) - (> (angle-sign seed c1 c2) 0))) - (make-raw-voronoi-region seed (list-sort compare-angles vertices))) - -(define (voronoi-region-center region) - (let* ((vertices (voronoi-region-vertices region)) - (centers (map (lambda (v) (triangle-center v)) vertices))) - (scale-point - (apply sum-points centers) - (/ 1 (length vertices))))) - - -;;; Voronoi mesh - -(define-record-type - (make-raw-voronoi-mesh triangles points frame regions) - voronoi-mesh? - (triangles voronoi-mesh-triangles) - (points voronoi-mesh-points) - (frame voronoi-mesh-frame) - (regions voronoi-mesh-regions)) - -(define (make-voronoi-mesh vertices) - ;; Delaunay triangulation - (receive (triangles points frame) - (bowyer-watson vertices) - (make-raw-voronoi-mesh - triangles - points - frame - (make-regions points triangles)))) - -(define (partitioning voronoi) - (define (is-real-triangle triangle) - ;; real triangle points cannot be frame points - (let ((frame (voronoi-mesh-frame voronoi))) - (let check-points ((points (triangle-points triangle))) - (cond ((null? points) - #t) ; triangle is real - (else - (and (not (member (car points) frame)) - (check-points (cdr points)))))))) - - (define (is-real-region region) - ;; real region points cannot be frame points - (let check-vertices ((vertices (voronoi-region-vertices region))) - (cond ((null? vertices) - #t) ; region is real - (else - (and (is-real-triangle (car vertices)) - (check-vertices (cdr vertices))))))) - - (let* ((points (voronoi-mesh-points voronoi)) - (regions (voronoi-mesh-regions voronoi)) - ;; we need the regions in the same order as points are - (ordered-regions - (map-in-order - (lambda (p) - (assoc-ref regions p)) - points)) - ;; only real regions without frame points - (filtered-regions - (filter (lambda (r) (is-real-region r)) - ordered-regions))) - filtered-regions)) - -(define* (voronoi-mesh-relax voronoi #:optional (points-to-relax '())) - (let ((regions - (map - (lambda (r) (cons (voronoi-region-seed r) (voronoi-region-center r))) - (partitioning voronoi))) - (points - (filter - (lambda (p) (not (member p (voronoi-mesh-frame voronoi)))) - (voronoi-mesh-points voronoi))) - (to-relax - (if (null? points-to-relax) - (voronoi-mesh-points voronoi) - points-to-relax))) - (make-voronoi-mesh - (map - (lambda (point) - (let ((center (assoc-ref regions point))) - (if (and center (member point to-relax)) - center - point))) - points)))) - -(define (make-regions points triangles) - (map-in-order - (lambda (p) - (let ((vertices - (filter - (lambda (tr) (member p (triangle-points tr))) - triangles))) - (cons p (make-voronoi-region p vertices)))) - points)) diff --git a/modules/base.scm b/modules/base.scm new file mode 100644 index 0000000..ac69646 --- /dev/null +++ b/modules/base.scm @@ -0,0 +1,21 @@ +;;; Dungeon Master --- RPG Adventure Generator +;;; Copyright © 2019 Javier Sancho + +;;; Dungeon Master is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or +;;; (at your option) any later version. + +;;; Dungeon Master is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. + +;;; You should have received a copy of the GNU General Public License +;;; along with Dungeon Master. If not, see . + + +(use-modules (dungeon-master) + (dungeon-master generators terrain)) + +(register-scene-generator "Basic city" 'urban city-generator) diff --git a/modules/dungeon-master/dialogue.scm b/modules/dungeon-master/dialogue.scm new file mode 100644 index 0000000..059f9a8 --- /dev/null +++ b/modules/dungeon-master/dialogue.scm @@ -0,0 +1,29 @@ +;;; Dungeon Master --- RPG Adventure Generator +;;; Copyright © 2020 Javier Sancho +;;; +;;; Dungeon Master is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Dungeon Master is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Dungeon Master. If not, see . + + +(define-module (dungeon-master dialogue) + #:use-module (ice-9 optargs) + #:export (run-dialogue)) + + +(define* (run-dialogue dialogue #:optional initial-scene) + (let ((scene (if initial-scene + (assoc-ref dialogue initial-scene) + (cdar dialogue)))) + (let-keywords scene #t (text) + (display text) + (newline)))) diff --git a/modules/dungeon-master/generators/terrain.scm b/modules/dungeon-master/generators/terrain.scm new file mode 100644 index 0000000..38668b5 --- /dev/null +++ b/modules/dungeon-master/generators/terrain.scm @@ -0,0 +1,22 @@ +;;; Dungeon Master --- RPG Adventure Generator +;;; Copyright © 2019 Javier Sancho + +;;; Dungeon Master is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or +;;; (at your option) any later version. + +;;; Dungeon Master is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. + +;;; You should have received a copy of the GNU General Public License +;;; along with Dungeon Master. If not, see . + + +(define-module (dungeon-master generators terrain) + #:export (city-generator)) + +(define (city-generator x) + (format #t "***~%~a~%***~%" x)) diff --git a/modules/dungeon-master/generators/town.scm b/modules/dungeon-master/generators/town.scm new file mode 100644 index 0000000..7e93636 --- /dev/null +++ b/modules/dungeon-master/generators/town.scm @@ -0,0 +1,63 @@ +;;; Dungeon Master --- RPG Adventure Generator +;;; Copyright © 2019 Javier Sancho +;;; +;;; Dungeon Master is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Dungeon Master is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Dungeon Master. If not, see . + + +(define-module (dungeon-master generators town) + #:use-module (dungeon-master geom voronoi) + #:use-module (dungeon-master geom point) + #:export (generate)) + +(define (random-bool) + (= (random 2) 1)) + +(define pi 3.141592654) +(define relax-steps 3) + +(define (generate 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 n-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 (make-point + (* (cos a) r) + (* (sin a) r)))) + (get-points (- n 1) seed (cons point l)))) + (else + l))) + + (define (relax voronoi n step) + "Relaxing central wards" + (cond ((> step 0) + (let* ((voronoi-points (voronoi-mesh-points voronoi)) + (n-points (length voronoi-points)) + (to-relax (cons (list-ref voronoi-points (- n-points n-patches)) + (list-tail voronoi-points (- n-points 3))))) + (relax (voronoi-mesh-relax voronoi to-relax) n (- step 1)))) + (else + voronoi))) + + (let* ((sa (* (random:exp) 2 pi)) + (points (get-points (* 8 n-patches) sa)) + (voronoi (relax (make-voronoi-mesh points) n-patches relax-steps))) + "end")) diff --git a/modules/dungeon-master/geom.scm b/modules/dungeon-master/geom.scm new file mode 100644 index 0000000..466d369 --- /dev/null +++ b/modules/dungeon-master/geom.scm @@ -0,0 +1,37 @@ +;;; Dungeon Master --- RPG Adventure Generator +;;; Copyright © 2019 Javier Sancho +;;; +;;; Dungeon Master is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Dungeon Master is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Dungeon Master. If not, see . + + +(define-module (dungeon-master geom) + #:use-module (dungeon-master geom point) + #:export (angle-sign)) + + +(define (angle-sign center a b) + "Return the sign of (- (atan (- a center)) + (atan (- b center)))" + (let ((x1 (- (point-x a) (point-x center))) + (y1 (- (point-y a) (point-y center))) + (x2 (- (point-x b) (point-x center))) + (y2 (- (point-y b) (point-y center)))) + (cond ((and (>= x1 0) (< x2 0)) + 1) + ((and (>= x2 0) (< x1 0)) + -1) + ((and (= x1 0) (= x2 0)) + (if (> y2 y1) 1 -1)) + (else + (if (> (- (* x2 y1) (* x1 y2)) 0) 1 -1))))) diff --git a/modules/dungeon-master/geom/bowyer-watson.scm b/modules/dungeon-master/geom/bowyer-watson.scm new file mode 100644 index 0000000..1445539 --- /dev/null +++ b/modules/dungeon-master/geom/bowyer-watson.scm @@ -0,0 +1,144 @@ +;;; Dungeon Master --- RPG Adventure Generator +;;; Copyright © 2019 Javier Sancho +;;; +;;; Dungeon Master is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Dungeon Master is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Dungeon Master. If not, see . + + +(define-module (dungeon-master geom bowyer-watson) + #:use-module (ice-9 receive) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-9) + #:use-module (dungeon-master geom point) + #:use-module (dungeon-master geom triangle) + #:export (bowyer-watson)) + +" +Compute the Delaunay triangulation using Bowyer–Watson algorithm +https://en.wikipedia.org/wiki/Bowyer-Watson_algorithm +" + +(define (bowyer-watson vertices) + (receive (minx miny maxx maxy) + (calculate-limits vertices) + (let ((c1 (make-point minx miny)) + (c2 (make-point minx maxy)) + (c3 (make-point maxx miny)) + (c4 (make-point maxx maxy))) + (let ((frame (list c1 c2 c3 c4))) + (receive (points triangles) + (calculate-triangulation + (list c4 c3 c2 c1) + (list (make-triangle c1 c2 c3) + (make-triangle c2 c3 c4)) + vertices) + (values triangles points frame)))))) + +(define (calculate-limits vertices) + (let ((xs (map (lambda (p) (point-x p)) vertices)) + (ys (map (lambda (p) (point-y p)) vertices))) + (let ((minx (apply min (cons (expt 10 10) xs))) + (miny (apply min (cons (expt 10 10) ys))) + (maxx (apply max (cons (- (expt 10 9)) xs))) + (maxy (apply max (cons (- (expt 10 9)) ys)))) + (let ((dx (* (- maxx minx) 0.5)) + (dy (* (- maxy miny) 0.5))) + (values (- minx (/ dx 2)) + (- miny (/ dy 2)) + (+ maxx (/ dx 2)) + (+ maxy (/ dy 2))))))) + +(define (calculate-triangulation points triangles vertices) + (cond ((null? vertices) + (values points triangles)) + (else + (let ((vertice (car vertices))) + (receive (to-split to-keep) + (triangles-contains-point triangles vertice) + (cond ((null? to-split) + (calculate-triangulation points triangles (cdr vertices))) + (else + (calculate-triangulation + (cons vertice points) + (concatenate + (list (calculate-new-triangles to-split vertice) + to-keep)) + (cdr vertices))))))))) + +(define (calculate-new-triangles to-split p1) + (receive (a b) + (calculate-new-edges to-split) + (let loop ((p2-list a) + (p3-list b) + (triangles '())) + (cond ((null? p2-list) + triangles) + (else + (let ((p2 (car p2-list)) + (p3 (car p3-list))) + (loop (cdr p2-list) + (cdr p3-list) + (cons (make-triangle p1 p2 p3) triangles)))))))) + +(define* (calculate-new-edges triangles #:optional (original-t triangles) (a '()) (b '())) + (cond ((null? triangles) + (values a b)) + (else + (let* ((triangle (car triangles)) + (common-edge (triangles-has-common-edge triangle original-t))) + (let ((points (triangle-points triangle))) + (let ((p1 (car points)) + (p2 (cadr points)) + (p3 (caddr points)) + (e1 (car common-edge)) + (e2 (cadr common-edge)) + (e3 (caddr common-edge))) + (cond (e1 + (set! a (cons p1 a)) + (set! b (cons p2 b)))) + (cond (e2 + (set! a (cons p2 a)) + (set! b (cons p3 b)))) + (cond (e3 + (set! a (cons p3 a)) + (set! b (cons p1 b)))) + (calculate-new-edges (cdr triangles) original-t a b))))))) + +(define* (triangles-has-common-edge triangle triangles #:optional (e1 #t) (e2 #t) (e3 #t)) + (cond ((not (or e1 e2 e3)) + (list e1 e2 e3)) + ((null? triangles) + (list e1 e2 e3)) + (else + (let ((t (car triangles))) + (cond ((equal? t triangle) + (triangles-has-common-edge triangle (cdr triangles) e1 e2 e3)) + (else + (let ((points (triangle-points triangle))) + (let ((p1 (car points)) + (p2 (cadr points)) + (p3 (caddr points))) + (when (and e1 (triangle-has-edge t p2 p1)) + (set! e1 #f)) + (when (and e2 (triangle-has-edge t p3 p2)) + (set! e2 #f)) + (when (and e3 (triangle-has-edge t p1 p3)) + (set! e3 #f)))) + (triangles-has-common-edge triangle (cdr triangles) e1 e2 e3))))))) + +(define (triangles-contains-point triangles point) + (partition + (lambda (triangle) + (< (points-distance point (triangle-center triangle)) + (triangle-radius triangle))) + triangles)) diff --git a/modules/dungeon-master/geom/point.scm b/modules/dungeon-master/geom/point.scm new file mode 100644 index 0000000..72ca1bb --- /dev/null +++ b/modules/dungeon-master/geom/point.scm @@ -0,0 +1,53 @@ +;;; Dungeon Master --- RPG Adventure Generator +;;; Copyright © 2019 Javier Sancho +;;; +;;; Dungeon Master is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Dungeon Master is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Dungeon Master. If not, see . + + +(define-module (dungeon-master geom point) + #:use-module (srfi srfi-9) + #:export (make-point + point? + point-x + point-y + points-distance + sum-points + scale-point)) + +(define-record-type + (make-point x y) + point? + (x point-x) + (y point-y)) + +(define (points-distance p1 p2) + (abs + (sqrt (+ (expt (- (point-x p1) (point-x p2)) 2) + (expt (- (point-y p1) (point-y p2)) 2))))) + +(define (sum-points . points-to-sum) + (let loop ((points points-to-sum) + (x 0) + (y 0)) + (cond ((null? points) + (make-point x y)) + (else + (loop (cdr points) + (+ x (point-x (car points))) + (+ y (point-y (car points)))))))) + +(define (scale-point point scale) + (make-point + (* (point-x point) scale) + (* (point-y point) scale))) diff --git a/modules/dungeon-master/geom/triangle.scm b/modules/dungeon-master/geom/triangle.scm new file mode 100644 index 0000000..6f7ccf8 --- /dev/null +++ b/modules/dungeon-master/geom/triangle.scm @@ -0,0 +1,77 @@ +;;; Dungeon Master --- RPG Adventure Generator +;;; Copyright © 2019 Javier Sancho +;;; +;;; Dungeon Master is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Dungeon Master is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Dungeon Master. If not, see . + + +(define-module (dungeon-master geom triangle) + #:use-module (ice-9 receive) + #:use-module (srfi srfi-9) + #:use-module (dungeon-master geom point) + #:export (make-triangle + triangle? + triangle-points + triangle-center + triangle-radius + triangle-has-edge)) + +(define-record-type + (make-raw-triangle points center radius) + triangle? + (points triangle-points) + (center triangle-center) + (radius triangle-radius)) + +(define (make-triangle p1 p2 p3) + (let ((center (circumcenter p1 p2 p3))) + (make-raw-triangle + (list p1 p2 p3) + center + (points-distance center p1)))) + +(define (circumcenter p1 p2 p3) + (receive (a b c) + (perpendicular-line-from-points p1 p2) + (receive (e f g) + (perpendicular-line-from-points p2 p3) + (let ((determinant (- (* a f) (* e b)))) + (make-point + (/ (- (* f c) (* b g)) determinant) + (/ (- (* a g) (* e c)) determinant)))))) + +(define (perpendicular-line-from-points p1 p2) + (let ((x1 (point-x p1)) + (y1 (point-y p1)) + (x2 (point-x p2)) + (y2 (point-y p2))) + (let* ((a (- y2 y1)) + (b (- x1 x2)) + (c (+ (* a x1) (* b y2)))) + (let ((mid-x (/ (+ x1 x2) 2)) + (mid-y (/ (+ y1 y2) 2))) + (values (- b) + a + (+ (* (- b) mid-x) (* a mid-y))))))) + +(define (triangle-has-edge triangle a b) + (let ((points (triangle-points triangle))) + (let ((p1 (car points)) + (p2 (cadr points)) + (p3 (caddr points))) + (or (and (equal? p1 a) (equal? p2 b)) + (and (equal? p1 b) (equal? p2 a)) + (and (equal? p2 a) (equal? p3 b)) + (and (equal? p2 b) (equal? p3 a)) + (and (equal? p3 a) (equal? p1 b)) + (and (equal? p3 b) (equal? p1 a)))))) diff --git a/modules/dungeon-master/geom/voronoi.scm b/modules/dungeon-master/geom/voronoi.scm new file mode 100644 index 0000000..553beec --- /dev/null +++ b/modules/dungeon-master/geom/voronoi.scm @@ -0,0 +1,144 @@ +;;; Dungeon Master --- RPG Adventure Generator +;;; Copyright © 2019 Javier Sancho +;;; +;;; Dungeon Master is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Dungeon Master is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Dungeon Master. If not, see . + + +(define-module (dungeon-master geom voronoi) + #:use-module (ice-9 receive) + #:use-module (rnrs sorting) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-9) + #:use-module (dungeon-master geom) + #:use-module (dungeon-master geom point) + #:use-module (dungeon-master geom triangle) + #:use-module (dungeon-master geom bowyer-watson) + #:export (make-voronoi-mesh + voronoi-mesh? + voronoi-mesh-triangles + voronoi-mesh-points + voronoi-mesh-frame + voronoi-mesh-regions + voronoi-mesh-relax)) + +"https://github.com/watabou/TownGeneratorOS/blob/master/Source/com/watabou/geom/Voronoi.hx" + +;;; Voronoi mesh region + +(define-record-type + (make-raw-voronoi-region seed vertices) + voronoi-region? + (seed voronoi-region-seed) + (vertices voronoi-region-vertices)) + +(define (make-voronoi-region seed vertices) + (define (compare-angles triangle1 triangle2) + (let ((c1 (triangle-center triangle1)) + (c2 (triangle-center triangle2))) + (> (angle-sign seed c1 c2) 0))) + (make-raw-voronoi-region seed (list-sort compare-angles vertices))) + +(define (voronoi-region-center region) + (let* ((vertices (voronoi-region-vertices region)) + (centers (map (lambda (v) (triangle-center v)) vertices))) + (scale-point + (apply sum-points centers) + (/ 1 (length vertices))))) + + +;;; Voronoi mesh + +(define-record-type + (make-raw-voronoi-mesh triangles points frame regions) + voronoi-mesh? + (triangles voronoi-mesh-triangles) + (points voronoi-mesh-points) + (frame voronoi-mesh-frame) + (regions voronoi-mesh-regions)) + +(define (make-voronoi-mesh vertices) + ;; Delaunay triangulation + (receive (triangles points frame) + (bowyer-watson vertices) + (make-raw-voronoi-mesh + triangles + points + frame + (make-regions points triangles)))) + +(define (partitioning voronoi) + (define (is-real-triangle triangle) + ;; real triangle points cannot be frame points + (let ((frame (voronoi-mesh-frame voronoi))) + (let check-points ((points (triangle-points triangle))) + (cond ((null? points) + #t) ; triangle is real + (else + (and (not (member (car points) frame)) + (check-points (cdr points)))))))) + + (define (is-real-region region) + ;; real region points cannot be frame points + (let check-vertices ((vertices (voronoi-region-vertices region))) + (cond ((null? vertices) + #t) ; region is real + (else + (and (is-real-triangle (car vertices)) + (check-vertices (cdr vertices))))))) + + (let* ((points (voronoi-mesh-points voronoi)) + (regions (voronoi-mesh-regions voronoi)) + ;; we need the regions in the same order as points are + (ordered-regions + (map-in-order + (lambda (p) + (assoc-ref regions p)) + points)) + ;; only real regions without frame points + (filtered-regions + (filter (lambda (r) (is-real-region r)) + ordered-regions))) + filtered-regions)) + +(define* (voronoi-mesh-relax voronoi #:optional (points-to-relax '())) + (let ((regions + (map + (lambda (r) (cons (voronoi-region-seed r) (voronoi-region-center r))) + (partitioning voronoi))) + (points + (filter + (lambda (p) (not (member p (voronoi-mesh-frame voronoi)))) + (voronoi-mesh-points voronoi))) + (to-relax + (if (null? points-to-relax) + (voronoi-mesh-points voronoi) + points-to-relax))) + (make-voronoi-mesh + (map + (lambda (point) + (let ((center (assoc-ref regions point))) + (if (and center (member point to-relax)) + center + point))) + points)))) + +(define (make-regions points triangles) + (map-in-order + (lambda (p) + (let ((vertices + (filter + (lambda (tr) (member p (triangle-points tr))) + triangles))) + (cons p (make-voronoi-region p vertices)))) + points)) diff --git a/src/main.cpp b/src/main.cpp index 16c6fac..c9aa0f9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,7 +16,7 @@ */ #include -#include "mods.h" +#include "modules.h" using namespace irr; using namespace core; @@ -26,7 +26,7 @@ using namespace gui; int main () { - load_dmaster_mods (); + load_dmaster_modules (); IrrlichtDevice* device = createDevice (video::EDT_OPENGL, core::dimension2d (640, 480)); diff --git a/src/mods.cpp b/src/mods.cpp deleted file mode 100644 index 7b9115e..0000000 --- a/src/mods.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* Dungeon Master --- RPG Adventure Generator - Copyright © 2019 Javier Sancho - - Dungeon Master is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - Dungeon Master is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Dungeon Master. If not, see . -*/ - -#include -#include -#include "generators.h" -#include "mods.h" -#include "paths.h" - -SCM -register_scene_generator (SCM name, - SCM type, - SCM proc) -{ - SceneGenerator* generator = - register_generator (scm_to_utf8_string (name), - scm_to_utf8_string (scm_symbol_to_string (type)), - proc); - printf ("Register: %s (%s)\n", generator->name, generator->type); - scm_call_1 (generator->proc, scm_from_int (-1)); - return SCM_UNSPECIFIED; -} - -void -init_dungeon_master_module (void *unused) -{ - scm_c_define_gsubr ("register-scene-generator", 3, 0, 0, (scm_t_subr) register_scene_generator); - scm_c_export ("register-scene-generator", NULL); -} - -void -scm_init_dungeon_master_module () -{ - scm_c_define_module ("dungeon-master", init_dungeon_master_module, NULL); -} - -void -add_to_load_path (std::string path) -{ - // Add path to %load-path variable, needed for mods structured like modules - std::string exp = "(add-to-load-path \"" + path + "\")"; - scm_c_eval_string (exp.c_str ()); -} - -void -load_dmaster_mods () -{ - scm_init_guile (); - scm_init_dungeon_master_module (); - - std::set paths = get_dmaster_paths (); - DIR* mods_dir; - struct dirent* mod; - std::string - mods_path, - mod_main; - - for (const std::string &path : paths) - { - mods_path = path + PATH_DELIM + "mods"; - add_to_load_path (mods_path); - mods_dir = opendir (mods_path.c_str ()); - if (mods_dir != NULL) - { - while (mod = readdir (mods_dir)) - { - if (strstr (mod->d_name, ".scm") != NULL) { - mod_main = mods_path + PATH_DELIM + mod->d_name; - scm_primitive_load (scm_from_locale_string (mod_main.c_str ())); - } - } - } - closedir (mods_dir); - } -} diff --git a/src/mods.h b/src/mods.h deleted file mode 100644 index f8cd154..0000000 --- a/src/mods.h +++ /dev/null @@ -1,19 +0,0 @@ -/* Dungeon Master --- RPG Adventure Generator - Copyright © 2019 Javier Sancho - - Dungeon Master is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - Dungeon Master is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Dungeon Master. If not, see . -*/ - -void -load_dmaster_mods (); diff --git a/src/modules.cpp b/src/modules.cpp new file mode 100644 index 0000000..63c8045 --- /dev/null +++ b/src/modules.cpp @@ -0,0 +1,89 @@ +/* Dungeon Master --- RPG Adventure Generator + Copyright © 2019 Javier Sancho + + Dungeon Master is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Dungeon Master is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Dungeon Master. If not, see . +*/ + +#include +#include +#include "generators.h" +#include "modules.h" +#include "paths.h" + +SCM +register_scene_generator (SCM name, + SCM type, + SCM proc) +{ + SceneGenerator* generator = + register_generator (scm_to_utf8_string (name), + scm_to_utf8_string (scm_symbol_to_string (type)), + proc); + printf ("Register: %s (%s)\n", generator->name, generator->type); + scm_call_1 (generator->proc, scm_from_int (-1)); + return SCM_UNSPECIFIED; +} + +void +init_dungeon_master_module (void *unused) +{ + scm_c_define_gsubr ("register-scene-generator", 3, 0, 0, (scm_t_subr) register_scene_generator); + scm_c_export ("register-scene-generator", NULL); +} + +void +scm_init_dungeon_master_module () +{ + scm_c_define_module ("dungeon-master", init_dungeon_master_module, NULL); +} + +void +add_to_load_path (std::string path) +{ + // Add path to %load-path variable, needed for modules loading + std::string exp = "(add-to-load-path \"" + path + "\")"; + scm_c_eval_string (exp.c_str ()); +} + +void +load_dmaster_modules () +{ + scm_init_guile (); + scm_init_dungeon_master_module (); + + std::set paths = get_dmaster_paths (); + DIR* modules_dir; + struct dirent* module; + std::string + modules_path, + module_main; + + for (const std::string &path : paths) + { + modules_path = path + PATH_DELIM + "modules"; + add_to_load_path (modules_path); + modules_dir = opendir (modules_path.c_str ()); + if (modules_dir != NULL) + { + while (module = readdir (modules_dir)) + { + if (strstr (module->d_name, ".scm") != NULL) { + module_main = modules_path + PATH_DELIM + module->d_name; + scm_primitive_load (scm_from_locale_string (module_main.c_str ())); + } + } + } + closedir (modules_dir); + } +} diff --git a/src/modules.h b/src/modules.h new file mode 100644 index 0000000..074163e --- /dev/null +++ b/src/modules.h @@ -0,0 +1,19 @@ +/* Dungeon Master --- RPG Adventure Generator + Copyright © 2019 Javier Sancho + + Dungeon Master is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Dungeon Master is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Dungeon Master. If not, see . +*/ + +void +load_dmaster_modules ();