Commit Graph

33 Commits

Author SHA1 Message Date
Geralt d5d5a6fd6b Refactor/shop (#475)
* initial commit, DOES NOT COMPILE

* Rename joker interactions file to `joker_row`

* IT'S WORKIIING (now to make it pretty lol)

* fixed rebase issues

* fix rebase + undo state machine changes

* Document shop state functions

* clang format

* fix reroll cost not appearing on shop init

* Move generic SpriteObject text/price printing functions to sprite.c + some minor fixes

* Resolve weird defines/include order issue

* clang format

* Implement suggestions from @ricfehr3

* clang format

* clang format

* fix rebase

* Implement sugegstions from @ricfehr3

* Refactored shop to use the Button struct

* missed some memsets

---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
2026-05-15 18:36:19 -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
Elliot Tester 35b6169fd7 Optimize Damping Coefficient (#444)
* Optimize Damping Coefficient

* Added Rounding + Moved Constants

* Added Comments and Made Rounding not use a magic number

* adjust epsilon

* Adjusted Documentation
2026-04-23 19:17:23 +03:00
Rickey 0bc140b4e8 Document sprite.h w/ minor optimizations / fixes (#379)
* Rename Sprite to SpriteInfo

---------

Co-authored-by: MeirGavish <meir.gavish@gmail.com>
2026-02-11 16:55:56 +02:00
MeirGavish 81e6b7ab31 Button sound effect (#312)
* Removed magic number for CARD_FOCUS_SFX_PITCH_OFFSET_RANGE
2025-12-13 16:10:15 +02:00
MeirGavish 9bffe5c9a9 Refactor - remove selected from SpriteObject (#305) 2025-12-12 18:44:26 -08:00
Marcel Schulz f9ed858549 [Fixed] Joker shop price not properly erased on purchase (#286) 2025-12-11 08:39:09 +02:00
Rickey 291edaf4f2 Clang format and refactor game.h/c + update Bracket Alignment to BlockIndent (#259)
* Refactor and clang-format game.h/c

* Updated clang-format AlignAfterOpenBracket: BlockIndent and ColumnLimit: 100 and refactored all files accordingly

---------

Co-authored-by: MeirGavish <meir.gavish@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-03 13:49:31 +02:00
Rickey 6db35b0f95 Clang format sprite (#262) 2025-11-24 23:26:47 +02:00
Rickey Fehr 517d40c294 Cleanup for PR, return old sprite tracker 2025-10-19 15:52:36 -07:00
Rickey Fehr 16059ab632 Update for PR
Readd sprite tracker to not reuse indices
check for capacity when returning pool entries
Update script for printing memory map
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
alex d108836b6a changed how game_speed affects hand score animations 2025-10-13 20:24:20 -07:00
alex daba462575 fixed a division thingy 2025-09-23 12:45:09 -07:00
alex ad9358547d main 2025-09-23 12:44:03 -07:00
alex f57c37b900 fixed a divison thingy 2025-09-23 12:40:26 -07:00
alex 7bafc260dd fixed game_speed, now using fixed point and keeping game_speed static 2025-09-22 22:04:51 -07:00
alex 301f5a2a53 kind of fixed how game_speed behaves 2025-09-21 23:49:24 -07:00
alex 6e60cf5970 kind of fixed how game_speed behaves 2025-09-21 23:16:50 -07:00
Drew e8e945b17d Removed redundant copy of shadow buffer into OAM. 2025-09-14 13:50:38 -05:00
MeirGavish 64274ae465 Added joker selling (still no animation) + fixed SpriteObject constructor focused bug 2025-08-16 15:38:34 +03:00
MeirGavish d1677e82d2 Added Selection Grid system and refactored shop code to use it 2025-08-15 19:30:07 +03:00
MeirGavish 06dc4f9c62 Extracted focus to SpriteObject for joker selling - WIP 2025-08-15 10:38:20 +03:00
MeirGavish 0e080b916e Reverted removals of float2fx() as they're compiler-optimized but kept float optimization 2025-08-12 11:40:22 +03:00
MeirGavish 658b0572d9 Removed all uses of float for optimization 2025-08-12 03:01:02 +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
MeirGavish a8f429eca3 Moved the price of shop items below the item so it is not obstructed when the card is raised on highlight 2025-08-03 16:08:41 +03: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 176910c483 Jokers appear in the shop but don't do anything yet 2025-07-18 19:29:17 -04:00
cellos51 cac321a325 first commit 2025-01-31 17:42:09 -05:00