|
Post by vetea on Dec 18, 2017 4:28:22 GMT -5
Hello !!
Here is the original Code from the first version of Papi Commando ! Files .BIN and Gfx DATA are not included !!
It's a good way for noobs to learn and practice. Cheers !
'==========================================
'= =
'= Papi Commando =
'= Megadrive Edition =
'= (c) 2015 Vetea =
'= =
'==========================================
'///// Declaration Variables /////
global ChoixMusique as integer
global TypeMort as integer
global pcmid as long
global Animation as integer
global Xpapi as integer
global Ypapi as integer
global InitPapi as integer
global PorteeArmePapi as integer
global cycle as integer
global ZM as integer
global a as long
global TestText as integer
global AdresseImpact as integer
global ImpactTempo(6) as integer
global Xballe(6) as integer
global Yballe(6) as integer
global SensBalle(6) as integer
global MoveBalle(6) as integer
global CheminBalle(6) as integer
global CheminBalleMax(6) as integer
global SpeedBalle(6) as integer
global IDBonus as integer
global AdresseMap as integer
'Données Truck
global TruckS(4) as integer
global TruckBS(4) as integer
global TruckEnable as integer
global Xtruck as integer
global TempoTruckHit as integer
global SoundTruck as integer
global Ytruck as integer
global AdresseTruck as integer
global TirageTruck as integer
global HitTruck as integer
global LifeTruck as integer
global IdBalle(6) as integer '1 pôur les Balles de Papi, 2 pour les balles de Mami
'Données Mami
global MamiSprite as integer
global MamiEnable as integer
global NombreBalleMami as integer
global ScoreMami as integer
global ScoreMami$ as string
global BalleMami$ as integer
global RazScreenMami as integer
global RafaleArmeMami as integer
global RafaleM as integer
global PorteeArmeMami as integer
global Xmami as integer
global Ymami as integer
global LifeMami as integer
global SensMami as integer
global HautMami as integer
global BasMami as integer
global DroiteMami as integer
global GaucheMami as integer
global SpeedMami as integer
global RafaleMami as integer
global InitMami as integer
global AnimationMami as integer
global SensBulletMami as integer
global YscaleMami as integer
global XScaleMami as integer
global FireMami as integer
global SpeedBulletMami as integer
global NombreUniteStage as integer
global NombreUniteStageEffectif as integer
global ScoreUnit as integer
global finmusic as integer
global bonusL as integer
global CartoucheS as integer
global CartoucheMamiS as integer
global duree as integer
global DureeMusic as integer
global ScoreS as integer
global DeltaScoreLife as integer
global LifeS(5) as integer
global LifeMamiS(5) as integer
global TempoBonusL as integer
global SpeedPapi as integer
global TempoSangPapi as integer
global Xofficier(50) as integer
global TempoImmo as integer
global ScoreUnite as integer
global RazSCreen as integer
global Yofficier(50) as integer
global XOfficierScale(50) as integer
global YOfficierScale(50) as integer
global sensofficier(50) as integer
global animationofficier(50) as integer
global LChemin(50) as integer
global Chemin(50) as integer
global Cpuy(50) as integer
global MortOfficier(50) as integer
global BlankSpriteS as integer
global k as integer
global ScyOFF as integer
global ScxOFF as integer
global Scd as integer
global Scg as integer
global NombreCPU as integer
global Sens as integer
global Fire as integer
global AnimInit as integer
global j as integer
global i as integer
global tempo as integer
global Scyh as integer
global sconh as integer
global sconb as integer
global Scrolling as integer
global OfficierS(50) as integer
global GameOver as integer
global NombreUnite as integer
global AdresseDepart as integer
global AdresseOfficier as integer
global AdresseBonus as integer
global AdresseScore as integer
global NombreUniteMap as integer
global NombreEffectif as integer
global CollisionPapiX as integer
global CollisionPapiY as integer
global Score$ as string
global ScoreJeu as integer
global CpuHitBox as integer
global Hiscore$ as string
global HiscoreJeu as integer
global Startgame as integer
global DeltaScore as integer
global NombreStage as integer
global DisplayScore as integer
global Xscore as integer
global Yscore as integer
global temposcore as integer
global StageVictoire as integer
global SpriteBonus as integer
global TempoBonus as integer
global SpriteBonusOmbre as integer
global BonusX as integer
global BonusY as integer
global CollisionBonusX as integer
global CollisionBonusY as integer
global SensBonus as integer
global EventBonus as integer
global TypeBonus as integer
global TempoMessageBonus as integer
Global ValideMessage as integer
global TempoMessage as integer
global NumeroMAP as integer
global DeltaMAP as integer
global Nbtile as integer
global Scale as integer
global Xscale as integer
global Yscale as integer
global speedunit as integer
global TempoSang(50) as integer
global ScrollingY as integer
global TimeAggro as integer
global TypeUnite as integer '1 : Soldat, 2 : Officier
global LifeUnite(50) as integer
global HitUnite(50) as integer
global BonusAnimation as integer
global LifePapi as integer
global SequenceMort as integer
global PauseGame as integer
global PauseKey as integer
'Variables Bullets Papi
global AdresseBulletPapi as integer
global BulletPapiS(6) as integer
global BulletPapisOmbre(6) as integer
global SensBulletPapi(6) as integer
GLOBAL XBScale(6) as integer
global YBScale(6) as integer
global CollisionX(50) as integer
global CollisionY(50) as integer
global TempoC as integer
global SensBullet as integer
global Rafale as integer
global RafaleArmePapi as integer
global Ylimit as integer
global BalleTir as integer
global BonusBalle as integer
global NombreBalle as integer
global Balle$ as string
global Bonus as integer
global SpeedBullet as integer
global ModeGOD as integer
global TimeModeGod as integer
global Clignotement as integer
'Variable HitBox Decor
global Obstacle(55,55) as integer
'Variables Bullets Ennemis
global AdresseBalle as integer
global spriteballe as integer
global spriteballeombre as integer
global spriteballex as integer
global BalleXscale as integer
global BalleYscale as integer
global spriteballey as integer
global sensspriteballe as integer
global aggroofficier as integer
global GoBalle as integer
global TempoAggro as integer
global NumberAggro as integer
global IdAggro as integer
global TAggro as integer
global CollisionBalleX as integer
Global CollisionBalleY as integer
global AggroTempo as integer
global Hx(200) as integer
global Hy(200) as integer
global HT(200) as integer
global NbObjet as integer
global StartMap as integer
'Variables de scroll écran menu
global ScrollOn as integer
global ScrollScreenX as integer
global ScrollScreenY as integer
'///// Init Sons & Driver Z80 /////
pcmid&=64
gosub Z80driver
'///// Font Graphique /////
option NoLoadFont
palettes palettegenerale,0,0,16
loadtiles font_tiles,47,47
loadtiles exclamation,8,33
'///// Chargement écran de jeu /////
cls
ink 0
'Ecran Logo Sega !
gosub segalogo
segalogo
init:
freeallsprites
gosub blankscreen
scrollon=0
scrollscreeny=0
'choix du plan pour le scrolling
setgfxplane SCROLL_B
setscrollplane Scroll_B
setscrollmode HSCROLL_OVERALL, VSCROLL_OVERALL
'pallettes paletteTITRE6,1,0,16
palettes paletteGENERALE,0,0,16
loadtiles tilesTITRE,464,160
palettes palettetitre0,1,0,16
palettes palettehit,3,0,16
Reload mapdataTITRE
For Y = 1 To 28
For X = 1 To 40
ReadInt AuxInt
DrawTile 160+AuxInt+palette(1), X-1, Y-1
Next
Next
sleep 10
palettes palettetitre1,1,0,16
sleep 10
palettes palettetitre2,1,0,16
sleep 10
palettes palettetitre3,1,0,16
sleep 10
palettes palettetitre4,1,0,16
sleep 10
palettes palettetitre5,1,0,16
sleep 10
palettes palettetitre6,1,0,16
sleep 10
palettes palettetitre7,1,0,16
sleep 10
palettes palettetitre,1,0,16
'Ecran principal
locate 20,10:print " PRESS START !!"
while 1
'Musiques en boucle !
if xgm_isPlayingPCM(1)=0 [and] scrollon=0 then gosub music1
if joypad(0).7 then ScrollOn=2:cls:Gosub magnum:stopplay 0
'A l'appui de A on scrolle l'écran entier vers le haut
if scrollon=1 then
palettes palettetitre,1,0,16
sleep 5
palettes palettetitre7,1,0,16
sleep 5
palettes palettetitre6,1,0,16
sleep 5
palettes palettetitre4,1,0,16
sleep 5
palettes palettetitre3,1,0,16
sleep 5
palettes palettetitre2,1,0,16
sleep 5
palettes palettetitre1,1,0,16
sleep 5
palettes palettetitre0,1,0,16
goto suite10:
end if
if scrollon=2 then
for i=1 to 1500
next i
scrollscreeny++
if scrollscreeny>23 then scrollon=1
end if
'Scrolling Ecran & Menu
'if scrollon=2 then scroll right,scrollscreeny,SCROLL_A
wend
suite10:
gosub blankscreen
'RAZ Memory Sprite
freeallsprites
'Init Sprite
gosub initsprite
setscrollplane SCROLL_B
scrollscreeny=0
while 1
for i=1 to 500
next i
scrollscreeny++
scroll up,scrollscreeny,SCROLL_B
if scrollscreeny>20 then goto suite11:
wend
suite11:
scrollscreeny=0
scrollon=0
score$="0"
hiscore$="0"
nombreballe=45
nombrestage=1
NumeroMAP=1
deltamap=1
scale=8
startgame=1
gameover=1
lifepapi=3
c=0
j=0
nombreeffectif=0
'Information des vecteurs Sens de direction :
'1 = Haut
'2 = Bas
'3 = Gauche
'4 = Droite
'5 = HD
'6 = HG
'7 = BD
'8 = BG
'Limite tableau :
'X = max 420 , min 135
'Y = max 325 , min 1
'Configuration Map
SETGFXPLANE SCROLL_B
ClS
'Start !!
psgvol 0,0:psgvol 1,0:psgvol 2,0:psgvol 3,0
'gosub blankscreen
pause=1
Debut:
cls
'Reset de la priorité Text / Sprite
option textpriority,low
'On efface l'écran de tous les sprites
gosub resetsprite
'Cas d'un Game Over
if startgame=2 [and] gameover=2 then
gosub stagefail
end if
'Arret musique
stopplay 0
'Init Map
GestionMap (NumeroMap)
if startgame!=2 then
'Initialisation Scrolling MAP
scroll down,224,SCROLL_B
end if
'choix du plan pour le scrolling
setscrollplane SCROLL_B
setscrollmode HSCROLL_OVERALL, VSCROLL_OVERALL
if gameover=2 then
score$="0"
scorejeu=0
nombreeffectif=1
else
score$=str$(scorejeu)
end if
'Affichage des resume de stage / game over
if startgame=2 [and] gameover!=2 then gosub stagesuccess
'if startgame=2 [and] gameover=2 then gosub stagefail
sconb=0
sconh=0
scrollingscreeny=0
'nombreeffectif=32
rafale=1
RafaleMami=1
scrolling=1
Precision=1
Precisionhit=1
goballe=1
aggroofficier=1
sensspriteballe=1
fire=1
scyh=1
scyoff=1
if gameover!=2 then
nombreeffectif=nombreeffectif+1
if nombreeffectif>30 then nombreeffectif=30
else
nombreeffectif=1
nombreballe=45
end if
'Compensation Calcul Hitbox pour soulager ce pauvre 68000 ^^ - Max 8 pour ne pas trop bugger la hitbox.
cpuhitbox=6
'Sprite de Départ de Papi
propsprite PapiSprite,adressedepart+(16*11),3
'Ajustement Vitesse Jeu / Nombre Effectif
Gosub GestionSpeed
'Ecran générique de début de partie !
cls
stopplay 0
gosub music2
cls
pause=1
while pause<1500
pause=pause+1
locate 5,14:Print "STAGE "+str$(nombrestage)
locate 9,8:Print "READY TO START STAGE"
locate 13,10:print "KILL THE ENNEMIES"
wend
stopplay 0
cls
j=1
fail=1
for i=1 to nombreunite
if i<=nombreeffectif then
temposang(i)=1
'Hitpoint
if typeunite=1 then lifeunite(i)=1
if typeunite=2 then lifeunite(i)=2
hitunite(i)=1 '2 : Eclat de sang si blessé
mortofficier(i)=1 ' Unite vivante, 2 = Morte !
j=j+1
Beg:
fail=fail+1
randomize i*(scorejeu+nombreballe+fail)
Xofficier(i)=rnd(400)
Yofficier(i)=rnd(220)
'Verifions si une unite ne va pas dans le decor.
if obstacle((xofficier(i)/scale),(yofficier(i)/scale))=2 then goto Beg
if xofficier(i)<=135 then xofficier(i)=135
if yofficier(i)<=50 then yofficier(i)=50
if j>8 then j=1
sensofficier(i)=j
lchemin(i)=rnd(100)
if lchemin(i)<=30 then lchemin(i)=30
else
mortofficier(i)=2
xofficier(i)=0
yofficier(i)=0
end if
next
'Init Bullets
for i=1 to 6
MoveBalle(i)=0
Yballe(i)=0
Xballe(i)=0
propsprite bulletpapis(i),adressebulletPapi+1,0
next
sensbullet=1
rafalearmepapi=5 'Vitesse des rafales de tir de Papi
PorteeArmePapi=28 'Portee du tir de Papi
rafalearmeMami=15 'Vitesse des rafales de Mami
PorteeArmeMami=40 'Portee du tir de Mami
j=1
collisionx=1
collisiony=1
bonus=1
tempobonus=1
fire=1
ylimit=325
'Init Coordonnées
Xpapi=270
Ypapi=360
rafale=1
rafalemami=1
if mamienable=1 then
Xmami=270+50
Ymami=360
basmami=0
gauchemami=0
droitemami=0
end if
scrollingy=1
'Init Musique jeu
choixmusique++
if choixmusique>3 then choixmusique=1
'Event Bonus 50% de chance de tirage / Stage & Apparition Truck 30%
randomize (scorejeu+nombreballe+1)
Tirage=rnd(100)
randomize (scorejeu+nombreballe+1+50)
tirageTruck=rnd(100)
if tirage>=50 then eventbonus=2 else eventbonus=1
if tirageTruck>=70 then truckenable=1 else truckenable=0
tempobonus=1
psgvol 1,0
speedpapi=1
scd=65
scg=20
stagevictoire=1
tempomessagebonus=1
validemessage=1
Sens=0
nombreunitemap=nombreeffectif
startgame=2
speedunit=1
speedpapi=1
'Coordonnées Bonus flottant
randomize (scorejeu+nombreballe)
bonusx=rnd(410+nombreballe)
gobonus=1
if bonusx<=135 then bonusx=140
bonusy=rnd(300)
sensbonus=rnd(4)+1
typebonus=typebonus+1
if typebonus>4 then typebonus=1
ink 4
'locate 7,12:print "PAPI COMMANDO DEMO"
'locate 9,11:print "Test avec "+ str$(nombreunite) + " Unites !"
'Titre de la cartouche
option title,"Papi Commando"
speedpapi=1
speedbullet=6 'Vitesse Bullet Papi
SpeedBulletMami=5 'Vitesse Bullet Mami
RazScreen=1
RazScreenMami=1
startmap=1
sens=1
haut=1
bas=0
droite=0
gauche=0
tempoimmo=0
sequencemort=0
xtruck=550
ytruck=rnd(200)
cls
'Propriété Text priority
option textpriority,high
' boucle principale
on vblank gosub main
enable interrupt vblank
end
'/////////////////////////////////////////////////////////
'///// listing DATA des sprites et decors & routines /////
'/////////////////////////////////////////////////////////
'///// Boucle Principale /////
main:
while 1
if sequencemort!=1 then
'Pause en jeu ( Bouton Start )
if pausegame=0 then
if joypad(0).7 then pausegame=1:stopplay 0:gosub bonus
end if
if pausegame=1 then
pausekey++
if pausekey>250 then
if joypad(0).7 then pausegame=2
pausekey=0
end if
if pausegame=1 then locate 12,12:print "PAUSE GAME" else cls
goto theend:
end if
if pausegame=2 then
pausekey++
if pausekey>50 then
pausegame=0
pausekey=0
end if
end if
'Gestion musique
if pausegame=0 then
if xgm_isPlayingPCM(1)=0 [and] stagevictoire!=2 then gosub choixmusic
end if
'Gestion Vitesse CPU
Gosub GestionSpeedGame
'Gestion de la vie
if stagevictoire!=2 then gosub GestionLife
'Gestion du modeGod
if modegod=1 then
TimeModeGod++
if timemodegod>50 then TimeModeGod=0:modegod=0;clignotement=0
end if
'Gestion Score
gosub GestionScore
'Gestion du Camion
if TruckEnable=1 then gosub EventTruck
locate 7,10:print "S:"+str$(adressemap)
'locate 7,10:print "O:"+str$(obstacle(ballexscale,balleyscale))
'locate 9,10:print "CX:"+str$(Xtruck)+", CY:"+str$(ytruck)
'Tempo generale
tempo++
'Init Routine
gosub initgame
'Gestion Bonus
if stagevictoire!=2 then
if eventbonus=2 then gosub gestionbonus
if validemessage=2 then gosub MessageBonus
end if
end if
if startmap=1 then gosub Startstage
'Limite tableau & scrolling
if startmap!=1 then
if stagevictoire!=2 then gosub LimiteTableau
end if
if sequencemort!=1 then
'Gestion IA
if startmap!=1 then
gosub gestionia
end if
'Gestion Balle IA
if stagevictoire!=2 then
if goballe=2 then gosub balleia
end if
'Traitement Commande et scrolling
if startmap!=1 then
if stagevictoire!=2 then gosub gestionpad
end if
gosub initdeplacement
'gestion Bullet
gosub InitBullet
'Affichage Sprite
gosub Affichesprite
'Init & Gestion animation
gosub Gestionanimation
end if
'Mort de Papi et fin de partie.
if sequencemort=1 then gosub Mortpapi
Theend:
wend
return
StageFail:
cls
gobonus=1
scrollon=0
eventbonus=1
lifepapi=3
Mamienable=0
deltamap=1
numeromap=1
nombrestage=1
gosub BlackScreen
'goto init:
movesprite SpriteBalle,0,0
movesprite SpriteBalleOmbre,0,0
'reset scrolling
scroll up,(scrolling-1),SCROLL_B
movesprite spritebonus,0,0
movesprite spritebonusombre,0,0
freeallsprites
loadtiles tilesTITRE,545,600
palettes palettetitre0,1,0,16
Reload mapdataTITRE
For Y = 1 To 28
For X = 1 To 40
ReadInt AuxInt
DrawTile 600+AuxInt+palette(1), X-1, Y-1
Next
Next
sleep 10
palettes palettetitre1,1,0,16
sleep 10
palettes palettetitre2,1,0,16
sleep 10
palettes palettetitre3,1,0,16
sleep 10
palettes palettetitre4,1,0,16
sleep 10
palettes palettetitre5,1,0,16
sleep 10
palettes palettetitre6,1,0,16
sleep 10
palettes palettetitre7,1,0,16
sleep 10
palettes palettetitre,1,0,16
'goto init
'locate 5,14:Print "GAME OVER !!"
locate 20,12:print "PRESS START !!"
psgvol 0,0:psgvol 1,0:psgvol 2,0
temp=1
while 1
if xgm_isPlayingPCM(1)=0 [and] scrollon=0 then gosub music1
if joypad(0).7 then
scrollon=1
stopplay 0
cls
gosub magnum
palettes palettetitre,1,0,16
sleep 5
palettes palettetitre7,1,0,16
sleep 5
palettes palettetitre6,1,0,16
sleep 5
palettes palettetitre4,1,0,16
sleep 5
palettes palettetitre3,1,0,16
sleep 5
palettes palettetitre2,1,0,16
sleep 5
palettes palettetitre1,1,0,16
sleep 5
palettes palettetitre0,1,0,16
goto ahah:
end if
wend
ahah:
psgvol 0,0:psgvol 1,0:psgvol 2,0
gosub blackscreen
deltascore=1
sleep 100
'Init Sprite
gosub initsprite
return
'Musiques du jeu - Canal 0
Bravo:
asm
lea BravoPcm,a1 ; put address of sample in a1
move.l #(BravoPcm_end-BravoPcm),d1 ; put length of sample in d1
move.l #((1<<4)|0),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
SegaLogo:
asm
lea SegaPcm,a1 ; put address of sample in a1
move.l #(SegaPcm_end-SegaPcm),d1 ; put length of sample in d1
move.l #((1<<4)|0),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
Music:
asm
lea PapiPcm,a1 ; put address of sample in a1
move.l #(PapiPcm_end-PapiPcm),d1 ; put length of sample in d1
move.l #((1<<4)|0),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
Music1:
asm
lea PapiPcm1,a1 ; put address of sample in a1
move.l #(PapiPcm1_end-PapiPcm1),d1 ; put length of sample in d1
move.l #((1<<4)|0),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
Music2:
asm
lea PapiPcm2,a1 ; put address of sample in a1
move.l #(PapiPcm2_end-PapiPcm2),d1 ; put length of sample in d1
move.l #((1<<4)|0),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
'Bruitage Papi - Canal 1 & Mami
RirePapi:
asm
lea RirePapiPcm,a1 ; put address of sample in a1
move.l #(RirePapiPcm_end-RirePapiPcm),d1 ; put length of sample in d1
move.l #((1<<4)|1),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
RireMami:
asm
lea RireMamiPcm,a1 ; put address of sample in a1
move.l #(RireMamiPcm_end-RireMamiPcm),d1 ; put length of sample in d1
move.l #((1<<4)|1),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
StartMami:
asm
lea StartMamiPcm,a1 ; put address of sample in a1
move.l #(StartMamiPcm_end-StartMamiPcm),d1 ; put length of sample in d1
move.l #((1<<4)|1),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
OuhMami:
asm
lea OuhMamiPcm,a1 ; put address of sample in a1
move.l #(OuhMamiPcm_end-OuhMamiPcm),d1 ; put length of sample in d1
move.l #((1<<4)|1),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
CriMort:
asm
lea MortPapiPcm,a1 ; put address of sample in a1
move.l #(MortPapiPcm_end-MortPapiPcm),d1 ; put length of sample in d1
move.l #((1<<4)|1),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
Magnum:
asm
lea MagnumPcm,a1 ; put address of sample in a1
move.l #(MagnumPcm_end-MagnumPcm),d1 ; put length of sample in d1
move.l #((1<<4)|1),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
Uzi:
asm
lea UziPcm,a1 ; put address of sample in a1
move.l #(UziPcm_end-UziPcm),d1 ; put length of sample in d1
move.l #((1<<4)|1),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
'Bruitage Ennemis - Canal 2
Ouh:
asm
lea ouhpcm,a1 ; put address of sample in a1
move.l #(ouhpcm_end-ouhpcm),d1 ; put length of sample in d1
move.l #((1<<4)|2),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
Colt45:
asm
lea Colt45Pcm,a1 ; put address of sample in a1
move.l #(Colt45Pcm_end-Colt45Pcm),d1 ; put length of sample in d1
move.l #((1<<4)|2),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
Mort:
asm
lea MortPcm,a1 ; put address of sample in a1
move.l #(MortPcm_end-MortPcm),d1 ; put length of sample in d1
move.l #((1<<4)|2),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
Mort1:
asm
lea Mort1Pcm,a1 ; put address of sample in a1
move.l #(Mort1Pcm_end-Mort1Pcm),d1 ; put length of sample in d1
move.l #((1<<4)|2),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
Mort2:
asm
lea Mort2Pcm,a1 ; put address of sample in a1
move.l #(Mort2Pcm_end-Mort2Pcm),d1 ; put length of sample in d1
move.l #((1<<4)|2),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
Mort3:
asm
lea Mort3Pcm,a1 ; put address of sample in a1
move.l #(Mort3Pcm_end-Mort3Pcm),d1 ; put length of sample in d1
move.l #((1<<4)|2),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
'Bruitage en jeu - Canal 3
Bonus:
asm
lea BonusPcm,a1 ; put address of sample in a1
move.l #(BonusPcm_end-BonusPcm),d1 ; put length of sample in d1
move.l #((1<<4)|3),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
Truck:
asm
lea TruckPcm,a1 ; put address of sample in a1
move.l #(TruckPcm_end-TruckPcm),d1 ; put length of sample in d1
move.l #((1<<4)|3),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
Impact:
asm
lea ImpactPcm,a1 ; put address of sample in a1
move.l #(ImpactPcm_end-ImpactPcm),d1 ; put length of sample in d1
move.l #((1<<4)|3),d2 ; put priority and channel number in d2
end asm
'xgm_startPlayMusic
xgm_playPCM
return
'Code Source ASM
Z80Driver:
asm
jsr z80_loadDriver
end asm
return
'Raz VDP
declare asm function ResetVDP()
lea @VDPRegisters, a0 ; Load address of register table into a0
move.l #0x18, d0 ; 24 registers to write
move.l #0x00008000, d1 ; 'Set register 0' command (and clear the rest of d1 ready)
@Copy:
move.b (a0)+, d1 ; Move register value to lower byte of d1
move.w d1, 0x00C00004 ; Write command and value to VDP control port
add.w #0x0100, d1 ; Increment register #
dbra d0, @Copy
@VDPRegisters:
dc.b 0x20 ; 0: Horiz. interrupt on, plus bit 2 (unknown, but docs say it needs to be on)
dc.b 0x74 ; 1: Vert. interrupt on, display on, DMA on, V28 mode (28 cells vertically), + bit 2
dc.b 0x30 ; 2: Pattern table for Scroll Plane A at 0xC000 (bits 3-5)
dc.b 0x40 ; 3: Pattern table for Window Plane at 0x10000 (bits 1-5)
dc.b 0x05 ; 4: Pattern table for Scroll Plane B at 0xA000 (bits 0-2)
dc.b 0x70 ; 5: Sprite table at 0xE000 (bits 0-6)
dc.b 0x00 ; 6: Unused
dc.b 0x00 ; 7: Background colour - bits 0-3 = colour, bits 4-5 = palette
dc.b 0x00 ; 8: Unused
dc.b 0x00 ; 9: Unused
dc.b 0x00 ; 10: Frequency of Horiz. interrupt in Rasters (number of lines travelled by the beam)
dc.b 0x08 ; 11: External interrupts on, V/H scrolling on
dc.b 0x81 ; 12: Shadows and highlights off, interlace off, H40 mode (40 cells horizontally)
dc.b 0x34 ; 13: Horiz. scroll table at 0xD000 (bits 0-5)
dc.b 0x00 ; 14: Unused
dc.b 0x00 ; 15: Autoincrement off
dc.b 0x01 ; 16: Vert. scroll 32, Horiz. scroll 64
dc.b 0x00 ; 17: Window Plane X pos 0 left (pos in bits 0-4, left/right in bit 7)
dc.b 0x00 ; 18: Window Plane Y pos 0 up (pos in bits 0-4, up/down in bit 7)
dc.b 0x00 ; 19: DMA length lo byte
dc.b 0x00 ; 20: DMA length hi byte
dc.b 0x00 ; 21: DMA source address lo byte
dc.b 0x00 ; 22: DMA source address mid byte
dc.b 0x00 ; 23: DMA source address hi byte, memory-to-VRAM mode (bits 6-7)
end function
declare asm function xgm_isPlayingMusic()
move.w #$100,($A11100) ; Send the Z80 a bus request
move.w #$100,($A11200)
NOP
NOP
NOP
NOP
NOP
move.b ($A00102),d0 ; get channel playing status
andi.l #$40,d0 ; keep play XGM bit only
move.w #$000,($A11100) ; release the Z80 bus
end function
declare asm sub xgm_startPlayMusic()
; a1 should point on XGM music
move.w #$100,($A11100) ; Send the Z80 a bus request
move.w #$100,($A11200)
move.l a3,a0 ; a0 = reserved $FC array for sample id table
moveq #0,d0
@loop: ; prepare sample id table
move.w d0,d1
add.w d1,d1
add.w d1,d1
moveq #0,d2
move.w 0(a1,d1.w),d2 ; get sample addr in song bank table
rol.w #8,d2 ; revert endianess
cmp.w #$FFFF,d2 ; is null sample ?
bne @not_null
move.l NULLpcm,d2
jmp @addr_done
@not_null:
addq.w #1,d2 ; add offset
lsl.l #8,d2 ; pass to 24 bits
add.l a1,d2 ; transform to absolute address
@addr_done
lsr.l #8,d2 ; get high byte
move.b d2,0(a0,d1.w)
lsr.w #8,d2 ; get low byte
move.b d2,1(a0,d1.w)
move.w 2(a1,d1.w),2(a0,d1.w) ; copy sample length
addq.w #1,d0
cmp.w #$3F,d0
bne @loop
move.l #$A01C04,a2 ; destination of sample id table
lsl.w #2,d0 ; set size in bytes
subq.w #1,d0
@sampleIdLoop:
move.b (a0)+,(a2)+
dbra d0,@sampleIdLoop ; load sample id table
move.l a1,d0 ; d0 = song address
add.l #$100,d0 ; bypass sample id table
moveq #0,d2
move.w $FC(a1),d2 ; get sample data size
rol.w #8,d2 ; revert endianess
lsl.l #8,d2 ; pass to 24 bits
add.l d2,d0 ; bypass samples data
addq.l #4,d0 ; bypass music data size field
move.l #$A00104,a2 ; XGM base parameters address
move.b d0,0(a2) ; low byte
lsr.l #8,d0
move.b d0,1(a2) ; med low byte
lsr.l #8,d0
move.b d0,2(a2) ; med high byte
lsr.l #8,d0
move.b d0,3(a2) ; high byte
or.b #$40,($A00100) ; send play XGM command
move.w #$000,($A11100) ; release the Z80 bus
end sub
declare asm sub xgm_resumePlayMusic()
move.w #$100,($A11100) ; Send the Z80 a bus request
move.w #$100,($A11200)
NOP
NOP
NOP
NOP
NOP
or.b #$20,($A00100) ; send resume play command
move.w #$000,($A11100) ; release the Z80 bus
end sub
declare asm sub xgm_stopPlayMusic()
move.w #$100,($A11100) ; Send the Z80 a bus request
move.w #$100,($A11200)
NOP
NOP
NOP
NOP
NOP
or.b #$10,($A00100) ; send stop play command
move.w #$000,($A11100) ; release the Z80 bus
end sub
declare asm function xgm_isPlayingPCM(d0.w as integer)
move.w #$100,($A11100) ; Send the Z80 a bus request
move.w #$100,($A11200)
NOP
NOP
NOP
NOP
NOP
and.b ($A00102),d0 ; get channel playing status
move.w #$000,($A11100) ; release the Z80 bus
end function
declare asm sub xgm_playPCM()
; a1 should point on PCM sample
; d1 should contains PCM length
; d2 should contains channel and priority informations: (prio << 4) | channel
move.w #$100,($A11100) ; Send the Z80 a bus request
move.w #$100,($A11200)
move.l (__LONG_pcmid),d0
lsl.l #2,d0
lea $A01C00,a0
adda.l d0,a0 ; a0 point on id table entry
move.l a1,d0 ; d0 = sample address
lsr.l #8,d0 ; get sample address (high byte)
move.b d0,(a0)+
lsr.w #8,d0 ; get sample address (low byte)
move.b d0,(a0)+
lsr.l #8,d1 ; get sample length (high byte)
move.b d1,(a0)+
lsr.w #8,d1 ; get sample length (low byte)
move.b d1,(a0)+
move.l d2,d0
and.l #3,d0 ; d0 = channel number
lea $A00100,a0
moveq #1,d1
lsl.l d0,d1 ; d1 = channel shift command
or.b d1,(a0) ; set PCM play command
lea $A00108,a0
add.l d0,d0
adda.l d0,a0 ; a0 point on channel info
move.l d2,d0
lsr.l #4,d0
and.l #$F,d0 ; d0 = priority
move.b d0,(a0)+ ; set priority
move.l (__LONG_pcmid),d0 ; d0 = PCM id
move.b d0,(a0) ; set PCM id
addq.l #1,d0
and.l #$FF,d0
or.l #$40,d0 ; id < 0x40 are reserved for music
move.l d0,(__LONG_pcmid) ; pass to next id
move.w #$000,($A11100) ; release the Z80 bus
end sub
declare asm sub xgm_stopPCM()
; d2 should contains channel number
move.w #$100,($A11100) ; Send the Z80 a bus request
move.w #$100,($A11200)
move.l d2,d0
and.l #3,d0 ; d0 = channel number
lea $A00100,a0
moveq #1,d1
lsl.l d0,d1 ; d1 = channel shift command
or.b d1,(a0) ; set PCM play command
lea $A00108,a0
add.l d0,d0
adda.l d0,a0 ; a0 point on channel info
moveq #0,d0
move.b d0,(a0)+ ; set priority
move.b d0,(a0) ; set PCM id
move.w #$000,($A11100) ; release the Z80 bus
end sub
declare sub StopPlay(x as integer)
regmove.l x,d2
xgm_stopPCM
end sub
'Ressources sonores
asm
align 256
SegaPcm:
INCBIN "soundstef\sega.raw"
SegaPcm_end
align 256
BravoPCM:
INCBIN "soundstef\Bravo.raw"
BravoPCM_end
align 256
NULLpcm:
INCBIN "soundstef\null.raw"
NULLpcm_end:
align 256
BonusPcm:
INCBIN "soundstef\Bonus.raw"
BonusPcm_end:
align 256
Colt45Pcm:
INCBIN "soundstef\colt45.raw"
Colt45Pcm_end:
align 256
MortPcm:
INCBIN "soundstef\Mort.raw"
MortPcm_end:
align 256
Mort1Pcm:
INCBIN "soundstef\Mort1.raw"
Mort1Pcm_end:
align 256
Mort2Pcm:
INCBIN "soundstef\Mort2.raw"
Mort2Pcm_end:
align 256
Mort3Pcm:
INCBIN "soundstef\Mort3.raw"
Mort3Pcm_end:
align 256
MagnumPcm:
INCBIN "soundstef\Magnum357.raw"
MAgnumPcm_end:
align 256
XGMsong:
INCBIN "soundstef\sor2.xgc"
align 256
PapiPcm:
incbin "soundstef\papi.raw"
PapiPcm_end
align 256
PapiPcm1:
incbin "soundstef\papi1.raw"
PapiPcm1_end
align 256
ImpactPcm:
incbin "soundstef\Impact.raw"
ImpactPcm_end
align 256
MortPapiPcm:
incbin "soundstef\MortPapi.raw"
MortPapiPcm_end
align 256
PapiPcm2:
incbin "soundstef\papi2.raw"
PapiPcm2_end
align 256
TruckPcm:
incbin "soundstef\Truck.raw"
TruckPcm_end
align 256
OuhPcm:
incbin "soundstef\ouh.raw"
OuhPcm_end
align 256
StartMamiPcm:
incbin "soundstef\StartMami.raw"
StartMamiPcm_end
align 256
OuhMamiPcm:
incbin "soundstef\OuhMami.raw"
OuhMamiPcm_end
align 256
UziPcm:
incbin "soundstef\Uzi.raw"
UziPcm_end
align 256
RirePapiPcm:
incbin "soundstef\RirePapi.raw"
RirePapiPcm_end
align 256
RireMamiPcm:
incbin "soundstef\RireMami.raw"
RireMamiPcm_end
end asm
'Code Source ASM Driver Z80
asm
include "soundstef\xgm.asm"
end asm
CLRTruck:
movesprite trucks(1),0,0
movesprite trucks(2),0,0
movesprite trucks(3),0,0
movesprite trucks(4),0,0
return
'///// Gestion IA /////
GestionIA:
'for j=1 to NombreCPU
j=0
while j<=NombreCpu
j++
'Officier Mort : fin
if mortofficier(j)=2 [or] mortofficier(j)=3 then goto suite:
'Economie CPU ! On ne prend en compte que les unites visibles à l'ecran
cpuy(j)=ypapi-yofficier(j)
if cpuy(j)>32768 then cpuy(j)=65535-cpuy(j)
if scrollingy<=5 then
if cpuy(j)>=(224-scrollingy) then goto suite:
end if
if scrolling>=5 [and] scrollingy <=100 then
if cpuy(j)>=140 then goto suite:
end if
if scrollingy>100 then
if cpuy(j)>=220 then goto suite:
end if
'Test
'goto suite:
'Si collision avec Papi alors Game Over on recommence tout !
'goto kk:
if modegod!=1 then
collisionPapix=xofficier(j)-xpapi
collisionPapiY=yofficier(j)-ypapi
if collisionpapix>32768 then collisionpapix=65535-collisionpapix
if collisionpapiy>32768 then collisionpapiy=65535-collisionpapiy
if collisionpapix<=12 [and] collisionpapiy<=12 then
lifepapi=lifepapi-1
gosub crimort
modegod=1
if lifepapi<1 then
sequencemort=1
modegod=0
stopplay 0
movesprite lifes(1),0,0
movesprite lifes(2),0,0
movesprite lifes(3),0,0
movesprite lifes(4),0,0
movesprite lifes(5),0,0
end if
'gameover=2:nombrestage=1:deltamap=1:numeromap=1:goto debut:
end if
end if
KK:
'Immobilisation
if typebonus=9 then
tempoimmo++
if tempoimmo>400 then
typebonus=0
tempoimmo=0
end if
goto suite:
end if
'Gestion animation
animationia j
'Gestion Aggro
taggro=taggro+1
randomize (tempo+nombreballe+scorejeu)
if taggro>rnd(5)+1 then
aggroia j
taggro=1
end if
'Pathfinding IA
select case sensofficier(j)
case 1
yofficier(j)=yofficier(j)-speedunit
scaleofficier j
if obstacle(xofficierscale(j),yofficierscale(j)-speedunit)=2 then
sensofficier(j)=5
exit select
end if
chemin(j)--
if yofficier(j)<=1 then
sensofficier(j)=5
chemin(j)=rnd(100)
'if chemin(j)<20 then chemin(j)=20
exit select
end if
if chemin(j) <=1 then
sensofficier(j)=5
chemin(j)=rnd(100)
'if chemin(j)<20 then chemin(j)=20
exit select
end if
if yofficier(j)<=32 then
sensofficier(j)++
if sensofficier(j)>8 then sensofficier(j)=1
exit select
end if
exit select
case 2
yofficier(j)=yofficier(j)+speedunit
scaleofficier j
if obstacle(xofficierscale(j),yofficierscale(j)+1)=2 then
sensofficier(j)=8
exit select
end if
chemin(j)--
if yofficier(j)>325 then
sensofficier(j)++
if sensofficier(j)>8 then sensofficier(j)=1
chemin(j)=rnd(75)
if chemin(j)<20 then chemin(j)=20
exit select
end if
if chemin(j)<=1 then
sensofficier(j)=8
chemin(j)=rnd(75)
exit select
end if
exit select
case 3
xofficier(j)=xofficier(j)-speedunit
scaleofficier j
if obstacle(xofficierscale(j)-speedunit,yofficierscale(j))=2 then
sensofficier(j)=6
exit select
end if
chemin(j)--
if xofficier(j)<135 then
sensofficier(j)++
if sensofficier(j)>8 then sensofficier(j)=1
chemin(j)=rnd(80)
'if chemin(j)<20 then chemin(j)=20
exit select
end if
if chemin(j)<=1 then
sensofficier(j)=6
chemin(j)=rnd(80)
'if chemin(j)<20 then chemin(j)=20
exit select
end if
exit select
case 4
xofficier(j)=xofficier(j)+speedunit
scaleofficier j
if obstacle(xofficierscale(j)+speedunit,yofficierscale(j))=2 then
sensofficier(j)=7
exit select
end if
chemin(j)--
if chemin(j)<=1 then
sensofficier(j)=7
chemin(j)=rnd(120)
exit select
end if
if xofficier(j)>420 then
sensofficier(j)++
if sensofficier(j)>8 then sensofficier(j)=1
chemin(j)=rnd(120)
'if chemin(j)<20 then chemin(j)=20
exit select
end if
exit select
case 5
yofficier(j)=yofficier(j)-speedunit
xofficier(j)=xofficier(j)+speedunit
scaleofficier j
if obstacle(xofficierscale(j)+speedunit,yofficierscale(j)-speedunit)=2 then
sensofficier(j)=4
exit select
end if
chemin(j)--
if chemin(j)<=1 then
sensofficier(j)=4
chemin(j)=rnd(60)
''if chemin(j)<20 then chemin(j)=20
exit select
end if
if yofficier(j)<=32 then
sensofficier(j)++
if sensofficier(j)>8 then sensofficier(j)=1
exit select
end if
if xofficier(j)>420 then
sensofficier(j)++
if sensofficier(j)>8 then sensofficier(j)=1
exit select
end if
exit select
case 6
yofficier(j)=yofficier(j)-speedunit
xofficier(j)=xofficier(j)-speedunit
scaleofficier j
if obstacle(xofficierscale(j)-speedunit,yofficierscale(j)-speedunit)=2 then
sensofficier(j)=1
exit select
end if
chemin(j)--
if chemin(j)<=1 then
sensofficier(j)=1
chemin(j)=rnd(90)
'if chemin(j)<20 then chemin(j)=20
exit select
end if
if yofficier(j)<=16 then
sensofficier(j)++
if sensofficier(j)>8 then sensofficier(j)=1
exit select
end if
if xofficier(j)<135 then
sensofficier(j)++
if sensofficier(j)>8 then sensofficier(j)=1
exit select
end if
exit select
case 7
yofficier(j)=yofficier(j)+speedunit
xofficier(j)=xofficier(j)+speedunit
scaleofficier j
if obstacle(xofficierscale(j)+speedunit,yofficierscale(j)+speedunit)=2 then
sensofficier(j)=2
exit select
end if
chemin(j)--
if chemin(j)<=1 then
sensofficier(j)=2
chemin(j)=rnd(120)
'if chemin(j)<20 then chemin(j)=20
exit select
end if
if yofficier(j)>325 then
sensofficier(j)++
if sensofficier(j)>8 then sensofficier(j)=1
exit select
end if
if xofficier(j)>420 then
sensofficier(j)++
if sensofficier(j)>8 then sensofficier(j)=1
exit select
end if
exit select
case 8
yofficier(j)=yofficier(j)+speedunit
xofficier(j)=xofficier(j)-speedunit
scaleofficier j
if obstacle(xofficierscale(j)-speedunit,yofficierscale(j)+speedunit)=2 then
sensofficier(j)=3
exit select
end if
chemin(j)--
if chemin(j)<=1 then
sensofficier(j)=3
chemin(j)=rnd(75)
'if chemin(j)<20 then chemin(j)=20
exit select
end if
if yofficier(j)>325 then
sensofficier(j)++
if sensofficier(j)>8 then sensofficier(j)=1
exit select
end if
if xofficier(j)<135 then
sensofficier(j)++
if sensofficier(j)>8 then sensofficier(j)=1
chemin(j)=rnd(80)
'if chemin(j)<20 then chemin(j)=20
exit select
end if
exit select
end select
suite:
'Si unité morte alors efface les unites et on affiche les gerbes de sang
if mortofficier(j)=3 then
temposang(j)=temposang(j)+1
if temposang(j)<=10 then propsprite officiers(j),adresseofficier+(16*16),2
if temposang(j)>10 [and] temposang(j) <=20 then propsprite officiers(j),adresseofficier+(17*16),2
if temposang(j)>20 [and] temposang(j) <=30 then propsprite officiers(j),adresseofficier+(18*16),2
if temposang(j)>30 then propsprite officiers(j),adresseofficier+(19*16),2
if temposang(j)>50 then
mortofficier(j)=2
xofficier(j)=0
yofficier(j)=0
temposang(j)=1
propsprite officiers(j),adresseofficier+(18*3),2
'movesprite OfficierS(j),Xofficier(j)-scxoff,Yofficier(j)-scyoff
end if
end if
'Si unite blessé on affiche du sang
if hitunite(j)=2 then
temposang(j)=temposang(j)+1
propsprite officiers(j),adresseofficier+(20*16),0
if temposang(j)>5 then
hitunite(J)=1
temposang(j)=1
end if
end if
SuiteF:
'Affichage Sprite unite
movesprite OfficierS(j),Xofficier(j)-scxoff,Yofficier(j)-scyoff
suite5:
wend
'next j
fini:
return
'Limite tableau
LimiteTableau:
'Coté mami
if mamienable=1 then
if scrolling>10 [and] ymami>ylimit then ymami=ylimit
if ymami<=32 then ymami=32
if xmami<=135 then xmami=135
if xmami>=420 then xmami=420
'Cas avec le scrolling de Papi
if scrolling<=5 then
if ymami<=120 then ymami=120
end if
end if
'Coté Papi
if ypapi>ylimit then ypapi=ylimit
if ypapi<=32 then ypapi=32
if scyh>=95 [and] ypapi>=125 then
sconh=1
else
sconh=0
end if
if scyh>=95 [and] ypapi>= 125 then
sconb=1
else
sconb=0
end if
if xpapi<=135 then xpapi=135
if xpapi>=420 then xpapi=420
return
EventTruck:
if soundtruck=0 [and] xtruck<=450 then
gosub truck
soundtruck=1
end if
xtruck--
if xtruck<1 then xtruck=550:soundtruck=0
if hittruck=1 then
for i=1 to 4
Select case i
case 1
propsprite trucks(i),adressetruck+67,0
exit select
case 2
propsprite trucks(i),adressetruck+84,0
exit select
case 3
propsprite trucks(i),adressetruck+101,0
exit select
case 4
propsprite trucks(i),adressetruck+118,0
exit select
end select
next
tempotruckhit++
if tempotruckhit>5 then
tempotruckhit=0
hittruck=0
for i=1 to 4
Select case i
case 1
propsprite trucks(i),adressetruck,0
exit select
case 2
propsprite trucks(i),adressetruck+16,0
exit select
case 3
propsprite trucks(i),adressetruck+33,0
exit select
case 4
propsprite trucks(i),adressetruck+50,0
exit select
end select
next
end if
end if
movesprite trucks(1),xtruck,ytruck+scrolling
movesprite trucks(2),xtruck+32,ytruck+scrolling
movesprite trucks(3),xtruck,ytruck+32+scrolling
movesprite trucks(4),xtruck+32,ytruck+32+scrolling
return
ResetSprite:
'On efface l'écran de tous les sprites
if startgame=2 then
movesprite Papisprite,0,0
for i=1 to nombreunite
mortofficier(i)=2
movesprite officiers(i),0,0
next
for i=1 to 6
propsprite bulletpapis(i),adressebulletPapi+1,0
movesprite bulletpapis(i),0,0
movesprite bulletpapisombre(i),0,0
Cheminballe(i)=1
next
end if
return
GestionLife:
'Coté Mami
if mamienable=1 then
select case lifemami
case 0
movesprite lifemamis(1),0,0
movesprite lifemamis(2),0,0
movesprite lifemamis(3),0,0
movesprite lifemamis(4),0,0
movesprite lifemamis(5),0,0
exit select
case 1
movesprite lifemamis(1),352+(1*16),130
movesprite lifemamis(2),0,0
movesprite lifemamis(3),0,0
movesprite lifemamis(4),0,0
movesprite lifemamis(5),0,0
exit select
case 2
movesprite lifemamis(1),352+(1*16),130
movesprite lifemamis(2),352+(2*16),130
movesprite lifemamis(3),0,0
movesprite lifemamis(4),0,0
movesprite lifemamis(5),0,0
exit select
case 3
movesprite lifemamis(1),352+(1*16),130
movesprite lifemamis(2),352+(2*16),130
movesprite lifemamis(3),352+(3*16),130
movesprite lifemamis(4),0,0
movesprite lifemamis(5),0,0
exit select
case 4
movesprite lifemamis(1),352+(1*16),130
movesprite lifemamis(2),352+(2*16),130
movesprite lifemamis(3),352+(3*16),130
movesprite lifemamis(4),352+(4*16),130
movesprite lifemamis(5),0,0
exit select
case 5
movesprite lifemamis(1),352+(1*16),130
movesprite lifemamis(2),352+(2*16),130
movesprite lifemamis(3),352+(3*16),130
movesprite lifemamis(4),352+(4*16),130
movesprite lifemamis(5),352+(5*16),130
exit select
end select
'for i=1 to lifemami
'movesprite lifemamis(i),120+(i*16),130
'next
end if
'Coté Papi
select case lifePapi
case 0
movesprite lifes(1),0,0
movesprite lifes(2),0,0
movesprite lifes(3),0,0
movesprite lifes(4),0,0
movesprite lifes(5),0,0
exit select
case 1
movesprite lifes(1),120+(1*16),130
movesprite lifes(2),0,0
movesprite lifes(3),0,0
movesprite lifes(4),0,0
movesprite lifes(5),0,0
exit select
case 2
movesprite lifes(1),120+(1*16),130
movesprite lifes(2),120+(2*16),130
movesprite lifes(3),0,0
movesprite lifes(4),0,0
movesprite lifes(5),0,0
exit select
case 3
movesprite lifes(1),120+(1*16),130
movesprite lifes(2),120+(2*16),130
movesprite lifes(3),120+(3*16),130
movesprite lifes(4),0,0
movesprite lifes(5),0,0
exit select
case 4
movesprite lifes(1),120+(1*16),130
movesprite lifes(2),120+(2*16),130
movesprite lifes(3),120+(3*16),130
movesprite lifes(4),120+(4*16),130
movesprite lifes(5),0,0
exit select
case 5
movesprite lifes(1),120+(1*16),130
movesprite lifes(2),120+(2*16),130
movesprite lifes(3),120+(3*16),130
movesprite lifes(4),120+(4*16),130
movesprite lifes(5),120+(5*16),130
exit select
end select
'for i=1 to LifePapi
'movesprite lifes(i),120+(i*16),130
'next
return
'///// Listing des Musiques /////
ChoixMusic:
Select case ChoixMusique
case 1
gosub music
exit select
case 2
gosub music1
exit select
case 3
gosub music2
exit select
end select
return
'///// On noircit l'écran /////
BlackScreen:
loadtiles blacktile,1,adressebonus+40
For Y = 1 To 30
For X = 1 To 40
DrawTile (adressebonus+40)+palette(0), X-1, Y-1
Next
Next
return
'///// Papi démarre le stage - Apparition en bas de l'écran /////
StartStage:
'Tempo
for i=1 to 2000
next
'Papi rentre dans la map !
ypapi--
ymami--
hautmami=1
sensmami=1
haut=1
sens=1
if ypapi<=300 then startmap=0
return
'///// Gestion Aggro IA /////
declare sub AggroIA( N as integer )
'Init Balle
if goballe!=2 then
tempoaggro=tempoaggro+1
if tempoaggro>=timeaggro then
spriteballex=xofficier(n)+10
spriteballey=yofficier(n)+10
goballe=2
numberaggro=n
tempoaggro=1
idaggro=idaggro
sensspriteballe=sensofficier(n)
'Son tir
gosub colt45
end if
end if
end sub
'///// Conversion Coordonnées / Echelle /////
ScaleCoord:
XScale=Xpapi/scale
Yscale=Ypapi/scale
return
'///// Conversion Coordonnées Mami / Echelle /////
ScaleCoordMami:
XScaleMami=Xmami/scale
YscaleMami=YMami/scale
return
'///// Conversion Coordonnées Balle IA /////
ScaleBulletOfficier:
ballexscale=(spriteballex-12)/scale
balleyscale=(spriteballey-12)/scale
return
'///// Gestion Balle IA /////
BalleIA:
'Gestion Balle
select case sensspriteballe
case 1
spriteballey=spriteballey-speedballe
gosub scalebulletofficier
if obstacle(ballexscale,balleyscale)=2 then goballe=1:spriteballex=0:spriteballey=0
exit select
case 2
spriteballey=spriteballey+speedballe
gosub scalebulletofficier
if obstacle(ballexscale,balleyscale)=2 then goballe=1:spriteballex=0:spriteballey=0
exit select
case 3
spriteballex=spriteballex-speedballe
gosub scalebulletofficier
if obstacle(ballexscale,balleyscale)=2 then goballe=1:spriteballex=0:spriteballey=0
exit select
case 4
spriteballex=spriteballex+speedballe
gosub scalebulletofficier
if obstacle(ballexscale,balleyscale)=2 then goballe=1:spriteballex=0:spriteballey=0
exit select
case 5
spriteballey=spriteballey-speedballe
spriteballex=spriteballex+speedballe
gosub scalebulletofficier
if obstacle(ballexscale,balleyscale)=2 then goballe=1:spriteballex=0:spriteballey=0
exit select
case 6
spriteballey=spriteballey-speedballe
spriteballex=spriteballex-speedballe
gosub scalebulletofficier
if obstacle(ballexscale,balleyscale)=2 then goballe=1:spriteballex=0:spriteballey=0
exit select
case 7
spriteballey=spriteballey+speedballe
spriteballex=spriteballex+speedballe
gosub scalebulletofficier
if obstacle(ballexscale,balleyscale)=2 then goballe=1:spriteballex=0:spriteballey=0
exit select
case 8
spriteballey=spriteballey+speedballe
spriteballex=spriteballex-speedballe
gosub scalebulletofficier
if obstacle(ballexscale,balleyscale)=2 then goballe=1:spriteballex=0:spriteballey=0
exit select
end select
'Limite tableau :
IF spriteballex>450 then goballe=1:spriteballex=0:spriteballey=0
if spriteballex<120 then goballe=1:spriteballex=0:spriteballey=1
if spriteballey>340 then goballe=1:spriteballex=0:spriteballey=0
if spriteballey<=1 then goballe=1:spriteballex=0:spriteballey=0
'Collision Balle
if modegod!=1 then
collisionballex=(spriteballex-12)-xpapi
collisionballey=(spriteballey-12)-ypapi
if collisionballex>32768 then collisionballex=65535-collisionballex
if collisionballey>32768 then collisionballey=65535-collisionballey
if collisionballex<=12 [and] collisionballey<=12 then
lifepapi=lifepapi-1
modegod=1
gosub crimort
goballe=1:spriteballex=0:spriteballey=0
'Mort de Papi :(
if lifepapi<1 then
sequencemort=1
modegod=0
stopplay 0
movesprite lifes(1),0,0
movesprite lifes(2),0,0
movesprite lifes(3),0,0
movesprite lifes(4),0,0
movesprite lifes(5),0,0
end if
'gameover=2:nombrestage=1:deltamap=1:numeromap=1:goto debut:
end if
end if
movesprite spriteballe,spriteballex,spriteballey+scrolling
movesprite spriteballeombre,spriteballex,spriteballey+scrolling+8
return
InitSprite:
'Adresse de départ des TILE - Sprite
AdresseDepart=95
'Sprite Life
loadtiles Life,4,adressedepart
for i=1 to 5
lifes(i)=addsprite(2,2)
LifeMamiS(i)=addsprite(2,2)
propsprite lifes(i),adressedepart,0
propsprite LifeMamiS(i),adressedepart,0
next
'Sprite Cartouche
loadtiles Cartouche,4,adressedepart+4
CartoucheS=addsprite(2,2)
CartoucheMamiS=addsprite(2,2)
propsprite CartoucheMamiS,adressedepart+4,0
propsprite CartoucheS,adressedepart+4,0
adressedepart=adressedepart+5
'Palette Papi & Mami
palettes paletteSPRITES,3,0,16 'Palette Papi
'chargement des tiles
' Plan d'adressage : 128 : Sprite Papi
for i=16 to 30*16 step 16
c++
select case c
case 1
loadtiles hero1,16,adressedepart+i
exit select
case 2
loadtiles hero2,16,adressedepart+i
exit select
case 3
loadtiles hero3,16,adressedepart+i
exit select
case 4
loadtiles hero4,16,adressedepart+i
exit select
case 5
loadtiles hero5,16,adressedepart+i
exit select
case 6
loadtiles hero6,16,adressedepart+i
exit select
case 7
loadtiles hero7,16,adressedepart+i
exit select
case 8
loadtiles hero8,16,adressedepart+i
exit select
case 9
loadtiles hero9,16,adressedepart+i
exit select
case 10
loadtiles hero10,16,adressedepart+i
exit select
case 11
loadtiles hero11,16,adressedepart+i
exit select
case 12
loadtiles hero12,16,adressedepart+i
exit select
case 13
loadtiles hero13,16,adressedepart+i
exit select
case 14
loadtiles hero14,16,adressedepart+i
exit select
case 15
loadtiles hero15,16,adressedepart+i
exit select
case 16
loadtiles hero16,16,adressedepart+i
exit select
case 17
loadtiles hero17,16,adressedepart+i
exit select
case 18
loadtiles hero18,16,adressedepart+i
exit select
case 19
loadtiles hero19,16,adressedepart+i
exit select
case 20
loadtiles hero20,16,adressedepart+i
exit select
case 21
loadtiles hero21,16,adressedepart+i
exit select
case 22
loadtiles hero22,16,adressedepart+i
exit select
case 23
loadtiles hero23,16,adressedepart+i
exit select
case 24
loadtiles hero24,16,adressedepart+i
exit select
case 25
loadtiles hero25,16,adressedepart+i
exit select
case 26
loadtiles hero26,16,adressedepart+i
exit select
case 27
loadtiles hero27,16,adressedepart+i
exit select
case 28
loadtiles hero28,16,adressedepart+i
exit select
case 29
loadtiles hero29,16,adressedepart+i
exit select
case 30
loadtiles hero30,16,adressedepart+i
exit select
end select
next
'Bullets Papi
adressebulletpapi=adressedepart+(30*16)+16
for i=1 to 6
loadtiles bullet,1,adressebulletPapi+1
bulletpapis(i)=addsprite(1,1)
propsprite bulletpapis(i),adressebulletPapi+1,0
next
'Ombre Bullet
for i=1 to 6
loadtiles bulletombre,1,adressebulletPapi+2
bulletpapisombre(i)=addsprite(1,1)
propsprite bulletpapisombre(i),adressebulletPapi+2,0
next
'Balle Officier
adresseballe=adressebulletpapi+3
loadtiles bulletennemi,1,adresseballe
spriteballe=addsprite(1,1)
propsprite spriteballe,adresseballe,0
'adresseballe=(adressebulletpapi+12)+1
loadtiles bulletennemiombre,1,adresseballe+1
spriteballeOmbre=addsprite(1,1)
propsprite spriteballeombre,adresseballe+1,0
'Impact
adresseimpact=adresseballe+5
loadtiles ImpactTir,1,adresseimpact
'Sprite Score
adressescore=adresseimpact+1
j=0
for i=8 to 8*4 step 8
j++
Select case j
case 1
loadtiles score10,8,adressescore+i 'Score 10
exit select
case 2
loadtiles score25,8,adressescore+i 'Score 25
exit select
case 3
loadtiles score50,8,adressescore+i 'Score 50
exit select
case 4
loadtiles score100,8,adressescore+i 'Score 100
exit select
end select
next
j=0
ScoreS=addsprite(2,2)
propsprite scores,adressescore+8,0
adressetruck=adressescore+33
'Sprite Truck
palettes paletteGENERALE,0,0,16
loadtiles Truck1,16,adressetruck
loadtiles Truck2,16,adressetruck+16
loadtiles Truck3,16,adressetruck+33
loadtiles Truck4,16,adressetruck+50
loadtiles Truck1b,16,adressetruck+67
loadtiles Truck2b,16,adressetruck+84
loadtiles Truck3b,16,adressetruck+101
loadtiles Truck4b,16,adressetruck+118
for i=1 to 4
trucks(i)=addsprite(4,4)
Select case i
case 1
propsprite trucks(i),adressetruck,0
exit select
case 2
propsprite trucks(i),adressetruck+16,0
exit select
case 3
propsprite trucks(i),adressetruck+33,0
exit select
case 4
propsprite trucks(i),adressetruck+50,0
exit select
end select
next
'Sprite Officier & Ennemis
adresseofficier=adressetruck+119
nombreunite= 35
'Definition des sprites Papi
PapiSprite= addsprite(4,4)
propsprite PapiSprite,adressedepart+(16*11),3
'Definition des Sprites de Mami
MamiSprite=addsprite(4,4)
propsprite MamiSprite,adressedepart +(16*16),3
'Definition sprites Officiers & ennemis
for i=1 to nombreunite
OfficierS(i)=addsprite(4,4)
propsprite officiers(i),adresseofficier+(16*2),2
next
'Sprite Bonus
adressebonus=adresseofficier+(16*20)+16
loadtiles bonus1,8,adressebonus
loadtiles bonusombre,8,adressebonus+24
loadtiles bonus2,8,adressebonus+16
spritebonus=addsprite(2,2)
spritebonusombre=addsprite(2,2)
propsprite spritebonus,adressebonus,0
propsprite spritebonusombre,adressebonus+24,0
adressemap=adressebonus+40
return
'Gestion MAP
Declare sub GestionMap( N as integer)
CLS
' Init HitBox MAP
for i=1 to 55
for j=1 to 55
obstacle(i,j)=1
next
next
'n=3
' Selection de la map
n=2
if n=1 then nbobjet=16:reload mapdata1
if n=2 then nbobjet=66:reload mapdata2
if n=3 then nbobjet=24+39+13:reload mapdata3
'Test changement sprite ennemis / Stage
if n=1 then
j=0
timeaggro=50
typeunite=1
speedunit=1
speedballe=2
palettes paletteunit,2,0,16 'Palette Ennemi
'On précharge les frames d'animation pour gagner en vitesse ! Officiers
for i=16 to 16*20 step 16
j=j+1
select case j
case 1
loadtiles unit1,16,adresseofficier+i
exit select
case 2
loadtiles unit2,16,adresseofficier+i
exit select
case 3
loadtiles unit3,16,adresseofficier+i
exit select
case 4
loadtiles unit4,16,adresseofficier+i
exit select
case 5
loadtiles unit5,16,adresseofficier+i
exit select
case 6
loadtiles unit6,16,adresseofficier+i
exit select
case 7
loadtiles unit10,16,adresseofficier+i
exit select
case 8
loadtiles unit11,16,adresseofficier+i
exit select
case 9
loadtiles unit12,16,adresseofficier+i
exit select
case 10
loadtiles unit13,16,adresseofficier+i
exit select
case 11
loadtiles unit14,16,adresseofficier+i
exit select
case 12
loadtiles unit15,16,adresseofficier+i
exit select
case 13
loadtiles unit22,16,adresseofficier+i
exit select
case 14
loadtiles unit23,16,adresseofficier+i
exit select
case 15
loadtiles unit24,16,adresseofficier+i
exit select
case 16
loadtiles sang1,16,adresseofficier+i
exit select
case 17
loadtiles sang2,16,adresseofficier+i
exit select
case 18
loadtiles sang3,16,adresseofficier+i
exit select
case 19
loadtiles sang4,16,adresseofficier+i
exit select
case 20
loadtiles blanksprite,16,adresseofficier+i
exit select
end select
next
end if
if n=2 then
j=0
timeaggro=25
typeunite=2
speedunit=1
speedballe=3
palettes paletteunit,2,0,16 'Palette Ennemi
'On précharge les frames d'animation pour gagner en vitesse ! Officiers
for i=16 to 16*20 step 16
j=j+1
select case j
case 1
loadtiles unit25,16,adresseofficier+i
exit select
case 2
loadtiles unit26,16,adresseofficier+i
exit select
case 3
loadtiles unit27,16,adresseofficier+i
exit select
case 4
loadtiles unit28,16,adresseofficier+i
exit select
case 5
loadtiles unit29,16,adresseofficier+i
exit select
case 6
loadtiles unit30,16,adresseofficier+i
exit select
case 7
loadtiles unit34,16,adresseofficier+i
exit select
case 8
loadtiles unit35,16,adresseofficier+i
exit select
case 9
loadtiles unit36,16,adresseofficier+i
exit select
case 10
loadtiles unit37,16,adresseofficier+i
exit select
case 11
loadtiles unit38,16,adresseofficier+i
exit select
case 12
loadtiles unit39,16,adresseofficier+i
exit select
case 13
loadtiles unit46,16,adresseofficier+i
exit select
case 14
loadtiles unit47,16,adresseofficier+i
exit select
case 15
loadtiles unit48,16,adresseofficier+i
exit select
case 16
loadtiles sang1,16,adresseofficier+i
exit select
case 17
loadtiles sang2,16,adresseofficier+i
exit select
case 18
loadtiles sang3,16,adresseofficier+i
exit select
case 19
loadtiles sang4,16,adresseofficier+i
exit select
case 20
loadtiles blanksprite,16,adresseofficier+i
exit select
end select
next
end if
'Gestion HitBox Decor
for i=1 to nbobjet
readint hx(i),hy(i),ht(i)
obstacle(hx(i),hy(i))=ht(i)
next
ii:
'Configuration des Bases de données
tilesMAP:
datafile MapTileData.bin,BIN
tilesMAP_1:
datafile Map_1_TileData.bin,BIN
tilesMAP_2:
datafile Map_2_TileData.bin,BIN
PaletteMap:
datafile MapPalette.bin,BIN
paletteMAP_1:
datafile Map_1_Palette.bin,BIN
paletteMAP_2:
datafile Map_2_Palette.bin,BIN
MapDataMap:
datafile MapTileMap.bin,BIN
MapDataMap_1:
datafile Map_1_TileMap.bin,BIN
MapDataMap_2:
datafile Map_2_TileMap.bin,BIN
Select case N
case 1
nbtile=48
'Chargement des Données
loadtiles tilesmap,Nbtile,adressemap
pallettes paletteMAP,1,0,16
Reload mapdataMAP
exit select
case 2
Nbtile=127
'Chargement des Données
loadtiles tilesmap_1,Nbtile,adressemap
pallettes paletteMAP_1,1,0,16
Reload mapdataMAP_1
exit select
case 3
Nbtile=262
'Chargement des Données
loadtiles tilesmap_2,Nbtile,adressemap
pallettes paletteMAP_2,1,0,16
Reload mapdataMAP_2
exit select
end select
'Definition champ de bataille
For y= 1 to 75
For x = 1 To 40
ReadInt AuxInt
DrawTile adressebonus+40+auxint+palette(1), X-1, Y+400
Next
Next
'DATA MAP des HitBox
MAPDATA1:
dataint 22,32,2,22,31,2
dataint 23,32,2,23,31,2
dataint 24,32,2,24,31,2
dataint 25,32,2,25,31,2
dataint 41,24,2,41,23,2
dataint 42,24,2,42,23,2
dataint 43,24,2,43,23,2
dataint 44,24,2,44,23,2
MAPDATA2:
dataint 33,29,2,33,28,2,33,27,2,33,26,2
dataint 34,29,2,34,28,2,34,27,2,34,26,2
dataint 35,29,2,35,28,2,35,27,2,35,26,2
dataint 36,29,2,36,28,2,36,27,2,36,26,2
dataint 37,29,2,37,28,2,37,27,2,37,26,2
dataint 38,29,2,38,28,2,38,27,2,38,26,2
dataint 30,21,2,30,20,2,30,19,2,30,18,2
dataint 29,21,2,29,20,2,29,19,2,29,18,2
dataint 28,21,2,28,20,2,28,19,2,28,18,2
dataint 27,21,2,27,20,2,27,19,2,27,18,2
dataint 26,21,2,26,20,2,26,19,2,26,18,2
dataint 25,21,2,25,20,2,25,19,2,25,18,2
dataint 50,16,2,50,15,2,50,14,2
dataint 49,16,2,49,15,2,49,14,2
dataint 48,16,2,48,15,2,48,14,2
dataint 47,16,2,47,15,2,47,14,2
dataint 46,16,2,46,15,2,46,14,2
dataint 45,16,2,45,15,2,45,14,2
MAPDATA3:
dataint 26,29,2,26,28,2,26,27,2,26,26,2
dataint 25,29,2,25,28,2,25,27,2,25,26,2
dataint 24,29,2,24,28,2,24,27,2,24,26,2
dataint 23,29,2,23,28,2,23,27,2,23,26,2
dataint 22,29,2,22,28,2,22,27,2,22,26,2
dataint 21,29,2,21,28,2,21,27,2,21,26,2
dataint 22,24,2,22,23,2
dataint 21,24,2,21,23,2
dataint 20,24,2,20,23,2
dataint 19,24,2,19,23,2
dataint 18,24,2,18,23,2
dataint 17,24,2,17,23,2
dataint 34,16,2,34,15,2
dataint 33,16,2,33,15,2
dataint 32,16,2,32,15,2
dataint 31,16,2,31,15,2
dataint 30,16,2,30,15,2
dataint 29,16,2,29,15,2
dataint 46,12,2,46,11,2
dataint 45,12,2,45,11,2
dataint 44,12,2,44,11,2
dataint 43,12,2,43,11,2
dataint 42,12,2,42,11,2
dataint 41,12,2,41,11,2
dataint 16,17,2,16,16,2,16,15,2
dataint 52,25,2,52,24,2,52,23,2,52,22,2
dataint 51,25,2,51,24,2,51,23,2,51,22,2
dataint 50,25,2,50,24,2,50,23,2,50,22,2
end sub
'Gestion Bonus
MessageBonus:
tempomessagebonus=tempomessagebonus+1
if validemessage=2 then
'Les joueurs rigolent un peu.
if idbonus=1 then gosub rirepapi else gosub riremami
select case typebonus
'Bonus Vitesse
case 1
if IDbonus=1 then locate 12,5:print "PAPI GAIN BONUS SPEED X2 !" else locate 12,5:print "MAMI GAIN BONUS SPEED X2 !"
exit select
'15 Balles en plus
case 2
if IDBONUS=1 then locate 12,8:print "PAPI GAIN 15 BULLETS !" else locate 12,8:print "MAMI GAIN 15 BULLETS !"
exit select
'Ennemis immobilisés !
case 3
locate 10,5:print "BONUS IMMOBILIZED ENNEMY !"
exit select
'Balles Transpercantes
case 4
if IDBONUS=1 then locate 12,4:print "PAPI GAIN ARMOR PIERCING BULLET !" else locate 12,4:print "MAMI GAIN ARMOR PIERCING BULLET !"
exit select
end select
end if
if tempomessagebonus>150 then
validemessage=1
tempomessagebonus=1
'Gain des Bonus gagnés !
select case IDBonus
case 1
if typebonus=2 then nombreballe=nombreballe+15
if typebonus=1 then speedpapi=2
if typebonus=3 then typebonus=9
if typebonus=4 then typebonus=10
cls
exit select
case 2
if typebonus=2 then nombreballemami=nombreballemami+15
if typebonus=1 then speedmami=2
if typebonus=3 then typebonus=9
if typebonus=4 then typebonus=10
cls
exit select
end select
end if
return
GestionBonus:
if gobonus=1 then Tempobonus=tempobonus+1
randomize (tempobonus)
if tempobonus>rnd(5000) then GoBonus=2
if gobonus=2 then gosub startbonus:
return
StartBonus:
bonusanimation++
select case sensbonus
case 1
bonusx=bonusx+1
bonusy=bonusy-1
if bonusx>410 then sensbonus=2
if bonusy<=1 then sensbonus=3
exit select
case 2
bonusx=bonusx-1
bonusy=bonusy-1
if bonusx<=140 then sensbonus=3
if bonusy<=1 then sensbonus=3
exit select
case 3
bonusx=bonusx+1
bonusy=bonusy+1
if bonusx>410 then sensbonus=4
if bonusy>320 then sensbonus=1
exit select
case 4
bonusx=bonusx-1
bonusy=bonusy+1
if bonusx<140 then sensbonus=1
if bonusy>320 then sensbonus=2
exit select
end select
if sensbonus>4 then randomize bonusx:sensbonus=rnd(4)
psgvol 1,8
psg 1,100+bonusx
if bonusanimation <=15 then propsprite spritebonus,adressebonus,0
if bonusanimation>15 then propsprite spritebonus,adressebonus+16,0
if bonusanimation>30 then bonusanimation=1
movesprite spritebonus,bonusx,bonusy+scrolling
movesprite spritebonusombre,bonusx,bonusy+5+scrolling
'Collision Bonus
collisionbonus xpapi,ypapi,1
if mamienable=1 then collisionbonus xmami,ymami,2
return
'///// Collision Bonus / Joueurs /////
declare sub CollisionBonus(X1 as integer,Y1 as integer,ID as integer)
collisionbonusx=bonusx-X1
collisionbonusy=bonusy-Y1
if collisionbonusx>32768 then collisionbonusx=65535-collisionbonusx
if collisionbonusy>32768 then collisionbonusy=65535-collisionbonusy
if collisionbonusx<=20 [and] collisionbonusy<=20 then
movesprite spritebonus,0,0
movesprite spritebonusombre,0,0
propsprite scoreS,adressescore+24,0
scorejeu=scorejeu+50
deltascore=deltascore+50
deltascorelife=deltascorelife+50
displayscore=2
xscore=bonusx+8
yscore=bonusy
bonusanimation=1
'ID du joueur
IDbonus=ID
'son Bonus
gosub bonus
eventbonus=1
validemessage=2
gobonus=1
typebonus=typebonus+1
if typebonus>4 then typebonus=1
end if
end sub
'Init Routines
InitGame:
'Init Animation Papi
if tempo>10 then
AnimInit=sens
sens=0
tempo=0
end if
'Init Affiche Score Sprite
if displayscore=2 then temposcore=temposcore+1:yscore=yscore+-1
if temposcore>5 then psgvol 1,0
if temposcore>25 then
displayscore=1
temposcore=1
end if
return
'///// Gestion Score /////
GestionScore:
if stagevictoire!=2 then
locate 24,0:print "HISCORE "+hiscore$
movesprite cartoucheS,136,146
locate 2,3:print balle$
'Affichage Score selon le mode joueur ( 1 ou 2 )
if mamienable=0 then
if balle$="0" then
locate 10,15:print "OUT OF AMMO !!!"
end if
locate 0,31:print "2P"
locate 1,27:print "PRESS START"
locate 24,26:print "SCORE "+score$
'Gestion Hiscore
if scorejeu<10 then score$="0" else score$=str$(scorejeu)
if hiscorejeu<=scorejeu then hiscorejeu=scorejeu
hiscore$=str$(hiscorejeu)
if hiscorejeu<=1 then hiscore$="0"
balle$=str$(nombreballe)
if nombreballe<10 [and] RazScreen=1 then
RazScreen=2
cls
end if
else
'Gestion Hiscore
if hiscorejeu<=scorejeu then hiscorejeu=scorejeu
if hiscorejeu<=scoremami then hiscorejeu=scoremami
hiscore$=str$(hiscorejeu)
if hiscorejeu<=1 then hiscore$="0"
'Cote Mami
movesprite cartouchemamis,368,146
ballemami$=str$(nombreballemami)
locate 2,32:print ballemami$
if scoremami<10 then scoremami$="0" else scoremami$=str$(scoremami)
locate 4,29:print "SCORE "+scoremami$
if nombreballemami<10 [and] RazScreenMami=1 then
RazScreenMami=2
cls
end if
'Cote Papi
if scorejeu<10 then score$="0" else score$=str$(scorejeu)
balle$=str$(nombreballe)
if nombreballe<10 [and] RazScreen=1 then
RazScreen=2
cls
end if
if balle$="0" then
locate 5,0:print "OUT OF AMMO !!!"
end if
locate 4,0:print "SCORE "+score$
end if
'Tous les 1000 points : 1 vie en plus !
if lifepapi<5 then
if deltascorelife>=1000 then lifepapi=lifepapi+1:deltascorelife=1:bonusL=5:gosub bonus
end if
if lifepapi>5 then lifepapi=5
if bonusL=5 then
tempobonusL=tempobonusL+1
locate 10,12:print "GAIN EXTRA LIFE !!"
if tempobonusL>=100 then tempobonusL=1:bonusL=1:cls
end if
'Quand on cumule 450 points : 20 balles en plus !
if deltascore>=450 then nombreballe=nombreballe+20:deltascore=1:bonus=2
if nombreballe<1 then balle$="0"
'Tous les 250 points = + 20 Balles !!
if bonus=2 then
tempobonus=tempobonus+1
locate 10,5:print "BONUS SCORE 250 : 20 BULLETS !"
if tempobonus>=50 then tempobonus=1:bonus=1:cls
end if
end if
'Victoire !
if stagevictoire=2 then
gosub scrollingmapinit
'On efface les données d'écran
movesprite cartoucheS,0,0
movesprite lifes(1),0,0
movesprite lifes(2),0,0
movesprite lifes(3),0,0
movesprite lifes(4),0,0
movesprite lifes(5),0,0
movesprite cartouchemamis,0,0
movesprite lifemamis(1),0,0
movesprite lifemamis(2),0,0
movesprite lifemamis(3),0,0
movesprite lifemamis(4),0,0
movesprite lifemamis(5),0,0
'On efface le truck
gosub clrtruck
TruckEnable=0
stopplay 3
'On affiche les résultats
if mamienable=0 then locate 6,10:Print "WELL DONE PAPI !!" else locate 6,7:Print "WELL DONE PAPI AND MAMI !!"
locate 10,8:Print "GO TO THE NEXT STAGE "+str$(nombrestage+1)
locate 14,10:print " GAIN 5 BULLETS"
if scrollingscreenY>250 then
gameover=1
goto debut
end if
'if displayscore=1 then gameover=1:goto debut:
end if
return
ScrollingMapInit:
scrollingscreenY++
haut=1
hautmami=1
sensmami=1
sens=1
fire=1
firemami=0
speedpapi=1
speedmami=1
return
StageSuccess:
cls
psgvol 0,0:psgvol 1,0:psgvol 2,0
'reset scrolling
scroll up,(scrolling-1),SCROLL_B
gobonus=1
eventbonus=1
movesprite spritebonus,0,0
movesprite spritebonusombre,0,0
nombrestage=nombrestage+1
movesprite SpriteBalle,0,0
movesprite SpriteBalleOmbre,0,0
deltamap=deltamap+1
if deltaMap=5 then
numeromap=numeromap+1
if numeromap>2 then numeromap=2
deltamap=1
end if
'Arret musique
stopplay 0
'5 balles en plus !
nombreballe=nombreballe+5
if mamienable=1 then nombreballemami=nombreballemami+5
return
'///// Gestion Bullet Papi /////
InitBullet:
'Tempo de HitBox
TempoC++
if tempoc>10 then tempoc=1
'Init Balle Papi
if fire=2 then
rafale++
if rafale>rafalearmepapi then
rafale=1
for i=1 to 3
'Init Balle Papi
if moveballe(i)=0 then
IdBalle(i)=1
Xballe(i)=Xpapi+12
Yballe(i)=Ypapi+10
CheminBalle(i)=1
moveballe(i)=1
temposcore=1
sensballe(i)=sensbullet
CheminBalleMax(i)=PorteeArmePapi
nombreballe--
speedballe(i)=speedbullet
'Bruit de l'uzi
gosub uzi
exit for
end if
next
end if
end if
'Init Balle Mami
if mamienable=1 [and] firemami=1 then
rafalemami++
if rafalemami>10 then
rafalemami=1
for i=4 to 6
if moveballe(i)=0 then
IdBalle(i)=2
Xballe(i)=XMami+12
Yballe(i)=YMami+12
CheminBalle(i)=1
moveballe(i)=1
temposcore=1
Sensballe(i)=sensbulletmami
speedballe(i)=speedbulletmami
CheminBalleMax(i)=PorteeArmeMami
nombreballemami--
'Bruit du magnum
gosub magnum
exit for
end if
next
end if
end if
'Gestion Affichage Bullet
i=0
while i<=6
i++
'Mouvement Bullet & affichage
if MoveBalle(i)=1 then
gestionbullet (i)
movesprite bulletpapis(i),Xballe(i),Yballe(i)+scrolling
movesprite bulletpapisombre(i),Xballe(i),Yballe(i)+scrolling+8
end if
wend
fin:
return
'Tir Bullet Papi
declare sub GestionBullet(n as integer)
'Cas Mami
'Cas Papi
select case sensballe(n)
case 1
Yballe(n)=Yballe(n)-speedballe(n)
'course du bullet
CheminBalle(n)++
exit select
case 2
Yballe(n)=Yballe(n)+speedballe(n)
'course du bullet
CheminBalle(n)++
exit select
case 3
Xballe(n)=Xballe(n)-speedballe(n)
'course du bullet
CheminBalle(n)++
exit select
case 4
Xballe(n)=Xballe(n)+speedballe(n)
'course du bullet
CheminBalle(n)++
exit select
case 5
Yballe(n)=Yballe(n)-speedballe(n)
Xballe(n)=Xballe(n)+speedballe(n)
'course du bullet
CheminBalle(n)++
if idballe=2 then CheminBalleMax(n)=31 else CheminBalleMax(n)=19
exit select
case 6
Yballe(n)=Yballe(n)-speedballe(n)
Xballe(n)=Xballe(n)-speedballe(n)
'course du bullet
CheminBalle(n)++
if idballe=2 then CheminBalleMax(n)=31 else CheminBalleMax(n)=19
exit select
case 7
Yballe(n)=Yballe(n)+speedballe(n)
Xballe(n)=Xballe(n)+speedballe(n)
'course du bullet
CheminBalle(n)++
if idballe=2 then CheminBalleMax(n)=31 else CheminBalleMax(n)=19
exit select
case 8
Yballe(n)=Yballe(n)+speedballe(n)
Xballe(n)=Xballe(n)-speedballe(n)
'course du bullet
CheminBalle(n)++
if idballe=2 then CheminBalleMax(n)=31 else CheminBalleMax(n)=19
exit select
end select
'Conversion Scale & gestion hitbox
Scalebullet n
if obstacle(XbScale(n),YbScale(n))=2 then MoveBalle(n)=0:Xballe(n)=0:Yballe(n)=0:CheminBalle(n)=1
'Limite tableau :
IF Xballe(n)>450 then MoveBalle(n)=0:Xballe(n)=0:Yballe(n)=0:CheminBalle(n)=1:propsprite bulletpapis(n),adressebulletPapi+1,0
if Xballe(n)<120 then MoveBalle(n)=0:Xballe(n)=0:Yballe(n)=0:CheminBalle(n)=1:propsprite bulletpapis(n),adressebulletPapi+1,0
if Yballe(n)>340 then MoveBalle(n)=0:Xballe(n)=0:Yballe(n)=0:CheminBalle(n)=1:propsprite bulletpapis(n),adressebulletPapi+1,0
if Yballe(n)<=1 then MoveBalle(n)=0:Xballe(n)=0:Yballe(n)=0:CheminBalle(n)=1:propsprite bulletpapis(n),adressebulletPapi+1,0
'Limite de la course des Bullets
if CheminBalle(n)>=CheminBalleMax(n) [and] MoveBalle(n)=1 then
propsprite bulletpapis(n),adresseimpact,0
impacttempo(n)++
if impacttempo(n)>=7 then
propsprite bulletpapis(n),adressebulletPapi+1,0
MoveBalle(n)=0:Xballe(n)=0:Yballe(n)=0
impacttempo(n)=0
end if
end if
'Collision avec le Truck
if hittruck=0 then
Cx=(Xballe(n)-8)-(xtruck)
Cy=(Yballe(n)-4)-(ytruck+10)
if cx>32768 then cx=65535-cx
if cy>32768 then cy=65535-cy
if cx<=40 [and] cy<=16 then
hittruck=1
gosub impact
MoveBalle(n)=1
Xballe(n)=0
Yballe(n)=0
CheminBalle(n)=1
propsprite bulletpapis(n),adressebulletPapi+1,0
end if
end if
'Collision avec Ennemis
if tempoc>cpuhitbox then
for j=1 to nombreeffectif
if mortofficier(j)=1 [and] Moveballe(n)=1 then
Collisionx(j)=(Xballe(n)-8)-xofficier(j)
Collisiony(j)=(Yballe(n)-4)-yofficier(j)
if Collisionx(j)>32768 then Collisionx(j)=65535-Collisionx(j)
if Collisiony(j)>32768 then Collisiony(j)=65535-Collisiony(j)
if Collisionx(j)<=16 [and] Collisiony(j)<=16 then
'mortofficier(j)=3
if typebonus!=10 then
Moveballe(n)=1
Xballe(n)=0
Yballe(n)=0
CheminBalle(n)=1
propsprite bulletpapis(n),adressebulletPapi+1,0
end if
'Gestion HitPoint & Score si mort
lifeunite(j)=lifeunite(j)-1
hitunite(j)=2
'Beep de toucher
if lifeunite(j)!=0 then
gosub ouh
'psgvol 2,15
'psg 2,850
end if
if lifeunite(j)<1 then
'On adapte le score / Ennemies
if typeunite=1 then scoreunit=8:scoreunite=10
if typeunite=2 then scoreunit=16:scoreunite=25
propsprite scoreS,adressescore+ScoreUnit,0
hitunite(j)=1
mortofficier(j)=3
displayscore=2
xscore=xofficier(j)+8
yscore=yofficier(j)
nombreunitemap=nombreunitemap-1
aggrotempo=200 'Tempo d'aggro
'Score Papi
if idballe(n)=1 then
scorejeu=scorejeu+scoreunite
else
scoremami=scoremami+scoreunite
end if
deltascore=deltascore+scoreunite
deltascorelife=deltascorelife+scoreunite
'Cris de mort !
typemort++
if typemort>4 then typemort=1
select case typemort
case 1
gosub mort
exit select
case 2
gosub mort1
exit select
case 3
gosub mort2
exit select
case 4
gosub mort3
exit select
end select
'if nombreunitemap<10 then cls
'Victoire !! On incremente les unites de 1
if nombreunitemap<1 then stopplay 0:gosub bravo:cls:stagevictoire=2
end if
'On sort de la boucle !
exit for
end if
end if
next
'tempoc=1
end if
end sub
'Gestion Z
Zorder:
for j=1 to 325
for i=1 to nombreeffectif
if yofficier(i)=j then
h=h+1
'print str$(i)+":"+str$(adressedepart+(16*h))+". ";
propsprite officiers(i),adressedepart+(16*h),2
end if
next
h=0
next
return
'Gestion Animation
GestionAnimation:
if stagevictoire=2 then sens=1:sensmami=1
if startmap=1 then sens=1:sensmami=1
'Coté Mami
if mamienable=1 then
if sensmami>=1 then animationmami++
if animationmami <10 then
select case sensmami
case 1
propsprite MamiSprite,adressedepart+(16*22),3
exit case
case 2
propsprite MamiSprite,adressedepart+(16*16),3
exit case
case 3
propsprite MamiSprite,adressedepart+(16*19),3
exit case
case 4
propsprite MamiSprite,adressedepart+(16*19)+hfliptile(1),3
exit case
case 5
propsprite MamiSprite,adressedepart+(16*28)+hfliptile(1),3
exit case
case 6
propsprite MamiSprite,adressedepart+(16*28),3
exit case
case 7
propsprite MamiSprite,adressedepart+(16*25)+hfliptile(1),3
exit case
case 8
propsprite MamiSprite,adressedepart+(16*25),3
exit case
end select
end if
if animationmami >10 [and] animationmami <=20 then
select case sensmami
case 1
propsprite MamiSprite,adressedepart+(16*23),3
exit case
case 2
propsprite MamiSprite,adressedepart+(16*17),3
exit case
case 3
propsprite MamiSprite,adressedepart+(16*20),3
exit case
case 4
propsprite MamiSprite,adressedepart+(16*20)+hfliptile(1),3
exit case
case 5
propsprite MamiSprite,adressedepart+(16*29)+hfliptile(1),3
exit case
case 6
propsprite MamiSprite,adressedepart+(16*29),3
exit case
case 7
propsprite MamiSprite,adressedepart+(16*26)+hfliptile(1),3
exit case
case 8
propsprite MamiSprite,adressedepart+(16*26),3
exit case
end select
end if
if animationmami > 20 [and] animationmami <=30 then
select case sensmami
case 1
propsprite MamiSprite,adressedepart+(16*24),3
exit case
case 2
propsprite MamiSprite,adressedepart+(16*18),3
exit case
case 3
propsprite MamiSprite,adressedepart+(16*21),3
exit case
case 4
propsprite MamiSprite,adressedepart+(16*21)+hfliptile(1),3
exit case
case 5
propsprite MamiSprite,adressedepart+(16*30)+hfliptile(1),3
exit case
case 6
propsprite MamiSprite,adressedepart+(16*30),3
exit case
case 7
propsprite MamiSprite,adressedepart+(16*27)+hfliptile(1),3
exit case
case 8
propsprite MamiSprite,adressedepart+(16*27),3
exit case
end select
end if
if animationmami > 30 [and] animationmami <=40 then
select case sensmami
case 1
propsprite MamiSprite,adressedepart+(16*23),3
exit case
case 2
propsprite MamiSprite,adressedepart+(16*17),3
exit case
case 3
propsprite MamiSprite,adressedepart+(16*20),3
exit case
case 4
propsprite MamiSprite,adressedepart+(16*20)+hfliptile(1),3
exit case
case 5
propsprite MamiSprite,adressedepart+(16*29)+hfliptile(1),3
exit case
case 6
propsprite MamiSprite,adressedepart+(16*29),3
exit case
case 7
propsprite MamiSprite,adressedepart+(16*27)+hfliptile(1),3
exit case
case 8
propsprite MamiSprite,adressedepart+(16*27),3
exit case
end select
end if
'Init animation Mami
if animationmami > 40 then animationmami=1
if initmami=1 then
select case sensmami
case 1
propsprite MamiSprite,adressedepart+(16*23),3
exit case
case 2
propsprite MamiSprite,adressedepart+(16*17),3
exit case
case 3
propsprite MamiSprite,adressedepart+(16*20),3
exit case
case 4
propsprite MamiSprite,adressedepart+(16*20)+hfliptile(1),3
exit case
case 5
propsprite MamiSprite,adressedepart+(16*29)+hfliptile(1),3
exit case
case 6
propsprite MamiSprite,adressedepart+(16*29),3
exit case
case 7
propsprite MamiSprite,adressedepart+(16*27)+hfliptile(1),3
exit case
case 8
propsprite MamiSprite,adressedepart+(16*27),3
exit case
end select
end if
end if
'Gestion animation coté Papi
if sens>=1 then animation++
if animation <10 then
select case sens
case 1
propsprite PapiSprite,adressedepart+(16*7),3
exit case
case 2
propsprite PapiSprite,adressedepart+(16*1),3
exit case
case 3
propsprite PapiSprite,adressedepart+(16*4),3
exit case
case 4
propsprite PapiSprite,adressedepart+(16*4)+hfliptile(1),3
exit case
case 5
propsprite PapiSprite,adressedepart+(16*13)+hfliptile(1),3
exit case
case 6
propsprite PapiSprite,adressedepart+(16*13),3
exit case
case 7
propsprite PapiSprite,adressedepart+(16*10)+hfliptile(1),3
exit case
case 8
propsprite PapiSprite,adressedepart+(16*10),3
exit case
end select
end if
if animation >10 [and] animation <=20 then
select case sens
case 1
propsprite PapiSprite,adressedepart+(16*8),3
exit case
case 2
propsprite PapiSprite,adressedepart+(16*2),3
exit case
case 3
propsprite PapiSprite,adressedepart+(16*5),3
exit case
case 4
propsprite PapiSprite,adressedepart+(16*5)+hfliptile(1),3
exit case
case 5
propsprite PapiSprite,adressedepart+(16*14)+hfliptile(1),3
exit case
case 6
propsprite PapiSprite,adressedepart+(16*14),3
exit case
case 7
propsprite PapiSprite,adressedepart+(16*11)+hfliptile(1),3
exit case
case 8
propsprite PapiSprite,adressedepart+(16*11),3
exit case
end select
end if
if animation > 20 [and] animation <=30 then
select case sens
case 1
propsprite PapiSprite,adressedepart+(16*9),3
exit case
case 2
propsprite PapiSprite,adressedepart+(16*3),3
exit case
case 3
propsprite PapiSprite,adressedepart+(16*6),3
exit case
case 4
propsprite PapiSprite,adressedepart+(16*6)+hfliptile(1),3
exit case
case 5
propsprite PapiSprite,adressedepart+(16*15)+hfliptile(1),3
exit case
case 6
propsprite PapiSprite,adressedepart+(16*15),3
exit case
case 7
propsprite PapiSprite,adressedepart+(16*12)+hfliptile(1),3
exit case
case 8
propsprite PapiSprite,adressedepart+(16*12),3
exit case
end select
end if
if animation > 30 [and] animation <=40 then
select case sens
case 1
propsprite PapiSprite,adressedepart+(16*8),3
exit case
case 2
propsprite PapiSprite,adressedepart+(16*2),3
exit case
case 3
propsprite PapiSprite,adressedepart+(16*5),3
exit case
case 4
propsprite PapiSprite,adressedepart+(16*5)+hfliptile(1),3
exit case
case 5
propsprite PapiSprite,adressedepart+(16*14)+hfliptile(1),3
exit case
case 6
propsprite PapiSprite,adressedepart+(16*14),3
exit case
case 7
propsprite PapiSprite,adressedepart+(16*12)+hfliptile(1),3
exit case
case 8
propsprite PapiSprite,adressedepart+(16*12),3
exit case
end select
end if
'Init animation Papi
if animation > 40 then animation=1
if initpapi=1 then
select case sens
case 1
propsprite PapiSprite,adressedepart+(16*8),3
exit case
case 2
propsprite PapiSprite,adressedepart+(16*2),3
exit case
case 3
propsprite PapiSprite,adressedepart+(16*5),3
exit case
case 4
propsprite PapiSprite,adressedepart+(16*5)+hfliptile(1),3
exit case
case 5
propsprite PapiSprite,adressedepart+(16*14)+hfliptile(1),3
exit case
case 6
propsprite PapiSprite,adressedepart+(16*14),3
exit case
case 7
propsprite PapiSprite,adressedepart+(16*12)+hfliptile(1),3
exit case
case 8
propsprite PapiSprite,adressedepart+(16*12),3
exit case
end select
end if
if animation <10 then
select case sens
case 1
propsprite PapiSprite,adressedepart+(16*7),3
exit case
case 2
propsprite PapiSprite,adressedepart+(16*1),3
exit case
case 3
propsprite PapiSprite,adressedepart+(16*4),3
exit case
case 4
propsprite PapiSprite,adressedepart+(16*4)+hfliptile(1),3
exit case
case 5
propsprite PapiSprite,adressedepart+(16*13)+hfliptile(1),3
exit case
case 6
propsprite PapiSprite,adressedepart+(16*13),3
exit case
case 7
propsprite PapiSprite,adressedepart+(16*10)+hfliptile(1),3
exit case
case 8
propsprite PapiSprite,adressedepart+(16*10),3
exit case
end select
end if
if animation >10 [and] animation <=20 then
select case sens
case 1
propsprite PapiSprite,adressedepart+(16*8),3
exit case
case 2
propsprite PapiSprite,adressedepart+(16*2),3
exit case
case 3
propsprite PapiSprite,adressedepart+(16*5),3
exit case
case 4
propsprite PapiSprite,adressedepart+(16*5)+hfliptile(1),3
exit case
case 5
propsprite PapiSprite,adressedepart+(16*14)+hfliptile(1),3
exit case
case 6
propsprite PapiSprite,adressedepart+(16*14),3
exit case
case 7
propsprite PapiSprite,adressedepart+(16*11)+hfliptile(1),3
exit case
case 8
propsprite PapiSprite,adressedepart+(16*11),3
exit case
end select
end if
if animation > 20 [and] animation <=30 then
select case sens
case 1
propsprite PapiSprite,adressedepart+(16*9),3
exit case
case 2
propsprite PapiSprite,adressedepart+(16*3),3
exit case
case 3
propsprite PapiSprite,adressedepart+(16*6),3
exit case
case 4
propsprite PapiSprite,adressedepart+(16*6)+hfliptile(1),3
exit case
case 5
propsprite PapiSprite,adressedepart+(16*15)+hfliptile(1),3
exit case
case 6
propsprite PapiSprite,adressedepart+(16*15),3
exit case
case 7
propsprite PapiSprite,adressedepart+(16*12)+hfliptile(1),3
exit case
case 8
propsprite PapiSprite,adressedepart+(16*12),3
exit case
end select
end if
if animation > 30 [and] animation <=40 then
select case sens
case 1
propsprite PapiSprite,adressedepart+(16*8),3
exit case
case 2
propsprite PapiSprite,adressedepart+(16*2),3
exit case
case 3
propsprite PapiSprite,adressedepart+(16*5),3
exit case
case 4
propsprite PapiSprite,adressedepart+(16*5)+hfliptile(1),3
exit case
case 5
propsprite PapiSprite,adressedepart+(16*14)+hfliptile(1),3
exit case
case 6
propsprite PapiSprite,adressedepart+(16*14),3
exit case
case 7
propsprite PapiSprite,adressedepart+(16*12)+hfliptile(1),3
exit case
case 8
propsprite PapiSprite,adressedepart+(16*12),3
exit case
end select
end if
'Init animation Papi
if animation > 40 then animation=1
if initpapi=1 then
select case sens
case 1
propsprite PapiSprite,adressedepart+(16*8),3
exit case
case 2
propsprite PapiSprite,adressedepart+(16*2),3
exit case
case 3
propsprite PapiSprite,adressedepart+(16*5),3
exit case
case 4
propsprite PapiSprite,adressedepart+(16*5)+hfliptile(1),3
exit case
case 5
propsprite PapiSprite,adressedepart+(16*14)+hfliptile(1),3
exit case
case 6
propsprite PapiSprite,adressedepart+(16*14),3
exit case
case 7
propsprite PapiSprite,adressedepart+(16*12)+hfliptile(1),3
exit case
case 8
propsprite PapiSprite,adressedepart+(16*12),3
exit case
end select
end if
return
MortPapi:
'Mort de Papi ... :(
temposangpapi++
for i=1 to 1000
next
locate 10,14:Print "GAME OVER !!"
movesprite PapiSprite,Xpapi,Ypapi+scrolling
if temposangpapi<=20 then propsprite PapiSprite,adresseofficier+(16*16),0
if temposangpapi>40 [and] temposangpapi <=60 then propsprite PapiSprite,adresseofficier+(16*17),0
if temposangpapi>60 [and] temposangpapi <=80 then propsprite PapiSprite,adresseofficier+(16*18),0
if temposangpapi>80 then propsprite PapiSprite,adresseofficier+(16*19),0
if temposangpapi>200 then
temposangpapi=0
sequencemort=0
stopplay 0
gameover=2:nombrestage=1:deltamap=1:numeromap=1:goto debut:
end if
return
'Affichage Sprite Papi
AfficheSprite:
'Coté Mami
if mamienable=1 then
movesprite MamiSprite,Xmami,Ymami+scrolling
end if
if modegod!=1 then
movesprite PapiSprite,Xpapi,Ypapi+scrolling
else
'Mode God, Papi clignote !
clignotement++
if clignotement<3 then
movesprite PapiSprite,Xpapi,Ypapi+scrolling
else
movesprite PapiSprite,0,0
end if
if clignotement>6 then clignotement=0
end if
'Affichage score
if displayscore=2 then movesprite scoreS,Xscore,Yscore+scrolling else movesprite scores,0,0
return
Declare sub AnimationIA( h as integer )
'Animation officier
animationofficier(h)++
if animationofficier(h)<=10 then
select case sensofficier(h)
case 1
propsprite officiers(h),adresseofficier+(16*7),2
exit case
case 2
propsprite officiers(h),adresseofficier+(16*1),2
exit case
case 3
propsprite officiers(h),adresseofficier+(16*4),2
exit case
case 4
propsprite officiers(h),adresseofficier+(16*4)+hfliptile(1),2
exit case
case 5
propsprite officiers(h),adresseofficier+(16*13)+hfliptile(1),2
exit case
case 6
propsprite officiers(h),adresseofficier+(16*13),2
exit case
case 7
propsprite officiers(h),adresseofficier+(16*10)+hfliptile(1),2
exit case
case 8
propsprite officiers(h),adresseofficier+(16*10),2
exit case
end select
Goto EndZ
end if
if animationofficier(h) >10 [and] animationofficier(h) <=20 then
select case sensofficier(h)
case 1
propsprite officiers(h),adresseofficier+(16*8),2
exit case
case 2
propsprite officiers(h),adresseofficier+(16*2),2
exit case
case 3
propsprite officiers(h),adresseofficier+(16*5),2
exit case
case 4
propsprite officiers(h),adresseofficier+(16*5)+hfliptile(1),2
exit case
case 5
propsprite officiers(h),adresseofficier+(16*14)+hfliptile(1),2
exit case
case 6
propsprite officiers(h),adresseofficier+(16*14),2
exit case
case 7
propsprite officiers(h),adresseofficier+(16*11)+hfliptile(1),2
exit case
case 8
propsprite officiers(h),adresseofficier+(16*11),2
exit case
end select
Goto EndZ
end if
if animationofficier(h) > 20 [and] animationofficier(h) <=30 then
select case sensofficier(h)
case 1
propsprite officiers(h),adresseofficier+(16*9),2
exit case
case 2
propsprite officiers(h),adresseofficier+(16*3),2
exit case
case 3
propsprite officiers(h),adresseofficier+(16*6),2
exit case
case 4
propsprite officiers(h),adresseofficier+(16*6)+hfliptile(1),2
exit case
case 5
propsprite officiers(h),adresseofficier+(16*15)+hfliptile(1),2
exit case
case 6
propsprite officiers(h),adresseofficier+(16*15),2
exit case
case 7
propsprite officiers(h),adresseofficier+(16*12)+hfliptile(1),2
exit case
case 8
propsprite officiers(h),adresseofficier+(16*12),2
exit case
end select
Goto EndZ
end if
if animationofficier(h) > 30 [and] animationofficier(h) <=40 then
select case sensofficier(h)
case 1
propsprite officiers(h),adresseofficier+(16*8),2
exit case
case 2
propsprite officiers(h),adresseofficier+(16*2),2
exit case
case 3
propsprite officiers(h),adresseofficier+(16*5),2
exit case
case 4
propsprite officiers(h),adresseofficier+(16*5+hfliptile(1)),2
exit case
case 5
propsprite officiers(h),adresseofficier+(16*14)+hfliptile(1),2
exit case
case 6
propsprite officiers(h),adresseofficier+(16*14),2
exit case
case 7
propsprite officiers(h),adresseofficier+(16*11)+hfliptile(1),2
exit case
case 8
propsprite officiers(h),adresseofficier+(16*11),2
exit case
end select
Goto EndZ
end if
endz:
if animationofficier(h)>40 then animationofficier(h)=1
end sub
'///// Scale Balles /////
declare sub ScaleBullet(U as integer)
xbscale(u)=(xballe(u)-12)/scale
ybscale(u)=(Yballe(u)-12)/scale
end sub
'///// Scale Coord Oficiers /////
declare sub ScaleOfficier(N as integer)
xofficierscale(n)=xofficier(n)/scale
yofficierscale(n)=yofficier(n)/scale
end sub
'///// Ajustement Vitesse fonction du nombre d'unité à l'écran ////
GestionSPEED:
'Avant la partie
if nombreeffectif<10 then NombreCPU=(NombreUnite-10)
if nombreeffectif>10 then NombreCPU=Nombreeffectif
if nombreeffectif<=5 then NombreCPU=(NombreUnite-7)
return
GestionSpeedGame:
'En cours de partie
if nombreunitemap<10 then NombreCPU=(NombreUnite-10)
if nombreunitemap>10 then NombreCPU=Nombreeffectif
if nombreunitemap<=5 then NombreCPU=(NombreUnite-7)
return
'Gestion Pad & Commandes
GestionPad:
'2P Player actif ?! START !!
if MamiEnable=0 then
if joypad(1).7 then
cls
speedmami=1
Xmami=XPapi+50
YMami=YPapi
MamiEnable=1
lifemami=3
nombreballemami=45
gosub StartMami
end if
end if
if mamienable=1 then
'Plus de balles !!
if ballemami$="0" then firemami=0
if joypad(1).0 THEN hautmami=1 else hautmami=0
if joypad(1).1 THEN basmami=1 else basmami=0
if joypad(1).2 THEN gauchemami=1 else gauchemami=0
if joypad(1).3 THEN droitemami=1 else droitemami=0
if joypad(1).6 then FireMami=1 else FireMami=0
end if
'Feu
if joypad(0).6 then fire=2 else fire=1
'Plus de Balles !
if balle$="0" then fire=1
if joypad(0).0 THEN haut=1 else haut=0
if joypad(0).1 THEN bas=1 else bas=0
if joypad(0).2 THEN gauche=1 else gauche=0
if joypad(0).3 THEN droite=1 else droite=0
return
'Gestion déplacement Papi
InitDeplacement:
'Coté Mami
if mamienable=1 then
if droitemami=0 [and] gauchemami=0 [and] hautmami=0 [and] basmami=0 then initmami=1 else initmami=0
if hautmami=1 then
ymami=ymami-speedmami
if stagevictoire=2 then goto suite411:
'Conversion Coord / scale
Gosub ScaleCoordMami
if obstacle(XscaleMami,YscaleMami-1)=2 then Ymami=Ymami+speedmami:goto suite111:
end if
suite111:
if basmami=1 then
ymami=ymami+speedmami
'Conversion Coord / scale
Gosub ScaleCoordMami
if obstacle(XscaleMami,YscaleMami+1)=2 then ymami=ymami-speedmami:goto suite211:
end if
suite211:
if gauchemami=1 then
xmami=xmami-speedmami
'Conversion Coord / scale
Gosub ScaleCoordMami
if obstacle(XscaleMami-1,YscaleMami)=2 then xmami=xmami+speedmami:goto suite311:
end if
suite311:
if droitemami=1 then
xmami=xmami+speedmami
'Conversion Coord / scale
Gosub ScaleCoordMami
if obstacle(XscaleMami+1,YscaleMami)=2 then xmami=xmami-speedmami:goto suite411:
end if
Suite411:
if hautmami=1 then sensmami=1:sensbulletmami=1
if Basmami=1 then sensmami=2:sensbulletmami=2
if Gauchemami=1 then sensmami=3:sensbulletmami=3
if Droitemami=1 then sensmami=4:sensbulletmami=4
if Hautmami=1 [and] Droitemami=1 then sensmami=5:sensbulletmami=5
if Hautmami=1 [and] Gauchemami=1 then sensmami=6:sensbulletmami=6
if Basmami=1 [and] Droitemami=1 then sensmami=7:sensbulletmami=7
if Basmami=1 [and] Gauchemami=1 then sensmami=8:sensbulletmami=8
'gestion Bullet Mami
'gosub InitBulletPapi
end if
'coté Papi
if droite=0 [and] gauche=0 [and] haut=0 [and] bas=0 then initpapi=1 else initpapi=0
if haut=1 then
ypapi=ypapi-speedpapi
if stagevictoire=2 then goto suite4:
'Conversion Coord / scale
Gosub ScaleCoord
if obstacle(xscale,yscale-1)=2 then ypapi=ypapi+speedpapi:goto suite1:
if ypapi >32 then scyh=scyh+speedpapi
if sconh=1 then
if scyh>90 then scrolling=scrolling+speedpapi
scroll down,speedpapi,SCROLL_B
scyoff=scyoff-speedpapi
scrollingy++
end if
end if
suite1:
if bas=1 then
ypapi=ypapi+speedpapi
'Conversion Coord / scale
Gosub ScaleCoord
if obstacle(xscale,yscale+1)=2 then ypapi=ypapi-speedpapi:goto suite2:
ScYH=ScYH-speedpapi
if scyh<=1 then scyh=1
if sconb=1 then
if scyh>90 then scrolling=scrolling-speedpapi
if scrolling<=1 then scrolling=1
scroll up,speedpapi,SCROLL_B
scyoff=scyoff+speedpapi
scrollingy--
if scrollingy<=1 then scrollingy=1
end if
end if
suite2:
if gauche=1 then
xpapi=xpapi-speedpapi
'Conversion Coord / scale
Gosub ScaleCoord
if obstacle(xscale-1,yscale)=2 then xpapi=xpapi+speedpapi:goto suite3:
end if
suite3:
if droite=1 then
xpapi=xpapi+speedpapi
'Conversion Coord / scale
Gosub ScaleCoord
if obstacle(xscale+1,yscale)=2 then xpapi=xpapi-speedpapi:goto suite4:
end if
Suite4:
if Haut=1 then sens=1:sensbullet=1
if Bas=1 then sens=2:sensbullet=2
if Gauche=1 then sens=3:sensbullet=3
if Droite=1 then sens=4:sensbullet=4
if Haut=1 [and] Droite=1 then sens=5:sensbullet=5
if Haut=1 [and] Gauche=1 then sens=6:sensbullet=6
if Bas=1 [and] Droite=1 then sens=7:sensbullet=7
if Bas=1 [and] Gauche=1 then sens=8:sensbullet=8
return
' assignation des palettes, Tiles
tilesTITRE:
datafile SceneTile.bin,BIN
'Palette Hit
PaletteHit:
DATAINT $0000,$0eee,$0eee,$0eee,$0eee,$0eee,$0eee,$0eee,$0eee,$0eee,$0eee,$0eee,$0eee,$0eee,$0eee,$0eee
'Palette avec effet de Fading
PaletteTitre0:
DATAINT $0000,$0000,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0
PaletteTitre1:
DATAINT $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
PaletteTitre2:
DATAINT $0000,$0000,$0002,$0002,$0002,$0022,$0002,$0222,$0000,$0000,$0000,$0000,$0000,$0002,$0000,$0002
PaletteTitre3:
DATAINT $0000,$0000,$0004,$0024,$0004,$0044,$0024,$0444,$0002,$0000,$0000,$0000,$0000,$0004,$0000,$0004
PaletteTitre4:
DATAINT $0000,$0000,$0006,$0046,$0026,$0066,$0246,$0666,$0004,$0000,$0000,$0000,$0000,$0006,$0002,$0006
PaletteTitre5:
DATAINT $0000,$0000,$0008,$0068,$0048,$0088,$0468,$0888,$0026,$0000,$0020,$0222,$0000,$0008,$0004,$0228
PaletteTitre6:
DATAINT $0000,$0000,$002A,$008A,$006A,$02AA,$068A,$0AAA,$0048,$0020,$0040,$0444,$0002,$000A,$0006,$044A
PaletteTitre7:
DATAINT $0000,$0000,$004C,$00AC,$008C,$04CC,$08AC,$0CCC,$026A,$0040,$0222,$0666,$0004,$000C,$0008,$066C
paletteTITRE:
DATAINT $0000,$0000,$006E,$02CE,$00AE,$06EE,$0ACE,$0EEE,$048C,$0262,$0444,$0888,$0006,$002E,$000A,$088E
mapdataTITRE:
datafile SceneTileMap.bin,BIN
paletteGENERALE: 'Palette des éléments du jeu
dataint $0000,$00EE,$0224,$004E,$000E,$00E0,$0E00,$008E,$0EEE,$0088,$0642,$0CCA,$0242,$0020,$0464,$0000 ' couleurs 8,9,A,B,C,D,E,F
paletteSPRITES: ' Palette de Papi
DATAINT $0C0E,$0000,$0EEE,$0AAC,$08CE,$0006,$0004,$000A
DATAINT $048C,$0446,$0688,$0222,$0020,$044E,$0262,$088E
paletteUnit: 'La Palette des sprites ennemis
DATAINT $0C0E,$0000,$0444,$0224,$048C,$0ACE,$06EE,$000E
DATAINT $066A,$080A,$026A,$068A,$0406,$0066,$000A,$0000
declare sub segalogo()
disable screen
ink 3
cls
loadtiles sega_logo,52,256
drawtilesinc 256, 13, 11, 13, 4
palettes sega_logo_f6,3,1,10
enable screen
sleep 3
palettes sega_logo_f5,3,1,10
sleep 3
palettes sega_logo_f4,3,1,10
sleep 3
palettes sega_logo_f3,3,1,10
sleep 3
palettes sega_logo_f2,3,1,10
sleep 3
palettes sega_logo_f1,3,1,10
sleep 3
palette &h0EEE, 3, 1
for a=0 to 1' Change the '1' to the number of "rolls" you want.
palettes sega_logo_r1,3,2,9
sleep 3
palettes sega_logo_r2,3,2,9
sleep 3
palettes sega_logo_r3,3,2,9
sleep 3
palettes sega_logo_r4,3,2,9
sleep 3
palettes sega_logo_r5,3,2,9
sleep 3
palettes sega_logo_r6,3,2,9
sleep 3
palettes sega_logo_r7,3,2,9
sleep 3
palettes sega_logo_r8,3,2,9
sleep 3
palettes sega_logo_r9,3,2,9
sleep 3
palettes sega_logo_r10,3,2,9
sleep 3
palettes sega_logo_r11,3,2,9
sleep 3
palettes sega_logo_r12,3,2,9
sleep 3
palettes sega_logo_r13,3,2,9
sleep 3
palettes sega_logo_r14,3,2,9
sleep 3
palettes sega_logo_r15,3,2,9
sleep 3
palettes sega_logo_r16,3,2,9
sleep 3
next
palettes sega_logo_r1,3,2,9
sleep 50
palettes sega_logo_f1,3,1,10
sleep 3
palettes sega_logo_f2,3,1,10
sleep 3
palettes sega_logo_f3,3,1,10
sleep 3
palettes sega_logo_f4,3,1,10
sleep 3
palettes sega_logo_f5,3,1,10
sleep 3
palettes sega_logo_f6,3,1,10
sleep 3
disable screen
cls
ink 0
enable screen
exit sub
end sub
BlankScreen:
disable screen
cls
ink 0
enable screen
return
sega_logo:
datafile segalogo.bin,BIN' 4x13
' Sega logo palette
' Fade in/out
sega_logo_f1:
DATAINT $0CCC,$0CA0,$0C80,$0C60,$0C40,$0C20,$0C00,$0C00,$0A00,$0800
sega_logo_f2:
DATAINT $0AAA,$0A80,$0A60,$0A40,$0A20,$0A00,$0A00,$0A00,$0800,$0600
sega_logo_f3:
DATAINT $0888,$0860,$0840,$0820,$0800,$0800,$0800,$0800,$0600,$0400
sega_logo_f4:
DATAINT $0666,$0640,$0620,$0600,$0600,$0600,$0600,$0600,$0400,$0200
sega_logo_f5:
DATAINT $0444,$0420,$0400,$0400,$0400,$0400,$0400,$0400,$0200,$0000
sega_logo_f6:
DATAINT $0222,$0200,$0200,$0200,$0200,$0200,$0200,$0200,$0000,$0000
' Palette rotation
sega_logo_r1:
DATAINT $0EC0,$0EA0,$0E80,$0E60,$0E40,$0E20,$0E00,$0C00,$0A00
sega_logo_r2:
DATAINT $0EA0,$0EC0,$0EA0,$0E80,$0E60,$0E40,$0E20,$0E00,$0C00
sega_logo_r3:
DATAINT $0E80,$0EA0,$0EC0,$0EA0,$0E80,$0E60,$0E40,$0E20,$0E00
sega_logo_r4:
DATAINT $0E60,$0E80,$0EA0,$0EC0,$0EA0,$0E80,$0E60,$0E40,$0E20
sega_logo_r5:
DATAINT $0E40,$0E60,$0E80,$0EA0,$0EC0,$0EA0,$0E80,$0E60,$0E40
sega_logo_r6:
DATAINT $0E20,$0E40,$0E60,$0E80,$0EA0,$0EC0,$0EA0,$0E80,$0E60
sega_logo_r7:
DATAINT $0E00,$0E20,$0E40,$0E60,$0E80,$0EA0,$0EC0,$0EA0,$0E80
sega_logo_r8:
DATAINT $0C00,$0E00,$0E20,$0E40,$0E60,$0E80,$0EA0,$0EC0,$0EA0
sega_logo_r9:
DATAINT $0A00,$0C00,$0E00,$0E20,$0E40,$0E60,$0E80,$0EA0,$0EC0
sega_logo_r10:
DATAINT $0C00,$0A00,$0C00,$0E00,$0E20,$0E40,$0E60,$0E80,$0EA0
sega_logo_r11:
DATAINT $0E00,$0C00,$0A00,$0C00,$0E00,$0E20,$0E40,$0E60,$0E80
sega_logo_r12:
DATAINT $0E20,$0E00,$0C00,$0A00,$0C00,$0E00,$0E20,$0E40,$0E60
sega_logo_r13:
DATAINT $0E40,$0E20,$0E00,$0C00,$0A00,$0C00,$0E00,$0E20,$0E40
sega_logo_r14:
DATAINT $0E60,$0E40,$0E20,$0E00,$0C00,$0A00,$0C00,$0E00,$0E20
sega_logo_r15:
DATAINT $0E80,$0E60,$0E40,$0E20,$0E00,$0C00,$0A00,$0C00,$0E00
sega_logo_r16:
DATAINT $0EA0,$0E80,$0E60,$0E40,$0E20,$0E00,$0C00,$0A00,$0C00
|
|