aboutsummaryrefslogtreecommitdiff
path: root/src/bullets.s
Commit message (Collapse)AuthorAgeFilesLines
* Add sound effectsMiquel Sabaté Solà2026-04-131-0/+3
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Fix overwrite issues when adding scoresMiquel Sabaté Solà2026-03-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | The add_to_player() function relied on parameters to be passed on the 'Globals::zp_tmpX' variables, but that's just plain stupid. First, because these memory addresses are not meant for arguments; but most importantly, because callers actually needed some of these values before calling this function. Hence, everything went into chaos and sprites began to act wrongly in all sorts of random ways. Moreover, some of the callers also needed a guarantee on either the 'x' or the 'y' registers. Since this wasn't always feasible, we needed to store/load these registers' values case by case. All in all, now add_to_player() accepts only one argument via the 'y' register (which callers already knew it was going to be messed with). The value on 'y' has to be set via some helper constants. As a cherry on top, this not only fixes a nasty bug, but it also makes things more performant and with less code. Fixes: 63ef73de3bdd ("Update scores on screen") Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Update scores on screenMiquel Sabaté Solà2026-03-251-1/+2
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Support reading from the second controllerMiquel Sabaté Solà2026-03-081-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Make bullet transitions in relation to HZMiquel Sabaté Solà2026-03-071-6/+6
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Convert enemy vs bullet collision into a loopMiquel Sabaté Solà2026-03-061-17/+21
| | | | | | | | 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>
* Rename scoped variables without being redundantMiquel Sabaté Solà2026-03-061-33/+33
| | | | | | | 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>
* Let enemies die whenever they touch a bulletMiquel Sabaté Solà2026-03-031-16/+43
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Wrap around the saving of the last allocated bulletMiquel Sabaté Solà2026-03-021-1/+6
| | | | | | | | | | 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-3/+2
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Use constants on asan:reserveMiquel Sabaté Solà2026-02-091-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Adapt the code to play well with nasm's asanMiquel Sabaté Solà2025-12-151-1/+1
| | | | | | | The address sanitizer from nasm provides quite a few goodies, so let's adapt the code more to it to benefit from those. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* bullet: Do not clash with the poolMiquel Sabaté Solà2025-05-151-9/+9
| | | | | | | | | | One of the glitches as hinted by commit ae857d302cd6 ("Implement the base for moving bullets") actually came from the fact that the temporary screen coordinates were pointing at the first sprite from the pool of bullets. This commit moves these variables into a memory region where there won't be any clashes. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Decrease the capacity of bullets on screenMiquel Sabaté Solà2025-05-151-1/+1
| | | | | | | | | This fixes any frame drops I have experienced so far. This is not a real fix since it is more likely that there's some part of the code that is simply too slow. At some point I should investigate where is that, but it will probably reappear whenever I start looking into enemies. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Implement the base for moving bulletsMiquel Sabaté Solà2025-05-141-0/+303
This establishes a way for bullets to move, be displayed as independent sprites, cycle these sprites, and check for the collision on the background. This is still lacking the collision check with enemies and has some obvious bugs that will be fixed on the next commits. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>