;;-*-Lisp-*-
(in-package goal)

;; failed to figure out what this is:
(defstate target-demo (target)
  :event target-generic-event-handler
  :code (behavior ()
    (if *time-of-day-proc*
        (set! (-> *time-of-day-proc* 0 hour) 12)
        )
    (set-setting! 'allow-pause #f 0.0 0)
    (set-setting! 'allow-progress #f 0.0 0)
    (apply-settings *setting-control*)
    (ja-channel-set! 0)
    (ja-post)
    (load-state-want-levels 'demo 'village1)
    (load-state-want-vis 'vi1)
    (case (scf-get-territory)
      ((2)
       (let ((gp-0 (ppointer->handle (static-screen-spawn
                                       6
                                       (new 'static 'texture-id :page #x27c)
                                       (new 'static 'texture-id :index #x1 :page #x27c)
                                       (new 'static 'texture-id :index #x2 :page #x27c)
                                       (seconds 5)
                                       #f
                                       self
                                       )
                                     )
                   )
             )
         (while (handle->process gp-0)
           (suspend)
           )
         )
       (let ((gp-1 (ppointer->handle (static-screen-spawn
                                       7
                                       (new 'static 'texture-id :page #x27d)
                                       (new 'static 'texture-id :index #x1 :page #x27d)
                                       (new 'static 'texture-id :index #x2 :page #x27d)
                                       (seconds 5)
                                       #f
                                       self
                                       )
                                     )
                   )
             )
         (while (handle->process gp-1)
           (suspend)
           )
         )
       (let ((gp-2 (ppointer->handle (static-screen-spawn
                                       8
                                       (new 'static 'texture-id :page #x2f0)
                                       (new 'static 'texture-id :index #x1 :page #x2f0)
                                       (new 'static 'texture-id :index #x2 :page #x2f0)
                                       (seconds 60)
                                       #t
                                       self
                                       )
                                     )
                   )
             )
         (while (handle->process gp-2)
           (suspend)
           )
         )
       )
      ((1)
       (case (-> *setting-control* current language)
         (((language-enum french))
          (let ((gp-3 (ppointer->handle (static-screen-spawn
                                          10
                                          (new 'static 'texture-id :page #x63f)
                                          (new 'static 'texture-id :index #x1 :page #x63f)
                                          (new 'static 'texture-id :index #x2 :page #x63f)
                                          (seconds 5)
                                          #f
                                          self
                                          )
                                        )
                      )
                )
            (while (handle->process gp-3)
              (suspend)
              )
            )
          )
         (((language-enum german))
          (let ((gp-4 (ppointer->handle (static-screen-spawn
                                          11
                                          (new 'static 'texture-id :page #x640)
                                          (new 'static 'texture-id :index #x1 :page #x640)
                                          (new 'static 'texture-id :index #x2 :page #x640)
                                          (seconds 5)
                                          #f
                                          self
                                          )
                                        )
                      )
                )
            (while (handle->process gp-4)
              (suspend)
              )
            )
          )
         (((language-enum italian))
          (let ((gp-5 (ppointer->handle (static-screen-spawn
                                          12
                                          (new 'static 'texture-id :page #x641)
                                          (new 'static 'texture-id :index #x1 :page #x641)
                                          (new 'static 'texture-id :index #x2 :page #x641)
                                          (seconds 5)
                                          #f
                                          self
                                          )
                                        )
                      )
                )
            (while (handle->process gp-5)
              (suspend)
              )
            )
          )
         (((language-enum spanish))
          (let ((gp-6 (ppointer->handle (static-screen-spawn
                                          13
                                          (new 'static 'texture-id :page #x642)
                                          (new 'static 'texture-id :index #x1 :page #x642)
                                          (new 'static 'texture-id :index #x2 :page #x642)
                                          (seconds 5)
                                          #f
                                          self
                                          )
                                        )
                      )
                )
            (while (handle->process gp-6)
              (suspend)
              )
            )
          )
         (else
           (let ((gp-7 (ppointer->handle (static-screen-spawn
                                           2
                                           (new 'static 'texture-id :page #x5cd)
                                           (new 'static 'texture-id :index #x1 :page #x5cd)
                                           (new 'static 'texture-id :index #x2 :page #x5cd)
                                           (seconds 5)
                                           #f
                                           self
                                           )
                                         )
                       )
                 )
             (while (handle->process gp-7)
               (suspend)
               )
             )
           )
         )
       (let ((gp-8 (ppointer->handle (static-screen-spawn
                                       3
                                       (new 'static 'texture-id :page #x5ce)
                                       (new 'static 'texture-id :index #x1 :page #x5ce)
                                       (new 'static 'texture-id :index #x2 :page #x5ce)
                                       (seconds 5)
                                       #f
                                       self
                                       )
                                     )
                   )
             )
         (while (handle->process gp-8)
           (suspend)
           )
         )
       (case (-> *setting-control* current language)
         (((language-enum french))
          (let ((gp-9 (ppointer->handle (static-screen-spawn
                                          15
                                          (new 'static 'texture-id :page #x644)
                                          (new 'static 'texture-id :index #x1 :page #x644)
                                          (new 'static 'texture-id :index #x2 :page #x644)
                                          (seconds 60)
                                          #t
                                          self
                                          )
                                        )
                      )
                )
            (while (handle->process gp-9)
              (suspend)
              )
            )
          )
         (((language-enum german))
          (let ((gp-10 (ppointer->handle (static-screen-spawn
                                           16
                                           (new 'static 'texture-id :page #x645)
                                           (new 'static 'texture-id :index #x1 :page #x645)
                                           (new 'static 'texture-id :index #x2 :page #x645)
                                           (seconds 60)
                                           #t
                                           self
                                           )
                                         )
                       )
                )
            (while (handle->process gp-10)
              (suspend)
              )
            )
          )
         (((language-enum italian))
          (let ((gp-11 (ppointer->handle (static-screen-spawn
                                           17
                                           (new 'static 'texture-id :page #x646)
                                           (new 'static 'texture-id :index #x1 :page #x646)
                                           (new 'static 'texture-id :index #x2 :page #x646)
                                           (seconds 60)
                                           #t
                                           self
                                           )
                                         )
                       )
                )
            (while (handle->process gp-11)
              (suspend)
              )
            )
          )
         (((language-enum spanish))
          (let ((gp-12 (ppointer->handle (static-screen-spawn
                                           18
                                           (new 'static 'texture-id :page #x647)
                                           (new 'static 'texture-id :index #x1 :page #x647)
                                           (new 'static 'texture-id :index #x2 :page #x647)
                                           (seconds 60)
                                           #t
                                           self
                                           )
                                         )
                       )
                )
            (while (handle->process gp-12)
              (suspend)
              )
            )
          )
         (else
           (let ((gp-13 (ppointer->handle (static-screen-spawn
                                            14
                                            (new 'static 'texture-id :page #x643)
                                            (new 'static 'texture-id :index #x1 :page #x643)
                                            (new 'static 'texture-id :index #x2 :page #x643)
                                            (seconds 60)
                                            #t
                                            self
                                            )
                                          )
                        )
                 )
             (while (handle->process gp-13)
               (suspend)
               )
             )
           )
         )
       )
      (else
        (let ((gp-14 (ppointer->handle (static-screen-spawn
                                         2
                                         (new 'static 'texture-id :page #x5cd)
                                         (new 'static 'texture-id :index #x1 :page #x5cd)
                                         (new 'static 'texture-id :index #x2 :page #x5cd)
                                         (seconds 5)
                                         #f
                                         self
                                         )
                                       )
                     )
              )
          (while (handle->process gp-14)
            (suspend)
            )
          )
        (let ((gp-15 (ppointer->handle (static-screen-spawn
                                         3
                                         (new 'static 'texture-id :page #x5ce)
                                         (new 'static 'texture-id :index #x1 :page #x5ce)
                                         (new 'static 'texture-id :index #x2 :page #x5ce)
                                         (seconds 5)
                                         #f
                                         self
                                         )
                                       )
                     )
              )
          (while (handle->process gp-15)
            (suspend)
            )
          )
        (let ((gp-16 (ppointer->handle (static-screen-spawn
                                         4
                                         (new 'static 'texture-id :page #x5cf)
                                         (new 'static 'texture-id :index #x1 :page #x5cf)
                                         (new 'static 'texture-id :index #x2 :page #x5cf)
                                         (seconds 60)
                                         #t
                                         self
                                         )
                                       )
                     )
              )
          (while (handle->process gp-16)
            (suspend)
            )
          )
        )
      )
    (process-spawn-function process (lambda ()
                                      (set! (-> *setting-control* default bg-a) 0.0)
                                      (start 'play (get-continue-by-name *game-info* "village1-demo-convo"))
                                      )
                            )
    (loop
      (suspend)
      )
    (none)
    )
  :post target-no-move-post
  )
