Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-and-itasks
clean-libraries
Commits
416102da
Commit
416102da
authored
Apr 13, 2000
by
Peter Achten
Browse files
(PA) improved OS Windows C implementation (modular structure)
parent
a77e03b4
Changes
16
Hide whitespace changes
Inline
Side-by-side
libraries/ObjectIO/GameLib/Clean System Files/Dsutil.obj
0 → 100644
View file @
416102da
File added
libraries/ObjectIO/GameLib/Clean System Files/cCrossCallGame_121.obj
0 → 100644
View file @
416102da
File added
libraries/ObjectIO/GameLib/Clean System Files/cGameLib_121.obj
0 → 100644
View file @
416102da
File added
libraries/ObjectIO/GameLib/Clean System Files/cOSGameLib_121.obj
0 → 100644
View file @
416102da
File added
libraries/ObjectIO/GameLib/Clean System Files/ddraw_library
0 → 100644
View file @
416102da
ddraw.dll
DirectDrawCreate@12
DirectDrawEnumerateA@8
libraries/ObjectIO/GameLib/Clean System Files/ddutil.obj
0 → 100644
View file @
416102da
File added
libraries/ObjectIO/GameLib/Clean System Files/dsound_library
0 → 100644
View file @
416102da
dsound.dll
DirectSoundCreate@12
libraries/ObjectIO/GameLib/StdGSt.dcl
View file @
416102da
...
...
@@ -2,7 +2,7 @@ definition module StdGSt
// ********************************************************************************
// Clean Standard Game library, version 1.2
// Clean Standard Game library, version 1.2
.1
//
// StdGSt imports the GSt type and some handy access functions.
// ********************************************************************************
...
...
libraries/ObjectIO/GameLib/StdGame.dcl
View file @
416102da
...
...
@@ -2,7 +2,7 @@ definition module StdGame
// ********************************************************************************
// Clean Standard Game library, version 1.2
// Clean Standard Game library, version 1.2
.1
//
// StdGame contains the functions one needs during a game.
// ********************************************************************************
...
...
libraries/ObjectIO/GameLib/StdGame.icl
View file @
416102da
implementation
module
StdGame
import
StdProcess
import
StdArray
,
StdBool
,
StdClass
,
StdFunc
,
StdInt
,
StdList
,
StdMisc
import
StdId
import
StdId
,
StdProcess
import
fixed
,
GameFunctions
,
gamehandle
,
gameutils
,
gst
from
gameobjectutils
import
toBoundMapCode
,
fromBoundMapCode
from
StdPSt
import
appPIO
,
accPIO
from
iostate
import
setIOToolbox
,
getIOToolbox
import
windowcreate
,
windowdevice
from
window
access
import
initWindowHandle
import
commondef
,
iostate
,
windowdevice
from
windowaccess
import
initWindowHandle
,
checkZeroWindowHandlesBound
,
decreaseWindowHandlesBound
,
addWindowHandlesWindow
from
window
create
import
bufferDelayedEvents
from
windowvalidate
import
validateWindowId
from
ostypes
import
OSNoWindowPtr
...
...
@@ -21,6 +21,10 @@ BND_STATIC_BOUNDS :== 1 << 31
SK_FOREVER
:==
-1
StdGameFatalError
::
String
String
->
.
x
StdGameFatalError
function
error
=
FatalError
function
"StdGame"
error
startGame
::
.(
Game
a
)
a
[.
GameAttribute
a
]
!*
World
->
.
World
startGame
gamedef
initialstate
options
world
=
startIO
SDI
0
init
[
ProcessClose
closeProcess
]
world
...
...
@@ -56,26 +60,41 @@ 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
#
(
isZero
,
pState
)
=
accPIO
checkZeroWindowBound
pState
|
isZero
=
(
ErrorViolateDI
,
pState
)
#
maybe_id
=
Just
id
#
(
maybe_okId
,
ioState
)
=
validateWindowId
maybe_id
pState
.
io
#
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
|
not
found
// This condition should never occur: WindowDevice must have been 'installed'
=
StdGameFatalError
"openGame"
"could not retrieve WindowSystemState from IOSt"
#
windows
=
WindowSystemStateGetWindowHandles
wDevice
#
(
isZero
,
windows
)
=
checkZeroWindowHandlesBound
windows
|
isZero
#
ioState
=
IOStSetDevice
(
WindowSystemState
windows
)
ioState
=
(
ErrorViolateDI
,{
pState
&
io
=
ioState
})
|
otherwise
#
pState
=
{
pState
&
io
=
ioState
}
info
=
{
gamewindowDDPtr
=
OSNoWindowPtr
,
gamewindowCDepth
=
bitsperpixel
,
gamewindowSize
=
gamewindowsize
,
gamewindowFullScreen
=
fullscreen
}
okId
=
fromJust
maybe_okId
#
wH
=
initWindowHandle
""
Modeless
IsGameWindow
(
GameWindowInfo
info
)
[]
[
WindowId
okId
]
#
pState
=
openwindow
okId
{
wlsState
=
undef
,
wlsHandle
=
wH
}
pState
#
pState
=
appPIO
decreaseWindowBound
pState
=
(
NoError
,
pState
)
#
info
=
{
gamewindowDDPtr
=
OSNoWindowPtr
,
gamewindowCDepth
=
bitsperpixel
,
gamewindowSize
=
gamewindowsize
,
gamewindowFullScreen
=
fullscreen
}
okId
=
fromJust
maybe_okId
#
wH
=
initWindowHandle
""
Modeless
IsGameWindow
(
GameWindowInfo
info
)
[]
[
WindowId
okId
]
#
wH
=
{
wH
&
whSize
=
gamewindowsize
}
#
(
tb
,
ioState
)
=
getIOToolbox
ioState
#
tb
=
OSinitialiseGame
tb
#
(
delayinfo
,
wPtr
,
tb
)
=
OScreateGameWindow
fullscreen
(
toTuple
gamewindowsize
)
bitsperpixel
tb
#
ioState
=
setIOToolbox
tb
ioState
wlsH
=
{
wlsState
=
undef
,
wlsHandle
=
wH
}
wIds
=
{
wId
=
okId
,
wPtr
=
wPtr
,
wActive
=
False
}
wsH
=
{
wshIds
=
wIds
,
wshHandle
=
Just
wlsH
}
windows
=
addWindowHandlesWindow
0
wsH
windows
windows
=
decreaseWindowHandlesBound
windows
#
ioState
=
IOStSetDevice
(
WindowSystemState
windows
)
ioState
#
ioState
=
bufferDelayedEvents
delayinfo
ioState
=
(
NoError
,{
pState
&
io
=
ioState
})
PlayLevels
::
!
Int
.
gs
!(
Game
.
gs
)
!*
OSToolbox
->
(.
gs
,
!
ErrorReport
,
!*
OSToolbox
)
PlayLevels
level
gs
gdef
tb
...
...
libraries/ObjectIO/GameLib/StdGameDef.dcl
View file @
416102da
definition
module
StdGameDef
// ********************************************************************************
// Clean Standard Game library, version 1.2
// Clean Standard Game library, version 1.2
.1
//
// StdGameDef contains all the type definitions needed to specify a game.
// ********************************************************************************
...
...
libraries/ObjectIO/GameLib/StdGameDef.icl
View file @
416102da
...
...
@@ -2,7 +2,7 @@ implementation module StdGameDef
// ********************************************************************************
// Clean Standard Game library, version 1.2
// Clean Standard Game library, version 1.2
.1
//
// StdGameDef contains all the type definitions needed to specify a game.
// ********************************************************************************
...
...
libraries/ObjectIO/GameLib/gameCrossCall_12.dcl
View file @
416102da
definition
module
gameCrossCall_12
import
clCrossCall_12
,
gameintrface_12
import
clCrossCall_12
,
gameintrface_12
from
ostypes
import
OSWindowPtr
from
oswindow
import
DelayActivationInfo
// Initialisation of game. This function must be called before any game cross call can be done!
WinInitialiseGame
::
!*
OSToolbox
->
*
OSToolbox
//----------------------------------------------//
// Game related crosscalls //
//----------------------------------------------//
WinCreateGameWindow
::
!
Bool
!(!
Int
,!
Int
)
!
Int
!*
OSToolbox
->
(![
DelayActivationInfo
],!
OSWindowPtr
,!*
OSToolbox
)
WinRunGameEngine
::
!(
CrossCallInfo
->
.(.
s
->
.(*
OSToolbox
->
*(.
CrossCallInfo
,.
s
,*
OSToolbox
))))
!.
s
!
Int
!
Int
!
Int
!*
OSToolbox
->
(!.
s
,!*
OSToolbox
)
...
...
libraries/ObjectIO/GameLib/gameCrossCall_12.icl
View file @
416102da
implementation
module
gameCrossCall_12
import
clCrossCall_12
,
gameintrface_12
import
StdTuple
/* PA: these imports have been moved to clCrossCall_12.
import code from "cGameLib_12.obj", "cOSGameLib_12.obj", "ddutil.obj", "Dsutil.obj"
import
StdList
,
StdTuple
from
commondef
import
FatalError
from
windowCrossCall_12
import
WinFakePaint
import
clCrossCall_12
,
gameintrface_12
import
ostypes
import
code
from
"cCrossCallGame_121.obj"
,
"cGameLib_121.obj"
,
"cOSGameLib_121.obj"
,
"ddutil.obj"
,
"Dsutil.obj"
import
code
from
library
"ddraw_library"
import
code
from
library
"dsound_library"
*/
gameCrossCall_12FatalError
::
String
String
->
.
x
gameCrossCall_12FatalError
function
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
WinInitialiseGame
tb
=
code
{
.inline
InstallCrossCallGame
ccall
InstallCrossCallGame
"I-I"
.end
}
//----------------------------------------------//
// Game related crosscalls //
//----------------------------------------------//
WinCreateGameWindow
::
!
Bool
!(!
Int
,!
Int
)
!
Int
!*
OSToolbox
->
(![
DelayActivationInfo
],!
OSWindowPtr
,!*
OSToolbox
)
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
wPtr
=
case
returncci
.
ccMsg
of
CcRETURN1
->
returncci
.
p1
CcWASQUIT
->
OSNoWindowPtr
_
->
gameCrossCall_12FatalError
"WinCreateGameWindow"
"Expected CcRETURN1 value."
=
(
reverse
delay_info
,
wPtr
,
tb
)
where
(
w
,
h
)
=
size
OScreateGameWindowCallback
::
!
CrossCallInfo
![
DelayActivationInfo
]
!*
OSToolbox
->
(!
CrossCallInfo
,![
DelayActivationInfo
],!*
OSToolbox
)
OScreateGameWindowCallback
{
ccMsg
=
CcWmPAINT
,
p1
=
hwnd
}
s
tb
=
(
Return0Cci
,
s
,
WinFakePaint
hwnd
tb
)
OScreateGameWindowCallback
{
ccMsg
=
CcWmACTIVATE
,
p1
=
hwnd
}
delay_info
tb
=
(
Return0Cci
,
[
DelayActivatedWindow
hwnd
:
delay_info
],
tb
)
OScreateGameWindowCallback
{
ccMsg
=
CcWmDEACTIVATE
,
p1
=
hwnd
}
delay_info
tb
=
(
Return0Cci
,
[
DelayDeactivatedWindow
hwnd
:
delay_info
],
tb
)
OScreateGameWindowCallback
{
ccMsg
=
CcWmCREATE
,
p1
=
hwnd
}
delay_info
tb
=
(
Return0Cci
,
delay_info
,
tb
)
OScreateGameWindowCallback
{
ccMsg
=
CcWmSIZE
,
p1
=
hwnd
,
p2
=
width
,
p3
=
height
}
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
...
...
libraries/ObjectIO/GameLib/osgame.dcl
View file @
416102da
...
...
@@ -3,7 +3,7 @@ definition module osgame
// Version 1.0
from
StdIOBasic
import
Point2
import
gamehandle
,
gameintrface_12
import
gamehandle
,
gameintrface_12
,
ostypes
::
OSGameData
gs
=
{
scroll
::
[(
MAPID
,
Movement
)]
// The layer movement functions
...
...
@@ -11,12 +11,16 @@ import gamehandle, gameintrface_12
,
gamehnd
::
GameHandle
gs
// Complete game definition
}
OSinitialiseGame
::
!*
OSToolbox
->
*
OSToolbox
OSBinaryIntStr
::
!
Int
->
{#
Char
}
OSBinaryBoolStr
::
!
Bool
->
{#
Char
}
OSIntListArrayToString
::
![{#
Int
}]
->
{#
Char
}
OScreateGameWindow
::
!
Bool
!(!
Int
,!
Int
)
!
Int
!*
OSToolbox
->
(![
DelayActivationInfo
],!
OSWindowPtr
,!*
OSToolbox
)
OSInitGameBitmap
::
!
BID
!{#
Char
}
!
Int
!
Int
!
Int
!
Int
!*
OSToolbox
->
(!
GRESULT
,!*
OSToolbox
)
OSGameBitmapDone
::
!
BID
!*
OSToolbox
->
(!
GRESULT
,!*
OSToolbox
)
...
...
libraries/ObjectIO/GameLib/osgame.icl
View file @
416102da
...
...
@@ -8,12 +8,17 @@ from ospicture import toRGBtriple
from
clCCall_12
import
WinBeep
import
gameCrossCall_12
,
gamehandle
,
gameobjectutils
,
gst
::
OSGameData
gs
=
{
scroll
::
[(
MAPID
,
Movement
)]
// The layer movement functions
,
gamest
::
gs
// The game state
,
gamehnd
::
GameHandle
gs
// Complete game definition
}
OSinitialiseGame
::
!*
OSToolbox
->
*
OSToolbox
OSinitialiseGame
tb
=
WinInitialiseGame
tb
OSBinaryIntStr
::
!
Int
->
{#
Char
}
OSBinaryIntStr
x
=
WinBinaryIntStr
x
...
...
@@ -45,6 +50,10 @@ where
maskshift
::
!
Int
!
Int
->
Int
maskshift
nrbits
x
=
(
x
>>
nrbits
)
bitand
0xFF
OScreateGameWindow
::
!
Bool
!(!
Int
,!
Int
)
!
Int
!*
OSToolbox
->
(![
DelayActivationInfo
],!
OSWindowPtr
,!*
OSToolbox
)
OScreateGameWindow
fullscreen
size
bpp
tb
=
WinCreateGameWindow
fullscreen
size
bpp
tb
OSInitGameBitmap
::
!
BID
!{#
Char
}
!
Int
!
Int
!
Int
!
Int
!*
OSToolbox
->
(!
GRESULT
,!*
OSToolbox
)
OSInitGameBitmap
id
filename
w
h
blockwidth
blockheight
tb
=
WinInitGameBitmap
id
filename
w
h
blockwidth
blockheight
tb
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment