Add asset_cg_exists function

This commit is contained in:
Nunuhara Cabbage
2021-05-24 11:00:56 -07:00
parent 8eb91a235c
commit e78a208bbd
3 changed files with 11 additions and 1 deletions
+1
View File
@@ -42,6 +42,7 @@ struct archive_data *asset_get(enum asset_type type, int no);
// FIXME: CG code should be refactored to read from buffer only, not archive,
// then caller can just use asset_get and cg_load
struct cg *asset_cg_load(int no);
bool asset_cg_exists(int no);
bool asset_cg_get_metrics(int no, struct cg_metrics *metrics);
void asset_cg_index_init(void);
+9
View File
@@ -279,6 +279,15 @@ struct cg *asset_cg_load(int no)
return cg_load(archives[ASSET_CG], no - 1);
}
bool asset_cg_exists(int no)
{
if (!archives[ASSET_CG])
return false;
if (!(no = cg_translate_index(no)))
return false;
return true;
}
bool asset_cg_get_metrics(int no, struct cg_metrics *metrics)
{
if (!archives[ASSET_CG])
+1 -1
View File
@@ -688,7 +688,7 @@ int sact_Key_IsDown(int keycode)
int sact_CG_IsExist(int cg_no)
{
return asset_exists(ASSET_CG, cg_no - 1);
return asset_cg_exists(cg_no);
}
//int SACT2_CSV_Load(struct string *filename);