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
8d976905
Commit
8d976905
authored
Apr 11, 2000
by
Mike Wiering
Browse files
Game Examples now use Tile Studio instead of GRED/EDLEV
parent
b59a0b2c
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
libraries/ObjectIO/Game Examples/Charlie/Charlie.icl
View file @
8d976905
This diff is collapsed.
Click to expand it.
libraries/ObjectIO/Game Examples/SINT/Sint.icl
View file @
8d976905
This diff is collapsed.
Click to expand it.
libraries/ObjectIO/Game Examples/WORMS/Worms.icl
View file @
8d976905
...
...
@@ -3,14 +3,16 @@ module Worms
/*
Worms Demonstration Game for the Clean Game Library
Version:
2.0
Version:
3.0 (March 20, 2000)
Author: Mike Wiering (mike.wiering@cs.kun.nl)
Note: To play Worms with background music, copy your favourite MIDI file
to Worms.mid in the music\ subdirectory.
*/
import
StdEnv
,
StdIO
import
StdGameDef
,
StdGame
,
StdGSt
,
GameFunctions
import
L1
,
L2
,
L3
,
WORM
,
HEAD
import
Random
,
notes
import
StdEnv
,
StdIO
,
StdGameDef
,
StdGame
,
StdGSt
,
GameFunctions
,
Random
,
notes
import
WormsGfx
/* generated by Tile Studio */
::
GameState
=
{
curlevel
::
!
Int
...
...
@@ -32,6 +34,7 @@ initialGameState = { curlevel = 0
}
/* move with speed V */
V
=
3.0
/* 24 rem V must be 0 */
/* ---------- main program: load game definition and start the game! ---------- */
...
...
@@ -40,8 +43,7 @@ Start :: *World -> *World
Start
world
#
(
seed
,
world
)
=
getNewRandomSeed
world
=
startGame
WormsDemo
{
initialGameState
&
randseed
=
seed
}
[
ScreenSize
{
w
=
640
,
h
=
480
},
ColorDepth
16
]
world
[
ScreenSize
{
w
=
640
,
h
=
480
},
ColorDepth
16
]
world
/* ---------- the complete game definition ---------- */
...
...
@@ -60,14 +62,12 @@ WormsDemo =
,
textitems
=
accGSt
WormsTextItems
}
/* if the quit function returns true, the game engine quit the level */
WormsQuitFunction
::
GameState
->
(
Bool
,
GameState
)
WormsQuitFunction
gst
=
(
gst
.
quit
,
gst
)
/* function that returns the next level to run, 0 = end game */
WormsNextLevelFunction
::
GameState
->
(
Int
,
GameState
)
...
...
@@ -106,94 +106,30 @@ H :== 24
DEFAULT_SIZE
:==
{
w
=
W
,
h
=
H
}
/* object codes (corresponds with level map) */
OBJ_START
:==
0x10
OBJ_WORMHEAD
:==
0x10
OBJ_WORMSEGMENT
:==
0x11
OBJ_FOOD
:==
0x12
OBJ_WALL
:==
0x80
/* user events */
EV_STOP
:==
0
EV_DIE
:==
1
EV_GAMEOVER
:==
2
EV_END_LEVEL
:==
3
/* ---------- level 1 ---------- */
/* ---------- levels ---------- */
GameLevel1
=
{
boundmap
=
{
map
=
Level1Bounds
,
blocksize
=
DEFAULT_SIZE
,
objstart
=
OBJ_START
,
startobjx
=
0
,
startobjy
=
0
}
,
initpos
=
{
x
=
W
-
8
,
y
=
0
}
,
layers
=
[
Level1Layer
]
,
objects
=
ObjectList
,
music
=
Just
BackGroundMusic
,
soundsamples
=
SoundSampleList
,
leveloptions
=
{
fillbackground
=
Nothing
,
escquit
=
False
,
debugscroll
=
False
,
fadein
=
False
,
fadeout
=
False
}
=
{
DefaultLevel
&
boundmap
=
Level1Map1BoundMap
,
layers
=
[
Level1Map1Layer
]
,
music
=
Just
BackgroundMusic
}
Level1Layer
=
{
bmp
=
Level1Bitmap
,
layermap
=
Level1Map
,
sequences
=
[]
,
movement
=
defaultMovement
}
/* ---------- level 2 ---------- */
GameLevel2
=
{
boundmap
=
{
map
=
Level2Bounds
,
blocksize
=
DEFAULT_SIZE
,
objstart
=
OBJ_START
,
startobjx
=
0
,
startobjy
=
0
}
,
initpos
=
{
x
=
W
-
8
,
y
=
0
}
,
layers
=
[
Level2Layer
]
,
objects
=
ObjectList
,
music
=
Nothing
,
soundsamples
=
SoundSampleList
,
leveloptions
=
{
fillbackground
=
Nothing
,
escquit
=
False
,
debugscroll
=
False
,
fadein
=
False
,
fadeout
=
False
}
}
Level2Layer
=
{
bmp
=
Level2Bitmap
,
layermap
=
Level2Map
,
sequences
=
[]
,
movement
=
defaultMovement
=
{
DefaultLevel
&
boundmap
=
Level2Map1BoundMap
,
layers
=
[
Level2Map1Layer
]
}
/* ---------- level 3 ---------- */
GameLevel3
=
{
boundmap
=
{
map
=
Level3Bounds
,
blocksize
=
DEFAULT_SIZE
,
objstart
=
OBJ_START
,
startobjx
=
0
,
startobjy
=
0
}
,
initpos
=
{
x
=
W
-
8
,
y
=
0
}
,
layers
=
[
Level3Layer
]
=
{
DefaultLevel
&
boundmap
=
Level3Map1BoundMap
,
layers
=
[
Level3Map1Layer
]
}
DefaultLevel
=
{
blankScreen
&
initpos
=
{
x
=
W
-
8
,
y
=
0
}
,
objects
=
ObjectList
,
music
=
Nothing
,
soundsamples
=
SoundSampleList
...
...
@@ -205,14 +141,21 @@ GameLevel3
}
}
Level3Layer
=
{
bmp
=
Level3Bitmap
,
layermap
=
Level3Map
,
sequences
=
[]
,
movement
=
defaultMovement
}
/* ---------- objects ---------- */
/* object codes (corresponds with level map) */
OBJ_WORMHEAD
:==
0x10
OBJ_WORMSEGMENT
:==
0x11
OBJ_FOOD
:==
0x12
OBJ_WALL
:==
0x80
/* user events */
EV_STOP
:==
0
EV_DIE
:==
1
EV_GAMEOVER
:==
2
EV_END_LEVEL
:==
3
/* ---------- worm object ---------- */
...
...
@@ -230,11 +173,6 @@ BND_WORMSEGMENT :== 0x0002
BND_FOOD
:==
0x0004
BND_WALL
:==
0x0008
/*
the wormstate contains the next x/y direction to move, the position where
new segments can be added, and the sprites for all directions
*/
::
WormState
=
{
xv
::
!
Real
/* next x-speed */
,
yv
::
!
Real
/* next y-speed */
...
...
@@ -245,7 +183,6 @@ BND_WALL :== 0x0008
,
next
::
!
Int
/* next sprite */
}
/* layer height, to display some objects in front of others */
NormalLayer
=
1
TopLayer
=
2
...
...
@@ -253,7 +190,11 @@ TopLayer = 2
WormHead
#
obj
=
defaultGameObject
OBJ_WORMHEAD
sz
wormstate
#
obj
=
{
obj
&
sprites
=
WormHeadSpriteList
&
sprites
=
[
WormHeadSprite1
,
WormHeadSprite2
,
WormHeadSprite3
,
WormHeadSprite4
]
,
init
=
(
newInit
sz
wormstate
)
,
keydown
=
newKeyDown
,
move
=
newMove
...
...
@@ -386,11 +327,10 @@ where
=
quitlevel
{
st
=
st
,
or
=
or
,
gs
=
gs
}
=
{
st
=
st
,
or
=
or
,
gs
=
gs
}
WormSegment
#
obj
=
defaultGameObject
OBJ_WORMSEGMENT
sz
Void
#
obj
=
{
obj
&
sprites
=
[
WormSegmentSprite
]
&
sprites
=
[
WormSegmentSprite
1
]
,
init
=
(
newInit
sz
Void
)
,
move
=
newMove
,
userevent
=
newUserEvent
...
...
@@ -404,7 +344,7 @@ where
#
objrec
=
{
objrec
&
ownbounds
=
if
(
subtype
>
1
)
BND_WORMSEGMENT
0
,
collidebounds
=
0
,
skipmove
=
0
// toInt (2.0 / V) -1
,
skipmove
=
0
// toInt (2.0 / V) -1
,
layer
=
AtLayer
NormalLayer
}
=
{
st
=
state
,
or
=
objrec
,
gs
=
gs
}
...
...
@@ -433,7 +373,6 @@ where
/* ---------- wall object ---------- */
Wall
#
obj
=
defaultGameObject
OBJ_WALL
sz
Void
#
obj
=
{
obj
&
init
=
(
newInit
sz
Void
)}
...
...
@@ -446,7 +385,6 @@ where
=
{
st
=
state
,
or
=
objrec
,
gs
=
gs
}
/* ---------- food object ---------- */
SPR_INVISIBLE
=
0
...
...
@@ -455,7 +393,7 @@ SPR_VISIBLE = 1
Food
#
obj
=
defaultGameObject
OBJ_FOOD
sz
Void
#
obj
=
{
obj
&
sprites
=
[
Worm
FoodSprite
]
&
sprites
=
[
FoodSprite
1
]
,
init
=
(
newInit
sz
Void
)
,
move
=
newMove
,
touchbound
=
newTouchBound
...
...
@@ -518,6 +456,7 @@ where
=
{
st
=
st
,
or
=
or
,
gs
=
gs
}
=
{
st
=
st
,
or
=
or
,
gs
=
gs
}
/* ---------- useful functions for objects ---------- */
/* quit the level */
...
...
@@ -548,37 +487,16 @@ getgstgameover :: GameState -> (Bool, GameState)
getgstgameover
gst
=
(
gst
.
gameover
,
gst
)
/* ---------- music ---------- */
Back
G
roundMusic
=
{
musicfile
=
"Worms.mid"
Back
g
roundMusic
=
{
musicfile
=
"
music
\\
Worms.mid"
,
restart
=
True
,
continue
=
True
}
/* ---------- bitmaps and sprites ---------- */
WormHeadSpriteList
=
[
ws
SPR_WH_UP
,
ws
SPR_WH_LEFT
,
ws
SPR_WH_DOWN
,
ws
SPR_WH_RIGHT
]
where
ws
::
Int
->
Sprite
ws
n
=
{
bitmap
=
HeadBitmap
,
sequence
=
[(
n
,
100
)],
loop
=
True
}
WormSegmentSprite
=
{
bitmap
=
WormBitmap
,
sequence
=
[(
3
,
100
)]
,
loop
=
True
}
WormFoodSprite
=
{
bitmap
=
WormBitmap
,
sequence
=
[(
1
,
35
),(
2
,
35
)]
,
loop
=
True
}
/* ---------- statistics ---------- */
/* ---------- text items ---------- */
BigStyle
=
{
fontname
=
"Arial"
...
...
@@ -642,13 +560,13 @@ gsrand gs=:{randseed}
#
(
x
,
newseed
)
=
random
randseed
=
(
x
,
{
gs
&
randseed
=
newseed
})
/* ---------- sound samples ---------- */
SND_FOOD
:==
1
SND_HIT
:==
2
SoundSampleList
=
[
{
soundid
=
SND_FOOD
,
soundfile
=
"FOOD.WAV"
,
soundbuffers
=
3
}
,
{
soundid
=
SND_HIT
,
soundfile
=
"HIT.WAV"
,
soundbuffers
=
5
}
[
{
soundid
=
SND_FOOD
,
soundfile
=
"
sounds
\\
FOOD.WAV"
,
soundbuffers
=
3
}
,
{
soundid
=
SND_HIT
,
soundfile
=
"
sounds
\\
HIT.WAV"
,
soundbuffers
=
5
}
]
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