Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
  • Loading branch information
dto committed Feb 13, 2013
1 parent 6ebaa27 commit dc2c5ab
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 24 deletions.
36 changes: 29 additions & 7 deletions console.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,7 @@ name PROJECT. Returns the pathname if found, otherwise nil."
'(("png" :image)
("wav" :sample)
("ogg" :music)
("xm" :music)
("lisp" :lisp)
("ttf" :ttf)))

Expand All @@ -1181,7 +1182,7 @@ resource is stored; see also `find-resource'."
*resources*)
resource))

(defun defresource-expand-plist (plist)
(defun expand-resource-description (plist)
(destructuring-bind
(&key name type file properties &allow-other-keys) plist
(list :name name
Expand All @@ -1194,30 +1195,45 @@ resource is stored; see also `find-resource'."
;; variable
((and (symbolp (first entries))
(boundp (first entries)))
(mapcar #'defresource-expand-plist
(mapcar #'expand-resource-description
(symbol-value (first entries))))
;; short form: (defresource "file.ext" &rest PROPERTIES)
((stringp (first entries))
(list
(defresource-expand-plist
(expand-resource-description
(list :name (first entries)
:properties (rest entries)))))
;; inline: (defresource :name ...)
((keywordp (first entries))
(list
(defresource-expand-plist entries)))
(expand-resource-description entries)))
;; list of property lists
((every #'consp entries)
(mapcar #'defresource-expand-plist entries))))
(mapcar #'expand-resource-description entries))))

(defmacro defresource (&rest entries)
`(eval-when (:load-toplevel)
(blocky:add-resources
(resource-entries-to-plists ',entries))))

(defun directory-samples (dir)
(remove-if-not #'sample-filename-p
(directory-files dir)))

(defun project-samples ()
(directory-samples (find-project-path)))

(defun add-file-resource (filename)
(add-resource (expand-resource-description
(list filename))))

(defun load-all-samples ()
(dolist (sample (project-samples))
(add-file-resource sample)))

(defun find-project-path (project-name)
(defun find-project-path (&optional (project-name *project*))
"Return the current project path."
(assert *project*)
(assert (not (null project-name)))
(or *project-path*
(search-project-path project-name)))

Expand Down Expand Up @@ -1989,6 +2005,12 @@ of the music."
(when *use-sound*
(apply #'sdl-mixer:halt-sample :channel channel args)))

(defun set-sample-volume (sample volume)
(when *use-sound*
(load-sample-resource (find-resource sample))
(let ((chunk (find-resource-object sample)))
(setf (sdl-mixer:sample-volume chunk) volume))))

(defun initialize-sound ()
;; try opening sound
(when (null (sdl-mixer:open-audio :frequency *frequency*
Expand Down
71 changes: 71 additions & 0 deletions ideas.org
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,77 @@
** TODO Blocky Demoscene Livecoding Synthesis with VM's


* TODO OBSOOLETE DESIGN
*** TODO seek the ball, contact it
*** TODO contact bricks, you can bash them with the button or throw them at the ball carrier or other competitors for the ball
*** TODO can't pick up colored base bricks, must break with ball
*** TODO if i just kicked the ball, i'm the ball carrier, whose name is displayed
*** TODO if i run into another player, choose a new direction (how?)
*** TODO seek the ball carrier and try to bump him
*** TODO fumble! ball carrier sends ball flying and staggers a little
*** TODO [#B] don't require world to have player
*** TODO [#B] bricks should speed up the ball so that it's easier to get the ball back and tunnel thru.
**** TODO ball speed indicated by pitch of beep at kick time
*** TODO [#C] omega race corner bumpers for the ball
*** TODO [#C] better kick sounds (one normal, one strong)
*** TODO [#C] player can "block" other player to slow him down (keep him from getting ball carrier). press button
** TODO Implement goals, offense/defense
**** TODO GREEN: follow QB (simple seek for now, pathfinding later)
*** TODO [#B] a player's "base" is his pile of bricks with the goal inside.
**** TODO parts of the goal can be exposed by attacks.
*** TODO [#B] when a player's goal is hit 3 times, he is out for the rest of the game.
*** TODO [#B] finish porting path.lisp; any player can have a path
*** TODO [#B] when both players on a team are knocked out of the game, they lose the game.
**** TODO GOLD: PLAYER 1
**** TODO GREEN: PLAYER 2 or, FRIEND AI
**** TODO BLUE AND PURPLE: AI only (until netplay is implemented)
*** TODO [#C] later: rain/snow play with inertia, parts of field turning to mush
*** TODO [#C] two human player versus each other (each with AI teammate)

*** TODO [#C] WOW. http://www.atariage.com/2600/archives/combat_asm/index.html
*** DONE [#A] camera follows ball
CLOSED: [2012-10-08 Mon 02:39]

*** DONE [#A] refine auto-kick to work better when player is on top of ball.
CLOSED: [2012-10-08 Mon 02:13]
**** DONE kick causes ball to ignore kicker collisions for a limited time
CLOSED: [2012-10-08 Mon 02:13]

*** DONE [#C] check out add's https://github.com/gpadd/cl-h12rl
CLOSED: [2012-10-08 Mon 00:46]

*** DONE [#C] analyze what the 2600 AI does by playing game 28 or 43 (difficult)
CLOSED: [2012-10-08 Mon 00:55]
**** TODO http://www.atariage.com/manual_html_page.html?SoftwareLabelID=73
**** TODO imitate referee lines on side of tv
** DONE there is only one football, a white square
CLOSED: [2012-10-08 Mon 00:40]
** DONE the football can break any brick and it bounces like puck, but slows down over time like a 2600 kick
CLOSED: [2012-10-08 Mon 00:40]
** DONE auto-kick when push against ball
CLOSED: [2012-10-08 Mon 00:38]
** DONE dude foot sounds
CLOSED: [2012-10-06 Sat 20:57]
** DONE work with only green field for now.
CLOSED: [2012-10-06 Sat 21:17]
** DONE green background like a field
CLOSED: [2012-10-06 Sat 21:17]
** DONE [#A] control-r for reset
CLOSED: [2012-10-08 Mon 00:41]

* Archived Entries

** DONE indicate (paused) in listener
CLOSED: [2012-10-06 Sat 06:35]
:PROPERTIES:
:ARCHIVE_TIME: 2012-10-06 Sat 19:29
:ARCHIVE_FILE: ~/plong/plong.org
:ARCHIVE_OLPATH: Tasks
:ARCHIVE_CATEGORY: plong
:ARCHIVE_TODO: DONE
:END:


* Reactopong

Reactopong is a game of quick reactions and think-ahead strategy. An
Expand Down
13 changes: 8 additions & 5 deletions livecoding.org
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
*** TODO control or right-click on background to create a word cursor.
*** TODO remove it if nothing typed.


*** TODO connecting of block words into phrases

*** TODO howto select/execute a paragraph block
*** TODO inline typing of block words
*** TODO flesh out generic word-and-body-and-END block for things like "define", where END is implicit
Expand All @@ -22,6 +20,10 @@

*** TODO graceful error handling with pop up notifications

*** DONE control or right-click on background to create a word cursor.
CLOSED: [2013-02-06 Wed 14:17]
*** DONE remove it if nothing typed.
CLOSED: [2013-02-06 Wed 14:17]
*** DONE left-drag to move blocks
CLOSED: [2013-02-04 Mon 15:22]
*** DONE click to select block
Expand All @@ -40,7 +42,8 @@
*** DONE improved block appearance with schemebricks-style typing
CLOSED: [2013-02-04 Mon 15:25]

*** TODO make music with blockyforth ... ambient at first.
*
** TODO make music with blockyforth ... ambient at first.
*** TODO able to click/grab/edit/copy blockified forth commands
*** TODO [#B] show stack in sidebar
*** TODO consistent set of function keys for executing global words
Expand Down
15 changes: 4 additions & 11 deletions music.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,10 @@ SAMPLE has not yet been assigned a number, assign it."
number
(import-sample sample))))

(defun directory-samples (dir)
(remove-if-not #'sample-filename-p
(directory-files dir)))

(defun project-samples ()
(directory-samples (project-directory)))

(defun load-all-samples (project)
(setf *next-sample-number* 1)
(setf *samples* nil)
(mapcar #'import-sample (project-samples)))
;; (defun load-all-samples (project)
;; (setf *next-sample-number* 1)
;; (setf *samples* nil)
;; (mapcar #'import-sample (project-samples)))

;;; Generators

Expand Down
2 changes: 1 addition & 1 deletion phrase.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
(let ((phrase (apply #'new 'phrase contents)))
(prog1 phrase
(update-parent-links phrase)
(freeze (first (%inputs phrase)))
(freeze (first (%inputs phrase))) ;; wait, is this wrong?
(with-fields (orientation no-background dash spacing) phrase
(setf orientation :vertical)
(setf dash 1)
Expand Down
6 changes: 6 additions & 0 deletions words.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,12 @@ interpreter."
(:music (play-music name))
(:sample (play-sample name)))))

(define-word volume! (sample volume)
(set-sample-volume sample volume))

(define-word load-all-samples ()
(load-all-samples))

(define-word playing (music) (play-music music :loop t))

(define-word stop-music () (halt-music))
Expand Down

0 comments on commit dc2c5ab

Please sign in to comment.