Commit Graph

52 Commits

Author SHA1 Message Date
Jeremy Rand dfcf6a66b6 Turns out I only have fixed the "magically appearing mushroom" bug. I fixed it for slow moving centipedes coming on screen but there was a second case of the same problem for fast moving centipedes. So fix that now also. Bump the version number to 1.0.1. I will do a patch update at some point but I don't think this bug deserves pushing out a quick release update. It is an annoying minor bug at most. 2021-03-03 22:20:22 -05:00
Jeremy Rand 23b37d095b Fix the mysterious appearing mushroom bug. 2021-01-26 00:25:35 -05:00
Jeremy Rand 384a9ea233 Make more globals per player and index into them with the player number at game time. 2021-01-10 23:17:05 -05:00
Jeremy Rand 3f0578d142 Fix the crashing bug when the previous game ends with the player colliding with the last remaining segment. 2020-12-26 00:31:54 -05:00
Jeremy Rand dbbdd156e3 Fix the bug where the tiles on the RHS may be marked dirty and accumulate garbage if the player dies on the RHS. Add some more debug for the crashing bug I am chasing. It looks like more than 12 segments have been added so I am adding debug to detect when the number of segments exceeds 12. 2020-12-25 23:59:09 -05:00
Jeremy Rand b432cf654b Implement stereo sound. Sounds now come from the left or the right speaker depending on where the sound is coming from on the screen as much as possible. 2020-12-22 23:40:21 -05:00
Jeremy Rand 763ce0626e Fix problem on real HW where the player will start the next level shooting if they died while shooting, regardless of the state of the mouse. It now ignores the first poll of the mouse at the start of a level to avoid stale poll information. Add some debug in the code for jumping to the head and body segment draw routines to confirm that the table offsets are sane. I have seen a crash which indicates that sometimes the offset is incorrect. 2020-12-16 12:51:37 -05:00
Jeremy Rand d201f80c3b Move the sound code into a gameSound.s file. This is the first step towards going around the sound toolset for playing sounds. 2020-12-16 12:00:56 -05:00
Jeremy Rand 0136579125 Disassociate sound resources from the generators they are connected with. Use multiple generators to play multiple shot sounds at the same time. It sounds weird but it kind of works. 2020-12-10 21:55:13 -05:00
Jeremy Rand bae931aaa6 Add sounds for shooting, killing bugs, dying and resetting mushrooms after death. The shoot sound isn't great because it doesn't restart when rapid fire is happening but this is a start. 2020-12-10 00:45:48 -05:00
Jeremy Rand 1650e8e040 Fix bug where slow head segments would not detect collisions with other segments and change direction. 2020-12-04 00:32:42 -05:00
Jeremy Rand 7368281d58 Fix a long standing bug I have ignored for too long. When adding centipede segments on the left or right, if there was a mushroom right where the segment was arriving, it would try to change direction even though it was still mostly off-screen. This lead to some very strange segment tracks that should never happen. I have added code to ignore blocking mushrooms and not change direction when the segment is partially off-screen. 2020-12-02 23:51:06 -05:00
Jeremy Rand 868f4a3199 Fix a crash that would happen if the last centipede segment collided with the player. Both level and player code was trying to start the next level and the corrupted things badly. Now, the level code is always responsible for starting the next level. The player code only restarts a level when the player dies and doesn't finish the level. 2020-11-19 23:45:23 -05:00
Jeremy Rand fd40c12d31 Explode a bug when it crashes into the player. When the last segment collides with the player, go onto the next level. 2020-11-18 23:36:01 -05:00
Jeremy Rand 520aaa5a34 Add collision detection for all of the bug types. Remove the debug code for shooting bugs. It is almost a functional game now! 2020-11-17 22:53:30 -05:00
Jeremy Rand 2abb57b1a5 Add the code for detecting player collisions, exploding the player, decrementing the number of lives and maybe ending the game. 2020-11-11 23:51:09 -05:00
Jeremy Rand bb66ef4b03 Replace the C code which built tables at game launch time with a script which generates these tables at build time. This reduces the start time of the application and saves code space and is a necessary step before adding some new tables to handle the mouse efficiently. 2020-11-04 22:48:18 -05: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 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 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 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 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 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 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