Author Topic: Stopping IconBar eating mouse events.  (Read 30 times)

0 Members and 4 Guests are viewing this topic.

Offline Scavenger

Stopping IconBar eating mouse events.
« on: Today at 03:42:39 PM »
Hey, I'm trying to customise the IconBar in the template game so it's always on screen and at the bottom, as a first step towards turning it into a verb box. So far I have it positioned right and removed all the hide/show commands so it doesn't crash the engine after a few clicks, however it eats all the user input no matter where on screen the mouse is.  Is there a way to solve this? I'll paste my edited code below. The scripts are a little hard to read as there's lots of magic numbers and temp variable names, but I'm sure I can work it out. Thanks in advance!

Quote
   (method (handleEvent pEvent &tmp temp0 pEventType temp2 temp3 theGCursorNumber theCurIcon theCurInvIcon)
      (pEvent localize:)
      (= pEventType (pEvent type?))
      (cond
         ((& state $0004))
         (
            (or
               (and
                  (not pEventType)
                  (& state $0400)
                  ;(<= -10 (pEvent y?))
                  (<= 168 (pEvent y?) )
                  (<= 0 (pEvent x?))
                  (<= (pEvent x?) 320)
                  (not (= temp0 0))
               )
               (and
                  (== pEventType evKEYBOARD)
                  (or
                     (== (pEvent message?) KEY_ESCAPE)
                     (== (pEvent message?) KEY_DELETE)
                  )
                  (= temp0 1)
               )
            )
            (pEvent globalize:)
            (= oldMouseX (pEvent x?))
            (= oldMouseY (pEvent y?))
            (= theGCursorNumber gCursorNumber)
            (= theCurIcon curIcon)
            (= theCurInvIcon curInvIcon)
            ;(self show:)
            ;(gGame setCursor: 999)
            (if temp0
               (gGame
                  setCursor:
                     gCursorNumber
                     1
                     (+
                        (curIcon nsLeft?)
                        (/ (- (curIcon nsRight?) (curIcon nsLeft?)) 2)
                     )
                     (- (curIcon nsBottom?) 3)
               )
            )
            (self doit:)
            (= temp3
               (if (or (gUser canControl:) (gUser canInput:))
                  (curIcon cursor?)
               else
                  gWaitCursor
               )
            )
            (if temp0
               (gGame setCursor: temp3 1 oldMouseX oldMouseY)
            else
               (gGame
                  setCursor: temp3 1 ((pEvent new:) x?) (Max (pEvent y?) (+ 1 height))
               )
            )
            ;(self hide:)
         )
         ((& pEventType evKEYBOARD)
            (switch (pEvent message?)
               (KEY_RETURN
                  (cond
                     ((not (IsObject curIcon)))
                     ((or (!= curIcon useIconItem) curInvIcon)
                        (pEvent
                           type: (curIcon type?)
                           message:
                              (if (== curIcon useIconItem)
                                 (curInvIcon message?)
                              else
                                 (curIcon message?)
                              )
                        )
                     )
                     (else (pEvent type: 0))
                  )
               )
               (KEY_NUMPAD0
                  (if (gUser canControl:) (self swapCurIcon:))
                  (pEvent claimed: TRUE)
               )
               (JOY_NULL
                  (if (& (pEvent type?) evJOYSTICK)
                     (self advanceCurIcon:)
                     (pEvent claimed: TRUE)
                  )
               )
            )
         )
         ((& pEventType evMOUSEBUTTON)
            (cond
               ((& (pEvent modifiers?) emSHIFT) (self advanceCurIcon:) (pEvent claimed: TRUE))
               ((& (pEvent modifiers?) emCTRL)
                  (if (gUser canControl:) (self swapCurIcon:))
                  (pEvent claimed: TRUE)
               )
               ((IsObject curIcon)
                  (pEvent
                     type: (curIcon type?)
                     message:
                        (if (== curIcon useIconItem)
                           (curInvIcon message?)
                        else
                           (curIcon message?)
                        )
                  )
               )
            )
         )
      )
   )



Offline lskovlun

Re: Stopping IconBar eating mouse events.
« Reply #1 on: Today at 03:55:12 PM »
Have you looked at LSL6? Does it do what you want?

Offline Scavenger

Re: Stopping IconBar eating mouse events.
« Reply #2 on: Today at 04:00:28 PM »
I did look at LSL6, but opening LSL6 in SCI Companion gives me basically machine code that I can't read, so unless someone has done all that work deciphering it and commenting it, I don't think I could use it.

Offline Kawa

Re: Stopping IconBar eating mouse events.
« Reply #3 on: Today at 04:12:10 PM »
The trick I recall seeing from studying Gabriel Knight and LSL6 is that the icon bar you see is not the real icon bar. If I remember correctly off the top of my head there was a separate "draw everything" function or method, and putting the mouse cursor in the hot zone activated the "real" icon bar. Hope this helps~

Offline lskovlun

Re: Stopping IconBar eating mouse events.
« Reply #4 on: Today at 04:13:21 PM »
There is a newer decompiler by Sluicebox, which does better. The LSL6 decompilation is here: https://github.com/sluicebox/sci-scripts/tree/main/lsl6-dos-1.000/src


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.034 seconds with 16 queries.