build 132

This commit is contained in:
2022-03-27 23:55:17 -04:00
parent bea5a776da
commit d343426b63
9 changed files with 389 additions and 1166 deletions
+19 -10
View File
@@ -4,42 +4,51 @@ by Tomasz 'pecus' Pecko and Pawel 'pirx' Kalinowski
Warsaw, Miami 2000, 2001, 2002, 2003, 2009, 2012, 2013, 2022 Warsaw, Miami 2000, 2001, 2002, 2003, 2009, 2012, 2013, 2022
you can contact us at pecus@poczta.fm or pirx@5oft.pl You can contact us at pecus@poczta.fm or pirx@5oft.pl
home page of this project is https://github.com/pkali/scorch_src home page of this project is https://github.com/pkali/scorch_src
this source code was compiled under OMC65 crossassembler This source code was originally compiled under OMC65 crossassembler
(https://github.com/pkali/omc65) (https://github.com/pkali/omc65)
and on 2012-06-21 translated to mads and on 2012-06-21 translated to mads
game source code is split into 5+1 parts: Game source code is split into 5+3 parts:
- scorch.asm is the main game code (with many assorted routines) - scorch.asm is the main game code (with many assorted routines)
- grafproc.asm - graphics routines like line or circle - grafproc.asm - graphics routines like line or circle
- textproc.asm - text routines like list of weapons and shop - textproc.asm - text routines like list of weapons and shop
- variables.asm - all non-zero page variables and constants - variables.asm - all non-zero page variables
- constants.asm - various tables of constants
- display.asm - display lists and text screen definitions - display.asm - display lists and text screen definitions
- ai.asm - artificial stupidity of computer opponents - ai.asm - artificial stupidity of computer opponents
- weapons.asm - general arsenal of tankies
we were trying to use as much macros and pseudo-ops as possible We were trying to use as much macros and pseudo-ops as possible.
they are defined in atari.hea and macro.hea files together with many They are defined in atari.hea and macro.hea files together with many
atari constants. This way it should be relatively easy to atari constants. This way it should be relatively easy to
port this code to e.g. C64 port this code to e.g. C64
After those N years of working on this piece of code After those N years of working on this piece of code
we are sure it would be much wiser to write it in C, Action! we are sure it would be much wiser to write it in C, Action!
or MadPascal but on the other hand it is so much fun to type 150 chars or MadPascal but on the other hand it is so much fun to type 150 chars
where you want to have y=ax+b :) where all you want to have y=ax+b :)
originally most variables were in Polish, comments were sparse Originally most variables were in Polish, comments were sparse
but we wanted to release this piece of code to public but we wanted to release this piece of code to public
and due to being always short of time/energy (to finish the game) and due to being always short of time/energy (to finish the game)
we decided it must go in 'English' to let other people work on it. we decided it must go in 'English' to let other people work on it.
it never happened, but we got some encouraging comments and we are still It never happened, but we got some encouraging comments and we are still
trying to do something from time to time. trying to do something from time to time.
with the advent of fujinet (https://fujinet.online/) we are thinking about making the game interplanetary, err, with multiplayer over the net. we'll see. With the advent of fujinet (https://fujinet.online/) we are thinking about making the game interplanetary, err, with multiplayer over the net. We'll see.
## Changes: ## Changes:
###### Build 132
2022-03-27
- fixed bug: https://github.com/pkali/scorch_src/issues/21 Wrong number of shells purchased
- fixed bug: https://github.com/pkali/scorch_src/issues/19 Inventory not cleared on next match. When fixing in a general way (cleaning all variables on game restart) I encountered a very old and nasty bug that made the game running basically by pure chance.
- fixed bug: https://github.com/pkali/scorch_src/issues/18 selecting players using fire sometimes selects more than one. Rewritten keyboard handling to prepare for enhancements like #17
- tables of constants moved to a separate file, variables declared with .DS directive in preparation for memory map optimization.
###### Build 131 ###### Build 131
2022-03-20 2022-03-20
- fixed bug: https://github.com/pkali/scorch_src/issues/4 It was really hard one, because I had to unspaghetti our own lousy code :] - fixed bug: https://github.com/pkali/scorch_src/issues/4 It was really hard one, because I had to unspaghetti our own lousy code :]
+1 -1
View File
@@ -1,4 +1,4 @@
; @com.wudsn.ide.asm.mainsourcefile=program.asm ; @com.wudsn.ide.asm.mainsourcefile=scorch.asm
; artificial intelligence of tanks goes here! ; artificial intelligence of tanks goes here!
; in A there is a level of tank's intelligence ; in A there is a level of tank's intelligence
+1 -1
View File
@@ -77,7 +77,7 @@ PlotLine = display + screenHeight*screenBytes ; the last line is plot pointer
;Screen displays go first to avoid crossing 4kb barrier ;Screen displays go first to avoid crossing 4kb barrier
;----------------------------------------------- ;-----------------------------------------------
OptionsScreen OptionsScreen
dta d"Welcome to Scorch ver. 131 (un)2000-2022" dta d"Welcome to Scorch ver. 132 (un)2000-2022"
dta d" Please select option with cursor keys " dta d" Please select option with cursor keys "
dta d" and press (Return) to proceed " dta d" and press (Return) to proceed "
OptionsHere OptionsHere
-12
View File
@@ -438,18 +438,6 @@ splot8 .proc
RTS RTS
.endp .endp
;--------------------------------------------------
WaitForKeyRelease .proc
;--------------------------------------------------
lda SKSTAT
cmp #$ff
beq KeyIsReleased
cmp #$f7
bne WaitForKeyRelease
KeyIsReleased
rts
.endp
;-------------------------------------------------- ;--------------------------------------------------
clearscreen .proc clearscreen .proc
;-------------------------------------------------- ;--------------------------------------------------
+97 -93
View File
@@ -11,13 +11,14 @@
;(https://github.com/pkali/omc65) ;(https://github.com/pkali/omc65)
;and on 2012-06-21 translated to mads ;and on 2012-06-21 translated to mads
; ;
;game source code is split into 5+1 parts: ;game source code is split into 5+2 parts:
;scorch.asm is the main game code (with many assorted routines) ;scorch.asm is the main game code (with many assorted routines)
;grafproc.asm - graphics routines like line or circle ;grafproc.asm - graphics routines like line or circle
;textproc.asm - text routines like list of weapons and shop ;textproc.asm - text routines like list of weapons and shop
;variables.asm - all non-zero page variables and constans ;variables.asm - all non-zero page variables and constans
;display.asm - display lists and text screen definitions ;display.asm - display lists and text screen definitions
;ai.asm - artificial stupidity of computer opponents ;ai.asm - artificial stupidity of computer opponents
;weapons.asm - general arsenal of tankies
;we were trying to use as much macros and pseudoops as possible ;we were trying to use as much macros and pseudoops as possible
;they are defined in atari.hea and macro.hea files together with many ;they are defined in atari.hea and macro.hea files together with many
@@ -91,6 +92,7 @@ MaxPlayers = 6
;----------------------------------------------- ;-----------------------------------------------
icl 'display.asm' icl 'display.asm'
;---------------------------------------------- ;----------------------------------------------
icl 'constants.asm'
icl 'variables.asm' icl 'variables.asm'
;-------------------------------------------------- ;--------------------------------------------------
OffensiveTexts OffensiveTexts
@@ -120,12 +122,11 @@ START
mva #0 TankNr mva #0 TankNr
loop01 @ jsr EnterPlayerName
jsr EnterPlayerName inc TankNr
inc TankNr lda TankNr
lda TankNr cmp NumberOfPlayers
cmp NumberOfPlayers bne @-
bne loop01
mwa #dl dlptrs mwa #dl dlptrs
lda dmactls lda dmactls
@@ -185,27 +186,12 @@ checkForHuman ; if all in skillTable other than 0 then switch to DEMO MODE
beq peopleAreHere beq peopleAreHere
dex dex
bpl checkForHuman bpl checkForHuman
tay
; no people, just wait a bit ; no people, just wait a bit
pause 150 pause 150
jmp noKey jmp noKey
peopleAreHere peopleAreHere
;key ; only if there is a human player jsr getkey
lda SKSTAT
cmp #$ff
beq checkFire
cmp #$f7
beq checkFire
jmp noKey ;key pressed, so go
checkFire
;------------JOY-------------
;happy happy joy joy
;check for joystick now
;fire
lda TRIG0
bne peopleAreHere ;fire not pressed, so loop
noKey noKey
ldx NumberOfPlayers ldx NumberOfPlayers
dex dex
@@ -267,11 +253,11 @@ Round .proc ;
lda #0 lda #0
tax tax
loop @
sta previousAngle,x sta previousAngle,x
inx inx
cpx #(clearEnd-PreviousAngle) cpx #(singleRoundVarsEnd-PreviousAngle)
bne loop bne @-
ldx #5 ldx #5
SettingEnergies SettingEnergies
@@ -317,11 +303,10 @@ SettingEnergies
jsr drawmountains ;draw them jsr drawmountains ;draw them
jsr drawtanks ;finally draw tanks jsr drawtanks ;finally draw tanks
.endp ; not really end of the procedure, but just for now. revisit. .endp ; not really end of the procedure, but just for now. TODO: revisit.
;--------------------round screen is ready--------- ;--------------------round screen is ready---------
;mva #0 TankNr
mva #0 TankSequencePointer mva #0 TankSequencePointer
MainRoundLoop MainRoundLoop
@@ -628,70 +613,8 @@ PlayerXdeath .proc
jmp AfterExplode jmp AfterExplode
;--------------------------------------------------
Explosion .proc
;--------------------------------------------------
;cleanup of the soil fall down ranges (left and right)
mwa #screenwidth RangeLeft
lda #0
sta RangeRight
sta RangeRight+1
ldx TankNr
lda ActiveWeapon,x
asl
.endp
Explosion2 .proc
tax
lda ExplosionRoutines+1,x
pha
lda ExplosionRoutines,x
pha
rts
ExplosionRoutines
.word babymissile-1
.word missile-1
.word babynuke-1
.word nuke-1
.word leapfrog-1
.word funkybomb-1
.word mirv-1
.word deathshead-1
.word VOID-1 ;napalm
.word VOID-1 ;hotnapalm
.word tracer-1
.word VOID-1 ;smoketracer
.word babyroller-1
.word roller-1
.word heavyroller-1
.word VOID-1 ;riotcharge
.word VOID-1 ;riotblast
.word riotbomb-1
.word heavyriotbomb-1
.word babydigger-1
.word digger-1
.word heavydigger-1
.word babysandhog-1
.word sandhog-1
.word heavysandhog-1
.word dirtclod-1
.word dirtball-1
.word tonofdirt-1
.word VOID-1 ;liquiddirt
.word dirtcharge-1
.word VOID-1 ;earthdisrupter
.word VOID-1 ;plasmablast
.word laser-1
VOID
rts
.endp
; ------------------------
icl 'weapons.asm' icl 'weapons.asm'
;-------------------------------------------------- ;--------------------------------------------------
DecreaseEnergyX .proc DecreaseEnergyX .proc
;Decreases energy of player nr X ;Decreases energy of player nr X
@@ -767,7 +690,7 @@ PMoutofScreen .proc
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
.nowarn .proc WeaponCleanup; .proc WeaponCleanup;
; cleaning of the weapon possesion tables ; cleaning of the weapon possesion tables
; (99 of Baby Missles, all other weapons=0) ; (99 of Baby Missles, all other weapons=0)
;-------------------------------------------------- ;--------------------------------------------------
@@ -792,8 +715,7 @@ loop05
Initialize .proc Initialize .proc
;Initialization sequence ;Initialization sequence
;-------------------------------------------------- ;--------------------------------------------------
;jsr GenerateOffensiveTextTables deletePtr = temp
;jsr GenerateDeffensiveTextTables
lda #0 lda #0
sta Erase sta Erase
@@ -802,6 +724,33 @@ Initialize .proc
sta oldPlotPointerX+1 sta oldPlotPointerX+1
sta GameIsOver sta GameIsOver
; clean variables
tay
mwa #variablesStart deletePtr
@ tya
sta (deletePtr),y
inw deletePtr
cpw deletePtr #variablesEnd
bne @-
lda #2
sta OptionsTable+2
sta OptionsTable+3
mwa #1024 RandBoundaryHigh
mva #$ff LastWeapon
sta HowMuchToFall
mva #1 color
mva #$40 MaxWind
mwa #$0080 Wind
mva #25 gravity
jsr WeaponCleanup
mva #$2 colpf2s mva #$2 colpf2s
mva #12 colpf3s mva #12 colpf3s
mva #>WeaponFont chbas mva #>WeaponFont chbas
@@ -1121,6 +1070,61 @@ nextishigher
rts rts
.endp .endp
;--------------------------------------------------
getkey .proc; waits for pressing a key and returns pressed value in A
;--------------------------------------------------
jsr WaitForKeyRelease
@
lda SKSTAT
cmp #$ff
beq checkJoyGetKey ; key not pressed, check Joy
lda kbcode
and #$3f ;CTRL and SHIFT ellimination
rts
checkJoyGetKey
;------------JOY-------------
;happy happy joy joy
;check for joystick now
lda JSTICK0
and #$0f
cmp #$0f
beq notpressedJoyGetKey
tay
lda joyToKeyTable,y
rts
notpressedJoyGetKey
;fire
lda TRIG0
bne @-
lda #$0c ;Return key
rts
.endp
;--------------------------------------------------
getkeynowait .proc;
;--------------------------------------------------
jsr WaitForKeyRelease
lda kbcode
and #$3f ;CTRL and SHIFT ellimination
rts
.endp
;--------------------------------------------------
WaitForKeyRelease .proc
;--------------------------------------------------
lda JSTICK0
and #$0f
cmp #$0f
bne WaitForKeyRelease
lda TRIG0
beq WaitForKeyRelease
lda SKSTAT
cmp #$ff
bne WaitForKeyRelease
KeyIsReleased
rts
.endp
;---------------------------------------------- ;----------------------------------------------
icl 'textproc.asm' icl 'textproc.asm'
;---------------------------------------------- ;----------------------------------------------
BIN
View File
Binary file not shown.
+9 -62
View File
@@ -6,62 +6,7 @@
; this module contains routines used in text mode ; this module contains routines used in text mode
; like shop and start-up options ; like shop and start-up options
;---------------------------------------- ;----------------------------------------
;--------------------------------------------------
getkey .proc; waits for pressing a key and returns pressed value in A
;--------------------------------------------------
pause 5
lda SKSTAT
cmp #$ff
beq lopx01
cmp #$f7
bne getkey ; I guess it waits for RELEASING a key
lda JSTICK0
and #$0f
cmp #$0f
bne getkey ; waits for not moving the joy
lda TRIG0
beq getkey ; waits for releasing FIRE
lopx01 lda SKSTAT
cmp #$ff
beq checkJoyGetKey ; key not pressed, check Joy
cmp #$f7
beq checkJoyGetKey ; key not pressed, check Joy
lda kbcode
and #$3f ;CTRL and SHIFT ellimination
rts
checkJoyGetKey
;------------JOY-------------
;happy happy joy joy
;check for joystick now
lda JSTICK0
and #$0f
cmp #$0f
beq notpressedJoyGetKey
tay
lda joyToKeyTable,y
rts
notpressedJoyGetKey
;fire
lda TRIG0
bne lopx01
lda #$0c ;Return key
rts
.endp
;--------------------------------------------------
getkeynowait .proc;
;--------------------------------------------------
lda SKSTAT
cmp #$ff
beq getkeynowait
cmp #$f7
beq getkeynowait ; I guess it waits for RELEASING a key
lda kbcode
and #$3f ;CTRL and SHIFT ellimination
rts
.endp
;-------------------------------------------------- ;--------------------------------------------------
Options .proc Options .proc
;-------------------------------------------------- ;--------------------------------------------------
@@ -682,6 +627,7 @@ SecondSelected
;-------------------------------------------------- ;--------------------------------------------------
.proc PurchaseWeaponNow .proc PurchaseWeaponNow
;-------------------------------------------------- ;--------------------------------------------------
weaponPtr = temp
isPriceZero = tempXRoller isPriceZero = tempXRoller
lda WhichList lda WhichList
@@ -718,17 +664,18 @@ PurchaseAll
; and add appropriate number of shells ; and add appropriate number of shells
lda TanksWeaponsTableL,x lda TanksWeaponsTableL,x
sta temp sta weaponPtr
lda TanksWeaponsTableH,x lda TanksWeaponsTableH,x
sta temp+1 sta weaponPtr+1
lda (temp),y ; and we have number of posessed bullets of the weapon clc
lda (weaponPtr),y ; and we have number of posessed bullets of the weapon
adc WeaponUnits,y adc WeaponUnits,y
sta (temp),y ; and we added appropriate number of bullets sta (weaponPtr),y ; and we added appropriate number of bullets
cmp #100 ; but there should be no more than 99 bullets cmp #100 ; but there should be no more than 99 bullets
bcc LessThan100 bcc LessThan100
lda #99 lda #99
sta (temp),y sta (weaponPtr),y
LessThan100 LessThan100
sty LastWeapon ; store last purchased weapon sty LastWeapon ; store last purchased weapon
; because we must put screen pointer next to it ; because we must put screen pointer next to it
@@ -739,7 +686,7 @@ LessThan100
lda isPriceZero lda isPriceZero
bne @+ bne @+
lda #0 lda #0
sta (temp),y sta (weaponPtr),y
@ @
jmp Purchase.AfterPurchase jmp Purchase.AfterPurchase
.endp .endp
@@ -1021,7 +968,7 @@ nextchar05
.proc SelectLevel .proc SelectLevel
; this routine highlights the choosen ; this routine highlights the choosen
; level of the computer opponent ; level of the computer opponent
ldx #$9 ; 9 possible levels ldx #8 ; 9 possible levels
CheckNextLevel01 CheckNextLevel01
lda LevelNameBeginL,x ; address on the screen lda LevelNameBeginL,x ; address on the screen
sta temp sta temp
+198 -978
View File
File diff suppressed because it is too large Load Diff
+64 -9
View File
@@ -1,6 +1,65 @@
; @com.wudsn.ide.asm.mainsourcefile=scorch.asm ; @com.wudsn.ide.asm.mainsourcefile=scorch.asm
.IF *>0 ;this is a trick that prevents compiling this file alone .IF *>0 ;this is a trick that prevents compiling this file alone
;--------------------------------------------------
Explosion .proc
;--------------------------------------------------
;cleanup of the soil fall down ranges (left and right)
mwa #screenwidth RangeLeft
lda #0
sta RangeRight
sta RangeRight+1
ldx TankNr
lda ActiveWeapon,x
asl
.endp
Explosion2 .proc
tax
lda ExplosionRoutines+1,x
pha
lda ExplosionRoutines,x
pha
rts
ExplosionRoutines
.word babymissile-1
.word missile-1
.word babynuke-1
.word nuke-1
.word leapfrog-1
.word funkybomb-1
.word mirv-1
.word deathshead-1
.word VOID-1 ;napalm
.word VOID-1 ;hotnapalm
.word tracer-1
.word VOID-1 ;smoketracer
.word babyroller-1
.word roller-1
.word heavyroller-1
.word VOID-1 ;riotcharge
.word VOID-1 ;riotblast
.word riotbomb-1
.word heavyriotbomb-1
.word babydigger-1
.word digger-1
.word heavydigger-1
.word babysandhog-1
.word sandhog-1
.word heavysandhog-1
.word dirtclod-1
.word dirtball-1
.word tonofdirt-1
.word VOID-1 ;liquiddirt
.word dirtcharge-1
.word VOID-1 ;earthdisrupter
.word VOID-1 ;plasmablast
.word laser-1
VOID
rts
.endp
; ------------------------
; ------------------------ ; ------------------------
.proc babymissile .proc babymissile
@@ -811,7 +870,6 @@ ContinueToCheckMaxForce2
jsr DrawTankNr jsr DrawTankNr
wait ; best after drawing a tank wait ; best after drawing a tank
;wait
;keyboard reading ;keyboard reading
@@ -822,6 +880,8 @@ ContinueToCheckMaxForce2
; $f3 - shift+key ; $f3 - shift+key
notpressed notpressed
lda TRIG0
beq notpressed
lda SKSTAT lda SKSTAT
cmp #$ff cmp #$ff
beq checkJoy beq checkJoy
@@ -866,11 +926,9 @@ checkJoy
notpressedJoy notpressedJoy
;fire ;fire
lda TRIG0 lda TRIG0
bne JNotFire jeq pressedSpace
lda #$21 jmp notpressed
jmp jumpFromStick
JNotFire
jmp notpressed
; ;
pressedUp pressedUp
;force increaseeee! ;force increaseeee!
@@ -1060,7 +1118,6 @@ AfterStrongShoot
clc clc
lda xtraj+1 lda xtraj+1
adc EndOfTheBarrelX,y ; correction of X adc EndOfTheBarrelX,y ; correction of X
;adc #4
sta xtraj+1 sta xtraj+1
lda xtraj+2 lda xtraj+2
adc #0 adc #0
@@ -1068,7 +1125,6 @@ AfterStrongShoot
sec sec
lda ytraj+1 lda ytraj+1
sbc EndOfTheBarrelY,y ; correction of Y sbc EndOfTheBarrelY,y ; correction of Y
;sbc #7
sta ytraj+1 sta ytraj+1
lda ytraj+2 lda ytraj+2
sbc #0 sbc #0
@@ -1078,7 +1134,6 @@ AfterStrongShoot
jsr Flight jsr Flight
mva #1 color mva #1 color
;jsr WaitForKeyRelease
rts rts
.endp .endp