The Walking Dead Law and Order Legacies Jurassic Park Back to the future: The Game Puzzle Agent Sam & Max Tales of Monkey Island Wallace & Gromit's Grand Adventures More Telltale Games
Forgot your password?
No worries, we can help!

The Walking Dead

Go Back   Telltale Games Forums > The Classics > Wallace & Gromit's Grand Adventures > Wallace & Gromit General Discussion

Wallace & Gromit General Discussion Cracking conversation, Gromit!

Reply
 
Thread Tools Search this Thread
Old 05/06/2009, 12:12 am   #21
Pantagruel's Friend
Still spinning
 
Pantagruel's Friend's Avatar
 
Join Date: Aug 2008
Location: Budapest, Hungary
Posts: 626
Default

Quote:
Originally Posted by Derrick View Post
Try this test version. It compensates for aspect ratios that are not exactly 16x9. Also it seems that even though the mouse looks like it stops at any letter-boxing, it really goes into it. So you can push past the border making the mouse slow to come out of it. I now select the whole area as the movement click.
Hmmm, interesting. You got the problem right - I was playing at 1280x1024. The aspect ratio problem did cross my mind, but I thought then I wouldn't be able to move towards the Y-edges at all, and dissed the idea

I'll try the new version after work.

Cheers!
Pantagruel's Friend is offline   Reply With Quote
Old 05/06/2009, 02:05 pm   #22
Pantagruel's Friend
Still spinning
 
Pantagruel's Friend's Avatar
 
Join Date: Aug 2008
Location: Budapest, Hungary
Posts: 626
Default

Quote:
Originally Posted by Derrick View Post
Try this test version.
Yes, it works now! Great!
Pantagruel's Friend is offline   Reply With Quote
Old 05/07/2009, 08:32 pm   #23
Derrick
Senior Member
 
Join Date: Nov 2006
Location: lounging around the pool
Posts: 117
Default

Quote:
Originally Posted by [TTG] Yare View Post
How does the "screen edge" stuff cope with the game in windowed mode, or with multiple monitors?
Here is a test version with windowed support. Because I don't have good direct access to the mouse in a DX game from outside it, the best I can do is this.

If you click in the game window, the mouse will lock to the window. The movement modes will then behave exactly like full screen. To move the mouse out of the window you must first press the 'F' key to Free the mouse.

Depending on you system, you may have to change theses values:
Code:
; windowed mode info
; I need to see if this can be read automatically
; you may have to change these to suit your computer
winBarPixels := 29    ; top bar
winBorderPixels := 3  ; other 3 edges
This version also incudes a fix where I keep sending down keystrokes when the mouse is pressed. You won't notice the difference in game, but it technically cleans up and speeds up the code.

Code:
; Script Function:
;	Map mouse clicks at the edges of the screen as arrow keys
;   You can also move by holding down the button and dragging the mouse
;   The script will time out after 2 minutes if game is not launched
;   Press 'F' in windowed mode to free the cursor


; Set this to the W&G episode you want to run with this script
; 0 = Demo
episode := 1

; set options to 0=disable 1=enable
; Left Button options
useEdgesL  := 1
useCenterL := 1

; Right Button options
useEdgesR  := 1
useCenterR := 1

; how long in milliseconds to press mouse button in center screen before movement is controlled by mouse dragging
; left move delay
buttonDelayL := 150

; right move delay
buttonDelayR := 50

; movement box size in pixels
boxSize := 100

; pixels at edge used to select movement
; must be 1 to 25
borderPixels := 5


; ==================================
; only change values above this line
; ==================================

; windowed mode info
; I need to see if this can be read automatically
; you may have to change these to suit your computer
winBarPixels := 29    ; top bar
winBorderPixels := 3  ; other 3 edges

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
#SingleInstance ignore ; only allow 1 running script
SetTitleMatchMode, 3  ; Names must be exact

; check values
if (borderPixels < 1 OR borderPixels > 25)
{
  MsgBox, borderPixels value out of range
  ExitApp
}

timeDelayL  := buttonDelayL // 10
timeDelayR  := buttonDelayR // 10
movePixels := boxSize // 2
edgeMargin := movePixels * 2 + borderPixels
border := borderPixels
mouseLocked := 0

; setup paths and file
if (episode = 0)
{
gameFile = WallaceGromitDemo.exe
launcherName = Wallace & Gromit Demo
}
else if (episode = 1)
{
gameFile = WallaceGromit101.exe
launcherName = Fright of the Bumblebees
}
else if (episode = 2)
{
gameFile = WallaceGromit102.exe
launcherName = The Last Resort
}
else if (episode = 3)
{
gameFile = WallaceGromit103.exe
launcherName = Muzzled!
}
else if (episode = 4)
{
gameFile = WallaceGromit104.exe
launcherName = The Bogey Man
}
else
{
  MsgBox, Invalid Episode #
  ExitApp
}
gameReg  = SOFTWARE\Telltale Games\%gameFile%
RegRead, gameDir, HKEY_LOCAL_MACHINE, %gameReg% , Install Location

; this is the name of the game as shown on the task bar
; Demo, Ep1 and Ep2 all use the same name, so I assume all episodes will
gameName = Telltale Games


; launch game
Run, %gameFile%, %gameDir%, UseErrorLevel
if ErrorLevel = ERROR
{
  MsgBox, Episode %episode% could not be found
  ExitApp
}
winwait, %gameName%, , 120
if ErrorLevel
{
  ExitApp
}
gameID := WinExist(gameName)
WinActivate, ahk_id %gameID%
SetTimer, gameCheck
return


gameCheck:
;------------------------------
; quit script on game exit
;------------------------------
if (mouseLocked AND isFullScreen())
{
  ; free the mouse if we switched modes
  DllCall("ClipCursor")
  mouseLocked := 0
}
IfWinNotExist, ahk_id %gameID%
{
  ; free the mouse just in case
  DllCall("ClipCursor")
  ExitApp
}
return


~LButton::
useEdges  := useEdgesL
useCenter := useCenterL
timeDelay := timeDelayL
testButton = LButton
Gosub, mouseToArrows
return


~RButton::
useEdges  := useEdgesR
useCenter := useCenterR
timeDelay := timeDelayR
testButton = RButton
Gosub, mouseToArrows
return


mouseToArrows:
;------------------------------
; process mouse movement
;------------------------------
usingCenterMove := 0
if (isFullScreen())
{
  ; fullscreen
  CoordMode, Mouse, Screen
  width  := A_ScreenWidth
  height := A_ScreenHeight
  winXpos := 0
  winYpos := 0
  winXoffset := 0
  winYoffset := 0
}
else
{
  ; only do mouse to key conversion in game window
  IfWinNotActive, ahk_id %gameID%
    Return,
  CoordMode, Mouse, Relative
  ; get window information
  WinGetPos, winXpos, winYpos, width, height, ahk_id %gameID%
  ; free up mouse if on bar
  MouseGetPos, , curY
  if (curY < winBarPixels)
    Return,
  ; remove window border pixels
  width  -= winBorderPixels * 2
  height -= winBarPixels + winBorderPixels
  winXoffset := winBorderPixels
  winYoffset := winBarPixels
  ; set top left of game window
  ; keep locking the window so the mouse does not get free
  mouseLocked := 1
  Gosub, lockWindow
}

; check aspect ratio and adjust
if (width * 9 // height < 16)
{
  ; top and bottom letterboxed
  newHeight := width * 9 // 16
  edgeLeft  := 0
  edgeRight := width
  edgeUp    := (height - newHeight) // 2
  edgeDown  := edgeUp  + newHeight
}
else
{
  ; sides letterboxed
  newWidth  := height * 16 // 9
  edgeLeft  := (width   - newWidth) // 2
  edgeRight := edgeLeft + newWidth
  edgeUp    := 0
  edgeDown  := height
}

; bottom corner is one pixel in
edgeRight--
edgeDown--

if (useCenter = 1)
{
  timePressed := 0
  ; the valid center movement area
  centerLeft  := edgeLeft  + edgeMargin
  centerRight := edgeRight - edgeMargin
  centerUp    := edgeUp    + edgeMargin
  centerDown  := edgeDown  - edgeMargin
}

While GetKeyState(testButton)
{
  MouseGetPos, curX, curY
  if (!usingCenterMove)
  {
    ; adjust for window border
    curX -= winXoffset
    curY -= winYoffset
  }

  if (useEdges = 1 OR usingCenterMove = 1)
  {
    if (curX < edgeLeft + border)
    {
      if (!downL)
      {
        Send {Left Down}
        downL := 1
      }
    }
    else
    {
      if (downL)
      {
        Send {Left Up}
      }
      downL := 0
    }

    if (curX > edgeRight - border)
    {
      if (!downR)
      {
        Send {Right Down}
        downR := 1
      }
    }
    else
    {
      if (downR)
      {
        Send {Right Up}
      }
      downR := 0
    }

    if (curY < edgeUp + border)
    {
      if (!downU)
      {
        Send {Up Down}
        downU := 1
      }
    }
    else
    {
      if (downU)
      {
        Send {Up Up}
      }
      downU := 0
    }

    if (curY > edgeDown - border)
    {
      if (!downD)
      {
        Send {Down Down}
        downD := 1
      }
    }
    else
    {
      if (downD)
      {
        Send {Down Up}
      }
      downD := 0
    }
  }

  if (useCenter AND !usingCenterMove)
  {
    ; start counting if in center of screen
    if (curX > centerLeft AND curX < centerRight AND curY > centerUp AND curY < centerDown)
    {
      timePressed++
      if (timePressed > timeDelay)
      {
        ; button down long enough, start using center move
        ; re-djust mousepos to real and setup movement box
        curX += winXoffset
        curY += winYoffset
        edgeLeft  := curX - movePixels
        edgeUp    := curY - movePixels
        edgeRight := curX + movePixels
        edgeDown  := curY + movePixels
        VarSetCapacity(R, 16, 0), NumPut(winXpos + edgeLeft, &R+0), NumPut(winYpos + edgeUp, &R+4), NumPut(winXpos + edgeRight + 1, &R+8), NumPut(winYpos + edgeDown + 1, &R + 12)
        DllCall("ClipCursor", UInt, &R)
        usingCenterMove := 1
        border := 1
      }
    }
    else
    {
      ; reset count when not in center
      timePressed := 0
    }
  }
Sleep, 10
}

if (usingCenterMove)
{
  ; free the cursor
  if (mouseLocked)
    Gosub, lockWindow
  else
    DllCall("ClipCursor")
  ; reset to view border
  border := borderPixels
}

; unpress any keys that are down
if (downL)
{
  Send {Left Up}
}
downL := 0
if (downR)
{
  Send {Right Up}
}
downR := 0
if (downU)
{
  Send {Up Up}
}
downU := 0
if (downD)
{
  Send {Down Up}
}
downD := 0
Return,


isFullScreen()
;------------------------------
; check to see if fullscreen
;------------------------------
{
  Global gameID
  WinGet, style, Style, ahk_id %gameID%
  ; 0x800000 is WS_BORDER.
  ; 0x20000000 is WS_MINIMIZE.
  ; no border and not minimized
  Return, (style & 0x20800000) ? 0 : 1
}


~f::
;------------------------------
; free mouse from window
;------------------------------
if (mouseLocked)
{
  IfWinActive, ahk_id %gameID%
  {
    ; free the cursor
    DllCall("ClipCursor")
    mouseLocked := 0
  }
}
Return,


lockWindow:
;------------------------------
; lock mouse to window
;------------------------------
VarSetCapacity(R, 16, 0), NumPut(winXpos + winBorderPixels, &R+0), NumPut(winYpos + winBarPixels, &R+4), NumPut(winXpos + winBorderPixels + width, &R+8), NumPut(winYpos + winBarPixels + height, &R + 12)
DllCall("ClipCursor", UInt, &R)
Return,

Last edited by Derrick; 05/09/2009 at 01:26 pm.
Derrick is offline   Reply With Quote
Old 05/07/2009, 08:37 pm   #24
Derrick
Senior Member
 
Join Date: Nov 2006
Location: lounging around the pool
Posts: 117
Default

Quote:
Originally Posted by [TTG] Yare View Post
How does the "screen edge" stuff cope with the game in windowed mode, or with multiple monitors?
I'm not sure about multi-monitor, but I think it should work just like W&G.

I can't imagine W&G supports spanning a game across multiple monitors in fullscreen without using Dual/TripleHead. At that point my script would work fine. In windowed mode it should also work fine if the window spans multiple monitors.

I can't test either setup though.
Derrick is offline   Reply With Quote
Old 05/09/2009, 01:29 pm   #25
Derrick
Senior Member
 
Join Date: Nov 2006
Location: lounging around the pool
Posts: 117
Default

Ok, this should be the final last version. It adds full windowed support for mouse movement and takes into account varying window border sizes. The first post in this thread has been updated with the info and the new script file.

Enjoy.
Derrick is offline   Reply With Quote
Old 06/01/2009, 10:19 pm   #26
werpu
Senior Member
 
Join Date: May 2009
Posts: 290
Default

Quote:
Originally Posted by Derrick View Post

Myself, I just can't get used to using WASD. I do all my gaming from the couch on my HTPC. So it is too much of a pain to use the keyboard on my lap. I remapped my joystick to what I liked, but did not like selecting on-screen items by toggling through them. Which means I still needed a mouse/joystick combo. With this script I can now use only the mouse. I click on selectable items to move, but if I get to a spot when I need to use WASD, now I can just press and hold the right mouse button at the edge of the screen.
If you use a HTPC do yourself a favor and play the game with a gamepad...
The control scheme is clearly designed for a gamepad. I played it also that way and it works out well!
werpu is offline   Reply With Quote
Old 06/01/2009, 10:38 pm   #27
Armakuni
Senior Member
 
Armakuni's Avatar
 
Join Date: Mar 2007
Location: Amigastan
Posts: 966
Default

This actually works pretty well... I like it much better than the default controls.

I hope this will work for Monkey Island episodes as well.
Armakuni is offline   Reply With Quote
Old 06/02/2009, 05:19 am   #28
der_ketzer
Fhqwhgod
 
der_ketzer's Avatar
 
Join Date: Nov 2008
Location: in.meinem.turm.versteckt
Posts: 4,754
Default

Quote:
Originally Posted by Armakuni View Post
I hope this will work for Monkey Island episodes as well.
I saw your post over there and I am sure that they will make a script for ToMI if this one should not work.
der_ketzer is offline   Reply With Quote
Old 07/17/2009, 06:04 am   #29
parabolee
Senior Member
 
parabolee's Avatar
 
Join Date: Jun 2009
Posts: 107
Default

I would love to use AutoHotKey to allow me to use the right anologue stick on a gamepad as a mouse in W&G. I tried XPadder but because hot spot swap is mapped to it by default it interferes.

From what I am told I can use AutoHotKey to force it to ignore the original joystick commands.

Can anyone help me with that? Never used AHK before. Thanks
parabolee is offline   Reply With Quote
Old 07/17/2009, 07:21 am   #30
Derrick
Senior Member
 
Join Date: Nov 2006
Location: lounging around the pool
Posts: 117
Default

Quote:
Originally Posted by parabolee View Post
I would love to use AutoHotKey to allow me to use the right anologue stick on a gamepad as a mouse in W&G. I tried XPadder but because hot spot swap is mapped to it by default it interferes.

From what I am told I can use AutoHotKey to force it to ignore the original joystick commands.

Can anyone help me with that? Never used AHK before. Thanks
You could start with this as the basis for the script and modify it for the second analog stick. I have never tried that script, so I really can't help you any more with that. Autohotkey does have great forums that offer plenty of help and you can search it for ideas.

Edit... just noticed people are complaining about W&G default mapping still working while they are using the 2nd analog stick as a mouse. I think Autohotkey only allows blocking and remapping of buttons. The axes are not blocked, so autohotkey will be of no help for this issue. I could be wrong, but that is the way it looks from the documentation.

You could always try Pinnacle Game Profiler.

Last edited by Derrick; 07/17/2009 at 07:44 am.
Derrick is offline   Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 11:32 pm.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Telltale Games - © 2013 Telltale, Incorporated. All rights reserved.
Home  |   Store  |   Blogs  |   Forums  |   Product Support  |   Corporate Info  |   Press Releases  |   Jobs  |   Terms of Use  |   Privacy Policy