summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoutade <thegoofist@protonmail.com>2019-10-20 07:45:28 -0500
committerBoutade <thegoofist@protonmail.com>2019-10-20 07:45:28 -0500
commit5c22b7888e09c9e43e2b605d817a1e57bde63ddc (patch)
treee6061348d0e52d6c2135c5e516999ae95ef54dce
parentc065c7d856bce3fab29c768ea99f65afd0c80a06 (diff)
mogrified assets, set foreign memory on bootup
-rw-r--r--assets.lisp27
-rw-r--r--assets/Cop1.pngbin22086 -> 1623 bytes
-rw-r--r--assets/Cop2.pngbin22865 -> 1633 bytes
-rw-r--r--assets/KidSheet.pngbin107108 -> 5450 bytes
-rw-r--r--assets/Nance.pngbin148181 -> 7701 bytes
-rw-r--r--assets/Normy.pngbin130251 -> 7394 bytes
-rw-r--r--assets/Punker.pngbin139134 -> 7368 bytes
-rw-r--r--assets/Speechbubble.pngbin2902 -> 365 bytes
-rw-r--r--assets/Suit.pngbin162505 -> 6777 bytes
-rw-r--r--assets/TitleCard.pngbin32993 -> 31685 bytes
-rw-r--r--assets/backdrop.pngbin201852 -> 199861 bytes
-rw-r--r--assets/emoji.pngbin54344 -> 50184 bytes
-rw-r--r--assets/sliding-door.pngbin10627 -> 8366 bytes
-rw-r--r--the-price-of-a-cup-of-coffee.asd8
-rw-r--r--the-price-of-a-cup-of-coffee.lisp71
15 files changed, 67 insertions, 39 deletions
diff --git a/assets.lisp b/assets.lisp
index 426e6f5..241f91e 100644
--- a/assets.lisp
+++ b/assets.lisp
@@ -86,9 +86,7 @@
(:NAME "very-angry" :X 0 :Y 0 :WIDTH 72 :HEIGHT 72)))
-(defparameter +shared-faces+
- (create-sprite-faces +tile-defs+))
-
+(defparameter +shared-faces+ nil)
(defparameter +nance-sheet-image+ #P"assets/Nance.png")
@@ -121,21 +119,15 @@
(defparameter +sliding-door-open-x+ 800)
(defparameter +sliding-door-closed-x+ 868)
-(defvar *sliding-door-position*
- (sdl2:make-rect +sliding-door-closed-x+ 8 104 138))
+(defvar *sliding-door-position*)
+
(defvar *harmony-initialized-p* nil)
(defvar *cold-day-track*)
(defvar *looking-up-track*)
(defvar *current-track*)
-(defvar *cop-animation-faces*
- (let* ((f1 (sdl2:make-rect 0 0 64 128))
- (f2 (sdl2:make-rect 64 0 64 128))
- (v (make-array 2 :initial-contents (list f1 f2))))
- (make-sprite-faces
- :facing-down v :facing-up v :facing-left v :facing-right v
- :walking-down v :walking-up v :walking-left v :walking-right v)))
+(defvar *cop-animation-faces*)
(defun make-texture-from-file (renderer filepath)
(with-surface-from-file (surf filepath)
@@ -149,6 +141,17 @@
(defun boot-up-assets (renderer)
+ (setf +shared-faces+ (create-sprite-faces +tile-defs+))
+ (setf *sliding-door-position*
+ (sdl2:make-rect +sliding-door-closed-x+ 8 104 138))
+ (setf *cop-animation-faces*
+ (let* ((f1 (sdl2:make-rect 0 0 64 128))
+ (f2 (sdl2:make-rect 64 0 64 128))
+ (v (make-array 2 :initial-contents (list f1 f2))))
+ (make-sprite-faces
+ :facing-down v :facing-up v :facing-left v :facing-right v
+ :walking-down v :walking-up v :walking-left v :walking-right v)))
+
(setf *nance-texture* (make-texture-from-file renderer +nance-sheet-image+))
(setf *suit-texture* (make-texture-from-file renderer +suit-sheet-image+))
(setf *normy-texture* (make-texture-from-file renderer +nomry-sheet-image+))
diff --git a/assets/Cop1.png b/assets/Cop1.png
index 665cf54..1039a61 100644
--- a/assets/Cop1.png
+++ b/assets/Cop1.png
Binary files differ
diff --git a/assets/Cop2.png b/assets/Cop2.png
index b05519d..f31e16b 100644
--- a/assets/Cop2.png
+++ b/assets/Cop2.png
Binary files differ
diff --git a/assets/KidSheet.png b/assets/KidSheet.png
index c8a8f0d..7152f4e 100644
--- a/assets/KidSheet.png
+++ b/assets/KidSheet.png
Binary files differ
diff --git a/assets/Nance.png b/assets/Nance.png
index 42bd6f8..101bdff 100644
--- a/assets/Nance.png
+++ b/assets/Nance.png
Binary files differ
diff --git a/assets/Normy.png b/assets/Normy.png
index 1fdbb83..fb9a89f 100644
--- a/assets/Normy.png
+++ b/assets/Normy.png
Binary files differ
diff --git a/assets/Punker.png b/assets/Punker.png
index 78d6315..7acaa66 100644
--- a/assets/Punker.png
+++ b/assets/Punker.png
Binary files differ
diff --git a/assets/Speechbubble.png b/assets/Speechbubble.png
index 8400d30..f4d8d20 100644
--- a/assets/Speechbubble.png
+++ b/assets/Speechbubble.png
Binary files differ
diff --git a/assets/Suit.png b/assets/Suit.png
index cd585ed..974c66a 100644
--- a/assets/Suit.png
+++ b/assets/Suit.png
Binary files differ
diff --git a/assets/TitleCard.png b/assets/TitleCard.png
index e3b5f99..dc789db 100644
--- a/assets/TitleCard.png
+++ b/assets/TitleCard.png
Binary files differ
diff --git a/assets/backdrop.png b/assets/backdrop.png
index 5cddb8d..41d0e47 100644
--- a/assets/backdrop.png
+++ b/assets/backdrop.png
Binary files differ
diff --git a/assets/emoji.png b/assets/emoji.png
index d7555bd..09b9c3a 100644
--- a/assets/emoji.png
+++ b/assets/emoji.png
Binary files differ
diff --git a/assets/sliding-door.png b/assets/sliding-door.png
index f38fbcb..a75ebd1 100644
--- a/assets/sliding-door.png
+++ b/assets/sliding-door.png
Binary files differ
diff --git a/the-price-of-a-cup-of-coffee.asd b/the-price-of-a-cup-of-coffee.asd
index 27f82a2..fa14e56 100644
--- a/the-price-of-a-cup-of-coffee.asd
+++ b/the-price-of-a-cup-of-coffee.asd
@@ -2,11 +2,17 @@
(asdf:defsystem #:the-price-of-a-cup-of-coffee
:description "Just a cold day on a busy street."
+
+ :defsystem-depends-on (:deploy)
+ :build-operation "deploy-op"
+ :build-pathname "price-of-coffee"
+ :entry-point "pocc::start"
+
:author "<thegoofist@protonmail.com>"
:license "GPL3"
:version "0.0.1"
:serial t
- :depends-on (#:animise #:sdl2 #:sdl2-image #:harmony-simple #:trivia #:swank)
+ :depends-on (#:animise #:sdl2 #:sdl2-image #:harmony-simple #:trivia) ; #:swank)
:components ((:file "package")
(:file "macros")
(:file "assets")
diff --git a/the-price-of-a-cup-of-coffee.lisp b/the-price-of-a-cup-of-coffee.lisp
index 4171cba..31929fd 100644
--- a/the-price-of-a-cup-of-coffee.lisp
+++ b/the-price-of-a-cup-of-coffee.lisp
@@ -12,7 +12,7 @@
(defparameter +home-base-y+ 36)
(defparameter +home-base-x+ 292)
(defparameter +coffee-cost+ 0.45)
-(defparameter +screen-sized-rect+ (sdl2:make-rect 0 0 +window-width+ +window-height+))
+(defparameter +screen-sized-rect+ nil)
;;; STUCTS AND CLASSES
@@ -58,33 +58,38 @@
(defvar *pedestrians* nil)
(defvar *to-render-by-y* nil)
(defvar *on-coffee-break* nil)
-(defvar *status-meter-decoration-rect* (sdl2:make-rect 0 0 48 48))
+(defvar *status-meter-decoration-rect*)
(defvar *space-clamping-p* t)
(defvar *tweens* nil)
-(defvar *sickness-rect* (sdl2:make-rect 0 0 40 40))
+(defvar *sickness-rect*)
(defvar *collision-on-p* t)
(defvar *input-mode* :start) ;; (or :normal :start nil)
(defvar *collision-count* 0)
-(defvar *ped-hit-box* (sdl2:make-rect 0 0 64 32))
-(defvar *nance-hit-box* (sdl2:make-rect 0 0 64 32))
+(defvar *ped-hit-box* )
+(defvar *nance-hit-box* )
(defvar *fading-out* nil)
(defvar *door-open-p* nil)
-(defvar *expression-rect*
- (sdl2:make-rect 0 0 50 50)
- "used to render expressions.")
-(defvar *keys-down* (make-keys-down))
+(defvar *expression-rect*)
+
+(defvar *keys-down*)
(defvar *human-frame-pause* (/ 1000 4))
(defvar *cached-pedestrians* nil)
(defvar *pedestrian-count* 4)
+(defvar *money-meter* nil)
+(defvar *stress-meter* nil)
+(defvar *cold-meter* nil)
+
+
+(defun boot-meters ()
-(let* ((padding 8)
- (y (- +window-height+ +meter-bar-height+ padding))
- (measure (round (/ +window-width+ 5)))
- (width (- measure (* 2 padding)))
- (double-width (- (* 2 measure) (* 2 padding))))
+ (let* ((padding 8)
+ (y (- +window-height+ +meter-bar-height+ padding))
+ (measure (round (/ +window-width+ 5)))
+ (width (- measure (* 2 padding)))
+ (double-width (- (* 2 measure) (* 2 padding))))
- (defvar *money-meter*
+ (setf *money-meter*
(make-instance 'status-meter
:color (list 0 200 50 200)
:decoration "dollars"
@@ -93,7 +98,7 @@
:percent 0.0
:max-width double-width))
- (defvar *stress-meter*
+ (setf *stress-meter*
(make-instance 'status-meter
:color (list 200 20 20 200)
:decoration "stressed"
@@ -104,7 +109,7 @@
:percent 0.0
:max-width width))
- (defvar *cold-meter*
+ (setf *cold-meter*
(make-instance 'status-meter
:color (list 0 140 240 200)
:decoration "cold"
@@ -113,6 +118,19 @@
:percent 0.0
:max-width width)))
+ (defmethod render :after ((money-meter (eql *money-meter*)) renderer)
+ (let ((x (round (* +coffee-cost+ (max-width money-meter)))))
+ (setf (sdl2:rect-x *status-meter-decoration-rect*) x)
+ (sdl2:render-copy renderer *expression-texture*
+ :source-rect (get-expression "coffee")
+ :dest-rect *status-meter-decoration-rect*)))
+
+ (defmethod (setf percent) :after (new-val (meter (eql *stress-meter*)))
+ (when (<= 1.0 new-val)
+ (stressed-out-sequence)))
+
+ )
+
;;; GENERICS
(defgeneric render (sprite renderer))
(defgeneric update (thing time))
@@ -149,12 +167,6 @@
:dest-rect *status-meter-decoration-rect*)))
-(defmethod render :after ((money-meter (eql *money-meter*)) renderer)
- (let ((x (round (* +coffee-cost+ (max-width money-meter)))))
- (setf (sdl2:rect-x *status-meter-decoration-rect*) x)
- (sdl2:render-copy renderer *expression-texture*
- :source-rect (get-expression "coffee")
- :dest-rect *status-meter-decoration-rect*)))
(defmethod render ((human human) renderer)
(with-slots (pos sheet faces face frame expression) human
@@ -273,9 +285,6 @@
(setf percent (clamp new-val 0.0 1.0))
(setf (sdl2:rect-width filled-shape) (round (* max-width percent)))))
-(defmethod (setf percent) :after (new-val (meter (eql *stress-meter*)))
- (when (<= 1.0 new-val)
- (stressed-out-sequence)))
(defmethod (setf walk-speed) :after (newval (human human))
@@ -1012,6 +1021,16 @@
(defun start ()
+ (setf +screen-sized-rect+ (sdl2:make-rect 0 0 +window-width+ +window-height+))
+ (setf *status-meter-decoration-rect* (sdl2:make-rect 0 0 48 48))
+ (setf *sickness-rect* (sdl2:make-rect 0 0 40 40))
+ (setf *ped-hit-box* (sdl2:make-rect 0 0 64 32))
+ (setf *nance-hit-box* (sdl2:make-rect 0 0 64 32))
+ (setf *expression-rect* (sdl2:make-rect 0 0 50 50))
+ (setf *keys-down* (make-keys-down))
+
+ (boot-meters)
+
(setf *input-mode* :start)
(setf *pedestrians* nil)
(setf *to-render-by-y* nil)