Commit a23fa7b4 authored by Peter Achten's avatar Peter Achten

(PA) turned all object I/O functions to lower-case.

parent e01e76ba
......@@ -22,7 +22,7 @@ SK_FOREVER :== -1
StdGameFatalError :: String String -> .x
StdGameFatalError function error = FatalError function "StdGame" error
StdGameFatalError function error = fatalError function "StdGame" error
startGame :: .(Game a) a [.GameAttribute a] !*World -> .World
......@@ -60,18 +60,18 @@ where
// always full screen, game in a window not implemented yet
OpenGameWindow :: !Id !Size !Int !Bool !(PSt .l) -> (!ErrorReport, !PSt .l)
OpenGameWindow id gamewindowsize bitsperpixel fullscreen pState
# pState = WindowFunctions.dOpen pState // Install the window device
# pState = windowFunctions.dOpen pState // Install the window device
# maybe_id = Just id
# (maybe_okId,ioState) = validateWindowId maybe_id pState.io
| isNothing maybe_okId
= (ErrorIdsInUse,{pState & io=ioState})
# (found,wDevice,ioState) = IOStGetDevice WindowDevice ioState
# (found,wDevice,ioState) = ioStGetDevice WindowDevice ioState
| not found // This condition should never occur: WindowDevice must have been 'installed'
= StdGameFatalError "openGame" "could not retrieve WindowSystemState from IOSt"
# windows = WindowSystemStateGetWindowHandles wDevice
# windows = windowSystemStateGetWindowHandles wDevice
# (isZero,windows) = checkZeroWindowHandlesBound windows
| isZero
# ioState = IOStSetDevice (WindowSystemState windows) ioState
# ioState = ioStSetDevice (WindowSystemState windows) ioState
= (ErrorViolateDI,{pState & io=ioState})
| otherwise
# info = { gamewindowDDPtr = OSNoWindowPtr
......@@ -91,7 +91,7 @@ where
wsH = {wshIds=wIds,wshHandle=Just wlsH}
windows = addWindowHandlesWindow 0 wsH windows
windows = decreaseWindowHandlesBound windows
# ioState = IOStSetDevice (WindowSystemState windows) ioState
# ioState = ioStSetDevice (WindowSystemState windows) ioState
# ioState = bufferDelayedEvents delayinfo ioState
= (NoError,{pState & io=ioState})
......
......@@ -2,8 +2,8 @@ implementation module gameCrossCall_12
import StdList, StdTuple
from commondef import FatalError
from windowCrossCall_12 import WinFakePaint
from commondef import fatalError
from windowCrossCall_12 import winFakePaint
import clCrossCall_12, gameintrface_12
import ostypes
import code from "cCrossCallGame_121.obj",
......@@ -17,7 +17,7 @@ import code from library "dsound_library"
gameCrossCall_12FatalError :: String String -> .x
gameCrossCall_12FatalError function error
= FatalError function "gameCrossCall_12" error
= fatalError function "gameCrossCall_12" error
// Initialisation of game. This function must be called before any game cross call can be done!
WinInitialiseGame :: !*OSToolbox -> *OSToolbox
......@@ -37,7 +37,7 @@ WinCreateGameWindow :: !Bool !(!Int,!Int) !Int !*OSToolbox -> (![DelayActivation
WinCreateGameWindow fullscreen size bpp tb
# createcci = {ccMsg=CcRqCREATEGAMEWINDOW,p1=w,p2=h,p3=bpp,p4=toInt fullscreen,p5=0,p6=0}
# (returncci,delay_info,tb)
= IssueCleanRequest OScreateGameWindowCallback createcci [] tb
= issueCleanRequest OScreateGameWindowCallback createcci [] tb
wPtr = case returncci.ccMsg of
CcRETURN1 -> returncci.p1
CcWASQUIT -> OSNoWindowPtr
......@@ -49,36 +49,36 @@ where
OScreateGameWindowCallback :: !CrossCallInfo ![DelayActivationInfo] !*OSToolbox
-> (!CrossCallInfo,![DelayActivationInfo],!*OSToolbox)
OScreateGameWindowCallback {ccMsg=CcWmPAINT,p1=hwnd} s tb
= (Return0Cci, s, WinFakePaint hwnd tb)
= (return0Cci, s, winFakePaint hwnd tb)
OScreateGameWindowCallback {ccMsg=CcWmACTIVATE,p1=hwnd} delay_info tb
= (Return0Cci, [DelayActivatedWindow hwnd:delay_info], tb)
= (return0Cci, [DelayActivatedWindow hwnd:delay_info], tb)
OScreateGameWindowCallback {ccMsg=CcWmDEACTIVATE,p1=hwnd} delay_info tb
= (Return0Cci, [DelayDeactivatedWindow hwnd:delay_info], tb)
= (return0Cci, [DelayDeactivatedWindow hwnd:delay_info], tb)
OScreateGameWindowCallback {ccMsg=CcWmCREATE,p1=hwnd} delay_info tb
= (Return0Cci, delay_info, tb)
= (return0Cci, delay_info, tb)
OScreateGameWindowCallback {ccMsg=CcWmSIZE,p1=hwnd,p2=width,p3=height} s tb
= (Return0Cci, s, tb)
= (return0Cci, s, tb)
OScreateGameWindowCallback {ccMsg} s tb
= gameCrossCall_12FatalError "WinCreateGameWindowCallback" ("unknown message type ("+++toString ccMsg+++")")
WinRunGameEngine :: !(CrossCallInfo -> .(.s -> .(*OSToolbox -> *(.CrossCallInfo,.s,*OSToolbox)))) !.s !Int !Int !Int !*OSToolbox
-> (!.s,!*OSToolbox)
WinRunGameEngine handleGameEvents initState a b c tb
# (finalOScci,finalState,tb) = IssueCleanRequest handleGameEvents (Rq3Cci CcRqRUNGAME a b c) initState tb
# (finalOScci,finalState,tb) = issueCleanRequest handleGameEvents (Rq3Cci CcRqRUNGAME a b c) initState tb
= (finalState,tb)
WinInitGameObject :: !Int !Int !Int !Int !*OSToolbox -> (!GRESULT, !*OSToolbox)
WinInitGameObject objtype subtype x y tb
# tb = snd (IssueCleanRequest2 (ErrorCallback2 "WinInitGameObject") (Rq4Cci CcRqCREATEGAMEOBJECT objtype subtype x y) tb)
# tb = snd (issueCleanRequest2 (errorCallback2 "WinInitGameObject") (Rq4Cci CcRqCREATEGAMEOBJECT objtype subtype x y) tb)
= (0, tb)
// modified 01/11/99
WinCreateUserEvent :: !Int !Int !Int !Int !Int !Int !*OSToolbox -> (!GRESULT, !*OSToolbox)
WinCreateUserEvent ev evpar1 evpar2 target subtarget time tb
# tb = snd (IssueCleanRequest2 (ErrorCallback2 "WinCreateUserEvent") (Rq6Cci CcRqUSERGAMEEVENT ev evpar1 evpar2 target subtarget time) tb)
# tb = snd (issueCleanRequest2 (errorCallback2 "WinCreateUserEvent") (Rq6Cci CcRqUSERGAMEEVENT ev evpar1 evpar2 target subtarget time) tb)
= (0, tb)
WinPlaySoundSample :: !Int !Int !Int !Int !Int !*OSToolbox -> (!GRESULT, !*OSToolbox)
WinPlaySoundSample id vol pan freq delay tb
# tb = snd (IssueCleanRequest2 (ErrorCallback2 "WinCreateUserEvent") (Rq5Cci CcRqPLAYSOUNDSAMPLE id vol pan freq delay) tb)
# tb = snd (issueCleanRequest2 (errorCallback2 "WinCreateUserEvent") (Rq5Cci CcRqPLAYSOUNDSAMPLE id vol pan freq delay) tb)
= (0, tb)
......@@ -5,7 +5,7 @@ implementation module osgame
import StdArray, StdBool, StdChar, StdInt
import StdMaybe
from ospicture import toRGBtriple
from clCCall_12 import WinBeep
from clCCall_12 import winBeep
import gameCrossCall_12, gamehandle, gameobjectutils, gst
......@@ -151,7 +151,7 @@ OSSetBoundMap x y newvalue tb
handleGameEvents :: !CrossCallInfo !v:(OSGameData u:gs) !*OSToolbox -> (!CrossCallInfo,!v:OSGameData u:gs,!*OSToolbox), [v<=u]
handleGameEvents fromOSCci=:{ccMsg=CcWmGAMEKEYBOARD,p1=key,p2=x,p3=y} state tb
= (Return2Cci x` y`,state,tb)
= (return2Cci x` y`,state,tb)
where
(x`,y`) = case key of
GK_LEFT -> (x-1, y)
......@@ -164,10 +164,10 @@ handleGameEvents fromOSCci=:{ccMsg=CcWmCHECKQUIT} state=:{gamest,gamehnd={quitle
# gst = toGSt gamest tb
# (quit, gst) = quitfunction gst
# (newstate, tb) = fromGSt gst
= (Return1Cci (toInt quit), {state & gamest = newstate}, tb)
= (return1Cci (toInt quit), {state & gamest = newstate}, tb)
handleGameEvents fromOSCci=:{ccMsg=CcWmSCROLL,p1=id,p2=x,p3=y,p4=t} state=:{scroll} tb
= (Return2Cci x` y`, state, tb)
= (return2Cci x` y`, state, tb)
where
{x = x`, y = y`} = f (MakePoint x y) t
f = FindMovement (id, scroll)
......@@ -179,50 +179,50 @@ where
handleGameEvents fromOSCci=:{ccMsg=CcWmINITOBJECT, p1=objtype, p2=subtype, p3=id, p4=x, p5=y, p6=time} state tb
# (state,tb) = initialiseGameObject objtype subtype id {x=x,y=y} time state tb
= (Return0Cci, state, tb)
= (return0Cci, state, tb)
handleGameEvents fromOSCci=:{ccMsg=CcWmOBJECTDONE, p1=objtype, p2=id} state tb
# (state, tb) = doneGameObject objtype id state tb
= (Return0Cci, state, tb)
= (return0Cci, state, tb)
handleGameEvents fromOSCci=:{ccMsg=CcWmMOVEOBJECT, p1=objtype, p2=id} state tb
# (state,tb) = moveGameObject objtype id state tb
= (Return0Cci, state, tb)
= (return0Cci, state, tb)
handleGameEvents fromOSCci=:{ccMsg=CcWmTOUCHBOUND, p1=objtype, p2=id, p3=dir, p4=mapcode} state tb
# (state,tb) = touchBound objtype id dir mapcode state tb
= (Return0Cci, state, tb)
= (return0Cci, state, tb)
handleGameEvents fromOSCci=:{ccMsg=CcWmCOLLISION, p1=ot1, p2=id1, p3=ot2, p4=id2, p5=dir} state tb
# (state,tb) = handleCollision ot1 id1 ot2 id2 dir state tb
= (Return0Cci, state, tb)
= (return0Cci, state, tb)
handleGameEvents fromOSCci=:{ccMsg=CcWmANIMATION, p1=objtype, p2=id} state tb
# (state,tb) = handleAnimationEvent objtype id state tb
= (Return0Cci, state, tb)
= (return0Cci, state, tb)
handleGameEvents fromOSCci=:{ccMsg=CcWmUSEREVENT, p1=objtype, p2=id, p3=ev, p4=par1, p5=par2} state tb
# (state,tb) = handleUserEvent objtype id ev par1 par2 state tb
= (Return0Cci, state, tb)
= (return0Cci, state, tb)
handleGameEvents fromOSCci=:{ccMsg=CcWmOBJECTTIMER, p1=objtype, p2=id} state tb
# (state,tb) = handleTimerEvent objtype id state tb
= (Return0Cci, state, tb)
= (return0Cci, state, tb)
handleGameEvents fromOSCci=:{ccMsg=CcWmOBJECTKEYDOWN, p1=objtype, p2=id, p3=key} state tb
# (state,tb) = handleKeyDown objtype id key state tb
= (Return0Cci, state, tb)
= (return0Cci, state, tb)
handleGameEvents fromOSCci=:{ccMsg=CcWmOBJECTKEYUP, p1=objtype, p2=id, p3=key} state tb
# (state,tb) = handleKeyUp objtype id key state tb
= (Return0Cci, state, tb)
= (return0Cci, state, tb)
handleGameEvents fromOSCci=:{ccMsg=CcWmSTATISTICS} state=:{gamest,gamehnd={textitems`=stats}} tb
# gst = toGSt gamest tb
# (statlist, gst) = stats gst
# (newstate, tb) = fromGSt gst
# tb = showall statlist tb
= (Return0Cci, {state & gamest = newstate}, tb)
= (return0Cci, {state & gamest = newstate}, tb)
where
showall :: ![GameText] !*OSToolbox -> *OSToolbox
showall [] tb = tb
......@@ -254,7 +254,7 @@ where
(sx,sy) = al.xyfromscreencenter
handleGameEvents fromOSCci state tb
= (Return0Cci,state,WinBeep tb)
= (return0Cci,state,winBeep tb)
MakePoint :: !Int !Int -> Point2
......
......@@ -53,47 +53,47 @@ BUTTONDOWN :== 1
BUTTONSTILLUP :== 0 /* PA: new constant for passing mouse move events. */
WinLaunchApp :: !{#Char} !Bool !*OSToolbox -> (!Bool,!*OSToolbox)
WinLaunchApp2 :: !{#Char} !{#Char} !Bool !*OSToolbox -> (!Bool,!*OSToolbox)
WinCallProcess :: !CSTR !CSTR !CSTR !CSTR !CSTR !CSTR !*OSToolbox -> (!Bool,!Int,!*OSToolbox)
winLaunchApp :: !{#Char} !Bool !*OSToolbox -> (!Bool,!*OSToolbox)
winLaunchApp2 :: !{#Char} !{#Char} !Bool !*OSToolbox -> (!Bool,!*OSToolbox)
winCallProcess :: !CSTR !CSTR !CSTR !CSTR !CSTR !CSTR !*OSToolbox -> (!Bool,!Int,!*OSToolbox)
WinGetModulePath :: {#Char}
WinFileModifiedDate :: !{#Char} -> (!Bool,!Int,!Int,!Int,!Int,!Int,!Int)
WinFileExists :: !{#Char} -> Bool
winGetModulePath :: {#Char}
winFileModifiedDate :: !{#Char} -> (!Bool,!Int,!Int,!Int,!Int,!Int,!Int)
winFileExists :: !{#Char} -> Bool
WinBeep :: !*OSToolbox -> *OSToolbox
winBeep :: !*OSToolbox -> *OSToolbox
Rand :: Int
rand :: Int
WinReleaseCString :: !CSTR !*OSToolbox -> *OSToolbox
WinGetCStringAndFree :: !CSTR !*OSToolbox -> (!{#Char},!*OSToolbox)
WinGetCString :: !CSTR !*OSToolbox -> (!{#Char},!*OSToolbox)
WinMakeCString :: !{#Char} !*OSToolbox -> (!CSTR,!*OSToolbox)
winReleaseCString :: !CSTR !*OSToolbox -> *OSToolbox
winGetCStringAndFree :: !CSTR !*OSToolbox -> (!{#Char},!*OSToolbox)
winGetCString :: !CSTR !*OSToolbox -> (!{#Char},!*OSToolbox)
winMakeCString :: !{#Char} !*OSToolbox -> (!CSTR,!*OSToolbox)
WinGetAppPath :: CSTR
winGetAppPath :: CSTR
WinSetDoubleDownDist :: !Int !*OSToolbox -> *OSToolbox
winSetDoubleDownDist :: !Int !*OSToolbox -> *OSToolbox
WinGetHorzResolution :: Int
WinGetVertResolution :: Int
winGetHorzResolution :: Int
winGetVertResolution :: Int
WinMaxFixedWindowSize :: (!Int,!Int)
WinMaxScrollWindowSize :: (!Int,!Int)
winMaxFixedWindowSize :: (!Int,!Int)
winMaxScrollWindowSize :: (!Int,!Int)
// PA: interfaces added for determining screen width and height.
WinScreenYSize :: !*OSToolbox -> (!Int,!*OSToolbox)
WinScreenXSize :: !*OSToolbox -> (!Int,!*OSToolbox)
winScreenYSize :: !*OSToolbox -> (!Int,!*OSToolbox)
winScreenXSize :: !*OSToolbox -> (!Int,!*OSToolbox)
WinMinimumWinSize :: (!Int,!Int)
winMinimumWinSize :: (!Int,!Int)
// PA: function added to get system metrics for width and height of scrollbars.
WinScrollbarSize :: !*OSToolbox -> (!Int,!Int,!*OSToolbox)
winScrollbarSize :: !*OSToolbox -> (!Int,!Int,!*OSToolbox)
/* PA: two new routines (Win(M/S)DIClientToOuterSizeDims added to convert between the
/* PA: two new routines (win(M/S)DIClientToOuterSizeDims added to convert between the
client and outer size of (M/S)DI windows. The Int argument contains the style flags
of the window.
*/
WinMDIClientToOuterSizeDims :: !Int !*OSToolbox -> (!Int,!Int,!*OSToolbox)
WinSDIClientToOuterSizeDims :: !Int !*OSToolbox -> (!Int,!Int,!*OSToolbox)
winMDIClientToOuterSizeDims :: !Int !*OSToolbox -> (!Int,!Int,!*OSToolbox)
winSDIClientToOuterSizeDims :: !Int !*OSToolbox -> (!Int,!Int,!*OSToolbox)
WinPlaySound :: !{#Char} !*OSToolbox -> (!Bool,!*OSToolbox)
winPlaySound :: !{#Char} !*OSToolbox -> (!Bool,!*OSToolbox)
......@@ -60,8 +60,8 @@ BUTTONDOWN :== 1
BUTTONSTILLUP :== 0 /* PA: new constant for passing mouse move events. */
WinLaunchApp :: !{#Char} !Bool !*OSToolbox -> ( !Bool, !*OSToolbox)
WinLaunchApp _ _ _
winLaunchApp :: !{#Char} !Bool !*OSToolbox -> ( !Bool, !*OSToolbox)
winLaunchApp _ _ _
= code
{
.inline WinLaunchApp
......@@ -69,8 +69,8 @@ WinLaunchApp _ _ _
.end
}
WinLaunchApp2 :: !{#Char} !{#Char} !Bool !*OSToolbox -> ( !Bool, !*OSToolbox)
WinLaunchApp2 _ _ _ _
winLaunchApp2 :: !{#Char} !{#Char} !Bool !*OSToolbox -> ( !Bool, !*OSToolbox)
winLaunchApp2 _ _ _ _
= code
{
.inline WinLaunchApp2
......@@ -78,8 +78,8 @@ WinLaunchApp2 _ _ _ _
.end
}
WinCallProcess :: !CSTR !CSTR !CSTR !CSTR !CSTR !CSTR !*OSToolbox -> ( !Bool, !Int, !*OSToolbox)
WinCallProcess _ _ _ _ _ _ _
winCallProcess :: !CSTR !CSTR !CSTR !CSTR !CSTR !CSTR !*OSToolbox -> ( !Bool, !Int, !*OSToolbox)
winCallProcess _ _ _ _ _ _ _
= code
{
.inline WinCallProcess
......@@ -87,8 +87,8 @@ WinCallProcess _ _ _ _ _ _ _
.end
}
WinGetModulePath :: {#Char}
WinGetModulePath
winGetModulePath :: {#Char}
winGetModulePath
= code
{
.inline WinGetModulePath
......@@ -96,8 +96,8 @@ WinGetModulePath
.end
}
WinFileModifiedDate :: !{#Char} -> ( !Bool, !Int, !Int, !Int, !Int, !Int, !Int)
WinFileModifiedDate _
winFileModifiedDate :: !{#Char} -> ( !Bool, !Int, !Int, !Int, !Int, !Int, !Int)
winFileModifiedDate _
= code
{
.inline WinFileModifiedDate
......@@ -105,8 +105,8 @@ WinFileModifiedDate _
.end
}
WinFileExists :: !{#Char} -> Bool
WinFileExists _
winFileExists :: !{#Char} -> Bool
winFileExists _
= code
{
.inline WinFileExists
......@@ -114,8 +114,8 @@ WinFileExists _
.end
}
WinBeep :: !*OSToolbox -> *OSToolbox
WinBeep tb
winBeep :: !*OSToolbox -> *OSToolbox
winBeep tb
= code
{
.inline WinBeep
......@@ -123,8 +123,8 @@ WinBeep tb
.end
}
Rand :: Int
Rand
rand :: Int
rand
= code
{
.inline Rand
......@@ -132,8 +132,8 @@ Rand
.end
}
WinReleaseCString :: !CSTR !*OSToolbox -> *OSToolbox
WinReleaseCString _ _
winReleaseCString :: !CSTR !*OSToolbox -> *OSToolbox
winReleaseCString _ _
= code
{
.inline WinReleaseCString
......@@ -141,8 +141,8 @@ WinReleaseCString _ _
.end
}
WinGetCStringAndFree :: !CSTR !*OSToolbox -> ( !{#Char}, !*OSToolbox)
WinGetCStringAndFree _ _
winGetCStringAndFree :: !CSTR !*OSToolbox -> ( !{#Char}, !*OSToolbox)
winGetCStringAndFree _ _
= code
{
.inline WinGetCStringAndFree
......@@ -150,8 +150,8 @@ WinGetCStringAndFree _ _
.end
}
WinGetCString :: !CSTR !*OSToolbox -> ( !{#Char}, !*OSToolbox)
WinGetCString _ _
winGetCString :: !CSTR !*OSToolbox -> ( !{#Char}, !*OSToolbox)
winGetCString _ _
= code
{
.inline WinGetCString
......@@ -159,8 +159,8 @@ WinGetCString _ _
.end
}
WinMakeCString :: !{#Char} !*OSToolbox -> ( !CSTR, !*OSToolbox)
WinMakeCString _ _
winMakeCString :: !{#Char} !*OSToolbox -> ( !CSTR, !*OSToolbox)
winMakeCString _ _
= code
{
.inline WinMakeCString
......@@ -168,8 +168,8 @@ WinMakeCString _ _
.end
}
WinGetAppPath :: CSTR
WinGetAppPath
winGetAppPath :: CSTR
winGetAppPath
= code
{
.inline WinGetAppPath
......@@ -177,8 +177,8 @@ WinGetAppPath
.end
}
WinSetDoubleDownDist :: !Int !*OSToolbox -> *OSToolbox
WinSetDoubleDownDist _ _
winSetDoubleDownDist :: !Int !*OSToolbox -> *OSToolbox
winSetDoubleDownDist _ _
= code
{
.inline WinSetDoubleDownDist
......@@ -186,8 +186,8 @@ WinSetDoubleDownDist _ _
.end
}
WinGetHorzResolution :: Int
WinGetHorzResolution
winGetHorzResolution :: Int
winGetHorzResolution
= code
{
.inline WinGetHorzResolution
......@@ -195,8 +195,8 @@ WinGetHorzResolution
.end
}
WinGetVertResolution :: Int
WinGetVertResolution
winGetVertResolution :: Int
winGetVertResolution
= code
{
.inline WinGetVertResolution
......@@ -204,8 +204,8 @@ WinGetVertResolution
.end
}
WinMaxFixedWindowSize :: ( !Int, !Int)
WinMaxFixedWindowSize
winMaxFixedWindowSize :: ( !Int, !Int)
winMaxFixedWindowSize
= code
{
.inline WinMaxFixedWindowSize
......@@ -213,8 +213,8 @@ WinMaxFixedWindowSize
.end
}
WinMaxScrollWindowSize :: ( !Int, !Int)
WinMaxScrollWindowSize
winMaxScrollWindowSize :: ( !Int, !Int)
winMaxScrollWindowSize
= code
{
.inline WinMaxScrollWindowSize
......@@ -223,8 +223,8 @@ WinMaxScrollWindowSize
}
// PA: interface added for determining screen width and height.
WinScreenYSize :: !*OSToolbox -> (!Int,!*OSToolbox)
WinScreenYSize _
winScreenYSize :: !*OSToolbox -> (!Int,!*OSToolbox)
winScreenYSize _
= code
{
.inline WinScreenYSize
......@@ -232,8 +232,8 @@ WinScreenYSize _
.end
}
WinScreenXSize :: !*OSToolbox -> (!Int,!*OSToolbox)
WinScreenXSize _
winScreenXSize :: !*OSToolbox -> (!Int,!*OSToolbox)
winScreenXSize _
= code
{
.inline WinScreenXSize
......@@ -241,8 +241,8 @@ WinScreenXSize _
.end
}
WinMinimumWinSize :: ( !Int, !Int)
WinMinimumWinSize
winMinimumWinSize :: ( !Int, !Int)
winMinimumWinSize
= code
{
.inline WinMinimumWinSize
......@@ -251,8 +251,8 @@ WinMinimumWinSize
}