junglejourney
changeset 42:99ef92fc83ae
Slowed down the movement of enemies.
Motion control will be changed to use global counters instead.
| author | David Boddie <david@boddie.org.uk> |
|---|---|
| date | Sun Aug 21 18:57:07 2011 +0200 |
| parents | 513dc8ee2a82 |
| children | 4d9da53995ae |
| files | build.py mapcode.oph |
| diffstat | 2 files changed, 70 insertions(+), 119 deletions(-) [+] |
line diff
1.1 --- a/build.py Sun Aug 21 16:02:00 2011 +0200 1.2 +++ b/build.py Sun Aug 21 18:57:07 2011 +0200 1.3 @@ -54,8 +54,8 @@ 1.4 # 4 and higher enemy - bits 3,4,5 are enemy type) 1.5 # n+1 counter/direction (player: bits 1,2 are direction, 1.6 # bit 0 is animation 1.7 - # enemy: bits 3,4 are direction, 1.8 - # bits 1,2 are animation, bit 0 is a delay bit) 1.9 + # enemy: bits 4,5 are direction, 1.10 + # bits 2,3 are animation, bits 0,1 are delay bits) 1.11 # (emerging, explosion: bits 4,5,6 are enemy type for emerging, 1.12 # bit 3 is type 0=emerge,1=explode, 1.13 # bits 0,1,2 are animation with bit 0 a delay bit)
2.1 --- a/mapcode.oph Sun Aug 21 16:02:00 2011 +0200 2.2 +++ b/mapcode.oph Sun Aug 21 18:57:07 2011 +0200 2.3 @@ -1207,7 +1207,8 @@ 2.4 clc 2.5 sta $71 ; 0x00, 0x02, 0x04, 0x06, 0x08 2.6 2.7 - lda $80 ; remove the least significant bit, used to delay 2.8 + lda $80 2.9 + lsr ; remove the least significant bits, used to delay 2.10 lsr ; the animation 2.11 and #7 ; remove the top direction bit 2.12 clc 2.13 @@ -1900,16 +1901,9 @@ 2.14 2.15 ldy #1 2.16 lda ($74),y 2.17 - sta $81 2.18 - adc #1 2.19 - and #$07 ; keep animation bits 2.20 - sta $8f 2.21 - lda $81 2.22 - and #$10 ; keep vertical direction bit 2.23 - ora $8f 2.24 + and #$2f ; keep vertical direction bit and animation bits 2.25 sta ($74),y ; left (horizontal directional bit is 0) 2.26 2.27 - jsr plot_character 2.28 rts 2.29 2.30 move_enemy_left: ; $74,$75=character address 2.31 @@ -1919,10 +1913,8 @@ 2.32 cmp #0 2.33 beq move_enemy_left_check_x 2.34 2.35 - sta $81 ; temporary 2.36 - jsr unplot_character ; unplot the enemy character 2.37 - dec $81 2.38 - lda $81 2.39 + sec 2.40 + sbc #1 2.41 ldy #5 2.42 sta ($74),y ; dx 2.43 clc 2.44 @@ -1969,7 +1961,6 @@ 2.45 bne move_enemy_left_exit 2.46 2.47 move_enemy_allow_left: 2.48 - jsr unplot_character ; unplot the enemy character 2.49 lda $81 2.50 ldy #4 2.51 sta ($74),y ; store the new room x offset 2.52 @@ -1989,17 +1980,9 @@ 2.53 2.54 ldy #1 2.55 lda ($74),y 2.56 - sta $81 2.57 - adc #1 2.58 - and #$07 ; keep animation bits 2.59 - sta $8f 2.60 - lda $81 2.61 - and #$10 ; keep vertical direction bit 2.62 - ora $8f 2.63 - ora #8 ; right 2.64 + ora #$10 ; right (keep vertical direction bit and animation bits) 2.65 sta ($74),y 2.66 2.67 - jsr plot_character 2.68 rts 2.69 2.70 move_enemy_right: ; $74,$75=character_address 2.71 @@ -2011,13 +1994,10 @@ 2.72 cmp #3 2.73 beq move_enemy_right_tile 2.74 2.75 - sta $81 ; temporary 2.76 - jsr unplot_character ; unplot the enemy character 2.77 - inc $81 ; 0 < dy < 5 2.78 - lda $81 2.79 + clc 2.80 + adc #1 2.81 ldy #5 2.82 sta ($74),y 2.83 - clc 2.84 jmp animate_enemy_right ; optimise away the rts 2.85 2.86 move_enemy_right_check_x: ; Check the x offset. 2.87 @@ -2052,7 +2032,7 @@ 2.88 lda $70 2.89 adc #10 2.90 sta $70 2.91 - ldy $81 2.92 + ldy $81 ; temporary (x + 1) 2.93 lda ($70),y ; load the tile below and to the right 2.94 2.95 cmp #0 2.96 @@ -2060,7 +2040,6 @@ 2.97 2.98 move_enemy_allow_right: 2.99 2.100 - jsr unplot_character ; unplot the enemy character 2.101 ldy #5 2.102 lda ($74),y ; dx 2.103 adc #1 2.104 @@ -2069,8 +2048,8 @@ 2.105 jmp animate_enemy_right ; optimise away the rts 2.106 2.107 move_enemy_right_tile: 2.108 - 2.109 - jsr unplot_character ; unplot the enemy character 2.110 + clc 2.111 + 2.112 ldy #4 2.113 lda ($74),y ; x 2.114 adc #1 2.115 @@ -2091,16 +2070,9 @@ 2.116 2.117 ldy #1 2.118 lda ($74),y 2.119 - sta $81 2.120 - adc #1 2.121 - and #$07 ; keep animation bits 2.122 - sta $8f 2.123 - lda $81 2.124 - and #$08 ; keep horizontal direction bit 2.125 - ora $8f 2.126 + and #$1f ; keep horizontal direction bit and animation bits 2.127 sta ($74),y 2.128 2.129 - jsr plot_character 2.130 rts 2.131 2.132 move_enemy_up: ; $74,$75=character address 2.133 @@ -2110,10 +2082,8 @@ 2.134 cmp #0 2.135 beq move_enemy_up_check_y 2.136 2.137 - sta $81 2.138 - jsr unplot_character ; unplot the enemy character 2.139 - dec $81 2.140 - lda $81 2.141 + sec 2.142 + sbc #1 2.143 ldy #3 2.144 sta ($74),y ; dy 2.145 clc 2.146 @@ -2158,9 +2128,6 @@ 2.147 2.148 move_enemy_allow_up: 2.149 txa 2.150 - sta $81 ; temporary 2.151 - jsr unplot_character ; unplot the enemy character 2.152 - lda $81 2.153 ldy #2 2.154 sta ($74),y ; store the new room y offset 2.155 lda #5 2.156 @@ -2179,17 +2146,10 @@ 2.157 2.158 ldy #1 2.159 lda ($74),y 2.160 - sta $81 2.161 - adc #1 2.162 - and #$07 ; keep animation bits 2.163 - sta $8f 2.164 - lda $81 2.165 - and #$08 ; keep horizontal direction bit 2.166 - ora $8f 2.167 - ora #$10 ; down 2.168 + and #$1f ; keep horizontal direction bit and animation bits 2.169 + ora #$20 ; down 2.170 sta ($74),y 2.171 2.172 - jsr plot_character 2.173 rts 2.174 2.175 move_enemy_down: ; $74,$75=character address 2.176 @@ -2201,10 +2161,7 @@ 2.177 cmp #5 2.178 beq move_enemy_down_tile 2.179 2.180 - sta $81 ; temporary 2.181 - jsr unplot_character ; unplot the character 2.182 - inc $81 ; 0 < dy < 5 2.183 - lda $81 2.184 + adc #1 2.185 ldy #3 2.186 sta ($74),y ; dy 2.187 clc 2.188 @@ -2250,7 +2207,6 @@ 2.189 2.190 move_enemy_allow_down: 2.191 2.192 - jsr unplot_character ; unplot the character 2.193 ldy #3 2.194 lda ($74),y ; dy 2.195 adc #1 2.196 @@ -2259,8 +2215,8 @@ 2.197 jmp animate_enemy_down ; optimise away the rts 2.198 2.199 move_enemy_down_tile: 2.200 - 2.201 - jsr unplot_character ; unplot the character 2.202 + clc 2.203 + 2.204 ldy #2 2.205 lda ($74),y ; y 2.206 adc #1 2.207 @@ -2277,32 +2233,34 @@ 2.208 2.209 move_enemy_animate: ; $74,$75=character address 2.210 2.211 - jsr unplot_character 2.212 ldy #1 2.213 lda ($74),y ; direction/animation 2.214 sta $81 2.215 adc #1 2.216 - and #$07 ; keep animation bits 2.217 + and #$0f ; keep animation bits 2.218 sta $8f 2.219 lda $81 2.220 - and #$18 ; mask off the animation bits 2.221 + and #$30 ; mask off the animation bits 2.222 ora $8f 2.223 sta ($74),y 2.224 - jmp plot_character ; optimise away the rts 2.225 + rts 2.226 2.227 move_enemy: ; $74,$75=character address 2.228 2.229 ldy #1 2.230 lda ($74),y ; direction/animation 2.231 - and #1 2.232 - beq move_enemy_delay 2.233 - 2.234 - lda ($74),y ; direction/animation 2.235 - and #2 2.236 - bne move_enemy_horizontally 2.237 - 2.238 - ;and #16 ; A contains the object type 2.239 - ;beq move_enemy_with_inbuilt_direction 2.240 + and #3 2.241 + cmp #3 2.242 + beq move_enemy_now 2.243 + 2.244 + clc 2.245 + jmp move_enemy_animate ; optimise away the rts 2.246 + 2.247 + move_enemy_now: 2.248 + lda #0 2.249 + sta $8d 2.250 + lda #0 2.251 + sta $8e 2.252 2.253 ldy #2 2.254 lda ($74),y ; y 2.255 @@ -2313,16 +2271,18 @@ 2.256 ldy #3 2.257 lda ($74),y ; dy 2.258 cmp #1 2.259 - beq move_enemy_toggle 2.260 + beq move_enemy_horizontally 2.261 bpl move_enemy_upwards 2.262 2.263 move_enemy_downwards: 2.264 - lda #$10 2.265 - jmp move_enemy_vertically_with_direction 2.266 + lda #2 2.267 + sta $8d 2.268 + jmp move_enemy_horizontally 2.269 2.270 move_enemy_upwards: 2.271 - lda #$00 2.272 - jmp move_enemy_vertically_with_direction 2.273 + lda #1 2.274 + sta $8d 2.275 + ;jmp move_enemy_horizontally 2.276 2.277 move_enemy_horizontally: 2.278 ldy #4 2.279 @@ -2334,65 +2294,56 @@ 2.280 ldy #5 2.281 lda ($74),y ; dx 2.282 cmp #0 2.283 - beq move_enemy_toggle 2.284 + beq move_enemy_with_direction 2.285 bpl move_enemy_leftwards 2.286 2.287 move_enemy_rightwards: 2.288 - lda #$08 2.289 - jmp move_enemy_horizontally_with_direction 2.290 + lda #2 2.291 + sta $8e 2.292 + jmp move_enemy_with_direction 2.293 2.294 move_enemy_leftwards: 2.295 - lda #$00 2.296 - jmp move_enemy_horizontally_with_direction 2.297 - 2.298 - move_enemy_with_inbuilt_direction: 2.299 - 2.300 - ldy #1 ; direction/animation 2.301 - lda ($74),y 2.302 - and #$18 2.303 + lda #1 2.304 + sta $8e 2.305 + ;jmp move_enemy_with_direction 2.306 2.307 move_enemy_with_direction: 2.308 - 2.309 - move_enemy_horizontally_with_direction: 2.310 - 2.311 - cmp #0 2.312 + clc 2.313 + 2.314 + jsr unplot_character 2.315 + 2.316 + lda $8e 2.317 + cmp #1 2.318 bne move_enemy_not_left 2.319 jsr move_enemy_left 2.320 - bcs move_enemy_toggle 2.321 - bcc move_enemy_exit 2.322 + clc 2.323 + jmp move_enemy_not_right 2.324 2.325 move_enemy_not_left: 2.326 - cmp #$08 2.327 - bne move_enemy_toggle 2.328 + lda $8e 2.329 + cmp #2 2.330 + bne move_enemy_not_right 2.331 jsr move_enemy_right 2.332 - bcs move_enemy_toggle 2.333 - bcc move_enemy_exit 2.334 - 2.335 - move_enemy_vertically_with_direction: 2.336 + clc 2.337 2.338 move_enemy_not_right: 2.339 - cmp #0 2.340 + lda $8d 2.341 + cmp #1 2.342 bne move_enemy_not_up 2.343 jsr move_enemy_up 2.344 - bcs move_enemy_toggle 2.345 - bcc move_enemy_exit 2.346 + clc 2.347 + jmp move_enemy_toggle 2.348 2.349 move_enemy_not_up: 2.350 - cmp #$10 2.351 + lda $8d 2.352 + cmp #2 2.353 bne move_enemy_toggle 2.354 jsr move_enemy_down 2.355 - bcs move_enemy_toggle 2.356 - bcc move_enemy_exit 2.357 2.358 move_enemy_toggle: 2.359 clc 2.360 - jmp move_enemy_animate 2.361 - 2.362 - move_enemy_delay: 2.363 - ldy #1 2.364 - lda ($74),y 2.365 - eor #1 2.366 - sta ($74),y 2.367 + jsr move_enemy_animate 2.368 + jmp plot_character ; optimise away the rts 2.369 2.370 move_enemy_exit: 2.371 clc
