summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-07-14 08:55:30 -0700
committer3gg <3gg@shellblade.net>2025-07-14 08:55:30 -0700
commit129fbdadc3a8e7ec2971fab893259802498f228a (patch)
tree95d6b4110d64b8f0b22997c1c64d001bd165ce5d
parent6cefdd40dd62f098874bd706720db731341bc957 (diff)
Remove unnecessary typdefs
-rw-r--r--src/isogfx.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/isogfx.c b/src/isogfx.c
index baf422f..53a6650 100644
--- a/src/isogfx.c
+++ b/src/isogfx.c
@@ -49,10 +49,6 @@ typedef struct TileData {
49 uint16_t pixels_handle; // Handle to the tile's pixels in the pixel pool. 49 uint16_t pixels_handle; // Handle to the tile's pixels in the pixel pool.
50} TileData; 50} TileData;
51 51
52// File format is already convenient for working in memory.
53typedef Ss_Row SpriteSheetRow;
54typedef Ss_SpriteSheet SpriteSheetData;
55
56typedef struct SpriteData { 52typedef struct SpriteData {
57 SpriteSheet sheet; // Handle to the sprite's sheet. 53 SpriteSheet sheet; // Handle to the sprite's sheet.
58 ivec2 position; 54 ivec2 position;
@@ -64,7 +60,7 @@ DEF_MEMPOOL_DYN(TilePool, TileData)
64DEF_MEM_DYN(PixelPool, Pixel) 60DEF_MEM_DYN(PixelPool, Pixel)
65 61
66DEF_MEMPOOL_DYN(SpritePool, SpriteData) 62DEF_MEMPOOL_DYN(SpritePool, SpriteData)
67DEF_MEM_DYN(SpriteSheetPool, SpriteSheetData) 63DEF_MEM_DYN(SpriteSheetPool, Ss_SpriteSheet)
68 64
69typedef struct IsoGfx { 65typedef struct IsoGfx {
70 int screen_width; 66 int screen_width;
@@ -521,8 +517,8 @@ bool isogfx_load_sprite_sheet(
521 if (file == NULL) { 517 if (file == NULL) {
522 goto cleanup; 518 goto cleanup;
523 } 519 }
524 const size_t sheet_size = get_file_size(file); 520 const size_t sheet_size = get_file_size(file);
525 SpriteSheetData* ss_sheet = mem_alloc(&iso->sheets, sheet_size); 521 Ss_SpriteSheet* ss_sheet = mem_alloc(&iso->sheets, sheet_size);
526 if (!ss_sheet) { 522 if (!ss_sheet) {
527 goto cleanup; 523 goto cleanup;
528 } 524 }
@@ -591,11 +587,10 @@ void isogfx_update(IsoGfx* iso, double t) {
591 // TODO: Consider linking animated sprites in a list so that we only walk 587 // TODO: Consider linking animated sprites in a list so that we only walk
592 // over those here and not also the static sprites. 588 // over those here and not also the static sprites.
593 mempool_foreach(&iso->sprites, sprite, { 589 mempool_foreach(&iso->sprites, sprite, {
594 const SpriteSheetData* sheet = mem_get_chunk(&iso->sheets, sprite->sheet); 590 const Ss_SpriteSheet* sheet = mem_get_chunk(&iso->sheets, sprite->sheet);
595 assert(sheet); // TODO: Make this a hard assert inside the mem/pool. 591 assert(sheet); // TODO: Make this a hard assert inside the mem/pool.
596 const SpriteSheetRow* row = 592 const Ss_Row* row = get_sprite_sheet_row(sheet, sprite->animation);
597 get_sprite_sheet_row(sheet, sprite->animation); 593 sprite->frame = (sprite->frame + 1) % row->num_cols;
598 sprite->frame = (sprite->frame + 1) % row->num_cols;
599 }); 594 });
600 595
601 iso->last_animation_time = t; 596 iso->last_animation_time = t;
@@ -740,7 +735,7 @@ static void draw_world(IsoGfx* iso) {
740 735
741static void draw_sprite( 736static void draw_sprite(
742 IsoGfx* iso, ivec2 origin, const SpriteData* sprite, 737 IsoGfx* iso, ivec2 origin, const SpriteData* sprite,
743 const SpriteSheetData* sheet) { 738 const Ss_SpriteSheet* sheet) {
744 assert(iso); 739 assert(iso);
745 assert(sprite); 740 assert(sprite);
746 assert(sheet); 741 assert(sheet);
@@ -748,7 +743,7 @@ static void draw_sprite(
748 assert(sprite->animation < sheet->num_rows); 743 assert(sprite->animation < sheet->num_rows);
749 assert(sprite->frame >= 0); 744 assert(sprite->frame >= 0);
750 745
751 const SpriteSheetRow* row = get_sprite_sheet_row(sheet, sprite->animation); 746 const Ss_Row* row = get_sprite_sheet_row(sheet, sprite->animation);
752 const uint8_t* frame = get_sprite_sheet_sprite(sheet, row, sprite->frame); 747 const uint8_t* frame = get_sprite_sheet_sprite(sheet, row, sprite->frame);
753 draw_rect( 748 draw_rect(
754 iso, origin, sheet->sprite_width, sheet->sprite_height, 749 iso, origin, sheet->sprite_width, sheet->sprite_height,
@@ -761,7 +756,7 @@ static void draw_sprites(IsoGfx* iso) {
761 const CoordSystem iso_space = make_iso_coord_system(iso); 756 const CoordSystem iso_space = make_iso_coord_system(iso);
762 757
763 mempool_foreach(&iso->sprites, sprite, { 758 mempool_foreach(&iso->sprites, sprite, {
764 const SpriteSheetData* sheet = mem_get_chunk(&iso->sheets, sprite->sheet); 759 const Ss_SpriteSheet* sheet = mem_get_chunk(&iso->sheets, sprite->sheet);
765 assert(sheet); 760 assert(sheet);
766 761
767 const ivec2 screen_origin = 762 const ivec2 screen_origin =