Commit Graph

11 Commits

Author SHA1 Message Date
MeirGavish d24b0b5619 Refactor shop code to use generic Item (#536)
* Turned SpriteObject into a member of JokerObject and CardObject and expiremented with casting

* Extracted shop code to use generic `SpriteObject`

* Extracted shop joker generation to a function

* Renamed object -> item

* Added setters and getters for `SpriteObject` members and updated all accesses to use them with casting (AI used for tedious work and reviewed - model Raptor mini)

* Added sprite_object_set_vx() because sprite_object_set_vy() exists and reordered the function order to have x,y parameters first, then targets

* Added Item object to act as a purchasable interface for the shop - AI used (model Raptor mini)

* Added -fms-extensions and switched to anonymous inheritance

* Fixed anonymous inheritance for joker and added direct access for that too

* fix build error from previous commit + clang-format

* Fixed build errors + clang-format for real this time (I hope...)

* clang-format one last time, I don't understand it anymore

* clang-format is annoying

* Added uses of CHECK_NULL_ARG macros

* Merged item_defs.h into item.h and fixed build error from previous commit

* clang-format...?

* Changed sprite_object_new() into sprite_object_init() and made it accept a parameter instead of returning one to make it less awkward

* Updated sprite_object_init() documentation

* Updated sprite_object_destroy documentation

* More clang-format

* Renamed add_to_inventory to acquire and updated documentation

* Added function documentations

* Update documentation + swap order of consumable and playing card types

* Added documentation for new files (+ small addition to button.h)

* clang-format

* Used typedef

* A bit more documentation

* Changed sho pcode to use generic Item instead of SpriteObject

* clang-format + fixed NULL-check error

* Revert weird clang-format...?

* clang-format for real

* Fixed errors from rebase on log_function_name

* Fixed build errors from rebase on main

* Added some more documentation about first member struct inheritance

* typo fix

* typo fix for real

* Removed SpriteObject field getters/setters (AI used - model Raptor mini)

* Renamed item_acquire -> item_on_acquired

* Added item_can_acquire()

* clang-format

* Fixed some sprite issues but not all...

* Fixed some more issues

* Cleanup JokerObject some more JokerObjects in the shop

* Added `item_destroy()`

* Added item_set_available_to_shop, CHECK_ITEM_TYPE macros + small documentation updates

* Another small JokerObject->Item replacement

* Removed item_set_available_to_shop and replaced with item_roll_new() and item_dispose(), also changed "available_to_shop" semantics to "rollable"

* Re-applied changes from game.c to round.c after rebase on main

* Added partial implementations of item functions for playing cards

* Line endings fix...

* Macro renames, function documentations

* Updated documentations

* Apply fixes from Copilot review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix card_object_get_buy_price type checking

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Avoid double pointer cast on dispose

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Apply suggestions from @ricfehr3's code review

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

* Remove redundant comments

* Moved error checking before joker_get_random_rarity

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

* Fixed build error from rebase

* clang-format

* Added doxygen documentation for Item explaining inheritance

* Removed unnecessary comment

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Rickey <ric@rf3.xyz>
2026-07-09 09:13:51 +03:00
MeirGavish 9a4aaca399 Fixed #575 incorrect joker sell value displayed after displaying description (#576) 2026-07-02 13:26:00 +03:00
Geralt c706a387a9 Implement a global SpriteObject update loop (#553)
* Implement `sprite_object_update_all`

* clang format

* Change update order

* tmp

* make it crash

* Fix bad address crash

* Address @MeirGavish's comments

* Tweaked card draw position further

* Tweaked card draw position further, again

---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
2026-06-17 19:26:53 -07:00
Geralt 6170efca99 Fix missing Deck size/max text after showing Joker description in the Shop
Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
2026-06-12 20:05:57 -07:00
Rickey 8111b6e046 Cleanup sprite_position usage (#539)
* Cleanup sprite_position usage

* Add IWRAM_CODE attr for inline sprite function

* removed extra sprite_position call
2026-06-11 18:01:41 -07:00
Geralt e26558e1a5 [Feature] Implement Joker descriptions in the Shop when holding B (#530)
* WIP

* WIP

* WIP

* WIP

* Tags are bugged but it's looking good

* Centering is bugged, almost there

* WIP

* Fixed centeriiiing, yaaaay

* good progress

* add proper '\n' support

* WIP descriptions

* All descriptions are there ^^

* missing 9-patch for pretty display

* WIP

* fix rebase issues

* Fix minor Run Setup screen issues

* Almost done, only one fix to go

* Aaaalmooost doooneeeee

* make desc frame size adaptative

* add rarity color and text

* final cleanup

* clang format

* clang format

* clang format

* clang format

* clang format

* Fix Joker update loop index

* Fix const and Bull description

* Fix unwanted button SFX

* fix tte colors

* Add misprint description

* Fix justified line length computation

* Add safeguards to tag parsing loop

* clang format

* Fix Ante bugged display at boss blind end

* Tweak suit colors

* Final fixes

* Simplified the way we print descriptions

* simplify further

* get rid of weird macro

* Fix Onwed joker price when holding A after showing its description

---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
2026-06-08 18:16:37 -07:00
MeirGavish 8dc96b6bbb Refactor - Moved shop data structures to shop.c/.h (#521)
* Moved shop data structures to `shop.c/.h`

* Renamed static variables and reset function
2026-05-31 12:32:27 +03:00
Rickey 63b6584706 Feature/game over audio (#494)
* initial additions

* Move current_blind to game vars

* tmp

* tmp

* tmp

* tmp

* tmp

* tmp

* tmp

* Compile but is broken

* temp fix for token location

* tmp

* Working, lets clean up

* remove todo

* Remove odd reroll blind variable

* fix skipping blind screen

* fix reroll

* remove magic for blind token locations

* clang format

* Cleanup button highlight in blind menu

* some cleanup

* Add layout file for global UI rects

* remove dead code

* Clang format

* clang format it up

* Move reset top left funct to gfx utils

* make note of soon-to-be removed vars

* Cleanup gamevars declaration

* Cleanup layout file

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Add include for stdbool.h in common_ui.h

* Cleanup rect declaration

* Start moving state machine stuff to new file

* quick tmp

* oops, add new files

* working call list

* fixed pointer stuff

* working as per norm

* working replacement

* move defines to static const

* fix compile issue

* Add some missing "void"s

* Working new substates

* add statemachine to blind select

* Fix game restart statemachine leak

* clang-format

* Clang format

* Rework shop exit logic

* Use new state machine in shop

* Remove substates entirely

* Remove debug stuff

* Clang format

* document state machine better

* update list tests

* clang-format

* Update for PR

* Claaaaang format

* another clang-format

* Remove extra state in round_end

* cleanup docs for removals in lists

* clang-format... again

* update doxygen format

* Clang format

* tmp

* Update for Pr

* clang-format

* Cleanup for only supporting losing

* bug fix, thanks logs!

* Fix dangling pointer bug

The control of removing statemachines may call issues if starting the
function is done from another state machine call. To remedy this, add a
flag to determine if a state machine is registered and return early
instead of blindly removing it to re-add.

* Fix bug with audio iterations possibly going in reverse

* Remove extra includes

* Clang-format

* Add sound effects for game win/lose

* adjust audio steps

* tmp

* Nice sounding and cleaned up

* Fix and cleanup

* clang-format

* clang-format

* clang format again

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-27 21:57:30 -07:00
Rickey 92cb9f9883 Refactor/state machine (#470)
* initial additions

* Move current_blind to game vars

* tmp

* tmp

* tmp

* tmp

* tmp

* tmp

* tmp

* Compile but is broken

* temp fix for token location

* tmp

* Working, lets clean up

* remove todo

* Remove odd reroll blind variable

* fix skipping blind screen

* fix reroll

* remove magic for blind token locations

* clang format

* Cleanup button highlight in blind menu

* some cleanup

* Add layout file for global UI rects

* remove dead code

* Clang format

* clang format it up

* Move reset top left funct to gfx utils

* make note of soon-to-be removed vars

* Cleanup gamevars declaration

* Cleanup layout file

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Add include for stdbool.h in common_ui.h

* Cleanup rect declaration

* Start moving state machine stuff to new file

* quick tmp

* oops, add new files

* working call list

* fixed pointer stuff

* working as per norm

* working replacement

* move defines to static const

* fix compile issue

* Add some missing "void"s

* Working new substates

* add statemachine to blind select

* Fix game restart statemachine leak

* clang-format

* Clang format

* Rework shop exit logic

* Use new state machine in shop

* Remove substates entirely

* Remove debug stuff

* Clang format

* document state machine better

* update list tests

* clang-format

* Update for PR

* Claaaaang format

* another clang-format

* Remove extra state in round_end

* cleanup docs for removals in lists

* clang-format... again

* update doxygen format

* Clang format

* Update list docs

* Update lists tests

* Fix bad conflict resolution

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-22 18:06:13 -07:00
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 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