Commit Graph

258 Commits

Author SHA1 Message Date
Jeremy Rand c45c3503d6 This is the first step to getting rid of the tile.c file and replace it with generated assembly instead. And then I can add the extra data required to handle the player correctly. 2020-11-03 00:11:22 -05:00
Jeremy Rand 7c0dc8ebb1 Replace the call to the Toolbox with a raw read of the mouse from ADB registers to try to minimize the cost of mouse polling in the game loop. 2020-11-01 22:50:10 -05:00
Jeremy Rand 4e500c6f38 Start adding some mouse code and display a player on the bottom row of tiles only for now. No collision detection hooked up and it is terribly inefficient but it seems to work. 2020-10-28 23:46:32 -04:00
Jeremy Rand 0fa9b45f45 Rework the LHS side of the game screen to have some BuGS branding. Move the number of lives indicator to the left and add a player 1 and player 2 section. 2020-10-27 23:59:06 -04:00
Jeremy Rand 62fcc82790 Add the code to shoot mushrooms and hook up a debug routine to shoot random mushrooms. 2020-10-26 23:26:12 -04:00
Jeremy Rand 0dd8222611 Add the code to handle restricting the spider to lower and lower rows as the score goes up. This is the final bit of game logic necessary for the bugs in the game I think. 2020-10-26 22:32:46 -04:00
Jeremy Rand 123c3a48ef Add some comments about the spider score threshold yet to be implemented where it is restricted to a smaller and smaller space close to the player. 2020-10-25 23:25:23 -04:00
Jeremy Rand 5a08aefab5 Fix the code for setting the starting flea speed based on the score threshold. 2020-10-25 23:19:31 -04:00
Jeremy Rand 96a6b6f51f Implement the code to add the flea at the right time. This includes tracking the score in multiples of 20,000 and adjusting the number of mushrooms required in the infield before a flea will appear. Simplify the other score based thresholds which are based on multiples of 20,000 to use this test. Add debug which allows me to add 20,000 to the score whenever I want so I can test these thresholds more easily. 2020-10-25 23:11:11 -04:00
Jeremy Rand bb1cd9b7ba Remove the debug code to control the scorpion speed now that the logic is implemented for that. 2020-10-23 00:25:00 -04:00
Jeremy Rand 1d4f783a3e Change the code for centipede speed to skip slow speed segments entirely once the score is more than 40000.
Add segments at the start of the next level in reverse order so the single head segments are added first.  This ensures they do collision detection properly in the updateSegment code.
Fix a bug where a set of 16 tiles were always marked as occupied by a centipede segment because we didn't clear it properly on each updateSegment call.  This fixed a problem with segments changing direction for no apparent reason.
Test for collisions on the two tiles the segment is spanning and change direction if either is occupied.  This should eliminate single segments travelling on top of each other.
Add scorpions randomly during a game once we get to level 4.  They are added with a 1 in 512 chance every 60 seconds so you should see a scorpion about once every 10 seconds or so.
When the score is above 20000, add scorpions at fast speed 3/4 of the time, slow speed the other 1/4 of the time.  Lower scores, the scorpion is always slow.
2020-10-23 00:20:18 -04:00
Jeremy Rand 9a34532d77 Implement the code to add spiders to the game. From my testing, it looks like 2 seconds after a spider leaves the game (either shot or off the screen), another one is added. Also, once the score is about 5000, the spiders added will be fast. The only spider behaviour I know of which is so far not implemented is as the player reaches higher levels, the spider constrains itself closer and closer to the bottom of the screen. 2020-10-22 00:00:16 -04:00
Jeremy Rand 1f26b38784 Fix the order of colours for the different levels. Remove the debug code to add centipedes and change the colour palette. This is gone now because we now have the concept of starting a game and progressing through levels with different kinds of centipedes running at different speeds with different palette colours. 2020-10-20 23:13:46 -04:00
Jeremy Rand 6c3b8398a8 Add the code to start a game and iterate through levels. We don't detect the end of a level yet though. 2020-10-19 23:34:08 -04:00
Jeremy Rand 04d2e74f15 Add the data about the different levels from a centipede segment perspective. 2020-10-17 16:36:12 -04:00
Jeremy Rand 99c7d98998 Add some comments about the lack of checking of a score "overflow". 2020-10-13 23:28:39 -04:00
Jeremy Rand a1b4013e1c Hook up the score. Shooting fleas, spiders, scorpions or segments will increase the score. We track the score in two ways. One is just as a 32-bit unsigned integer for doing numeric comparisons on the score (say to the high score list to be implemented in the future) and secondly as a series of numeric digits displayed in a tile. Both are updated. 2020-10-13 23:24:15 -04:00
Jeremy Rand b85000b4ed Start adding the infrastructure for levels and score. 2020-10-13 00:09:37 -04:00
Jeremy Rand a7d1db68e2 Add the code to add head segments once the centipede reaches the bottom of the screen. 2020-10-08 23:59:34 -04:00
Jeremy Rand 6969da19b9 Add code to accelerate to fast speed if the last segment. 2020-10-02 14:57:38 -04:00
Jeremy Rand eb418fb1c4 Add the ability to shoot centipede segments. 2020-10-02 14:50:14 -04:00
Jeremy Rand 74a21db9e0 Change the starting position so we get a collision right away. 2020-09-24 23:19:43 -04:00
Jeremy Rand 766eaf6273 Add the code to detect segment collisions and change direction if a head is colliding with another head or body segment. 2020-09-24 23:17:39 -04:00
Jeremy Rand a9f62257f9 Reverse the order in which segments are added in memory and add some data for tracking the tiles occupied by segments. This will allow for segment collision detection next. 2020-09-23 23:04:05 -04:00
Jeremy Rand 69efb23800 Some minor optimization to the update code and check for a mushroom in the tile we are moving into and the next tile when we need to decide to change direction. This better reproduces the real game's behaviour. 2020-09-23 22:42:02 -04:00
Jeremy Rand 1dfbe8156a Add support for having both fast and slow centipedes in play at the same time. 2020-09-21 22:57:06 -04:00
Jeremy Rand c4902f486b Add some global data to have a bit mask of tiles which contain a centipede segment. This will allow the update code to figure out if centipede segments are colliding and if so, change direction. Still need to write some codegen for this global constant data rather than building it at runtime in C. 2020-09-20 22:22:58 -04:00
Jeremy Rand a9d3b12725 Add code to poison a centipede. 2020-09-13 16:08:32 -04:00
Jeremy Rand 03466f8847 Add code to allow a centipede and all its body segments to scroll in at the top of the screen at slow speed. Need to do the same for fast speed. 2020-09-13 15:18:18 -04:00
Jeremy Rand f99ff8e816 Add all the code to handle double speed centipede segments. 2020-09-13 14:54:18 -04:00
Jeremy Rand dc5ab4720d Fix bugs that cause the centipede segment to drop as if poisoned when it reaches the bottom half of the screen. 2020-09-13 13:32:25 -04:00
Jeremy Rand ab5f5c6299 Fix bug in code that looks for the edge of the screen which was comparing by tile number, not tile offset. 2020-09-11 00:25:41 -04:00
Jeremy Rand 46567659e9 Add the code to animate the segments at slow speed. There is a bug where the centipede seems to get stuck along the left edge sometimes. But overall looks pretty good. 2020-09-11 00:01:30 -04:00
Jeremy Rand 0362b53e2c The head segment is now animating to the right. But it needs better support for segment speed and it needs to change direction when it reaches an obstacle. And all of the other directions to write still. 2020-09-09 23:53:51 -04:00
Jeremy Rand 0d4677c397 More work towards the animation of centipede segments. 2020-09-08 23:54:44 -04:00
Jeremy Rand 36617cbf9d Lay some more groundwork for animating centipede segments. We now have an array of 96 (97 actually) entries which describe the position of the segment now or in the past. By keeping past information, body segments which follow head segments will take no calculation to update. We just have to animate head segments and body segments will follow them 8 pixels behind automatically. 2020-09-07 22:35:32 -04:00
Jeremy Rand 3b541f8482 Fix bug leading to crash when trying to add centipede body segments. I needed to have a nop instruction after the self-modifying long jump. I am writing 4 bytes of the address into the long jump which only uses a 3 byte address and I was corrupting the next instruction. Inserting a nop ensures no corruption happens. 2020-09-06 13:39:00 -04:00
Jeremy Rand f5d1aa9ee6 Improve the performance of the centipede segment draw function. 2020-09-06 02:05:33 -04:00
Jeremy Rand 07f8df4b4f Draw the scorpion once we are sure the beam has past it on the screen for the previous frame. Adjust the wait for VBL look to look for less than scan line 200 rather than scan line 0. That way, we shouldn't get a frame glitch at 2.8MHz any more. 2020-09-06 01:54:47 -04:00
Jeremy Rand 92c02ded0f Simplify the handling of the dirty tiles to just store the dirty word and not keep the array of dirty tile offsets. Have the flea use game and non-game dirty tiles to fix the problem with LHS tiles being marked dirty all the time. 2020-09-04 01:55:38 -04:00
Jeremy Rand 22a22d3533 Change the code to race the beam down the screen, redrawing the dirty game rows as it goes. 2020-09-04 00:17:19 -04:00
Jeremy Rand b07221c363 Change from an array of structs to a series of individual arrays for the tile information. This makes it easier to index into the arrays because the tile number * 2 is the offset, rather than tile number * 16. 2020-09-02 00:15:53 -04:00
Jeremy Rand df56cdecf1 Add the ability to display head segments of the centipede. Body segments is not working yet. 2020-08-27 23:36:16 -04:00
Jeremy Rand 3a63b2ef1b Add code to support marking dirty tiles under head and body segments. 2020-08-27 22:36:04 -04:00
Jeremy Rand d8e9c6863b Add the code to draw the body and head segments in the game loop. Still need to add code to create, update and shoot segments. 2020-08-26 23:44:41 -04:00
Jeremy Rand 67e2b56dc2 Add some more code to support adding bug segments to the game. 2020-08-10 23:58:49 -04:00
Jeremy Rand 7d7afc908d Use macros to reduce the copy/pasted code for marking tiles as dirty. Rough out the support for body and head segments. 2020-07-30 23:34:48 -04:00
Jeremy Rand 2b45813cbb Increase the chance that a flea produces a mushroom. 2020-07-28 15:44:55 -04:00
Jeremy Rand 8bcd4fccf6 Add the code to support switching between fast and slow spiders. 2020-07-27 23:30:11 -04:00
Jeremy Rand 883d882d0e Provide an API to set the default speed of a flea or a scorpion. This will allow the speed to be changed for different levels in the game. Need to add this API for spiders also. 2020-07-27 22:27:18 -04:00