Commit Graph

56 Commits

Author SHA1 Message Date
Geralt
c2844a5d32 Refactor/RNG system (#476)
* Extract rng manipulation to its own file

* clang format

* Get CPU cycles since game start to use for RNG

* change a few things

* clang format

* Implement suggestions from @ricfehr3

* clang format

* Fix rebase issue

* clang format

* Create RngInfo struct to hold seed and step

* clang format

* Make a note about rng_restore system not having been tested properly yet

* Apply suggestions from @ricfehr3

Co-authored-by: Rickey <ric@rf3.xyz>

* clang format

---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
Co-authored-by: Rickey <ric@rf3.xyz>
2026-05-21 19:47:48 -07:00
Geralt
e7f550ce22 [Feature] Implement options menu and reading/writing values from/to the SRAM (#449)
* background

* Implement Options button

* Update main menu artwork

* add options menu tiles

* prepare options menu handling

* incorporate main menu refactor

* toto

* add all menu interactions

* do not reset selection_x in main_menu

* options struct

* fix rebase from ricfehr3's repo

* Implement high contrast cards

* Save/Load options values to SRAM

* load options on game_init and validate data within the load_options function

* Get changes from ricfehr3's PR

* recover fix for glitched ace

* clang format

* clang format

* clang format

* Save 500B of image data by using only minimal set of tiles instead of keeping final window in source file

* clang format

* clang format

* Implement Options button

* Update main menu artwork

* progress, leaving it alone for now until discussion

* make game_vars an extern

* Move options vars into their own struct

* rollback previous commit

* Implement save validation. Version check to come

* implement data validity + version check for game saves

* clang format

* Save position in rng sequence for consistent run after load

* fix rebase issues

* fix rebase issue

* remove unused/duplicate define

* Oops, made a mistake when testing PR #424

* encode high contrast palette into an image, and load it at game_start

* document save.c/h and correct typos

* correct alignment

* game speed and high contrast buttons working

* small cleanup

* sliders also work again now

* clang format

* Moved balatro_version extern declaration to version.h file

* removed unsused variable

* make showing ROM version a toggle

* move ante, round and money to the GameVariables struct

* Rename SaveCheckInfo struct to SaveHeader for clarity

* Add SaveHeader struct explanation

* clang format

* Revert unnecessary tileset optimization

* SFX now follows the sound volume slider

* clang format

* Music now follows volume slider

* Changed volume slider increment from 5 to 20 to avoid having the music sound too rough under 20% volume

* refactor main_menu.c to use SelectionGrid and Button structs

* clang format

* make a "new" save button so we don't save during the state transition

* clang format

* Reduced state transition flicker by only changing affine background to a different one

* Fix loading game too late in game init sequence

* First batch of suggestions from @MeirGavish

* Remove unnecessary intermediary buffers for high contrast palette swapping

* comment row warp hack for button input

* Add some of Copilot's suggestions

* rename balatro_version into gbalatro_version for rebranding reasons + version display erase screen fix

* remove unnecessary NULL check on `on_selection_changed` method

* implement small game speed arrow buttons animation

* factorize some code

* remove unnecessary data validation in load_game(), since we already checked the header

* Implement @MeirGavish 's suggestion regarding splitting the huge `on_update` function

* clang format

* implement @ricfehr3 's suggestion about keeping last selected button instead of using an obscure `on_boot` boolean

* Apply @ricfehr3's suggestions

* fix clang-format flags

---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
2026-05-02 14:28:52 -07:00
Geralt
db27962623 Implement boss blind graphics (#352)
Some checks failed
Build and Deploy Doxygen Docs / docs (push) Has been cancelled
* Created sprite bank for all blinds

* progress city, it's a beatiful city that progress city!

* Sprite appears in blind selection screen

* Added all blind colors

* fix magic numbers + disable boss reroll

* Fix boss blind token not moving after a reroll

* fix always rolling the Needle due to choosing too early for the rng seed to be set

* No need for affine sprite for blind tokens, regular is enough

* address Copilot's review 1/2

* address Copilot's review 2/2

* correct Blind Tokens/Types

* Index palette colors into the files instead of code

* Fix blind sprites (flip bug not solved)

* Fix magic number, tile index and Mark colors

* load boss blind palette only when changing spritesheet

* Adressing clang format and ease of modification of the blinds' list

* Removed some magic numbers


---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
2026-04-16 11:52:39 +03:00
Geralt
5cf9e2674d Implement arbitrary-sized joker spritesheets (#285)
* Convert static joker sprites indexes to maps for dynamic spritesheets size

* tmp commit

* reorder Joker spritesheets

* more reordering

* Joker maps, will test later

* More reorders and palette optimizations. Sprites now work

* Fix Joker gfx

* Format joker.c

* Fix rebase error

* Integrate Shoot the Moon art

* format

* format

* removing useless GBAL_UNUSED from photograph Joker effect func

* Tidy up joker.c variables formatting

* Fix magic number

* Add context for map in joker.c

Co-authored-by: Rickey <ric@rf3.xyz>

* Update source/joker.c

Co-authored-by: Rickey <ric@rf3.xyz>

* Apply suggestion from @ricfehr3

Co-authored-by: Rickey <ric@rf3.xyz>

* format

* reduce clutter in joker_effects.c file by defining a macro for forward static declarations of joker effect funcs

* refactored some maps in joker.c to make it more concise

* clang format

* adding back how to mark functions as unused when Jokers don't have a sprite yet

* format

* Remove comment about unused functions for Jokers without art

---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
Co-authored-by: Rickey <ric@rf3.xyz>
2026-03-28 17:58:05 -07:00
MeirGavish
9bffe5c9a9 Refactor - remove selected from SpriteObject (#305) 2025-12-12 18:44:26 -08:00
MeirGavish
5a4856ec82 Refactor - removed tile_mem obj charblock index magic number (#293) 2025-12-10 17:13:59 -08:00
Rickey
2fb9e6d633 Clang format joker files and def files (#257)
* Clang format joker files and def files

* Fix blind usage of GBLA_UNUSED macro

* Add final files for clang-format (main.c and selection_grid.h)

---------

Co-authored-by: MeirGavish <meir.gavish@gmail.com>
2025-12-10 09:41:24 +02:00
Geralt
0953a430c4 Implement Seltzer and Joker Expiration effect (#252)
* Add Seltzer art

* Implement Joker expiration

* Add exception to copying Jokers + Seltzer message fix

* Move all scoring logic to joker_object_score away from check_and_score_joker_for_event

---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
2025-11-30 08:52:42 +02:00
Geralt
435a9a0a1d Refactor JokerEffect scoring (#245)
* Remove usage of memcmp for JokerEffect null check

* Added suggestions from @ricfehr3

* Add suggestions from @MeirGavish


---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
Co-authored-by: MeirGavish <meir.gavish@gmail.com>
2025-11-28 19:03:47 +02:00
MeirGavish
f51380c93c Added sound effects for chips, mult, and xmult (#229) 2025-11-22 07:27:43 +02:00
Geralt
408c264e85 Modify blueprint and brainstorm implementation to fix retrigger bug (#244)
---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
2025-11-21 20:09:07 +02:00
Geralt
2fb41e533c Make Chips, Mult and Score unsigned and protect against overflow (#212)
---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
2025-11-20 12:39:15 +02:00
Geralt
4183f563ab Implement cards held in hand effects (#205)
* Adapt existing Jokers to the Held Card mechanic + effect display location

* Add suggestions from @ricfehr3

* Add suggestions from @MeirGavish

---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
2025-11-12 13:18:53 +02:00
Rickey
e0cffab768 Update list implementation to work with memory pools (#168)
* Introduce indexed list implementation

* Fix CI tests for pool

* Take bitset out of pool

* Replace joker bitset interactions with wrappers

* Add bitset tests

* Add test to gitignore

---------

Co-authored-by: rfehr-idexx <ric-fehr@idexx.com>
2025-11-11 17:56:21 +02:00
Geralt
eb815b7820 Refactor of scoring flow, Joker Callbacks and Card Retriggers (#160)
* Remove Baseball Card for now, will have to wait a future PR

* Removed cards held in hand joker scoring stage - should be in another PR

---------

Co-authored-by: MonteCrysto <mathis.martin31@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: MeirGavish <meir.gavish@gmail.com>
2025-11-01 15:50:52 +02:00
JustinL-12
b38433d191 Weight jokers by rarity in the shop (#152)
* Added weight for the rarity of jokers in the shop

* Includes manual conflict resolution

---------

Co-authored-by: JustinL-12 <jlong30@uic.edu>
Co-authored-by: MeirGavish <meir.gavish@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-27 19:18:48 +02:00
Rickey Fehr
517d40c294 Cleanup for PR, return old sprite tracker 2025-10-19 15:52:36 -07:00
Rickey Fehr
d499abe2c4 Cleanup for PR 2025-10-17 16:55:09 -07:00
Rickey Fehr
06cd13a17f Centralize location of memory pools
This commit centralizes the location of memory pools and adds an
associated script (scripts/get_memory_map.sh) to read the memory map.
2025-10-17 16:55:09 -07:00
Rickey Fehr
72c0a6c4a9 Optimize bit operations, style fix, cleanup 2025-10-17 16:55:07 -07:00
Rickey Fehr
e00c51502b Replace Malloc With Pools
This commit introduces an object pool and replaces instances of malloc with pools where sensible.
2025-10-17 16:54:09 -07:00
MonteCrysto
8cd86f1640 Merge remote-tracking branch 'upstream/main'
And add NULL Acrobat Joker effect
2025-10-07 20:18:41 +02:00
Drew
e620697917 Renamed joker_table.h to def_joker_gfx_table.h. Removed an unnecessary constant 2025-09-22 16:06:45 -05:00
Drew
7c377fca94 Making joker_gfxTiles and joker_gfxPal static 2025-09-17 15:35:21 -05:00
Drew
c4e804234b Moving macro into pool definition 2025-09-17 15:01:26 -05:00
Drew
3dc959c17d Converting joker_gfxTiles and joker_gfxPal to pools 2025-09-17 14:35:00 -05:00
Drew
2c5bc3b5dd Adding an x macro to cut down on some boilerplate.
This should make adding additional jokers require a little less
typing. Additional jokers will need an entry in /include/joker_table.h
2025-09-15 21:36:20 -05:00
MeirGavish
2d50005e30 Added art for Scary Face and Smiley Face by @GreenNinja2525 and enabled them in code 2025-08-22 19:43:27 +03:00
MeirGavish
46141090a0 Added joker sprites by @GreenNinja2525 for Blue Joker, Even Steven, Odd Todd, Scholar and Business Card. Disabled jokers with no sprites. 2025-08-17 12:36:20 +03:00
MeirGavish
64274ae465 Added joker selling (still no animation) + fixed SpriteObject constructor focused bug 2025-08-16 15:38:34 +03:00
MeirGavish
fd8e52d48a Removed magic numbers for card score length and intmax buffer sizes 2025-08-08 01:59:21 +03:00
MeirGavish
2ce3acbe1c Merge branch 'main' into jokers_with_graphics 2025-08-08 00:32:10 +03:00
theturtlemafia
4492176df2 allows multiple joker-effect popup texts 2025-08-07 23:08:41 +03:00
MeirGavish
50ec1bcdab Added art by @GreenNinja2525 for jokers Walkie-Talkie, Fibonacci, Banner, Mystic Summit, and Blackboard 2025-08-07 23:08:35 +03:00
MeirGavish
8956501591 Merge branch 'main' into jokers_palette_swapping 2025-08-04 10:21:19 +03:00
MeirGavish
de672572b1 Updated joker palette swapping system to reuse palettes when jokers are removed 2025-08-04 10:18:33 +03:00
theturtlemafia
4731fea21b add joker sprites 2025-08-02 13:08:42 -04:00
theturtlemafia
dbff88add0 Adds XMult, Joker Stencil and Misprint (rebase) 2025-08-01 18:35:31 -04:00
MeirGavish
305d093042 Added more joker art by for jokers 6-16, missing code implementation so they are not yet displayed. 2025-08-01 02:03:24 +03:00
MeirGavish
0c834d17c2 Added dynamic palette loading for jokers and added new joker designs by @GreenNinja2525 2025-07-30 21:00:29 +03:00
theturtlemafia
ed1204db74 remove usage of extern for joker_registry. Add array size macro to util.h 2025-07-28 14:24:33 -04:00
theturtlemafia
47ee3987fd refactor jokers to use struct and function pointer 2025-07-27 07:06:35 -04:00
MeirGavish
95565862b0 Extracted JokerObject and CardObject common functionalities to SpriteObject, removing duplicate code and dangerous casts. 2025-07-27 01:13:57 +03:00
cellos51
6a1f3bcd7a I hope this works 2025-07-23 20:14:22 -04:00
MeirGavish
c781807ed8 Revert "Sprite vram optimizations" 2025-07-24 02:14:04 +03:00
cellos51
ea5e4d5d1e refactor: remove commented-out code and simplify joker initialization 2025-07-23 17:35:42 -04:00
cellos51
300e725dfe made jokers dynamic and changed memcpy to us 32 2025-07-23 17:00:18 -04:00
MeirGavish
5e6bc76f5f Merge branch 'main' into jokers_refactors 2025-07-23 19:33:39 +03:00
cellos51
c025d35468 null check on greedy joker 2025-07-22 20:07:51 -04:00
cellos51
1b4267893d Added greedy joker and refactor joker system 2025-07-22 20:00:05 -04:00