Author: gmilare Date: Sat Feb 16 14:59:50 2008 New Revision: 14
Added: definitions/ documentation/ graphics/ the-feebs-war.asd (contents, props changed) Removed: brains.lisp extra.lisp feebs.asd feebs.tex graphics.lisp mazes.lisp rules.lisp Modified: images.lisp main.lisp package.lisp system.lisp Log:
Modified: images.lisp ============================================================================== --- images.lisp (original) +++ images.lisp Sat Feb 16 14:59:50 2008 @@ -1,6 +1,6 @@ ;;; -*- Common Lisp -*-
-#| Copyright (c) 2007 Gustavo Henrique Milar� +#| Copyright (c) 2007,2008 Gustavo Henrique Milar�
This file is part of The Feebs War.
@@ -19,7 +19,7 @@ |#
-(in-package :feebs) +(in-package :the-feebs-war)
;;; This file is an extension of system.lisp which handles vision
Modified: main.lisp ============================================================================== --- main.lisp (original) +++ main.lisp Sat Feb 16 14:59:50 2008 @@ -1,6 +1,6 @@ ;;; -*- Common Lisp -*-
-#| Copyright (c) 2007 Gustavo Henrique Milar� +#| Copyright (c) 2007,2008 Gustavo Henrique Milaré
This file is part of The Feebs War.
@@ -19,7 +19,7 @@ |#
-(in-package :feebs) +(in-package :the-feebs-war)
Modified: package.lisp ============================================================================== --- package.lisp (original) +++ package.lisp Sat Feb 16 14:59:50 2008 @@ -1,6 +1,6 @@ ;;; -*- Common Lisp -*-
-#| Copyright (c) 2007 Gustavo Henrique Milar�� +#| Copyright (c) 2007,2008 Gustavo Henrique Milaré
This file is part of The Feebs War.
@@ -30,95 +30,96 @@ ;; Graphics ported to X11 by Fred Gilham 8-FEB-1998.
-(defpackage :feebs +(defpackage :the-feebs-war + (:nicknames :feebs) (:use :common-lisp) ;; Export everything we want the players to get their hands on. (:export ;; Slots accessors - name facing - x-position y-position peeking line-of-sight - energy-reserve - score kills - ready-to-fire - aborted last-move - - my-square left-square right-square rear-square - - ;; Images - feeb-image-p feeb-image-name - feeb-image-facing feeb-image-peeking - fireball-image-p fireball-image-direction - - ;; Parameters - get-feeb-parm change-feeb-parm - list-parameter-settings - - game-length - - ;; Pontuation - points-for-killing points-for-dying - points-for-slow-down - - ;; Energy - flame-energy mushroom-energy carcass-energy - maximum-energy - starting-energy - carcass-rot-probability - carcass-guaranteed-lifetime - - ;; Game quantities - maze-x-size - maze-y-size - number-of-mushrooms - - ;; Probabilities - fireball-guaranteed-lifetime - fireball-dissipation-probability - fireball-reflection-probability - flame-no-recovery-time - flame-recovery-probability - - ;; Difficulty variables - slow-feeb-noop-switch - slow-feeb-noop-factor - reference-time - sense-location-p - may-get-maze-map-p - - ;; Settings - define-feeb delete-feeb - feebs - change-layout - get-maze-map - - ;; Constants - north south east west - - ;; Some layouts (can be find in mazes.lisp) - *maze-0* *maze-1* *maze-2* - *maze-3* *maze-4* *maze-5* - make-template generate-maze - - ;; Graphics - create-graphics - - ;; Extras - - ;; Directional arithmetic - left-of right-of behind-of - relative-facing - - forward-dx forward-dy - left-dx left-dy - right-dx right-dy - behind-dx behind-dy + name facing + x-position y-position peeking line-of-sight + energy-reserve + score kills + ready-to-fire + aborted last-move + + my-square left-square right-square rear-square + + ;; Images + feeb-image-p feeb-image-name + feeb-image-facing feeb-image-peeking + fireball-image-p fireball-image-direction + + ;; Parameters + get-feeb-parm change-feeb-parm + list-parameter-settings + + game-length + + ;; Pontuation + points-for-killing points-for-dying + points-for-slow-down + + ;; Energy + flame-energy mushroom-energy carcass-energy + maximum-energy + starting-energy + carcass-rot-probability + carcass-guaranteed-lifetime + + ;; Game quantities + maze-x-size + maze-y-size + number-of-mushrooms + + ;; Probabilities + fireball-guaranteed-lifetime + fireball-dissipation-probability + fireball-reflection-probability + flame-no-recovery-time + flame-recovery-probability + + ;; Difficulty variables + slow-feeb-noop-switch + slow-feeb-noop-factor + reference-time + sense-location-p + may-get-maze-map-p + + ;; Settings + define-feeb delete-feeb + feebs + change-layout + get-maze-map + + ;; Constants + north south east west + + ;; Mazes + *maze-0* *maze-1* *maze-2* + *maze-3* *maze-4* *maze-5* + make-template generate-maze + + ;; Graphics + create-graphics + + ;; Extras + + ;; Directional arithmetic + left-of right-of behind-of + relative-facing + + forward-dx forward-dy + left-dx left-dy + right-dx right-dy + behind-dx behind-dy + + ;; Others + wallp chance + + ;; Graphics for alpha release + simple-play))
- ;; Others - wallp chance - - ;; Graphics for alpha release - simple-play)) - -(in-package :feebs) +(in-package :the-feebs-war)
;;; Directions @@ -207,13 +208,6 @@
;;; Current feeb playing + (defvar *playing-feeb* nil) (defvar *feebs-to-be* ()) - -(defmacro aif (test then &optional else) - `(let ((it ,test)) - (if it ,then ,else))) - -(defmacro awhen (test &rest body) - `(let ((it ,test)) - (when it ,@body)))
Modified: system.lisp ============================================================================== --- system.lisp (original) +++ system.lisp Sat Feb 16 14:59:50 2008 @@ -1,6 +1,6 @@ ;;; -*- Common Lisp -*-
-#| Copyright (c) 2007 Gustavo Henrique Milar� +#| Copyright (c) 2007,2008 Gustavo Henrique Milaré
This file is part of The Feebs War.
@@ -19,7 +19,7 @@ |#
-(in-package :feebs) +(in-package :the-feebs-war)
;;; We start defining the main system rules by defining the classes @@ -39,13 +39,13 @@ (x-position :reader x-position :accessor feeb-x-position) (y-position :reader y-position :accessor feeb-y-position) (line-of-sight :accessor feeb-line-of-sight :reader line-of-sight - :initform 0) + :initform 0) (energy-reserve :accessor feeb-energy-reserve :reader energy-reserve) (ready-to-fire :accessor feeb-ready-to-fire :reader ready-to-fire - :initform t) + :initform t) (aborted :accessor feeb-aborted :reader aborted) (last-move :accessor feeb-last-move :reader last-move - :initform :dead) + :initform :dead)
;; These are available for the system (brain :accessor feeb-brain :initarg :brain) @@ -57,11 +57,11 @@ (turns-since-flamed :accessor feeb-turns-since-flamed :initform 0) (proximity :accessor feeb-proximity :initform (make-proximity)) (vision :accessor feeb-vision - :initform (make-array (list (max *maze-y-size* *maze-x-size*)))) + :initform (make-array (list (max *maze-y-size* *maze-x-size*)))) (vision-left :accessor feeb-vision-left - :initform (make-array (list (max *maze-y-size* *maze-x-size*)))) + :initform (make-array (list (max *maze-y-size* *maze-x-size*)))) (vision-right :accessor feeb-vision-right - :initform (make-array (list (max *maze-y-size* *maze-x-size*)))))) + :initform (make-array (list (max *maze-y-size* *maze-x-size*))))))
(defclass fireball (object) ((owner :accessor fireball-owner :initarg :owner) @@ -89,23 +89,23 @@
(defun delete-object (thing x y) (setf (aref *maze* x y) - (delete thing (aref *maze* x y)))) + (delete thing (aref *maze* x y))))
(defun place-object (thing x j) (push thing (aref *maze* x j)))
(defun change-object-pos (obj x y) (delete-object obj (object-x-position obj) - (object-y-position obj)) + (object-y-position obj)) (place-object obj x y) (setf (object-x-position obj) x - (object-y-position obj) y)) + (object-y-position obj) y))
(defun get-forward-pos (object) (let ((new-x (+ (forward-dx (object-direction object)) - (object-x-position object))) - (new-y (+ (forward-dy (object-direction object)) - (object-y-position object)))) + (object-x-position object))) + (new-y (+ (forward-dy (object-direction object)) + (object-y-position object)))) (values (aref *maze* new-x new-y) new-x new-y)))
@@ -124,7 +124,7 @@ (:method (object x-pos y-pos) (place-object object x-pos y-pos) (setf (object-x-position object) x-pos - (object-y-position object) y-pos)) + (object-y-position object) y-pos))
(:method ((feeb feeb) x-pos y-pos) (setf (feeb-last-move feeb) :dead) @@ -134,7 +134,7 @@ (:method ((fireball fireball) x-pos y-pos) (push fireball *fireballs-flying*) (setf (object-x-position object) x-pos - (object-y-position object) y-pos))) ; don't place it yet, only after first move + (object-y-position object) y-pos))) ; don't place it yet, only after first move
;;; Reincarnating
@@ -150,18 +150,18 @@ or :dissipate (for fireballs)." (:method (object cause) (delete-object object (object-x-position object) - (object-y-position object))) + (object-y-position object)))
(:method ((fireball fireball) cause) (setf *fireballs-flying* - (delete fireball *fireballs-flying*)) + (delete fireball *fireballs-flying*)) (call-next-method))
(:method ((feeb feeb) cause) (setf *dead-feebs* (nconc *dead-feebs* (list feeb)) - *feebs* (delete feeb *feebs*)) + *feebs* (delete feeb *feebs*)) (let* ((x (feeb-x-position feeb)) - (y (feeb-y-position feeb))) + (y (feeb-y-position feeb))) (push (list 0 x y) *carcasses*) (place-object :carcass x y)) (call-next-method))) @@ -176,11 +176,11 @@ (:documentation "Lets object make its move choice.") (:method ((feeb feeb)) (funcall (feeb-brain feeb) - feeb - (feeb-proximity feeb) - (feeb-vision feeb) - (feeb-vision-left feeb) - (feeb-vision-right feeb)))) + feeb + (feeb-proximity feeb) + (feeb-vision feeb) + (feeb-vision-left feeb) + (feeb-vision-right feeb))))
@@ -195,21 +195,21 @@
(:method (object (move (eql :turn-right))) (setf (object-direction object) - (right-of (object-direction object)))) + (right-of (object-direction object))))
(:method (object (move (eql :turn-left))) (setf (object-direction object) - (left-of (object-direction object)))) + (left-of (object-direction object))))
(:method (object (move (eql :turn-around))) (setf (object-direction object) - (behind (object-direction object)))) + (behind (object-direction object))))
(:method (object (move (eql :move-forward))) (multiple-value-bind (stuff new-x new-y) - (get-forward-pos object) + (get-forward-pos object) (unless (wallp stuff) - (change-object-pos object new-x new-y)))) + (change-object-pos object new-x new-y))))
(:method ((fireball fireball) (move (eql :dissipate))) (destroy-object fireball :dissipate)) @@ -218,19 +218,19 @@ (setf (feeb-turns-since-flamed feeb) 0) (create-object (make-instance 'fireball :direction (feeb-facing feeb) - :owner feeb) + :owner feeb) (feeb-x-position feeb) (feeb-y-position feeb)))
(:method ((feeb feeb) (move (eql :eat-mushroom))) (let ((x (feeb-x-position feeb)) - (y (feeb-y-position feeb))) + (y (feeb-y-position feeb))) (when (find :mushroom (aref *maze* x y)) - (delete-object :mushroom x y) - t))) + (delete-object :mushroom x y) + t)))
(:method ((feeb feeb) (move (eql :eat-carcass))) (when (find :carcass (aref *maze* (feeb-x-position feeb) - (feeb-y-position feeb))) + (feeb-y-position feeb))) t))
(:method ((feeb feeb) (move (eql :peek-left))) @@ -242,3 +242,4 @@ (setf (feeb-peeking feeb) move)))
) ; end of make-move generic function +
Added: the-feebs-war.asd ============================================================================== --- (empty file) +++ the-feebs-war.asd Sat Feb 16 14:59:50 2008 @@ -0,0 +1,39 @@ +;;; -*- Common Lisp -*- + +(defpackage :feebs-system + (:use :cl :asdf)) + +(in-package :feebs-system) + +(defsystem the-feebs-war + :description "The Feebs War is a continuation of Planet of the Feebs." + :version "0.1" + :author "Gustavo Henrique Milaré gugamilare@gmail.com" + :licence "GPL" +; :depends-on (lispbuilder-sdl lispbuilder-sdl-image lispbuilder-sdl-gfx) + + :components + (:cl-source-file "package") + (:cl-source-file "system" :depends-on ("package")) + (:cl-source-file "images" :depends-on ("system")) + (:cl-source-file "main" :depends-on ("images" "system")) + + (:module "definitions" + :components + (:cl-source-file "utils") + (:cl-source-file "rules" :depends-on ("main")) + (:cl-source-file "mazes" :depends-on ("package" "utils")) + (:cl-source-file "extra" :depends-on ("package")) + (:cl-source-file "brains" :depends-on ("package"))) + + (:module "graphics" + :components + (:file "graphics" :depends-on ("main"))) + + ;; GPL + (:doc-file "licence") + + ;; documentation + (:module "documentation" + :components + (:doc-file "feebs.tex")))
the-feebs-war-cvs@common-lisp.net