home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Acorn User 4
/
AUCD4.iso
/
arcade
/
arcgames
/
jawwars
/
!JawWars
/
!RunImage
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1998-05-11
|
17KB
|
656 lines
>!RunImage
Jaw Wars - Acorn 32-bit version (development)
All code, graphics, sound and design by Stephen Scott
1993, 1996, 1997, 1998
wimp_initialise
game_initialise
quit%
wimp_poll
remove_sounds
"Wimp_CloseDown"
INITIALISE WIMP FRONT END
wimp_initialise
block% 520,imenu% 100,winind% 400
quit%=
app$="JawWars"
"Wimp_Initialise",200,&4B534154,app$,0
ver,t_handle
report(
$+" at line "+
Check version of Risc OS and load either flat or 3D templates
ver=200
"Wimp_OpenTemplate",,"<JawWar$Dir>.Templates2"
"Wimp_OpenTemplate",,"<JawWar$Dir>.Templates3"
"Wimp_LoadTemplate",,block%,winind%,winind%+400,-1,"info",0
,,freeind%
"Wimp_CreateWindow",,block%
info%
"Wimp_CloseTemplate"
Set up menus and install on icon bar
create_menu(imenu%)
'<ibar%=
create_icon(-1,0,0,136,68,&3002,"!jawwars",0,0,0)
Jaw Wars,3
0,info%,Info
0,-1,Help
&80,-1,Quit
REPORT WIMP BASED ERROR MESSAGES
report(mess$,flag%)
!block%=255
5;$(block%+4)=mess$+" Jaw Wars must exit immediately!"+
name$=app$
flag%
name$="Message from "+name$
"Wimp_ReportError",block%,flag%,name$
,errclick%
flag%
"Wimp_CloseDown"
WIMP POLLING LOOP
wimp_poll
"Wimp_Poll",0,block%
reason%
reason%
"Wimp_OpenWindow",,block%
"Wimp_CloseWindow",,block%
mouse_click(block%!8,block%!16)
menu_select
17,18:
receive_message
DETECT WIMP MOUSE CLICKS
mouse_click(button%,icon%)
button%
1,4:
mode%=
"OS_Byte",21,0
"Wimp_SetMode",mode%
"Wimp_CreateMenu",,imenu%,!block%-64,228
DETECT SELECTIONS ON ICON BAR MENU
menu_select
sel%=!block%
sel%
"Filer_Run <JawWar$Dir>.!Help"
quit%=
DETECT WIMP MESSAGES
receive_message
block%!16
0:quit%=
CREATE MENU
create_menu(menu%)
title$,num%
$menu%=title$
width%=(
(title$)-2)*16
menu%!12=&00070207
menu%!20=44
menu%!24=0
ptr%=menu%+28
i%=1
num%
mflags%,subptr%,item$
!ptr%=mflags%
ptr%!4=subptr%
item$<>""
ptr%!8=&7000021
$(ptr%+12)=item$
(item$)+1)*16
ptr%!8=&7000121
addr%,len%
ptr%!12=addr%
ptr%!16=null%
ptr%!20=len%
a%=(len%+1)*16
a%>width% width%=a%
ptr%+=24
menu%!16=width%
CREATE ICON BAR ICON
create_icon(whan%,ix%,iy%,iw%,ih%,flag%,text$,ptr1%,ptr2%,ptr3%)
!block%=whan%
block%!4=ix%
block%!8=iy%
block%!12=ix%+iw%
block%!16=iy%+ih%
block%!20=flag%
ptr1%=0
$(block%+24)=text$
block%!24=ptr1%
block%!28=ptr2%
block%!32=ptr3%
"Wimp_CreateIcon",,block%
ihandle%
=ihandle%
END OF WIMP CODE
JAW WARS INITIALISE ARRAYS
game_initialise
#teeth=16 :
Number of teeth
5germs=16 :
Maximum number of germs on screen
exist(teeth)
decay(teeth)
count(teeth)
totalled(teeth)
tx(teeth),ty(teeth)
germexist(germs)
germx(germs),germy(germs)
g$(germs)
germpox(germs),germpoy(germs)
hiscore(5),hiscore$(5)
#hiscore()=0,500,400,300,200,100
9hiscore$()="","Nuni","Bunny","Dopey","Bruno","Graeme"
sprites_loaded%=FALSE
sounds_loaded%=
seen%=
load_sprites
scale% 16
scale%!8=1
scale%!12=1
load_sounds
sounds_loaded%=
JAW WARS GAME LOOP
error:
spop%=34
scale%!0=1
scale%!4=1
128+49:
spop%=52
scale%!0=1
scale%!4=2
seen%=
view_titles
score=0
title_screen
reset_banks
germexist()=
exist()=
fin%=
g$()=""
totalled()=0
total=0
decay()=0
count()=0
count2=0
offset=0
pressed=
stilldown=
bonus=
time=0
frame=0:framtim=0
score=0:loopy=
/paste=9 :
Number of shots of toothpaste+1
max=paste
data=1
teeth
tx(data),ty(data)
170,586,308,574
398,606,496,600
626,600,748,606
856,574,932,586: REM Top set
302,292,374,272
464,274,548,272
624,272,702,274
786,272,878,292: REM Bottom set
data2=1
germs
germpox(data2),germpoy(data2)
270,600,351,600
438,618,558,618
688,618,800,618
888,600,970,600: REM Top coords
342,372,420,372
500,348,582,348
660,348,738,348
825,372,909,372: REM Bottom coords
A%=1:O%=0
A%=2:O%=-32
&2E,spop%+256,area%,"mouth",0,O%,0,scale%,0
print_teeth
text_size(16,16)
outline("Ready?",14,15,23)
A%=1:
text_size(8,8)
A%=2:
text_size(8,16)
xco,yco,butty
6,112,fr
xco,yco,butty
&2E,spop%+256,area%,"mouth",0,O%,0,scale%,0
print_teeth
print_germs
print_stats
update_teeth
framtim+=1
framtim>4
3 frame+=1:
frame>3
frame=0
framtim=0
bonus=
paste<10
(40)=11:bonus=
2,383,100,100:time=0:blown=
(40)+10
bonus:
plot("paste",624,524+O%,8):time+=1:
time>=blown:bonus=
plot("ptr_brush",(xco+offset),(yco-offset),8)
(15)=2:
butty=4:pressed=
:offset=16
butty=0:pressed=
:stilldown=
:offset=0
pressed
stilldown:
whatone
pressed
stilldown:offset=16
butty=0:
paste>-2
paste<max:count2+=1:
count2>=30:paste+=1:count2=0
(-97)
6,113,fr:fr=3-fr
fin%
end_game
fin%=
print_stats
outline("Score: "+
(score)+" ",1,1,127)
outline("Teeth: "+
(13-total)+" ",30,1,127)
32,32,1216,32
paste<1
127
32,32,paste*32,32
outline(
(paste)+" ",1,30,127)
whatone
paste<1
paste-=1
"Splay_shlop2"
J%=1
germs
xco>=germx(J%)-32
xco<=germx(J%)+32
yco>=germy(J%)-32
yco<=germy(J%)+32
germexist(J%)=
germx(J%)=0
germy(J%)=0
germexist(J%)=
score+=20
OSCLI"Splay_kill1a"
J%=germs
stilldown=
bonus=
xco>=592
xco<=656
yco>=492
yco<=556
paste>0
bonus=
3,-15,100,100:paste+=20:score+=50
print_teeth
z=1
&2E,spop%+256,area%,"ttooth"+
(decay(z)),tx(z),ty(z)+O%,8,scale%,0
&2E,spop%+256,area%,"btooth"+
(decay(z+8)),tx(z+8),ty(z+8)+O%,8,scale%,0
whatgerm=
(germs)
germexist(whatgerm)=
exist(whatgerm)=
germexist(whatgerm)=
germtype=
germtype
1:g$(whatgerm)="germa"
2:g$(whatgerm)="germb"
3:g$(whatgerm)="germa"
4:g$(whatgerm)="germd"
5:g$(whatgerm)="germe"
6:g$(whatgerm)="germf"
7:g$(whatgerm)="germg"
8:g$(whatgerm)="germg"
%germx(whatgerm)=germpox(whatgerm)
%germy(whatgerm)=germpoy(whatgerm)
count(whatgerm)+=1
loopy=
print_germs
m=1
germs
germexist(m):
plot(g$(m)+
(frame),germx(m),germy(m),8)
germexist(m)
exist(m)=
:count(m)+=1
update_teeth
n=1
teeth
exist(n)
decay(n)<4
count(n)>49:decay(n)+=1:count(n)=0:score-=1
germexist(n)
count(n)=0
n>0
n<9
germy(n)+=16:germpoy(n)+=16
n>8
germy(n)-=16:germpoy(n)-=16
4,-15,10000+(total*500),1
exist(n)=
totalled(n)=1
total+=totalled(n)
score-=10
decay(n)=4
count(n)=0
total>13
fin%=
end_game
text_size(16,16)
outline("Game Over",11,15,23)
text_size(8,8)
plot(x$,x,y,m)
&2E,spop%+256,area%,x$,x-32,y-32,m,scale%,0
remove_sounds
sounds_loaded%
"RMKill jwvoice"
"RMKill kill1a"
"RMKill lovely"
"RMKill ouch"
"RMKill belch1"
"RMKill shlop2"
OSCLI"RMKill gover"
I=1
"ChannelVoice "+
(I)+" "+
error
*FX15,0
remove_sounds
"Desktop"
"An error has been found. Jaw Wars will now remove itself from the icon bar;"
'"Error type: ";
'"Location : ";
'"Just in case, try resetting the machine, and run Jaw Wars again."
'"If all else fails, consult the !ReadMe file for details on how to report bugs."
'"Press space to return to the desktop..."
"Desktop"
swap_banks
"OS_Byte",113,scr
scr=3-scr
"OS_Byte",112,scr
reset_banks
"OS_Byte",112,2
"OS_Byte",113,2
load_sprites
IF sprites_loaded% THEN ENDPROC
s$="<JawWar$Dir>.Spriteys"
"OS_File",5,s$
,,,,size%
area% size%+32
area%!0=size%+32
area%!4=0
area%!8=16
area%!12=16
&2E,256+9,area%
&2E,256+10,area%,s$
sprites_loaded%=TRUE
load_sounds
IF sounds_loaded% THEN ENDPROC
fx$="<JawWar$Dir>"
Oak Recorder Voices (use ChannelVoice on these)
"RMLoad "+fx$+".belch1"
"RMLoad "+fx$+".lovely"
"RMLoad "+fx$+".ouch"
"RMLoad "+fx$+".jwvoice"
OSCLI"RMLoad "+fx$+".gover"
SoundCon Voices (Use splay_NAME on these)
"RMLoad "+fx$+".kill1a"
"RMLoad "+fx$+".shlop2"
OSCLI"RMLoad "+fx$+".kill5"
OSCLI"RMLoad "+fx$+".munch1"
sounds_loaded%=TRUE
"ChannelVoice 2 belch1"
"ChannelVoice 3 lovely"
"ChannelVoice 4 ouch"
"ChannelVoice 5 jwvoice"
OSCLI"ChannelVoice 6 gover"
"RMKill jwvoice"
"RMKill kill1a"
"RMKill lovely"
"RMKill ouch"
"RMKill belch1"
"RMKill shlop2"
OSCLI"RMKill gover"
I=1
"ChannelVoice "+
(I)+" "+
title_screen
fadein=0
fadeout=0
pressed=
6,112,fr
fadein>0
200
192:
fade_in(fadein)
fadein<17 fadein+=1
(-99)
pressed=
6,113,fr:fr=3-fr
fadein>16
pressed
text_size(16,16)
outline("Jaw Wars",12,1,127):
5,383,100,100
text_size(4,8)
line_x=0.5
line_y=5
pressed=
(-99)
pressed=
line$
line$=" Use the mouse to move the toothbrush"
line_x=20.5:line_y=5
outline(line$,line_x,line_y,45)
line_y+=1.1
line$="Press the spacebar to play the game..."
pressed
text_size(8,8)
pressed:pressed=
26,4:
outline("Directed by Stephen Scott",7.5,27,104)
outline("Version 0.9841b (11th May, 1998)",4,28.1,104)
outline("
tapestry multimedia 1993-1998",4.5,29.2,104)
framtim=0:scr=0
frame=0:soundtim=0
pressed=FALSE
24,440;200;904;264;
plot("germa"+
(frame),472,232,8):
abdefg
plot("germb"+
(frame),552,232,8)
plot("germd"+
(frame),632,232,8)
plot("germe"+
(frame),712,232,8)
plot("germf"+
(frame),792,232,8)
plot("germg"+
(frame),872,232,8)
framtim+=1:soundtim+=1
framtim>49
200
128:
N frame+=1:
frame>3
frame=0
framtim=0
soundtim>299
5,383,
(100)+50,100
soundtim=0
(-99)
pressed=
pressed
ffffffffffffffffffffffffffffffffffffff
" Thanks for your support in the"
"development of Jaw Wars. This game is"
"currently in the beta stages and"
"therefore incomplete. Features may be"
"added and/or taken away with further"
"releases. Send me ideas/bug reports/"
"improvements and you will get credited"
"in the final release later in 1998!"
" I know I promised extra playability"
"but this version instead utilises the"
"GameModes module on the Risc PC to get"
"rid of letterboxing. The mouth graphic"
"has also been improved yet again."
" Use the mouse to move the toothbrush"
"and wipe out the bad germs before your"
"teeth all rot away. Don't forget to"
"recharge your brush with toothpaste."
"Extra tubes will appear when you need"
"them!"
" Click Select to activate your brush."
"And I mean CLICK - you cant hold it"
"down and 'cheat' for now."
" Press the TAB key at any time during"
"gameplay to return to the desktop."
"Press the spacebar to play the game..."
text_size(x%,y%)
23,17,7,6,x%;y%|
outline(t$,x,y,c)
tx=x*32
A%=1:ty=1024-(y*32)
A%=2:ty=960-(y*30)
tx-4,ty:
tx+4,ty:
tx,ty+4:
tx,ty-4:
tx-4,ty-4:
tx+4,ty+4:
tx,ty:
view_titles
seen%=
pressed=
fadein=0
fadeout=0
s$="<JawWar$Dir>.title"
"OS_File",5,s$
,,,,size1%
area1% size1%+32
area1%!0=size1%+32
area1%!4=0
area1%!8=16
area1%!12=16
&2E,256+9,area1%
&2E,256+10,area1%,s$
6,112,fr
fadein>0:
192:
&2E,34+256,area1%,"tapestry",388,428,0
fade_in(fadein)
fadein<17 fadein+=1
(-99)
pressed=
6,113,fr:fr=3-fr
fadein>16
pressed
pressed
6,112,fr
192:
&2E,34+256,area1%,"tapestry",388,428,0
fade_out(fadeout)
fadeout<17 fadeout+=1
(-99)
pressed=
6,113,fr:fr=3-fr
fadeout>16
pressed
pressed
fade_out(fadeout)
fadeout
2,63
3*64
2,63
2*64
2,63
1*64
2,63
0*64
2,42
3*64
2,42
2*64
2,42
1*64
2,42
0*64
2,21
3*64
2,21
2*64
2,21
1*64
2,21
0*64
2,00
3*64
2,00
2*64
2,00
1*64
2,00
0*64
fadeout>0
A%=1:
0,0,1280,1024
fadeout>0
A%=2:
0,0,1280,960
fade_in(fadein)
fadein
2,00
0*64
2,00
1*64
2,00
2*64
2,00
3*64
2,21
0*64
2,21
1*64
2,21
2*64
2,21
3*64
2,42
0*64
2,42
1*64
2,42
2*64
2,42
3*64
2,63
0*64
2,63
1*64
2,63
2*64
2,63
3*64
fadein>0
A%=1:
0,0,1280,1024
fadein>0
A%=2:
0,0,1280,960