source: abuse/trunk/data/lisp/userfuns.lsp @ 589

Last change on this file since 589 was 589, checked in by Sam Hocevar, 10 years ago

data: remove exact duplicate Lisp files, merge all main space Lisp files,
and move most frabs addons to the main data directory.

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, ie:
19;;   (seq "hi" 2 5)  -> '("hi0002.pcx" "hi0003.pcx" "hi0004.pcx" "hi0005.pcx")
20;; will take into acount reverse sequences
21;; XXX: Mac Abuse inlined calls to this function
22(defun seq (name first last)
23  (if (<= first last)
24      (forward-seq name first last)
25    (reverse-seq name first last)))
26
27(defun forward-seq (name first last)
28  (if (> first last)
29      nil
30    (cons (concatenate 'string name (digstr first 4) ".pcx")
31          (forward-seq name (+ 1 first) last))))
32(defun reverse-seq (name last first)
33  (if (< last first)
34      nil
35    (cons (concatenate 'string name (digstr last 4) ".pcx")
36          (reverse-seq name (- last 1) first))))
37
38(defun rep (name count)
39  (if (eq count 0)
40      nil
41    (cons name (rep name (- count 1)))))
42
43
44;; appends something to the end of a list
45(defun app (head tail) (if (null head) tail (cons (car head) (app (cdr head) tail))))
46
47
Note: See TracBrowser for help on using the repository browser.