source: abuse/trunk/data-frabs/lisp/userfuns.lsp @ 581

Last change on this file since 581 was 44, checked in by Sam Hocevar, 12 years ago
  • Importing abuse-frabs 2.10.
File size: 1.3 KB
Line 
1;; Copyright 1995 Crack dot Com,  All Rights reserved
2;; See licensing information for more details on usage rights
3
4(defun set_all_lives (first x)
5  (if (eq first nil)
6      nil
7    (progn
8      (set_lives first x)
9      (set_all_lives (next_focus first) x))))
10 
11
12(defun select_place (x place)
13  (- (/ x place) (* (/ x (* place 10)) 10)))
14
15(defun dig2char (x)
16  (code-char (+ x (char-code "0"))))
17
18;; this creates a list of dpaint numbered antimation from a base name
19;; i.e. (seq "hi" 2 5)  -> '("hi0002.pcx" "hi0003.pcx" "hi0004.pcx" "hi0005.pcx")
20;; will take into acount reverse sequences
21(defun seq (name first last)
22  (if (<= first last)
23      (forward-seq name first last)
24    (reverse-seq name first last))
25)
26(defun forward-seq (name first last)
27  (if (> first last)
28      nil
29    (cons (concatenate 'string name (digstr first 4) ".pcx")
30          (forward-seq name (+ 1 first) last))))
31(defun reverse-seq (name last first)
32  (if (< last first)
33      nil
34    (cons (concatenate 'string name (digstr last 4) ".pcx")
35          (reverse-seq name (- last 1) first))))
36
37(defun rep (name count)
38  (if (eq count 0)
39      nil
40    (cons name (rep name (- count 1)))))
41
42
43;; appends something to the end of a list
44(defun app (head tail) (if (null head) tail (cons (car head) (app (cdr head) tail))))
45
46
Note: See TracBrowser for help on using the repository browser.