(Manual conflict res) Merge branch 'main' into ttm/joker-scope-joker-1

This commit is contained in:
MeirGavish
2025-08-15 10:56:41 +03:00
32 changed files with 640 additions and 314 deletions
+17
View File
@@ -0,0 +1,17 @@
#ifndef AFFINE_BACKGROUND_H
#define AFFINE_BACKGROUND_H
#include <tonc.h>
#include "graphic_utils.h"
#define AFFINE_BG_PAL_LEN 5
#define AFFINE_BG_PB (PAL_ROW_LEN * 15) // This isn't really a palette bank, just the starting index of the palette
void affine_background_init();
void affine_background_update();
void affine_background_set_color(COLOR color);
// Must be called with an array of size at least AFFINE_BG_PAL_LEN
void affine_background_load_palette(const u16 *src);
#endif // AFFINE_BACKGROUND_H
+3
View File
@@ -6,6 +6,8 @@
#define MAX_JOKERS_HELD_SIZE 5 // This doesn't account for negatives right now.
#define MAX_SHOP_JOKERS 2 // TODO: Make this dynamic and allow for other items besides jokers
#define MAX_SELECTION_SIZE 5
#define MAX_CARD_SCORE_DIGITS 2 // Current digit limit for score received from cards including mult etc. from jokers
#define MAX_CARD_SCORE_STR_LEN (MAX_CARD_SCORE_DIGITS + 1) // For the '+' or 'X'
#define FRAMES(x) (((x) + game_speed - 1) / game_speed)
// TODO: Turn into enum?
@@ -77,6 +79,7 @@ typedef struct CardObject CardObject; // forward declaration, actually declared
typedef struct JokerObject JokerObject;
CardObject** get_hand_array(void);
int get_hand_top(void);
int hand_get_size(void);
CardObject** get_played_array(void);
int get_played_top(void);
JokerObject** get_jokers(void);
+22 -1
View File
@@ -44,6 +44,9 @@
#define TILE_SIZE 8
#define EFFECT_TEXT_SEPARATION_AMOUNT 32; // If we need to show multiple effects at once
// By default TTE characters occupy a single tile
#define TTE_CHAR_SIZE TILE_SIZE
typedef struct
{
int left;
@@ -118,4 +121,22 @@ void tte_erase_rect_wrapper(Rect rect);
*/
void update_text_rect_to_right_align_num(Rect* rect, int num, int overflow_direction);
#endif //GRAPHIC_UTILS_H
/*Copies 16 bit data from src to dst, applying a palette offset to the data.
* This is intended solely for use with tile8/8bpp data for dst and src.
* The palette offset allows the tiles to use a different location in the palette
* memory
* This is useful because grit always loads the palette to the beginning of
* pal_bg_mem[]
*/
void memcpy16_tile8_with_palette_offset(u16* dst, const u16* src, uint hwcount, u8 palette_offset);
/*Copies 32 bit data from src to dst, applying a palette offset to the data.
* This is intended solely for use with tile8/8bpp data for dst and src.
* The palette offset allows the tiles to use a different location in the palette
* memory
* This is useful because grit always loads the palette to the beginning of
* pal_bg_mem[]
*/
void memcpy32_tile8_with_palette_offset(u32* dst, const u32* src, uint wcount, u8 palette_offset);
#endif //GRAPHIC_UTILS_H
+7 -1
View File
@@ -6,10 +6,16 @@
#include "sprite.h"
#include "card.h"
#include "game.h"
#include "graphic_utils.h"
#define JOKER_TID (MAX_HAND_SIZE + MAX_SELECTION_SIZE) * JOKER_SPRITE_OFFSET // Tile ID for the starting index in the tile memory
#define JOKER_SPRITE_OFFSET 16 // Offset for the joker sprites
#define JOKER_BASE_PB 4 // Palette bank for the default jokers
#define JOKER_BASE_PB 4 // The starting palette index for the jokers
#define JOKER_LAST_PB (NUM_PALETTES - 1)
// Currently allocating the rest of the palettes for the jokers.
// This number needs to be decreased once we need to allocated palettes for other sprites
// such as planet cards etc.
#define JOKER_STARTING_LAYER 27
#define BASE_EDITION 0
+3
View File
@@ -10,5 +10,8 @@
#include "joker_gfx6.h"
#include "joker_gfx7.h"
#include "joker_gfx8.h"
#include "joker_gfx9.h"
#include "joker_gfx10.h"
#include "joker_gfx11.h"
#endif
+25
View File
@@ -0,0 +1,25 @@
#ifndef LIST_H
#define LIST_H
#include <stdbool.h>
/* Defining an int list for simplicity
* If another list is needed, a generic void*
* list should be defined....
*/
typedef struct IntList
{
int* _array;
int size;
int allocated_size;
} IntList;
IntList *int_list_new(int init_size);
void int_list_destroy(IntList **list);
bool int_list_append(IntList *list, int value);
bool int_list_remove_by_idx(IntList *list, int index);
int int_list_get(IntList *list, int index);
int int_list_get_size(IntList *list);
bool int_list_remove_by_value(IntList *list, int value);
#endif
+3 -1
View File
@@ -4,11 +4,12 @@
#include <tonc.h>
#include <maxmod.h>
#define CARD_SPRITE_SIZE 32
typedef struct
{
OBJ_ATTR *obj;
OBJ_AFFINE *aff;
u32 tid, pb;
POINT pos;
} Sprite;
@@ -44,6 +45,7 @@ INLINE void sprite_position(Sprite *sprite, int x, int y)
// Sprite functions
void sprite_init();
void sprite_draw();
int sprite_get_pb(const Sprite* sprite);
// SpriteObject methods
SpriteObject *sprite_object_new();
+2
View File
@@ -37,6 +37,8 @@ static inline int get_digits_even(int n)
#define NUM_ELEM_IN_ARR(arr) (sizeof(arr) / sizeof((arr)[0]))
#define INT_MAX_DIGITS 10 // strlen(str(INT_MAX)) = strlen("2147483647")
int int_arr_max(int int_arr[], int size);
#endif // UTIL_H