diff --git a/.gitignore b/.gitignore index 5d022f364a..a79bb4304e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,9 @@ Thumbs.db ehthumbs.db +# RAD Debugger files +*.rdi + # Visual Studio folder .vs *.pdb diff --git a/include/constants/sa1/characters.h b/include/constants/sa1/characters.h index 353b344a3c..7aa1270345 100644 --- a/include/constants/sa1/characters.h +++ b/include/constants/sa1/characters.h @@ -1,19 +1,7 @@ #ifndef GUARD_CONSTANTS_CHARACTERS_H #define GUARD_CONSTANTS_CHARACTERS_H -#if 01 -typedef enum { - CHARACTER_SONIC, -#if (GAME >= GAME_SA2) - CHARACTER_CREAM, -#endif - CHARACTER_TAILS, - CHARACTER_KNUCKLES, - CHARACTER_AMY, - - NUM_CHARACTERS -} ECharacters; -#else +// TODO: These should be an enum! // TODO: Right now these have to be defined like this for BriBaSA_ex to work. // Obviously this shall change! #define CHARACTER_SONIC 0 @@ -21,7 +9,6 @@ typedef enum { #define CHARACTER_KNUCKLES 2 #define CHARACTER_AMY 3 #define NUM_CHARACTERS 4 -#endif // NOTE: Put this after NUM_CHARACTERS, to allow BriBaSA_ex to parse this file properly. // Naming it CHARACTER_ before NUM_CHARACTERS confuses it. diff --git a/include/constants/sa2/characters.h b/include/constants/sa2/characters.h index afcd2cdb21..31139cd7ef 100644 --- a/include/constants/sa2/characters.h +++ b/include/constants/sa2/characters.h @@ -1,17 +1,15 @@ #ifndef GUARD_CONSTANTS_CHARACTERS_H #define GUARD_CONSTANTS_CHARACTERS_H -typedef enum { - CHARACTER_SONIC, -#if (GAME >= GAME_SA2) - CHARACTER_CREAM, -#endif - CHARACTER_TAILS, - CHARACTER_KNUCKLES, - CHARACTER_AMY, - - NUM_CHARACTERS -} ECharacters; +// TODO: These should be an enum! +// TODO: Right now these have to be defined like this for BriBaSA_ex to work. +// Obviously this shall change! +#define CHARACTER_SONIC 0 +#define CHARACTER_CREAM 1 +#define CHARACTER_TAILS 2 +#define CHARACTER_KNUCKLES 3 +#define CHARACTER_AMY 4 +#define NUM_CHARACTERS 5 // NOTE: Put this after NUM_CHARACTERS, to allow BriBaSA_ex to parse this file properly. // Naming it CHARACTER_ before NUM_CHARACTERS confuses it. diff --git a/include/gba/defines.h b/include/gba/defines.h index 0ae35e1198..648dea156f 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -86,7 +86,7 @@ extern uint8_t OAM[OAM_SIZE]; #define BG_VRAM &VRAM[0] #define BG_CHAR_ADDR(n) (((u8*)BG_VRAM) + (0x4000 * (n))) -#define BG_CHAR_ADDR_FROM_BGCNT(bg) (BG_VRAM + ((gBgCntRegs[bg] & BGCNT_CHARBASE(0x3)) << 12)) +#define BG_CHAR_ADDR_FROM_BGCNT(bg) (void*)(BG_VRAM + ((gBgCntRegs[bg] & BGCNT_CHARBASE(0x3)) << 12)) #define BG_SCREEN_ADDR(n) (((u8*)BG_VRAM) + (0x800 * (n))) #define BG_TILE_ADDR(n) (((u8*)BG_VRAM) + (0x80 * (n))) @@ -112,11 +112,11 @@ extern uint8_t OAM[OAM_SIZE]; #define BG_PLTT ((u16 *)(PLTT)) #define OBJ_PLTT ((u16 *)(PLTT + BG_PLTT_SIZE)) -#define VRAM 0x6000000 +#define VRAM (void*)0x6000000 #define BG_VRAM VRAM #define BG_CHAR_ADDR(n) (BG_VRAM + ((n) << 14)) -#define BG_CHAR_ADDR_FROM_BGCNT(bg) ((u8*)BG_VRAM + ((gBgCntRegs[bg] & BGCNT_CHARBASE(0x3)) << 12)) +#define BG_CHAR_ADDR_FROM_BGCNT(bg) (void*)((u8*)BG_VRAM + ((gBgCntRegs[bg] & BGCNT_CHARBASE(0x3)) << 12)) // TODO: Maybe rename BG_SCREEN_ADDR #define BG_SCREEN_ADDR(n) (BG_VRAM + (0x800 * (n))) #define BG_TILE_ADDR(n) (BG_VRAM + (0x80 * (n))) diff --git a/src/background.c b/src/background.c index 1792636f70..ee1744f017 100644 --- a/src/background.c +++ b/src/background.c @@ -904,7 +904,7 @@ NONMATCH("asm/non_matching/engine/sa2__sub_80039E4.inc", bool32 SA2_LABEL(sub_80 if (dims != (void *)-1) { u32 bgId = SPRITE_FLAG_GET(s, BG_ID); - void *bgVram = (void *)BG_CHAR_ADDR((gBgCntRegs[bgId] & BGCNT_CHARBASE(3)) >> 2); + void *bgVram = BG_CHAR_ADDR((gBgCntRegs[bgId] & BGCNT_CHARBASE(3)) >> 2); void *bgBase = bgVram + ((gBgCntRegs[bgId] & BGCNT_SCREENBASE_MASK) << 3); if (gBgCntRegs[bgId] & BGCNT_256COLOR) { @@ -1246,7 +1246,7 @@ s32 RenderText(void *dest, const void *font, u16 x, u16 y, u8 bg, const char *te { u8 i = 0; - u16 *vramTiles = (void *)BG_CHAR_ADDR_FROM_BGCNT(bg); + u16 *vramTiles = BG_CHAR_ADDR_FROM_BGCNT(bg); u16 layoutBase = (gBgCntRegs[bg] & BGCNT_SCREENBASE_MASK) << 3; u16 *vramLayout = ({ (u16 *)(VRAM + (layoutBase)); }) + y * 32 + x; @@ -1367,7 +1367,7 @@ static AnimCmdResult animCmd_SetIdAndVariant_BG(void *cursor, Sprite *s) s->animCursor += AnimCommandSizeInWords(*cmd); s->graphics.anim = cmd->animId; - s->prevVariant = 0xFF; + s->prevVariant = -1; s->variant = cmd->variant; return -1; diff --git a/src/core.c b/src/core.c index 0973af97fd..4676384731 100644 --- a/src/core.c +++ b/src/core.c @@ -622,31 +622,31 @@ void UpdateScreenDma(void) { u8 i, j = 0; REG_DISPCNT = gDispCnt; - DmaCopy32(3, gBgCntRegs, (void *)REG_ADDR_BG0CNT, sizeof(gBgCntRegs)); + DmaCopy32(3, gBgCntRegs, ®_BG0CNT, sizeof(gBgCntRegs)); if (gFlags & FLAGS_UPDATE_BACKGROUND_PALETTES) { - DmaCopy32(3, gBgPalette, (void *)BG_PLTT, sizeof(gBgPalette)); + DmaCopy32(3, gBgPalette, BG_PLTT, sizeof(gBgPalette)); gFlags ^= FLAGS_UPDATE_BACKGROUND_PALETTES; } if (gFlags & FLAGS_UPDATE_SPRITE_PALETTES) { - DmaCopy32(3, gObjPalette, (void *)OBJ_PLTT, sizeof(gObjPalette)); + DmaCopy32(3, gObjPalette, OBJ_PLTT, sizeof(gObjPalette)); gFlags ^= FLAGS_UPDATE_SPRITE_PALETTES; } - DmaCopy32(3, gWinRegs, (void *)REG_ADDR_WIN0H, sizeof(gWinRegs)); - DmaCopy16(3, &gBldRegs, (void *)REG_ADDR_BLDCNT, 6); + DmaCopy32(3, gWinRegs, ®_WIN0H, sizeof(gWinRegs)); + DmaCopy16(3, &gBldRegs, ®_BLDCNT, 6); #if (GAME == GAME_SA2) #ifdef BUG_FIX - DmaCopy16(3, &gMosaicReg, (void *)REG_ADDR_MOSAIC, sizeof(gMosaicReg)); + DmaCopy16(3, &gMosaicReg, ®_MOSAIC, sizeof(gMosaicReg)); #else // BUG: For some reason, even though the var // is only 2 they chose to copy 4 bytes, oops - DmaCopy16(3, &gMosaicReg, (void *)REG_ADDR_MOSAIC, 4); + DmaCopy16(3, &gMosaicReg, ®_MOSAIC, 4); #endif #endif - DmaCopy16(3, gBgScrollRegs, (void *)REG_ADDR_BG0HOFS, sizeof(gBgScrollRegs)); - DmaCopy32(3, &gBgAffineRegs, (void *)REG_ADDR_BG2PA, sizeof(gBgAffineRegs)); + DmaCopy16(3, gBgScrollRegs, ®_BG0HOFS, sizeof(gBgScrollRegs)); + DmaCopy32(3, &gBgAffineRegs, ®_BG2PA, sizeof(gBgAffineRegs)); if (gFlags & FLAGS_EXECUTE_HBLANK_CALLBACKS) { REG_IE |= INTR_FLAG_HBLANK; diff --git a/tools/BriBaSA_ex/src/drawing.c b/tools/BriBaSA_ex/src/drawing.c index 2dfef656db..c64b17242c 100644 --- a/tools/BriBaSA_ex/src/drawing.c +++ b/tools/BriBaSA_ex/src/drawing.c @@ -1019,8 +1019,8 @@ DrawMap(AppState *state, Rectangle recMap, Texture2D txMtAtlas, Texture2D txMap) ); } - int mtIndexBack = GetMetatileIndex(&state->map, &state->paths.map, LAYER_BACK, mtX, mtY); - int mtIndexFront = GetMetatileIndex(&state->map, &state->paths.map, LAYER_FRONT, mtX, mtY); + int mtIndexBack = GetMetatileIndex(state->game, &state->map, &state->paths.map, LAYER_BACK, mtX, mtY); + int mtIndexFront = GetMetatileIndex(state->game, &state->map, &state->paths.map, LAYER_FRONT, mtX, mtY); bool iterateAgain = false; do { diff --git a/tools/BriBaSA_ex/src/file_paths.c b/tools/BriBaSA_ex/src/file_paths.c index c95ea813f9..95763c5360 100644 --- a/tools/BriBaSA_ex/src/file_paths.c +++ b/tools/BriBaSA_ex/src/file_paths.c @@ -12,7 +12,7 @@ static void SetupTilemapPaths(Tilemap *out, char *directory); void -InitFilePaths(FileInfo *outInfo, char *gameDir, char *mapDir) +InitFilePaths(Game game, FileInfo *outInfo, char *gameDir, char *mapDir) { FileInfo info = {0}; @@ -20,11 +20,11 @@ InitFilePaths(FileInfo *outInfo, char *gameDir, char *mapDir) info.mapRoot = mapDir; /* Global C Headers */ - info.characters_h = allocPath(gameDir, "include/constants/characters.h"); - info.animations_h = allocPath(gameDir, "include/constants/animations.h"); - info.enemies_h = allocPath(gameDir, "include/constants/enemies.h"); - info.interactables_h = allocPath(gameDir, "include/constants/interactables.h"); - info.items_h = allocPath(gameDir, "include/constants/items.h"); + info.characters_h = allocPath(gameDir, TextFormat("include/constants/sa%d/characters.h", game)); + info.animations_h = allocPath(gameDir, TextFormat("include/constants/sa%d/animations.h", game)); + info.enemies_h = allocPath(gameDir, TextFormat("include/constants/sa%d/enemies.h", game)); + info.interactables_h = allocPath(gameDir, TextFormat("include/constants/sa%d/interactables.h", game)); + info.items_h = allocPath(gameDir, TextFormat("include/constants/sa%d/items.h", game)); /* Map-specific */ diff --git a/tools/BriBaSA_ex/src/file_paths.h b/tools/BriBaSA_ex/src/file_paths.h index ad4dd4c3a2..715e115192 100644 --- a/tools/BriBaSA_ex/src/file_paths.h +++ b/tools/BriBaSA_ex/src/file_paths.h @@ -1,7 +1,7 @@ #ifndef GUARD_BRIBASA_EX_FILE_PATHS_H #define GUARD_BRIBASA_EX_FILE_PATHS_H -extern void InitFilePaths(FileInfo *outInfo, char *gameDir, char *mapDir); +extern void InitFilePaths(Game game, FileInfo *outInfo, char *gameDir, char *mapDir); extern char *allocPath(char *folder, char *fileName); #endif // GUARD_BRIBASA_EX_FILE_PATHS_H diff --git a/tools/BriBaSA_ex/src/main.c b/tools/BriBaSA_ex/src/main.c index 88950cbcc1..207ea661ff 100644 --- a/tools/BriBaSA_ex/src/main.c +++ b/tools/BriBaSA_ex/src/main.c @@ -114,7 +114,7 @@ int main(void) exit(-1); } - const char *mapsRoot = TextFormat("%s/data/maps/", rootDir); + const char *mapsRoot = TextFormat("%s/data/sa%d/maps/", rootDir, state.game); if(!DirectoryExists(mapsRoot)) { printf("ERROR: '%s' could not be found. Closing...\n", mapsRoot); exit(-2); @@ -122,10 +122,10 @@ int main(void) char *mapDir = GetMapDirectory(mapsRoot); - InitFilePaths(&state.paths, (char*)rootDir, (char*)mapDir); + InitFilePaths(state.game, &state.paths, (char*)rootDir, (char*)mapDir); LoadEntityNamesAndIDs(&state); - LoadAllEntityTextures(state.paths.gameRoot, &state.paths); + LoadAllEntityTextures(state.game, state.paths.gameRoot, &state.paths); LoadEntityDataFromCSVs(&state); InitUiHeaderWidgets(&state.uiHeader); @@ -545,22 +545,40 @@ SetNewMetatiles(AppState *state, int x, int y) StageMap *map = &state->map; short targetIndex = y * map->width + x; - if(targetIndex < (state->paths.map.tilemap.dataSize / sizeof(short))) { + if(targetIndex < (state->paths.map.tilemap.dataSize / ((state->game == GAME_SA1) ? sizeof(unsigned char) : sizeof(short)) )) { if(map->flags & MAP_FLAG_SHOW_BACK_LAYER) { - unsigned short *layoutBack = state->paths.map.layers[LAYER_BACK].data; + if(state->game == GAME_SA1) { + unsigned char *layoutBack = state->paths.map.layers[LAYER_BACK].data; - if(layoutBack[targetIndex] != map->selectedMetatileIndexBack) { - layoutBack[targetIndex] = map->selectedMetatileIndexBack; - state->unsavedChangesExist = true; + if(layoutBack[targetIndex] != map->selectedMetatileIndexBack) { + layoutBack[targetIndex] = map->selectedMetatileIndexBack; + state->unsavedChangesExist = true; + } + } else { + unsigned short *layoutBack = state->paths.map.layers[LAYER_BACK].data; + + if(layoutBack[targetIndex] != map->selectedMetatileIndexBack) { + layoutBack[targetIndex] = map->selectedMetatileIndexBack; + state->unsavedChangesExist = true; + } } } if(map->flags & MAP_FLAG_SHOW_FRONT_LAYER) { - unsigned short *layoutFront = state->paths.map.layers[LAYER_FRONT].data; + if(state->game == GAME_SA1) { + unsigned char *layoutFront = state->paths.map.layers[LAYER_FRONT].data; + + if(layoutFront[targetIndex] != map->selectedMetatileIndexFront) { + layoutFront[targetIndex] = map->selectedMetatileIndexFront; + state->unsavedChangesExist = true; + } + } else { + unsigned short *layoutFront = state->paths.map.layers[LAYER_FRONT].data; - if(layoutFront[targetIndex] != map->selectedMetatileIndexFront) { - layoutFront[targetIndex] = map->selectedMetatileIndexFront; - state->unsavedChangesExist = true; + if(layoutFront[targetIndex] != map->selectedMetatileIndexFront) { + layoutFront[targetIndex] = map->selectedMetatileIndexFront; + state->unsavedChangesExist = true; + } } } } @@ -577,14 +595,19 @@ GetMousePositionInRec(Rectangle rec) { } inline int -GetMetatileIndex(StageMap *map, Tilemap* tilemap, MetatileLayer layer, int x, int y) +GetMetatileIndex(Game game, StageMap *map, Tilemap* tilemap, MetatileLayer layer, int x, int y) { ///assert(layer < LAYER_COUNT); if(x >= 0 && y >= 0 - && x < map->width && y < map->height) { - uint16_t *mtIndices = tilemap->layers[layer].data; - return mtIndices[y * map->width + x]; + && x < map->width && y < map->height) { + if(game == GAME_SA1) { + uint8_t *mtIndices = tilemap->layers[layer].data; + return mtIndices[y * map->width + x]; + } else { + uint16_t *mtIndices = tilemap->layers[layer].data; + return mtIndices[y * map->width + x]; + } } else { return 0; } @@ -638,8 +661,8 @@ HandleMouseInput(AppState *state, Rectangle recMap) map->selectedMetatile.x = mtMouse.x; map->selectedMetatile.y = mtMouse.y; - int mtIndexFront = GetMetatileIndex(&state->map, &state->paths.map, LAYER_FRONT, state->map.selectedMetatile.x, state->map.selectedMetatile.y); - int mtIndexBack = GetMetatileIndex(&state->map, &state->paths.map, LAYER_BACK , state->map.selectedMetatile.x, state->map.selectedMetatile.y); + int mtIndexFront = GetMetatileIndex(state->game, &state->map, &state->paths.map, LAYER_FRONT, state->map.selectedMetatile.x, state->map.selectedMetatile.y); + int mtIndexBack = GetMetatileIndex(state->game, &state->map, &state->paths.map, LAYER_BACK , state->map.selectedMetatile.x, state->map.selectedMetatile.y); state->map.selectedMetatileIndexFront = mtIndexFront; state->map.selectedMetatileIndexBack = mtIndexBack; diff --git a/tools/BriBaSA_ex/src/map.h b/tools/BriBaSA_ex/src/map.h index 671ffd71b0..9233feb461 100644 --- a/tools/BriBaSA_ex/src/map.h +++ b/tools/BriBaSA_ex/src/map.h @@ -2,7 +2,7 @@ #define GUARD_BRIBASA_EX_MAP_H extern Texture2D CreateMetatileAtlas(AppState *state, int numMetatiles); -extern int GetMetatileIndex(StageMap *map, Tilemap* tilemap, MetatileLayer layer, int x, int y); +extern int GetMetatileIndex(Game game, StageMap *map, Tilemap* tilemap, MetatileLayer layer, int x, int y); extern Vector2i GetMetatilePointBelowMouse(StageMap *map, Rectangle recMap); extern bool IsMouseOnSpawn(StageMap *map, CharacterList *chars); diff --git a/tools/BriBaSA_ex/src/parsing.c b/tools/BriBaSA_ex/src/parsing.c index 64622b2552..de4144d2e6 100644 --- a/tools/BriBaSA_ex/src/parsing.c +++ b/tools/BriBaSA_ex/src/parsing.c @@ -166,19 +166,28 @@ LoadEntityNamesAndIDs(AppState *state) } if(TextIsEqual(tokenName->text, TextFormat("SA%d_ANIM_ITEMBOX", state->game))) { - items->animItembox = TextToInteger(tokenID->text); + if(items->animItembox == 0) { + items->animItembox = TextToInteger(tokenID->text); + } } else if(TextIsEqual(tokenName->text, TextFormat("SA%d_ANIM_ITEMBOX_TYPE", state->game))) { - items->animItemType = TextToInteger(tokenID->text); + if(items->animItemType == 0) + { + items->animItemType = TextToInteger(tokenID->text); + } } else if(TextIsEqual(tokenName->text, TextFormat("SA%d_ANIM_RING", state->game))) { - ring->anim = TextToInteger(tokenID->text); + if(ring->anim == 0) { + ring->anim = TextToInteger(tokenID->text); + } } else if(foundEnemyAnims < enemies->count) { for(int ei = 0; ei < enemies->count; ei++) { unsigned short id = enemies->elements[ei].id; EntityMeta *enemy = &enemies->elements[id]; const char *format = TextFormat("SA%d_ANIM_%s", state->game, enemy->name); - if(TextIsEqual((char *)tokenName->text, format)) { - enemy->anim = TextToInteger(tokenID->text); + if(TextIsEqual((char *)tokenName->text, format)) { + if(enemy->anim == 0) { + enemy->anim = TextToInteger(tokenID->text); + } foundEnemyAnims++; break; @@ -192,7 +201,9 @@ LoadEntityNamesAndIDs(AppState *state) if(TextIsEqual((char *)tokenName->text, format)) { do { - ia->anim = TextToInteger(tokenID->text); + if(ia->anim == 0) { + ia->anim = TextToInteger(tokenID->text); + } foundIAAnims++; diff --git a/tools/BriBaSA_ex/src/texture.c b/tools/BriBaSA_ex/src/texture.c index 149096ec6e..7c152c42ec 100644 --- a/tools/BriBaSA_ex/src/texture.c +++ b/tools/BriBaSA_ex/src/texture.c @@ -49,65 +49,65 @@ GetEntityTextureById(AppState *state, EntityType etype, unsigned char id) } static inline void -LoadCharacterTextures(char *gameRoot, CharacterList *chars) +LoadCharacterTextures(Game game, char *gameRoot, CharacterList *chars) { for(int c = 0; c < chars->count; c++) { Character *character = &chars->elements[c]; int frame = 0; - const char *animPath = TextFormat("%s/graphics/obj_tiles/4bpp/anim_%04d/f%03d.png", - gameRoot, character->animIdle, frame); + const char *animPath = TextFormat("%s/graphics/sa%d/obj_tiles/4bpp/anim_%04d/f%03d.png", + gameRoot, game, character->animIdle, frame); character->texture = LoadTexture(animPath); } } static inline void -LoadEntityTextures(char *gameRoot, EntityMetaList *ents) +LoadEntityTextures(Game game, char *gameRoot, EntityMetaList *ents) { for(int c = 0; c < ents->count; c++) { EntityMeta *ent = &ents->elements[c]; int frame = 0; - const char *animPath = TextFormat("%s/graphics/obj_tiles/4bpp/anim_%04d/f%03d.png", - gameRoot, ent->anim, frame); + const char *animPath = TextFormat("%s/graphics/sa%d/obj_tiles/4bpp/anim_%04d/f%03d.png", + gameRoot, game, ent->anim, frame); ent->texture = LoadTexture(animPath); } } static inline void -LoadInteractableTextures(char *gameRoot, InteractableMetaList *ias) +LoadInteractableTextures(Game game, char *gameRoot, InteractableMetaList *ias) { for(int c = 0; c < ias->count; c++) { InteractableMeta *ia = &ias->elements[c]; int frame = 0; - const char *animPath = TextFormat("%s/graphics/obj_tiles/4bpp/anim_%04d/f%03d.png", - gameRoot, ia->anim, frame); + const char *animPath = TextFormat("%s/graphics/sa%d/obj_tiles/4bpp/anim_%04d/f%03d.png", + gameRoot, game, ia->anim, frame); ia->texture = LoadTexture(animPath); } } static inline void -LoadRingTexture(char *gameRoot, EntityMeta *ring) +LoadRingTexture(Game game, char *gameRoot, EntityMeta *ring) { int frame = 0; - const char *animPath = TextFormat("%s/graphics/obj_tiles/4bpp/anim_%04d/f%03d.png", - gameRoot, ring->anim, frame); + const char *animPath = TextFormat("%s/graphics/sa%d/obj_tiles/4bpp/anim_%04d/f%03d.png", + gameRoot, game, ring->anim, frame); ring->texture = LoadTexture(animPath); } static inline void -LoadItemTextures(char *gameRoot, ItemMetaList *items, short numCharacters) +LoadItemTextures(Game game, char *gameRoot, ItemMetaList *items, short numCharacters) { - const char *pathFormat = "%s/graphics/obj_tiles/4bpp/anim_%04d/f%03d.png"; + const char *pathFormat = "%s/graphics/sa%d/obj_tiles/4bpp/anim_%04d/f%03d.png"; // Itembox unsigned short animId = items->animItembox; - const char *itemboxPath = TextFormat(pathFormat, gameRoot, animId, 0); + const char *itemboxPath = TextFormat(pathFormat, gameRoot, game, animId, 0); items->txItembox = LoadTexture(itemboxPath); // 1-Up icons for(int c = 0; c < numCharacters; c++) { unsigned short animId = items->animItemType; - const char *iconPath = TextFormat(pathFormat, gameRoot, animId, c); + const char *iconPath = TextFormat(pathFormat, gameRoot, game, animId, c); Texture tx1Up = LoadTexture(iconPath); da_append(&items->oneUpIcons, &tx1Up); @@ -122,19 +122,19 @@ LoadItemTextures(char *gameRoot, ItemMetaList *items, short numCharacters) ent->texture = items->oneUpIcons.elements[0]; } } else { - const char *animPath = TextFormat(pathFormat, gameRoot, items->animItemType, (i - 1) + numCharacters); + const char *animPath = TextFormat(pathFormat, gameRoot, game, items->animItemType, (i - 1) + numCharacters); ent->texture = LoadTexture(animPath); } } } void -LoadAllEntityTextures(char *gamePath, FileInfo *paths) +LoadAllEntityTextures(Game game, char *gamePath, FileInfo *paths) { - LoadCharacterTextures(gamePath, &paths->characters); - LoadInteractableTextures(gamePath, &paths->interactables); - LoadEntityTextures(gamePath, &paths->enemies); - LoadItemTextures(gamePath, &paths->items, paths->characters.count); - LoadRingTexture(gamePath, &paths->ring); + LoadCharacterTextures(game, gamePath, &paths->characters); + LoadInteractableTextures(game, gamePath, &paths->interactables); + LoadEntityTextures(game, gamePath, &paths->enemies); + LoadItemTextures(game, gamePath, &paths->items, paths->characters.count); + LoadRingTexture(game, gamePath, &paths->ring); } diff --git a/tools/BriBaSA_ex/src/texture.h b/tools/BriBaSA_ex/src/texture.h index 2908718137..beef6145fa 100644 --- a/tools/BriBaSA_ex/src/texture.h +++ b/tools/BriBaSA_ex/src/texture.h @@ -3,6 +3,6 @@ extern Texture2D GetEntityTextureById(AppState *state, EntityType etype, unsigned char id); -extern void LoadAllEntityTextures(char *gamePath, FileInfo *paths); +extern void LoadAllEntityTextures(Game game, char *gamePath, FileInfo *paths); #endif // GUARD_BRISABA_EX_TEXTURE_H