aboutsummaryrefslogtreecommitdiff
path: root/.nasm
Commit message (Collapse)AuthorAgeFilesLines
* Save the high score after game overMiquel Sabaté Solà2026-03-271-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Update scores on screenMiquel Sabaté Solà2026-03-252-2/+3
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Add support for adding scoresMiquel Sabaté Solà2026-03-252-2/+4
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Implement the "take off" animationMiquel Sabaté Solà2026-03-231-1/+1
| | | | | | | | This is the animation that is done after clearing a stage. Moreover, and for the first time since I started development, now we can move into the next level as intended from the game's design. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Try to initialize enemies on unique Y coordinatesMiquel Sabaté Solà2026-03-222-2/+3
| | | | | | | | | | | | That is, our PRNG algorithm is so stupid that sometimes it cycles into the same value multiple times. While play testing, sometimes we were so unlucky that we got all enemies on the same Y screen coordinate. As funny as these situations can be, this shouldn't happen, so I have introduced an (awesomely named) function that makes a harder effort at finding a unique random number. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Restart the blinking animation after player's deathMiquel Sabaté Solà2026-03-201-1/+1
| | | | | | | | I believe this case was broken since the very beginning when I implemented it in commit b891997ab597 ("Add a blinking animation on player selection"). Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Center "game over (coin)" textMiquel Sabaté Solà2026-03-201-1/+1
| | | | | | Moreover, add a "!" character at the end. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Don't rely on the 'y' register in Over::handle()Miquel Sabaté Solà2026-03-201-1/+1
| | | | | | | Some of the functions being called from within will in fact tamper with this value. Hence, use the free 'Globals::zp_arg3' variable. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Set the proper "game over" flagMiquel Sabaté Solà2026-03-201-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Add support for the SUSE coinMiquel Sabaté Solà2026-03-201-1/+1
| | | | | | | | This is a coin that appears after going through a first cycle of levels and that allows the player to get a different game over screen than usual. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Let fuel tanks be delivered separatelyMiquel Sabaté Solà2026-03-182-2/+3
| | | | | | | | | Fuel tanks follow a different logic than regular items, in which they should be delivered almost instantaniously whenever they are needed. Hence, a new (much shorter/snappier) timer is provided for fuel tanks alone. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Use specific variables for cached player's tile coordinatesMiquel Sabaté Solà2026-03-181-1/+3
| | | | | | | | | Before this commit we were using the zp_argX variables, but this can go wrong, and more so considering other functions like background collision checking also use these variables. All in all, since we have plenty of RAM to spare, let's just allocate a new set of bytes just for that. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Add missing 'Items::zp_current_tiles' updatesMiquel Sabaté Solà2026-03-181-1/+1
| | | | | | | Collisions are based on this, so we better not forget updating these values. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Avoid a jmp by moving update_sprites()Miquel Sabaté Solà2026-03-161-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Improve the accuracy of the dropping zoneMiquel Sabaté Solà2026-03-161-1/+1
| | | | | | | | | | We were abusing on tile collision for this, and it wasn't exact. Not only that, but if the player was fast enough, sometimes the item wouldn't drop as the accelaration would pass through that zone. Avoid that by simply using regular screen coordinates, which aren't too hard to check in this case. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Wait for items to fall before changing screenMiquel Sabaté Solà2026-03-161-1/+1
| | | | | | | | | | | More specifically, whenever the player dies and we need to reset the screen, wait for items to fall in the same way as we do for explosions to disappear. This also brought with it some other changes like removing sprite reset on screen initialization. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Account for items switching to following the player in mid-airMiquel Sabaté Solà2026-03-151-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Update the shuttle as fuel is getting inMiquel Sabaté Solà2026-03-151-1/+1
| | | | | | | | | | Just like in the original, the shuttle turns purple for each fuel tank. That being said, due to the restriction from the NES/Famicom on updating background tile attributes, a "half-filled" strategy is being used here to convey the same idea for a total of 6 fuel tanks to be delivered. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Implement falling itemsMiquel Sabaté Solà2026-03-132-2/+3
| | | | | | | | | Every now and then an item will fall and, as in the original game, a fuel tank will be delivered whenever needed. There are still some things left out for later changes, like picking up items mid-air, or background effects for the rocket being filled with fuel. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Join 'zp_moved_out' and 'zp_pause_toggle'Miquel Sabaté Solà2026-03-121-3/+2
| | | | | | | It was wasteful, and it was there just because of my lazyness. Let's be a bit less careless. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Initial implementation for itemsMiquel Sabaté Solà2026-03-112-2/+7
| | | | | | | | | | This now only supports the appearance of shuttle parts and the fact that the player can collect them at a very specific order and drop them so to stack up the final shuttle. This is of course just the skeleton and there's a bunch of TODO's left. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Apply a correction on enemy movement for PALMiquel Sabaté Solà2026-03-111-1/+1
| | | | | | | | | | We cannot just "inc"/"dec" for enemy movement, but we have to apply an overstep on PAL every 5 frames in order to be equivalent to the NTSC version. This has been abstracted away on a macro that just does "inc"/"dec" on NTSC, but does this proper "adc"/"sbc" instructions with a helper memory region which is updated every 5 frames. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Add a blinking animation on player selectionMiquel Sabaté Solà2026-03-082-2/+5
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Support reading from the second controllerMiquel Sabaté Solà2026-03-082-9/+4
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* State game over only when all players are deadMiquel Sabaté Solà2026-03-081-0/+4
| | | | | | | This is a bit contrary to the original game, where each player would get its own "Game over" event. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Show lifes for player 2 if availableMiquel Sabaté Solà2026-03-081-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Define the bitmap for multiplayer supportMiquel Sabaté Solà2026-03-082-2/+3
| | | | | | | Also give it a dummy value on start and initialize it properly after the player's selection on the title screen. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Initialize 'zp_pause_toggle' before NMI enablementMiquel Sabaté Solà2026-03-071-1/+1
| | | | | | | | | Otherwise we might randomly get weird scenarios like the title screen not showing up properly. Fixes: bc99212539f6 ("Toggle a "Paused" message on top of the screen") Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Move some variables into another memory regionMiquel Sabaté Solà2026-03-071-5/+5
| | | | | | | | The zp_player_tile_* variables fit perfectly with the space that is left in the $0x memory region. This allows for a more contiguous space (e.g. on $Cx) for other elements to come (e.g. items). Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Update the explosions' pool capacityMiquel Sabaté Solà2026-03-071-3/+3
| | | | | | | More enemies means more possible explosions. Hence, increase the pool's capacity by one to match the recent change in enemies per screen. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Bump up to 4 enemies per screenMiquel Sabaté Solà2026-03-061-8/+8
| | | | | | | | This is more similar to the original game, and it's a bit more fun. In order to do so some variables had to move into another memory page, but that's fine as we have plenty. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Convert enemy vs bullet collision into a loopMiquel Sabaté Solà2026-03-061-1/+1
| | | | | | | | The fact that unrolling the loop was easier or faster was a plain lie from my lazyness. Convert it into a proper loop just so we can experiment with adding more enemies in one screen. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Fix bounce up for cross enemiesMiquel Sabaté Solà2026-03-061-1/+1
| | | | | | | | | Some old code was checking on the kind of level and skipping the bottom check if it was a half-sized enemy. However, the 'bounce' algorithm is not used by any half-sized enemy. Thus, the check can be removed entirely. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Rename scoped variables without being redundantMiquel Sabaté Solà2026-03-061-7/+7
| | | | | | | Some variables had the same name of the scope in their names as well. Remove this redundancy everywhere. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Check for enemy death after its movementMiquel Sabaté Solà2026-03-061-1/+1
| | | | | | | | | Some enemies might die right after moving (e.g. asteroids exploding into the ground). In these cases, there's no point on checking for player collision. Moreover, this also avoids the corner case of having two explosions on a single death. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Toggle a "Paused" message on top of the screenMiquel Sabaté Solà2026-03-062-2/+3
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Don't toggle pause from a holded buttonMiquel Sabaté Solà2026-03-061-0/+1
| | | | | | | | | | | If you just holded the Select or Start buttons, it would be forever toggling pause/unpause, which is an unexpected behavior. Fix this by saving which value from the joypad was previously read. With this, whenever the pause timer reaches zero, we can check whether either button is still pressed, and avoid toggling if that is the case. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Fix a cycling bug when shooting carelesslyMiquel Sabaté Solà2026-03-061-1/+1
| | | | | | | | | | | | | | | | When shooting like crazy and killing random enemies, after a while a cycling bug would appear which would make enemies to turn in weird directions, die unexpectedly, and other weird shenanigans. This comes back to commit 7c493ba3f338 ("Improve a bit the performance on enemy death"), which removed the saving/restoring of the value on the 'y' register. That being said, this register was actually being needed at least by Bullets::update(), so in certain situations this register might have a bad value (e.g. via the Explosions::create() call). Fixes: 7c493ba3f338 ("Improve a bit the performance on enemy death") Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Remove the pool size from enemiesMiquel Sabaté Solà2026-03-052-3/+2
| | | | | | It was never read anyways, so let's drop it. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Make enemies more colorfulMiquel Sabaté Solà2026-03-052-2/+3
| | | | | | | Each enemy also has its own palette upon creation. This way we add more variety as it was on the original game. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Add the Game Over screenMiquel Sabaté Solà2026-03-052-2/+4
| | | | | | | This is still missing the support for player 2, but I've left traces about it. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Update lifes left for player 1Miquel Sabaté Solà2026-03-042-2/+3
| | | | | | | The whole handling of player 2 will come whenever I set to implement multi-player for this game. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Add collision with the playerMiquel Sabaté Solà2026-03-042-2/+9
| | | | | | | This allows for explosions to run after making the player to disappear, and it re-runs the entering scene timer. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Let enemies die whenever they touch a bulletMiquel Sabaté Solà2026-03-032-2/+3
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Add a pool of explosion effectsMiquel Sabaté Solà2026-03-032-2/+5
| | | | | | | For now this only applies to enemies, but it's general enough so it can target any given coordinate, and hence any given object. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Allow enemies to revive after a given timeMiquel Sabaté Solà2026-03-031-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Move enemy initialization into its own functionMiquel Sabaté Solà2026-03-021-1/+1
| | | | | | This will be useful whenever we implement the re-appearance of enemies. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Wrap around the saving of the last allocated bulletMiquel Sabaté Solà2026-03-021-1/+1
| | | | | | | | | | If we don't do this, then it's possible to incur into a buffer overflow as the last allocated index is set to the next (out of buffer) position. Whenever we start over on this function, then it will compare for a good bullet on this position, and if it's not exactly $FF, then it will allocate it without problems. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Small optimization on bullet initializationMiquel Sabaté Solà2026-03-021-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Implement de 'chase' algorithmMiquel Sabaté Solà2026-03-021-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>